aboutsummaryrefslogtreecommitdiffstats
path: root/lsp/tsgo.lua
diff options
context:
space:
mode:
Diffstat (limited to 'lsp/tsgo.lua')
-rw-r--r--lsp/tsgo.lua9
1 files changed, 8 insertions, 1 deletions
diff --git a/lsp/tsgo.lua b/lsp/tsgo.lua
index d0394826..e51971dc 100644
--- a/lsp/tsgo.lua
+++ b/lsp/tsgo.lua
@@ -16,7 +16,14 @@
---@type vim.lsp.Config
return {
- cmd = { 'tsgo', '--lsp', '--stdio' },
+ cmd = function(dispatchers, config)
+ local cmd = 'tsgo'
+ local local_cmd = (config or {}).root_dir and config.root_dir .. '/node_modules/.bin/tsgo'
+ if local_cmd and vim.fn.executable(local_cmd) == 1 then
+ cmd = local_cmd
+ end
+ return vim.lsp.rpc.start({ cmd, '--lsp', '--stdio' }, dispatchers)
+ end,
filetypes = {
'javascript',
'javascriptreact',