Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Aug 12, 2023. It is now read-only.
This repository was archived by the owner on Aug 12, 2023. It is now read-only.

Incorrectly sets formatexpr #1131

@sQVe

Description

@sQVe

FAQ

  • I have checked the FAQ and it didn't resolve my problem.

Issues

  • I have checked existing issues and there are no issues with the same problem.

Neovim Version

NVIM v0.8.0-dev-1132-g37a71d1f28

Operating System

Arch Linux 5.19.10-arch1-1

Minimal config

-- this template is borrowed from nvim-lspconfig
local on_windows = vim.loop.os_uname().version:match("Windows")

local function join_paths(...)
local path_sep = on_windows and "\" or "/"
local result = table.concat({ ... }, path_sep)
return result
end

vim.g.loaded_remote_plugins = ""
vim.cmd([[set runtimepath=$VIMRUNTIME]])

local temp_dir = vim.loop.os_getenv("TEMP") or "/tmp"

vim.cmd("set packpath=" .. join_paths(temp_dir, "nvim", "site"))

local package_root = join_paths(temp_dir, "nvim", "site", "pack")
local install_path = join_paths(package_root, "packer", "start", "packer.nvim")
local compile_path = join_paths(install_path, "plugin", "packer_compiled.lua")

local null_ls_config = function()
local null_ls = require("null-ls")
-- add only what you need to reproduce your issue
null_ls.setup({
sources = {},
debug = true,
})
end

local function load_plugins()
-- only add other plugins if they are necessary to reproduce the issue
require("packer").startup({
{
"wbthomason/packer.nvim",
{
"jose-elias-alvarez/null-ls.nvim",
requires = { "nvim-lua/plenary.nvim" },
config = null_ls_config,
},
},
config = {
package_root = package_root,
compile_path = compile_path,
},
})
end

if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system({ "git", "clone", "https://github.com/wbthomason/packer.nvim", install_path })
load_plugins()
require("packer").sync()
else
load_plugins()
require("packer").sync()
end

Steps to reproduce

  • Use null-ls with the internal LSP.
  • Open a file that you haven't configured a server for, in my case markdown.
  • Run :lua =vim.bo.formatexpr

Expected behavior

It should be set to "".

Actual behavior

It is set to v:lua.vim.lsp.formatexpr()

Debug log

[TRACE Thu 22 Sep 2022 01:36:51 PM CEST] ...site/pack/packer/opt/null-ls.nvim/lua/null-ls/client.lua:110: starting null-ls client
[TRACE Thu 22 Sep 2022 01:36:51 PM CEST] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:123: received LSP request for method initialize
[TRACE Thu 22 Sep 2022 01:36:52 PM CEST] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:148: received LSP notification for method initialized
[TRACE Thu 22 Sep 2022 01:36:52 PM CEST] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:148: received LSP notification for method textDocument/didOpen
[TRACE Thu 22 Sep 2022 01:36:52 PM CEST] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS_ON_OPEN
[DEBUG Thu 22 Sep 2022 01:36:52 PM CEST] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:24: no generators available
[TRACE Thu 22 Sep 2022 01:36:53 PM CEST] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:123: received LSP request for method shutdown
[TRACE Thu 22 Sep 2022 01:36:53 PM CEST] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:148: received LSP notification for method exit
[TRACE Thu 22 Sep 2022 01:37:01 PM CEST] ...site/pack/packer/opt/null-ls.nvim/lua/null-ls/client.lua:110: starting null-ls client
[TRACE Thu 22 Sep 2022 01:37:01 PM CEST] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:123: received LSP request for method initialize
[DEBUG Thu 22 Sep 2022 01:37:01 PM CEST] ...site/pack/packer/opt/null-ls.nvim/lua/null-ls/client.lua:165: unable to notify client for method textDocument/didOpen (client not active): {
textDocument = {
uri = "file:///home/sqve/notes/todo.md"
}
}
[TRACE Thu 22 Sep 2022 01:37:01 PM CEST] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:148: received LSP notification for method initialized
[TRACE Thu 22 Sep 2022 01:37:01 PM CEST] ...im/site/pack/packer/opt/null-ls.nvim/lua/null-ls/rpc.lua:148: received LSP notification for method textDocument/didOpen
[TRACE Thu 22 Sep 2022 01:37:01 PM CEST] .../pack/packer/opt/null-ls.nvim/lua/null-ls/generators.lua:21: running generators for method NULL_LS_DIAGNOSTICS_ON_OPEN

Help

Yes, but I don't know how to start. I would need guidance

Implementation help

No response

Requirements

  • I have read and followed the instructions above and understand that my issue will be closed if I did not provide the required information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions