diff options
| author | kylo252 <[email protected]> | 2022-01-08 14:24:05 +0100 | 
|---|---|---|
| committer | GitHub <[email protected]> | 2022-01-08 14:24:05 +0100 | 
| commit | 4a66d4752d06cfe0452c55ee5f2b20f84d19c3bb (patch) | |
| tree | e5b55cda6903fa1712d0b3c63f701498150a9082 /lua/lvim/lsp | |
| parent | 6740afd743a05028cc48e8f1e203e7f81345aced (diff) | |
fix(null-ls): avoid sending invalid opts.args (#2154)
Diffstat (limited to 'lua/lvim/lsp')
| -rw-r--r-- | lua/lvim/lsp/config.lua | 1 | ||||
| -rw-r--r-- | lua/lvim/lsp/null-ls/services.lua | 26 | 
2 files changed, 16 insertions, 11 deletions
| 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 | 
