summaryrefslogtreecommitdiff
path: root/lua/lsp/null-ls.lua
diff options
context:
space:
mode:
authorkylo252 <[email protected]>2021-08-04 08:35:51 +0200
committerGitHub <[email protected]>2021-08-04 11:05:51 +0430
commit7cd03ff4e332e1427497b54d5ca8b037afbc0982 (patch)
tree36e5c3233b34df237f64e22a587df81d04b02e16 /lua/lsp/null-ls.lua
parent120590b8eca0d94d88272bf7a8db7c8cb7a0f530 (diff)
chore: minor cleanup to root_dir comments (#1222)
Diffstat (limited to 'lua/lsp/null-ls.lua')
-rw-r--r--lua/lsp/null-ls.lua10
1 files changed, 4 insertions, 6 deletions
diff --git a/lua/lsp/null-ls.lua b/lua/lsp/null-ls.lua
index 04e35976..27cd1f78 100644
--- a/lua/lsp/null-ls.lua
+++ b/lua/lsp/null-ls.lua
@@ -24,21 +24,19 @@ function M.get_registered_providers_by_filetype(ft)
end
local function validate_nodejs_provider(requests, provider)
- local root_dir = ""
+ local root_dir
if lvim.builtin.rooter.active then
- --- old logic to set root_dir
+ --- use vim-rooter to set root_dir
vim.cmd "let root_dir = FindRootDirectory()"
root_dir = vim.api.nvim_get_var "root_dir"
else
- --- new logic to set root_dir
+ --- use LSP to set root_dir
local ts_client = require("utils").get_active_client_by_ft "typescript"
- if ts_client then
- root_dir = ts_client.config.root_dir
- end
if ts_client == nil then
u.lvim_log "Unable to determine root directory since tsserver didn't start correctly"
return
end
+ root_dir = ts_client.config.root_dir
end
local local_nodejs_command = root_dir .. "/node_modules/.bin/" .. provider._opts.command
u.lvim_log(string.format("checking [%s] for local node module: [%s]", local_nodejs_command, vim.inspect(provider)))