summaryrefslogtreecommitdiff
path: root/lua/lsp/null-ls.lua
diff options
context:
space:
mode:
authorPasi Bergman <[email protected]>2021-07-29 16:03:03 +0300
committerGitHub <[email protected]>2021-07-29 17:33:03 +0430
commit3eaf6d461c896ba9fadaf63af0ecbe3769653fa2 (patch)
tree8d81af12b23c2f34e36f0bcb76fbad7f5225f445 /lua/lsp/null-ls.lua
parent7960a0e769d7981fef3d6a7c8191767cce4db109 (diff)
fix: Use null-ls eslint diagnostics config with eslint_d exe (#1159)
Diffstat (limited to 'lua/lsp/null-ls.lua')
-rw-r--r--lua/lsp/null-ls.lua12
1 files changed, 11 insertions, 1 deletions
diff --git a/lua/lsp/null-ls.lua b/lua/lsp/null-ls.lua
index a231698a..6a31de26 100644
--- a/lua/lsp/null-ls.lua
+++ b/lua/lsp/null-ls.lua
@@ -13,15 +13,25 @@ local find_local_exe = function(exe)
return local_exe
end
+-- https://github.com/jose-elias-alvarez/null-ls.nvim/blob/9b8458bd1648e84169a7e8638091ba15c2f20fc0/doc/BUILTINS.md#eslint
+local get_normalized_exe = function(exe, type)
+ if type == "diagnostics" and exe == "eslint_d" then
+ return "eslint"
+ end
+ return exe
+end
+
local function setup_ls(exe, type)
if utils.has_value(local_executables, exe) then
- local smart_executable = null_ls.builtins[type][exe]
+ local normalized_exe = get_normalized_exe(exe, type)
+ local smart_executable = null_ls.builtins[type][normalized_exe]
local local_executable = find_local_exe(exe)
if vim.fn.executable(local_executable) == 1 then
smart_executable._opts.command = local_executable
table.insert(sources, smart_executable)
else
if vim.fn.executable(exe) == 1 then
+ smart_executable._opts.command = exe
table.insert(sources, smart_executable)
end
end