summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorkylo252 <[email protected]>2022-01-08 14:24:05 +0100
committerGitHub <[email protected]>2022-01-08 14:24:05 +0100
commit4a66d4752d06cfe0452c55ee5f2b20f84d19c3bb (patch)
treee5b55cda6903fa1712d0b3c63f701498150a9082
parent6740afd743a05028cc48e8f1e203e7f81345aced (diff)
fix(null-ls): avoid sending invalid opts.args (#2154)
-rw-r--r--README.md8
-rw-r--r--lua/lvim/lsp/config.lua1
-rw-r--r--lua/lvim/lsp/null-ls/services.lua26
-rw-r--r--lua/lvim/plugins.lua23
-rw-r--r--utils/installer/config.example.lua35
5 files changed, 44 insertions, 49 deletions
diff --git a/README.md b/README.md
index 6de88398..97edf237 100644
--- a/README.md
+++ b/README.md
@@ -87,9 +87,9 @@ vim.list_extend(lvim.lsp.override, { "pyright" })
-- set a formatter, this will override the language server formatting capabilities (if it exists)
local formatters = require "lvim.lsp.null-ls.formatters"
formatters.setup {
- { exe = "black" },
+ { command = "black" },
{
- exe = "prettier",
+ command = "prettier",
---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports.
filetypes = { "typescript", "typescriptreact" },
},
@@ -98,9 +98,9 @@ formatters.setup {
-- set additional linters
local linters = require "lvim.lsp.null-ls.linters"
linters.setup {
- { exe = "black" },
+ { command = "black" },
{
- exe = "eslint_d",
+ command = "eslint_d",
---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports.
filetypes = { "javascript", "javascriptreact" },
},
diff --git a/lua/lvim/lsp/config.lua b/lua/lvim/lsp/config.lua
index 8c7a0dd9..64cf52f0 100644
--- a/lua/lvim/lsp/config.lua
+++ b/lua/lvim/lsp/config.lua
@@ -79,6 +79,7 @@ return {
"phpactor",
"pylsp",
"quick_lint_js",
+ "remark_ls",
"rome",
"solang",
"solidity_ls",
diff --git a/lua/lvim/lsp/null-ls/services.lua b/lua/lvim/lsp/null-ls/services.lua
index b8a8edc8..7dc0bb62 100644
--- a/lua/lvim/lsp/null-ls/services.lua
+++ b/lua/lvim/lsp/null-ls/services.lua
@@ -72,22 +72,26 @@ function M.register_sources(configs, method)
local name = config.name or cmd:gsub("-", "_")
local type = method == null_ls.methods.CODE_ACTION and "code_actions" or null_ls.methods[method]:lower()
local source = type and null_ls.builtins[type][name]
- Log:debug(string.format("Received request to register [%s] as a %s source", cmd, type))
+ Log:debug(string.format("Received request to register [%s] as a %s source", name, type))
if not source then
Log:error("Not a valid source: " .. name)
- elseif is_registered { command = cmd or name, method = method } then
- Log:trace "Skipping registering the source more than once"
+ elseif is_registered { name = source.name or name, method = method } then
+ Log:trace(string.format("Skipping registering [%s] more than once", name))
else
local command = M.find_command(source._opts.command) or source._opts.command
- local compat_opts = {
- command = command,
- -- treat `args` as `extra_args` for backwards compatibility. Can otherwise use `generator_opts.args`
- extra_args = config.args or config.extra_args,
- }
- local opts = vim.tbl_deep_extend("keep", compat_opts, config)
- Log:debug("Registering source: " .. source.name)
+
+ -- treat `args` as `extra_args` for backwards compatibility. Can otherwise use `generator_opts.args`
+ local compat_opts = vim.deepcopy(config)
+ if config.args then
+ compat_opts.extra_args = config.args or config.extra_args
+ compat_opts.args = nil
+ end
+
+ local opts = vim.tbl_deep_extend("keep", { command = command }, compat_opts)
+ Log:debug("Registering source " .. name)
+ Log:trace(vim.inspect(opts))
table.insert(sources, source.with(opts))
- vim.list_extend(registered_names, { name })
+ vim.list_extend(registered_names, { source.name })
end
end
diff --git a/lua/lvim/plugins.lua b/lua/lvim/plugins.lua
index f0bcf526..52ad1c01 100644
--- a/lua/lvim/plugins.lua
+++ b/lua/lvim/plugins.lua
@@ -6,22 +6,23 @@ local commit = {
cmp_path = "4d58224e315426e5ac4c5b218ca86cab85f80c79",
comment = "90df2f87c0b17193d073d1f72cea2e528e5b162d",
dapinstall = "dd09e9dd3a6e29f02ac171515b8a089fb82bb425",
+ dashboard_nvim = "d82ddae95fd4dc4c3b7bbe87f09b1840fbf20ecb",
fixcursorhold = "0e4e22d21975da60b0fd2d302285b3b603f9f71e",
friendly_snippets = "9f04462bcabfd108341a6e47ed742b09a6a5b975",
gitsigns = "c18fc65c77abf95ac2e7783b9e7455a7a2fab26c",
lua_dev = "03a44ec6a54b0a025a633978e8541584a02e46d9",
- lualine = "52725d2ca87c38e3cf479993afcbdd36e5c81a26",
+ lualine = "fd8fa5ddd823e15721ddec560ea61e7372e746a7",
luasnip = "ed0140696fa99ea072bc485c87d22a396c477db3",
- nlsp_settings = "90fbd2c736e5221427aa132fefd4d7f23e9114ee",
- null_ls = "b75effe6cb304e97901289f3f2e8d2ba77c7b752",
- nvim_autopairs = "96858723f1cba6a3eb004373a20c315d90584ea6",
- nvim_cmp = "1b94aacada96d2a33fef2ecf87748b27a2f50630",
- nvim_dap = "a6fa644f9de62c594a8a9cf6f2aaf324b5a6108b",
- nvim_lsp_installer = "3805f06d3e5b25996563fd9740a90014948bc31a",
- nvim_lspconfig = "c0310ab4c7ac864031bbf82b07809b36df54a9d2",
+ nlsp_settings = "97125eeb68a412f11885dffe5fdcc3a26d36c58d",
+ null_ls = "48ac5bcd4d766b371d91024d10c7c83fb909e388",
+ nvim_autopairs = "5348e4a778ebdf42126a54fb5a933a98612df6cb",
+ nvim_cmp = "9f6d2b42253dda8db950ab38795978e5420a93aa",
+ nvim_dap = "3f1514d020f9d73a458ac04f42d27e5b284c0e48",
+ nvim_lsp_installer = "2e81b1d86f90c8a05d7f875599818612bd68e1a7",
+ nvim_lspconfig = "c7081e00fa8100ee099c16e375f3e5e838cbf1db",
nvim_notify = "15f52efacd169ea26b0f4070451d3ea53f98cd5a",
nvim_tree = "0a2f6b0b6ba558a88c77a6b262af647760e6eca8",
- nvim_treesitter = "e81a60b6927521f7dc218ddb00e2c7fb6b1d797d",
+ nvim_treesitter = "a7c0c1764b0b583d0597108dd7d48bc5c0f98c81",
nvim_ts_context_commentstring = "097df33c9ef5bbd3828105e4bee99965b758dc3f",
nvim_web_devicons = "ac71ca88b1136e1ecb2aefef4948130f31aa40d1",
packer = "851c62c5ecd3b5adc91665feda8f977e104162a5",
@@ -29,9 +30,9 @@ local commit = {
popup = "b7404d35d5d3548a82149238289fa71f7f6de4ac",
project = "71d0e23dcfc43cfd6bb2a97dc5a7de1ab47a6538",
structlog = "6f1403a192791ff1fa7ac845a73de9e860f781f1",
- telescope = "a01ebd2793999c11d727fd15b1e5979ba20c7503",
+ telescope = "f06dd06bb1143caa779e492ca37e5f985f0c6157",
telescope_fzf_native = "b8662b076175e75e6497c59f3e2799b879d7b954",
- toggleterm = "ce92e485a9a731405393af2bd1aff5b49ba9eb73",
+ toggleterm = "463843d1ba0288eedaf834872c3eca114d45bddf",
which_key = "312c386ee0eafc925c27869d2be9c11ebdb807eb",
}
diff --git a/utils/installer/config.example.lua b/utils/installer/config.example.lua
index e3d9fa23..e209e7af 100644
--- a/utils/installer/config.example.lua
+++ b/utils/installer/config.example.lua
@@ -91,8 +91,8 @@ lvim.builtin.treesitter.highlight.enabled = true
-- local opts = {} -- check the lspconfig documentation for a list of all possible options
-- require("lvim.lsp.manager").setup("pylsp", opts)
--- you can set a custom on_attach function that will be used for all the language servers
--- See <https://github.com/neovim/nvim-lspconfig#keybindings-and-completion>
+-- -- you can set a custom on_attach function that will be used for all the language servers
+-- -- See <https://github.com/neovim/nvim-lspconfig#keybindings-and-completion>
-- lvim.lsp.on_attach_callback = function(client, bufnr)
-- local function buf_set_option(...)
-- vim.api.nvim_buf_set_option(bufnr, ...)
@@ -100,30 +100,18 @@ lvim.builtin.treesitter.highlight.enabled = true
-- --Enable completion triggered by <c-x><c-o>
-- buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
-- end
--- you can overwrite the null_ls setup table (useful for setting the root_dir function)
--- lvim.lsp.null_ls.setup.root_dir = require("lspconfig").util.root_pattern("Makefile", ".git", "node_modules")
--- or if you need something more advanced
--- lvim.lsp.null_ls.setup.root_dir = function(fname)
--- if vim.bo.filetype == "javascript" then
--- return require("lspconfig/util").root_pattern("Makefile", ".git", "node_modules")(fname)
--- or require("lspconfig/util").path.dirname(fname)
--- elseif vim.bo.filetype == "php" then
--- return require("lspconfig/util").root_pattern("Makefile", ".git", "composer.json")(fname) or vim.fn.getcwd()
--- else
--- return require("lspconfig/util").root_pattern("Makefile", ".git")(fname) or require("lspconfig/util").path.dirname(fname)
--- end
--- end
-- -- set a formatter, this will override the language server formatting capabilities (if it exists)
-- local formatters = require "lvim.lsp.null-ls.formatters"
-- formatters.setup {
--- { exe = "black", filetypes = { "python" } },
--- { exe = "isort", filetypes = { "python" } },
+-- { command = "black", filetypes = { "python" } },
+-- { command = "isort", filetypes = { "python" } },
-- {
--- exe = "prettier",
+-- -- each formatter accepts a list of options identical to https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#Configuration
+-- command = "prettier",
-- ---@usage arguments to pass to the formatter
-- -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}`
--- args = { "--print-with", "100" },
+-- extra_args = { "--print-with", "100" },
-- ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports.
-- filetypes = { "typescript", "typescriptreact" },
-- },
@@ -132,15 +120,16 @@ lvim.builtin.treesitter.highlight.enabled = true
-- -- set additional linters
-- local linters = require "lvim.lsp.null-ls.linters"
-- linters.setup {
--- { exe = "flake8", filetypes = { "python" } },
+-- { command = "flake8", filetypes = { "python" } },
-- {
--- exe = "shellcheck",
+-- -- each linter accepts a list of options identical to https://github.com/jose-elias-alvarez/null-ls.nvim/blob/main/doc/BUILTINS.md#Configuration
+-- command = "shellcheck",
-- ---@usage arguments to pass to the formatter
-- -- these cannot contain whitespaces, options such as `--line-width 80` become either `{'--line-width', '80'}` or `{'--line-width=80'}`
--- args = { "--severity", "warning" },
+-- extra_args = { "--severity", "warning" },
-- },
-- {
--- exe = "codespell",
+-- command = "codespell",
-- ---@usage specify which filetypes to enable. By default a providers will attach to all the filetypes it supports.
-- filetypes = { "javascript", "python" },
-- },