From 80fddd28de5fe0642da7adee955f5762b933e730 Mon Sep 17 00:00:00 2001 From: TuanHA <71129995+tuanha168@users.noreply.github.com> Date: Mon, 1 Aug 2022 20:08:05 +0700 Subject: fix(lua-language-server): cmd fails on Windows when using mason #2039 --- lua/lspconfig/server_configurations/sumneko_lua.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'lua') diff --git a/lua/lspconfig/server_configurations/sumneko_lua.lua b/lua/lspconfig/server_configurations/sumneko_lua.lua index 98d1dde2..aa932410 100644 --- a/lua/lspconfig/server_configurations/sumneko_lua.lua +++ b/lua/lspconfig/server_configurations/sumneko_lua.lua @@ -7,9 +7,17 @@ local root_files = { 'stylua.toml', 'selene.toml', } + +local bin_name = 'lua-language-server' +local cmd = { bin_name } + +if vim.fn.has 'win32' == 1 then + cmd = { 'cmd.exe', '/C', bin_name } +end + return { default_config = { - cmd = { 'lua-language-server' }, + cmd = cmd, filetypes = { 'lua' }, root_dir = function(fname) return util.root_pattern(unpack(root_files))(fname) or util.find_git_ancestor(fname) -- cgit v1.2.3-70-g09d2