diff options
Diffstat (limited to 'lsp/flow.lua')
| -rw-r--r-- | lsp/flow.lua | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/lsp/flow.lua b/lsp/flow.lua index 183606de..f526b94a 100644 --- a/lsp/flow.lua +++ b/lsp/flow.lua @@ -14,14 +14,18 @@ ---@type vim.lsp.Config return { - cmd = function(dispatchers) - local cmd = nil + cmd = function(dispatchers, config) + local cmd if vim.fn.executable('flow') == 1 then cmd = { 'flow', 'lsp' } else - cmd = { 'npx', '--no-install', 'flow', 'lsp' } + local flow_bin = (config or {}).root_dir and vim.fs.joinpath(config.root_dir, 'node_modules/.bin/flow') + if flow_bin and vim.fn.executable(flow_bin) == 1 then + cmd = { flow_bin, 'lsp' } + else + cmd = { 'npx', '--no-install', 'flow', 'lsp' } + end end - return vim.lsp.rpc.start(cmd, dispatchers) end, filetypes = { 'javascript', 'javascriptreact' }, |
