From a2719a8723e503f1be89d9b1c334846de405eb23 Mon Sep 17 00:00:00 2001 From: kylo252 <59826753+kylo252@users.noreply.github.com> Date: Wed, 1 Dec 2021 09:03:10 +0100 Subject: fix(npm): resolve the command correctly on windows --- lua/lspconfig/server_configurations/angularls.lua | 24 +++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'lua/lspconfig/server_configurations/angularls.lua') diff --git a/lua/lspconfig/server_configurations/angularls.lua b/lua/lspconfig/server_configurations/angularls.lua index 321c97cb..4d30de71 100644 --- a/lua/lspconfig/server_configurations/angularls.lua +++ b/lua/lspconfig/server_configurations/angularls.lua @@ -11,16 +11,24 @@ end local default_probe_dir = get_probe_dir(vim.fn.getcwd()) +local bin_name = 'ngserver' +local args = { + '--stdio', + '--tsProbeLocations', + default_probe_dir, + '--ngProbeLocations', + default_probe_dir, +} + +local cmd = { bin_name, unpack(args) } + +if vim.fn.has 'win32' == 1 then + cmd = { 'cmd.exe', '/C', bin_name, unpack(args) } +end + return { default_config = { - cmd = { - 'ngserver', - '--stdio', - '--tsProbeLocations', - default_probe_dir, - '--ngProbeLocations', - default_probe_dir, - }, + cmd = cmd, filetypes = { 'typescript', 'html', 'typescriptreact', 'typescript.tsx' }, -- Check for angular.json or .git first since that is the root of the project. -- Don't check for tsconfig.json or package.json since there are multiple of these -- cgit v1.2.3-70-g09d2