diff options
| -rw-r--r-- | lsp/flow.lua | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lsp/flow.lua b/lsp/flow.lua index 50568317..92743816 100644 --- a/lsp/flow.lua +++ b/lsp/flow.lua @@ -14,7 +14,16 @@ ---@type vim.lsp.Config return { - cmd = { 'npx', '--no-install', 'flow', 'lsp' }, + cmd = function(dispatchers) + local cmd = nil + if vim.fn.executable('flow') then + cmd = { 'flow', 'lsp' } + else + cmd = { 'npx', '--no-install', 'flow', 'lsp' } + end + + return vim.lsp.rpc.start(cmd, dispatchers) + end, filetypes = { 'javascript', 'javascriptreact', 'javascript.jsx' }, root_markers = { '.flowconfig' }, } |
