diff options
author | Abouzar Parvan <[email protected]> | 2021-08-01 14:27:15 +0430 |
---|---|---|
committer | GitHub <[email protected]> | 2021-08-01 09:57:15 +0000 |
commit | 30ad4b81f5dbccb6d49eb28ffdd33cefcb758ee5 (patch) | |
tree | a1b9784b7c3960bde6243e852ff624ea636460f8 /lua/lsp/null-ls.lua | |
parent | 326ac090453b302b35b5747ab9a66f86c70acfbe (diff) |
Hotfix/eslint d (#1198)
Diffstat (limited to 'lua/lsp/null-ls.lua')
-rw-r--r-- | lua/lsp/null-ls.lua | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/lua/lsp/null-ls.lua b/lua/lsp/null-ls.lua index 798c02ee..b8f9bfe6 100644 --- a/lua/lsp/null-ls.lua +++ b/lua/lsp/null-ls.lua @@ -34,18 +34,17 @@ end local function is_provider_found(provider) local retval = { is_local = false, path = nil } - if vim.fn.executable(provider._opts.command) == 1 then - return false, provider._opts.command - end if is_nodejs_provider(provider) then vim.cmd "let root_dir = FindRootDirectory()" local root_dir = vim.api.nvim_get_var "root_dir" local local_provider_command = root_dir .. "/node_modules/.bin/" .. provider._opts.command if vim.fn.executable(local_provider_command) == 1 then - retval.is_local = true - retval.path = local_provider_command + return true, local_provider_command end end + if vim.fn.executable(provider._opts.command) == 1 then + return false, provider._opts.command + end return retval.is_local, retval.path end @@ -78,23 +77,17 @@ function M.setup(filetype) -- builtin_diagnoser._opts.args = linter.args or builtin_diagnoser._opts.args -- builtin_diagnoser._opts.to_stdin = linter.stdin or builtin_diagnoser._opts.to_stdin -- NOTE: validate before inserting to table - if validate_provider(builtin_diagnoser) then - table.insert(M.requested_providers, builtin_diagnoser) - end -- special case: fallback to "eslint" -- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/9b8458bd1648e84169a7e8638091ba15c2f20fc0/doc/BUILTINS.md#eslint if linter.exe == "eslint_d" then - table.insert(M.requested_providers, null_ls.builtins.diagnostics.eslint.with { command = "eslint_d" }) + builtin_diagnoser = null_ls.builtins.diagnostics.eslint.with { command = "eslint_d" } + end + if validate_provider(builtin_diagnoser) then + table.insert(M.requested_providers, builtin_diagnoser) end u.lvim_log(string.format("Using linter provider: [%s]", linter.exe)) end - -- FIXME: why would we need to remove if we never add? - for idx, provider in pairs(M.requested_providers) do - if not validate_provider(provider) then - table.remove(M.requested_providers, idx) - end - end null_ls.register { sources = M.requested_providers } end |