diff options
author | christianchiarulli <[email protected]> | 2021-07-31 19:45:42 -0400 |
---|---|---|
committer | christianchiarulli <[email protected]> | 2021-07-31 19:45:42 -0400 |
commit | 8ee070833e17efede8b01c81ff9d8439ec52fdb8 (patch) | |
tree | 8db1ad6573f3ff6e80d823113a9b60cdf7888276 /lua/lsp/null-ls.lua | |
parent | 915603ed074bf5fe784b95508ad80a81eee24028 (diff) |
fix linter present when executable not found
Diffstat (limited to 'lua/lsp/null-ls.lua')
-rw-r--r-- | lua/lsp/null-ls.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lua/lsp/null-ls.lua b/lua/lsp/null-ls.lua index 1d9f1ec1..798c02ee 100644 --- a/lua/lsp/null-ls.lua +++ b/lua/lsp/null-ls.lua @@ -77,7 +77,10 @@ function M.setup(filetype) -- FIXME: why doesn't this work? -- builtin_diagnoser._opts.args = linter.args or builtin_diagnoser._opts.args -- builtin_diagnoser._opts.to_stdin = linter.stdin or builtin_diagnoser._opts.to_stdin - table.insert(M.requested_providers, builtin_diagnoser) + -- 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 @@ -86,6 +89,7 @@ function M.setup(filetype) 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) |