diff options
| author | Raphael <glepnir@neovim.pro> | 2023-05-09 15:10:14 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-05-09 15:10:14 +0800 |
| commit | 4a69ad6646eaad752901413c9a0dced73dfb562d (patch) | |
| tree | 271347f8f086c7e7e32eff5db954cd5152162935 | |
| parent | fix: check root already in workspace (#2590) (diff) | |
| download | nvim-lspconfig-4a69ad6646eaad752901413c9a0dced73dfb562d.tar nvim-lspconfig-4a69ad6646eaad752901413c9a0dced73dfb562d.tar.gz nvim-lspconfig-4a69ad6646eaad752901413c9a0dced73dfb562d.tar.bz2 nvim-lspconfig-4a69ad6646eaad752901413c9a0dced73dfb562d.tar.lz nvim-lspconfig-4a69ad6646eaad752901413c9a0dced73dfb562d.tar.xz nvim-lspconfig-4a69ad6646eaad752901413c9a0dced73dfb562d.tar.zst nvim-lspconfig-4a69ad6646eaad752901413c9a0dced73dfb562d.zip | |
fix: use exepath on server command (#2595)
79 files changed, 99 insertions, 626 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2d04b23f..a2b6c13c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -28,12 +28,7 @@ When choosing a server name, convert all dashes (`-`) to underscores (`_`) If th Note that Windows has a limitation when it comes to directly invoking a server that's installed by `npm` or `gem`, so it requires additional handling. ```lua -local bin_name = 'typescript-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end +cmd = { 'typescript-language-server', '--stdio' } ``` * `filetypes`: a list for filetypes a @@ -49,13 +44,6 @@ An example for adding a new language server is shown below for `pyright`, a pyth ```lua local util = require 'lspconfig.util' -local bin_name = 'pyright-langserver' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - local root_files = { 'pyproject.toml', 'setup.py', @@ -75,7 +63,7 @@ end return { default_config = { - cmd = cmd, + cmd = { 'pyright-langserver', '--stdio' }, filetypes = { 'python' }, root_dir = util.root_pattern(unpack(root_files)), single_file_support = true, diff --git a/lua/lspconfig/configs.lua b/lua/lspconfig/configs.lua index b10bd75d..c1d5e196 100644 --- a/lua/lspconfig/configs.lua +++ b/lua/lspconfig/configs.lua @@ -86,6 +86,14 @@ function configs.__newindex(t, config_name, config_def) local config = tbl_deep_extend('keep', user_config, default_config) + if config.cmd then + local original = config.cmd[1] + config.cmd[1] = vim.fn.exepath(config.cmd[1]) + if #config.cmd[1] == 0 then + config.cmd[1] = original + end + end + if util.on_setup then pcall(util.on_setup, config, user_config) end diff --git a/lua/lspconfig/server_configurations/angularls.lua b/lua/lspconfig/server_configurations/angularls.lua index 32507350..a720d440 100644 --- a/lua/lspconfig/server_configurations/angularls.lua +++ b/lua/lspconfig/server_configurations/angularls.lua @@ -11,24 +11,16 @@ 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 = cmd, + cmd = { + 'ngserver', + '--stdio', + '--tsProbeLocations', + default_probe_dir, + '--ngProbeLocations', + default_probe_dir, + }, filetypes = { 'typescript', 'html', 'typescriptreact', 'typescript.tsx' }, -- Check for angular.json since that is the root of the project. -- Don't check for tsconfig.json or package.json since there are multiple of these diff --git a/lua/lspconfig/server_configurations/ansiblels.lua b/lua/lspconfig/server_configurations/ansiblels.lua index f6ad2912..c221d821 100644 --- a/lua/lspconfig/server_configurations/ansiblels.lua +++ b/lua/lspconfig/server_configurations/ansiblels.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'ansible-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'ansible-language-server', '--stdio' }, settings = { ansible = { python = { diff --git a/lua/lspconfig/server_configurations/antlersls.lua b/lua/lspconfig/server_configurations/antlersls.lua index 28fa0d0c..ea4cf87e 100644 --- a/lua/lspconfig/server_configurations/antlersls.lua +++ b/lua/lspconfig/server_configurations/antlersls.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'antlersls' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'antlersls', '--stdio' }, filetypes = { 'html', 'antlers' }, root_dir = util.root_pattern 'composer.json', }, diff --git a/lua/lspconfig/server_configurations/astro.lua b/lua/lspconfig/server_configurations/astro.lua index b643e16d..40d60a6b 100644 --- a/lua/lspconfig/server_configurations/astro.lua +++ b/lua/lspconfig/server_configurations/astro.lua @@ -1,12 +1,5 @@ local util = require 'lspconfig.util' -local bin_name = 'astro-ls' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - local function get_typescript_server_path(root_dir) local project_root = util.find_node_modules_ancestor(root_dir) return project_root and (util.path.join(project_root, 'node_modules', 'typescript', 'lib', 'tsserverlibrary.js')) @@ -15,7 +8,7 @@ end return { default_config = { - cmd = cmd, + cmd = { 'astro-ls', '--stdio' }, filetypes = { 'astro' }, root_dir = util.root_pattern('package.json', 'tsconfig.json', 'jsconfig.json', '.git'), init_options = { diff --git a/lua/lspconfig/server_configurations/azure_pipelines_ls.lua b/lua/lspconfig/server_configurations/azure_pipelines_ls.lua index f61c0dbe..3e2fe940 100644 --- a/lua/lspconfig/server_configurations/azure_pipelines_ls.lua +++ b/lua/lspconfig/server_configurations/azure_pipelines_ls.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'azure-pipelines-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'azure-pipelines-language-server', '--stdio' }, filetypes = { 'yaml' }, root_dir = util.root_pattern 'azure-pipelines.yml', single_file_support = true, diff --git a/lua/lspconfig/server_configurations/bashls.lua b/lua/lspconfig/server_configurations/bashls.lua index eb190c3a..768fe7dd 100644 --- a/lua/lspconfig/server_configurations/bashls.lua +++ b/lua/lspconfig/server_configurations/bashls.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'bash-language-server' -local cmd = { bin_name, 'start' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, 'start' } -end - return { default_config = { - cmd = cmd, + cmd = { 'bash-language-server', 'start' }, settings = { bashIde = { -- Glob pattern for finding and parsing shell script files in the workspace. diff --git a/lua/lspconfig/server_configurations/blueprint_ls.lua b/lua/lspconfig/server_configurations/blueprint_ls.lua index 3334795e..db2e50c9 100644 --- a/lua/lspconfig/server_configurations/blueprint_ls.lua +++ b/lua/lspconfig/server_configurations/blueprint_ls.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'blueprint-compiler' -local cmd = { bin_name, 'lsp' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, 'start' } -end - return { default_config = { - cmd = cmd, + cmd = { 'blueprint-compiler', vim.fn.has 'win32' and 'start' or 'lsp' }, cmd_env = { -- Prevent recursive scanning which will cause issues when opening a file -- directly in the home directory (e.g. ~/foo.sh). diff --git a/lua/lspconfig/server_configurations/bright_script.lua b/lua/lspconfig/server_configurations/bright_script.lua index 4d58968b..6d4ba823 100644 --- a/lua/lspconfig/server_configurations/bright_script.lua +++ b/lua/lspconfig/server_configurations/bright_script.lua @@ -1,14 +1,8 @@ -local bin_name = 'bsc' -local cmd = { bin_name, '--lsp', '--stdio' } local util = require 'lspconfig/util' -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'bsc', '--lsp', '--stdio' }, filetypes = { 'brs' }, single_file_support = true, root_dir = util.root_pattern('makefile', 'Makefile', '.git'), diff --git a/lua/lspconfig/server_configurations/buck2.lua b/lua/lspconfig/server_configurations/buck2.lua index 23c0d307..134a5627 100644 --- a/lua/lspconfig/server_configurations/buck2.lua +++ b/lua/lspconfig/server_configurations/buck2.lua @@ -1,13 +1,8 @@ local util = require 'lspconfig.util' -local cmd = { 'buck2', 'lsp' } -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', 'buck2', 'lsp' } -end - return { default_config = { - cmd = cmd, + cmd = { 'buck2', 'lsp' }, filetypes = { 'bzl' }, root_dir = function(fname) return util.root_pattern '.buckconfig'(fname) diff --git a/lua/lspconfig/server_configurations/bufls.lua b/lua/lspconfig/server_configurations/bufls.lua index ed705341..ba12ddb6 100644 --- a/lua/lspconfig/server_configurations/bufls.lua +++ b/lua/lspconfig/server_configurations/bufls.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'bufls' -local cmd = { bin_name, 'serve' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, 'serve' } -end - return { default_config = { - cmd = cmd, + cmd = { 'bufls', 'serve' }, filetypes = { 'proto' }, root_dir = function(fname) return util.root_pattern('buf.work.yaml', '.git')(fname) diff --git a/lua/lspconfig/server_configurations/cadence.lua b/lua/lspconfig/server_configurations/cadence.lua index d9b36cd0..640fe5aa 100644 --- a/lua/lspconfig/server_configurations/cadence.lua +++ b/lua/lspconfig/server_configurations/cadence.lua @@ -1,25 +1,17 @@ local util = require 'lspconfig.util' -local config_name = 'flow.json' -local bin_name = 'flow' -local cmd = { 'flow', 'cadence', 'language-server' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, 'cadence', 'language-server' } -end - return { default_config = { - cmd = cmd, + cmd = { 'flow', 'cadence', 'language-server' }, filetypes = { 'cdc' }, init_options = { numberOfAccounts = '1', }, root_dir = function(fname, _) - return util.root_pattern(config_name)(fname) or vim.env.HOME + return util.root_pattern 'flow.json'(fname) or vim.env.HOME end, on_new_config = function(new_config, new_root_dir) - new_config.init_options.configPath = util.path.join(new_root_dir, config_name) + new_config.init_options.configPath = util.path.join(new_root_dir, 'flow.json') end, }, docs = { diff --git a/lua/lspconfig/server_configurations/coffeesense.lua b/lua/lspconfig/server_configurations/coffeesense.lua index 228ea093..f5b75a86 100644 --- a/lua/lspconfig/server_configurations/coffeesense.lua +++ b/lua/lspconfig/server_configurations/coffeesense.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'coffeesense-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'coffeesense-language-server', '--stdio' }, filetypes = { 'coffee' }, root_dir = util.root_pattern 'package.json', single_file_support = true, diff --git a/lua/lspconfig/server_configurations/cssls.lua b/lua/lspconfig/server_configurations/cssls.lua index 41c38e6a..b1a1d29e 100644 --- a/lua/lspconfig/server_configurations/cssls.lua +++ b/lua/lspconfig/server_configurations/cssls.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'vscode-css-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'vscode-css-language-server', '--stdio' }, filetypes = { 'css', 'scss', 'less' }, root_dir = util.root_pattern('package.json', '.git'), single_file_support = true, diff --git a/lua/lspconfig/server_configurations/cssmodules_ls.lua b/lua/lspconfig/server_configurations/cssmodules_ls.lua index 3107b75d..d7f5e3d0 100644 --- a/lua/lspconfig/server_configurations/cssmodules_ls.lua +++ b/lua/lspconfig/server_configurations/cssmodules_ls.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'cssmodules-language-server' -local cmd = { bin_name } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name } -end - return { default_config = { - cmd = cmd, + cmd = { 'cssmodules-language-server' }, filetypes = { 'javascript', 'javascriptreact', 'typescript', 'typescriptreact' }, root_dir = util.find_package_json_ancestor, }, diff --git a/lua/lspconfig/server_configurations/cucumber_language_server.lua b/lua/lspconfig/server_configurations/cucumber_language_server.lua index 07832061..1fb4b8a0 100644 --- a/lua/lspconfig/server_configurations/cucumber_language_server.lua +++ b/lua/lspconfig/server_configurations/cucumber_language_server.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'cucumber-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'cucumber-language-server', '--stdio' }, filetypes = { 'cucumber' }, root_dir = util.find_git_ancestor, }, diff --git a/lua/lspconfig/server_configurations/custom_elements_ls.lua b/lua/lspconfig/server_configurations/custom_elements_ls.lua index 31b9ae82..61e51a6a 100644 --- a/lua/lspconfig/server_configurations/custom_elements_ls.lua +++ b/lua/lspconfig/server_configurations/custom_elements_ls.lua @@ -1,16 +1,9 @@ local util = require 'lspconfig.util' -local bin_name = 'custom-elements-languageserver' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { init_options = { hostInfo = 'neovim' }, - cmd = cmd, + cmd = { 'custom-elements-languageserver', '--stdio' }, filetypes = { 'javascript', 'javascriptreact', diff --git a/lua/lspconfig/server_configurations/dartls.lua b/lua/lspconfig/server_configurations/dartls.lua index c6facded..83eda99f 100644 --- a/lua/lspconfig/server_configurations/dartls.lua +++ b/lua/lspconfig/server_configurations/dartls.lua @@ -1,13 +1,8 @@ local util = require 'lspconfig.util' -local cmd = ( - vim.fn.has 'win32' == 1 and { 'cmd.exe', '/C', 'dart', 'language-server', '--protocol=lsp' } - or { 'dart', 'language-server', '--protocol=lsp' } -) - return { default_config = { - cmd = cmd, + cmd = { 'dart', 'language-server', '--protocol=lsp' }, filetypes = { 'dart' }, root_dir = util.root_pattern 'pubspec.yaml', init_options = { diff --git a/lua/lspconfig/server_configurations/diagnosticls.lua b/lua/lspconfig/server_configurations/diagnosticls.lua index 8f0476b6..6fdba0fc 100644 --- a/lua/lspconfig/server_configurations/diagnosticls.lua +++ b/lua/lspconfig/server_configurations/diagnosticls.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'diagnostic-languageserver' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'diagnostic-languageserver', '--stdio' }, root_dir = util.find_git_ancestor, single_file_support = true, filetypes = {}, diff --git a/lua/lspconfig/server_configurations/digestif.lua b/lua/lspconfig/server_configurations/digestif.lua index 506348b7..f89ba63d 100644 --- a/lua/lspconfig/server_configurations/digestif.lua +++ b/lua/lspconfig/server_configurations/digestif.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'digestif' -local cmd = { bin_name } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name } -end - return { default_config = { - cmd = cmd, + cmd = { 'digestif' }, filetypes = { 'tex', 'plaintex', 'context' }, root_dir = util.find_git_ancestor, single_file_support = true, diff --git a/lua/lspconfig/server_configurations/docker_compose_language_service.lua b/lua/lspconfig/server_configurations/docker_compose_language_service.lua index 18b35fc2..9ff7ec5a 100644 --- a/lua/lspconfig/server_configurations/docker_compose_language_service.lua +++ b/lua/lspconfig/server_configurations/docker_compose_language_service.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'docker-compose-langserver' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'docker-compose-langserver', '--stdio' }, filetypes = { 'yaml' }, root_dir = util.root_pattern 'docker-compose.yaml', single_file_support = true, diff --git a/lua/lspconfig/server_configurations/dockerls.lua b/lua/lspconfig/server_configurations/dockerls.lua index 6d1cfc7d..97376ea7 100644 --- a/lua/lspconfig/server_configurations/dockerls.lua +++ b/lua/lspconfig/server_configurations/dockerls.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'docker-langserver' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'docker-langserver', '--stdio' }, filetypes = { 'dockerfile' }, root_dir = util.root_pattern 'Dockerfile', single_file_support = true, diff --git a/lua/lspconfig/server_configurations/dolmenls.lua b/lua/lspconfig/server_configurations/dolmenls.lua index 36ac87af..1f0657e1 100644 --- a/lua/lspconfig/server_configurations/dolmenls.lua +++ b/lua/lspconfig/server_configurations/dolmenls.lua @@ -1,14 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'dolmenls' -local cmd = { bin_name } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name } -end return { default_config = { - cmd = cmd, + cmd = { 'dolmenls' }, filetypes = { 'smt2', 'tptp', 'p', 'cnf', 'icnf', 'zf' }, root_dir = util.find_git_ancestor, single_file_support = true, diff --git a/lua/lspconfig/server_configurations/dotls.lua b/lua/lspconfig/server_configurations/dotls.lua index dff14b9c..479f4306 100644 --- a/lua/lspconfig/server_configurations/dotls.lua +++ b/lua/lspconfig/server_configurations/dotls.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'dot-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'dot-language-server', '--stdio' }, filetypes = { 'dot' }, root_dir = util.find_git_ancestor, single_file_support = true, diff --git a/lua/lspconfig/server_configurations/ecsact.lua b/lua/lspconfig/server_configurations/ecsact.lua index 26ff913e..e8eaa984 100644 --- a/lua/lspconfig/server_configurations/ecsact.lua +++ b/lua/lspconfig/server_configurations/ecsact.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'ecsact_lsp_server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'ecsact_lsp_server', '--stdio' }, filetypes = { 'ecsact' }, root_dir = util.root_pattern '.git', single_file_support = true, diff --git a/lua/lspconfig/server_configurations/elmls.lua b/lua/lspconfig/server_configurations/elmls.lua index 2718c88c..bd2caccc 100644 --- a/lua/lspconfig/server_configurations/elmls.lua +++ b/lua/lspconfig/server_configurations/elmls.lua @@ -2,20 +2,13 @@ local util = require 'lspconfig.util' local lsp = vim.lsp local api = vim.api -local bin_name = 'elm-language-server' -local cmd = { bin_name } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name } -end - local default_capabilities = lsp.protocol.make_client_capabilities() default_capabilities.offsetEncoding = { 'utf-8', 'utf-16' } local elm_root_pattern = util.root_pattern 'elm.json' return { default_config = { - cmd = cmd, + cmd = { 'elm-language-server' }, -- TODO(ashkan) if we comment this out, it will allow elmls to operate on elm.json. It seems like it could do that, but no other editor allows it right now. filetypes = { 'elm' }, root_dir = function(fname) diff --git a/lua/lspconfig/server_configurations/ember.lua b/lua/lspconfig/server_configurations/ember.lua index e6ce1eae..98d01ad1 100644 --- a/lua/lspconfig/server_configurations/ember.lua +++ b/lua/lspconfig/server_configurations/ember.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'ember-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'ember-language-server', '--stdio' }, filetypes = { 'handlebars', 'typescript', 'javascript' }, root_dir = util.root_pattern('ember-cli-build.js', '.git'), }, diff --git a/lua/lspconfig/server_configurations/emmet_ls.lua b/lua/lspconfig/server_configurations/emmet_ls.lua index ef334388..171bd560 100644 --- a/lua/lspconfig/server_configurations/emmet_ls.lua +++ b/lua/lspconfig/server_configurations/emmet_ls.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'emmet-ls' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'emmet-ls', '--stdio' }, filetypes = { 'astro', 'css', diff --git a/lua/lspconfig/server_configurations/erlangls.lua b/lua/lspconfig/server_configurations/erlangls.lua index cec19284..e2467f21 100644 --- a/lua/lspconfig/server_configurations/erlangls.lua +++ b/lua/lspconfig/server_configurations/erlangls.lua @@ -1,13 +1,8 @@ local util = require 'lspconfig.util' -local cmd = { 'erlang_ls' } -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', 'erlang_ls.cmd' } -end - return { default_config = { - cmd = cmd, + cmd = { 'erlang_ls' }, filetypes = { 'erlang' }, root_dir = util.root_pattern('rebar.config', 'erlang.mk', '.git'), single_file_support = true, diff --git a/lua/lspconfig/server_configurations/eslint.lua b/lua/lspconfig/server_configurations/eslint.lua index c3b2d746..000c3a84 100644 --- a/lua/lspconfig/server_configurations/eslint.lua +++ b/lua/lspconfig/server_configurations/eslint.lua @@ -32,13 +32,6 @@ local function fix_all(opts) }) end -local bin_name = 'vscode-eslint-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - local root_file = { '.eslintrc', '.eslintrc.js', @@ -51,7 +44,7 @@ local root_file = { return { default_config = { - cmd = cmd, + cmd = { 'vscode-eslint-language-server', '--stdio' }, filetypes = { 'javascript', 'javascriptreact', @@ -116,7 +109,7 @@ return { local pnp_cjs = util.path.join(new_root_dir, '.pnp.cjs') local pnp_js = util.path.join(new_root_dir, '.pnp.js') if util.path.exists(pnp_cjs) or util.path.exists(pnp_js) then - config.cmd = vim.list_extend({ 'yarn', 'exec' }, cmd) + config.cmd = vim.list_extend({ 'yarn', 'exec' }, config.cmd) end end, handlers = { diff --git a/lua/lspconfig/server_configurations/fennel_language_server.lua b/lua/lspconfig/server_configurations/fennel_language_server.lua index a26e7702..919b544b 100644 --- a/lua/lspconfig/server_configurations/fennel_language_server.lua +++ b/lua/lspconfig/server_configurations/fennel_language_server.lua @@ -1,14 +1,8 @@ local util = require 'lspconfig.util' -local cmd = { 'fennel-language-server' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', 'fennel-language-server' } -end - return { default_config = { - cmd = cmd, + cmd = { 'fennel-language-server' }, filetypes = { 'fennel' }, single_file_support = true, root_dir = util.find_git_ancestor, diff --git a/lua/lspconfig/server_configurations/foam_ls.lua b/lua/lspconfig/server_configurations/foam_ls.lua index 1f0d7fc8..1a991b61 100644 --- a/lua/lspconfig/server_configurations/foam_ls.lua +++ b/lua/lspconfig/server_configurations/foam_ls.lua @@ -1,14 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'foam-ls' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end return { default_config = { - cmd = cmd, + cmd = { 'foam-ls', '--stdio' }, filetypes = { 'foam', 'OpenFOAM' }, root_dir = function(fname) return util.search_ancestors(fname, function(path) diff --git a/lua/lspconfig/server_configurations/futhark_lsp.lua b/lua/lspconfig/server_configurations/futhark_lsp.lua index f627bfe4..2521cc1b 100644 --- a/lua/lspconfig/server_configurations/futhark_lsp.lua +++ b/lua/lspconfig/server_configurations/futhark_lsp.lua @@ -1,14 +1,8 @@ local util = require 'lspconfig.util' -local cmd = { 'futhark', 'lsp' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', 'futhark', 'lsp' } -end - return { default_config = { - cmd = cmd, + cmd = { 'futhark', 'lsp' }, filetypes = { 'futhark', 'fut' }, root_dir = util.find_git_ancestor, single_file_support = true, diff --git a/lua/lspconfig/server_configurations/glint.lua b/lua/lspconfig/server_configurations/glint.lua index 9c131d2f..1d991cff 100644 --- a/lua/lspconfig/server_configurations/glint.lua +++ b/lua/lspconfig/server_configurations/glint.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'glint-language-server' -local cmd = { bin_name } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name } -end - return { default_config = { - cmd = cmd, + cmd = { 'glint-language-server' }, on_new_config = function(config, new_root_dir) local project_root = util.find_node_modules_ancestor(new_root_dir) -- Glint should not be installed globally. diff --git a/lua/lspconfig/server_configurations/grammarly.lua b/lua/lspconfig/server_configurations/grammarly.lua index 2ab47e18..6b37a148 100644 --- a/lua/lspconfig/server_configurations/grammarly.lua +++ b/lua/lspconfig/server_configurations/grammarly.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'grammarly-languageserver' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'grammarly-languageserver', '--stdio' }, filetypes = { 'markdown' }, root_dir = util.find_git_ancestor, single_file_support = true, diff --git a/lua/lspconfig/server_configurations/graphql.lua b/lua/lspconfig/server_configurations/graphql.lua index ab5b2fda..fa1e8715 100644 --- a/lua/lspconfig/server_configurations/graphql.lua +++ b/lua/lspconfig/server_configurations/graphql.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'graphql-lsp' -local cmd = { bin_name, 'server', '-m', 'stream' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, 'server', '-m', 'stream' } -end - return { default_config = { - cmd = cmd, + cmd = { 'graphql-lsp', 'server', '-m', 'stream' }, filetypes = { 'graphql', 'typescriptreact', 'javascriptreact' }, root_dir = util.root_pattern('.graphqlrc*', '.graphql.config.*', 'graphql.config.*'), }, diff --git a/lua/lspconfig/server_configurations/helm_ls.lua b/lua/lspconfig/server_configurations/helm_ls.lua index b5bdbbd6..c41e6283 100644 --- a/lua/lspconfig/server_configurations/helm_ls.lua +++ b/lua/lspconfig/server_configurations/helm_ls.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'helm_ls' -local cmd = { bin_name, 'serve' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', unpack(cmd) } -end - return { default_config = { - cmd = cmd, + cmd = { 'helm_ls', 'serve' }, filetypes = { 'helm' }, root_dir = util.root_pattern 'Chart.yaml', single_file_support = true, diff --git a/lua/lspconfig/server_configurations/hoon_ls.lua b/lua/lspconfig/server_configurations/hoon_ls.lua index 80092db1..1a9240b3 100644 --- a/lua/lspconfig/server_configurations/hoon_ls.lua +++ b/lua/lspconfig/server_configurations/hoon_ls.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'hoon-language-server' -local cmd = { bin_name } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name } -end - return { default_config = { - cmd = cmd, + cmd = { 'hoon-language-server' }, filetypes = { 'hoon' }, root_dir = util.find_git_ancestor, single_file_support = true, diff --git a/lua/lspconfig/server_configurations/html.lua b/lua/lspconfig/server_configurations/html.lua index 2f8214f4..e432e2c8 100644 --- a/lua/lspconfig/server_configurations/html.lua +++ b/lua/lspconfig/server_configurations/html.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'vscode-html-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'vscode-html-language-server', '--stdio' }, filetypes = { 'html' }, root_dir = util.root_pattern('package.json', '.git'), single_file_support = true, diff --git a/lua/lspconfig/server_configurations/intelephense.lua b/lua/lspconfig/server_configurations/intelephense.lua index c9e35b9d..2b9ad0fe 100644 --- a/lua/lspconfig/server_configurations/intelephense.lua +++ b/lua/lspconfig/server_configurations/intelephense.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'intelephense' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'intelephense', '--stdio' }, filetypes = { 'php' }, root_dir = function(pattern) local cwd = vim.loop.cwd() diff --git a/lua/lspconfig/server_configurations/jsonls.lua b/lua/lspconfig/server_configurations/jsonls.lua index a62a715d..b6299599 100644 --- a/lua/lspconfig/server_configurations/jsonls.lua +++ b/lua/lspconfig/server_configurations/jsonls.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'vscode-json-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'vscode-json-language-server', '--stdio' }, filetypes = { 'json', 'jsonc' }, init_options = { provideFormatter = true, diff --git a/lua/lspconfig/server_configurations/lean3ls.lua b/lua/lspconfig/server_configurations/lean3ls.lua index b35a6932..ebcec10d 100644 --- a/lua/lspconfig/server_configurations/lean3ls.lua +++ b/lua/lspconfig/server_configurations/lean3ls.lua @@ -1,16 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'lean-language-server' -local args = { '--stdio', '--', '-M', '4096', '-T', '100000' } -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 = cmd, + cmd = { 'lean-language-server', '--stdio', '--', '-M', '4096', '-T', '100000' }, filetypes = { 'lean3' }, offset_encoding = 'utf-32', root_dir = function(fname) diff --git a/lua/lspconfig/server_configurations/lua_ls.lua b/lua/lspconfig/server_configurations/lua_ls.lua index 7ab54cf8..acb57318 100644 --- a/lua/lspconfig/server_configurations/lua_ls.lua +++ b/lua/lspconfig/server_configurations/lua_ls.lua @@ -10,16 +10,9 @@ local root_files = { 'selene.yml', } -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 = cmd, + cmd = { 'lua-language-server' }, filetypes = { 'lua' }, root_dir = function(fname) local root = util.root_pattern(unpack(root_files))(fname) diff --git a/lua/lspconfig/server_configurations/m68k.lua b/lua/lspconfig/server_configurations/m68k.lua index 9e96d847..053d4420 100644 --- a/lua/lspconfig/server_configurations/m68k.lua +++ b/lua/lspconfig/server_configurations/m68k.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'm68k-lsp-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'm68k-lsp-server', '--stdio' }, filetypes = { 'asm68k' }, root_dir = util.root_pattern('Makefile', '.git'), single_file_support = true, diff --git a/lua/lspconfig/server_configurations/nim_langserver.lua b/lua/lspconfig/server_configurations/nim_langserver.lua index 3a9877b3..f3c48273 100644 --- a/lua/lspconfig/server_configurations/nim_langserver.lua +++ b/lua/lspconfig/server_configurations/nim_langserver.lua @@ -1,14 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'nimlangserver' -local cmd = { bin_name } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name } -end return { default_config = { - cmd = cmd, + cmd = { 'nimlangserver' }, filetypes = { 'nim' }, root_dir = function(fname) return util.root_pattern '*.nimble'(fname) or util.find_git_ancestor(fname) diff --git a/lua/lspconfig/server_configurations/nimls.lua b/lua/lspconfig/server_configurations/nimls.lua index 82540afa..3c1aeb2b 100644 --- a/lua/lspconfig/server_configurations/nimls.lua +++ b/lua/lspconfig/server_configurations/nimls.lua @@ -1,14 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'nimlsp' -local cmd = { bin_name } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name } -end return { default_config = { - cmd = cmd, + cmd = { 'nimlsp' }, filetypes = { 'nim' }, root_dir = function(fname) return util.root_pattern '*.nimble'(fname) or util.find_git_ancestor(fname) diff --git a/lua/lspconfig/server_configurations/nxls.lua b/lua/lspconfig/server_configurations/nxls.lua index 7c4517ed..e3d38743 100644 --- a/lua/lspconfig/server_configurations/nxls.lua +++ b/lua/lspconfig/server_configurations/nxls.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'nxls' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'nxls', '--stdio' }, filetypes = { 'json', 'jsonc' }, root_dir = util.root_pattern('nx.json', '.git'), }, diff --git a/lua/lspconfig/server_configurations/ocamlls.lua b/lua/lspconfig/server_configurations/ocamlls.lua index fcc25dbc..8526f3e2 100644 --- a/lua/lspconfig/server_configurations/ocamlls.lua +++ b/lua/lspconfig/server_configurations/ocamlls.lua @@ -1,14 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'ocaml-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end return { default_config = { - cmd = cmd, + cmd = { 'ocaml-language-server', '--stdio' }, filetypes = { 'ocaml', 'reason' }, root_dir = util.root_pattern('*.opam', 'esy.json', 'package.json'), }, diff --git a/lua/lspconfig/server_configurations/pact_ls.lua b/lua/lspconfig/server_configurations/pact_ls.lua index ad3745b7..1eb89769 100644 --- a/lua/lspconfig/server_configurations/pact_ls.lua +++ b/lua/lspconfig/server_configurations/pact_ls.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'pact-lsp' -local cmd = { bin_name } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name } -end - return { default_config = { - cmd = cmd, + cmd = { 'pact-lsp' }, filetypes = { 'pact' }, root_dir = util.find_git_ancestor, single_file_support = true, diff --git a/lua/lspconfig/server_configurations/prismals.lua b/lua/lspconfig/server_configurations/prismals.lua index f330e253..16d252e8 100644 --- a/lua/lspconfig/server_configurations/prismals.lua +++ b/lua/lspconfig/server_configurations/prismals.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'prisma-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'prisma-language-server', '--stdio' }, filetypes = { 'prisma' }, settings = { prisma = { diff --git a/lua/lspconfig/server_configurations/purescriptls.lua b/lua/lspconfig/server_configurations/purescriptls.lua index 7010d57d..a7913ccf 100644 --- a/lua/lspconfig/server_configurations/purescriptls.lua +++ b/lua/lspconfig/server_configurations/purescriptls.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'purescript-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'purescript-language-server', '--stdio' }, filetypes = { 'purescript' }, root_dir = util.root_pattern('bower.json', 'psc-package.json', 'spago.dhall', 'flake.nix', 'shell.nix'), }, diff --git a/lua/lspconfig/server_configurations/pylyzer.lua b/lua/lspconfig/server_configurations/pylyzer.lua index 5b90d494..99e4e23a 100644 --- a/lua/lspconfig/server_configurations/pylyzer.lua +++ b/lua/lspconfig/server_configurations/pylyzer.lua @@ -1,15 +1,8 @@ local util = require('lspconfig').util -local bin_name = 'pylyzer' -local cmd = { bin_name, '--server' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--server' } -end - return { default_config = { - cmd = cmd, + cmd = { 'pylyzer', '--server' }, filetypes = { 'python' }, root_dir = function(fname) local root_files = { diff --git a/lua/lspconfig/server_configurations/pyright.lua b/lua/lspconfig/server_configurations/pyright.lua index 1bd3dbb6..4ce79a81 100644 --- a/lua/lspconfig/server_configurations/pyright.lua +++ b/lua/lspconfig/server_configurations/pyright.lua @@ -1,12 +1,5 @@ local util = require 'lspconfig.util' -local bin_name = 'pyright-langserver' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - local root_files = { 'pyproject.toml', 'setup.py', @@ -37,7 +30,7 @@ end return { default_config = { - cmd = cmd, + cmd = { 'pyright-langserver', '--stdio' }, filetypes = { 'python' }, root_dir = util.root_pattern(unpack(root_files)), single_file_support = true, diff --git a/lua/lspconfig/server_configurations/relay_lsp.lua b/lua/lspconfig/server_configurations/relay_lsp.lua index 7b849293..acaa617a 100644 --- a/lua/lspconfig/server_configurations/relay_lsp.lua +++ b/lua/lspconfig/server_configurations/relay_lsp.lua @@ -1,13 +1,6 @@ local util = require 'lspconfig.util' local log = require 'vim.lsp.log' -local bin_name = 'relay-compiler' -local cmd = { bin_name, 'lsp' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, 'lsp' } -end - return { default_config = { -- (default: false) Whether or not we should automatically start the @@ -19,7 +12,7 @@ return { -- helpful if your relay project is in a nested directory. path_to_config = nil, - cmd = cmd, + cmd = { 'relay-compiler', 'lsp' }, filetypes = { 'javascript', 'javascriptreact', @@ -32,7 +25,7 @@ return { on_new_config = function(config, root_dir) local project_root = util.find_node_modules_ancestor(root_dir) local node_bin_path = util.path.join(project_root, 'node_modules', '.bin') - local compiler_cmd = { util.path.join(node_bin_path, bin_name), '--watch' } + local compiler_cmd = { util.path.join(node_bin_path, 'relay-compiler'), '--watch' } local path = node_bin_path .. util.path.path_separator .. vim.env.PATH if config.cmd_env then config.cmd_env.PATH = path diff --git a/lua/lspconfig/server_configurations/remark_ls.lua b/lua/lspconfig/server_configurations/remark_ls.lua index 2668facb..54eabe7f 100644 --- a/lua/lspconfig/server_configurations/remark_ls.lua +++ b/lua/lspconfig/server_configurations/remark_ls.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'remark-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'remark-language-server', '--stdio' }, filetypes = { 'markdown' }, root_dir = util.root_pattern( '.remarkrc', diff --git a/lua/lspconfig/server_configurations/rome.lua b/lua/lspconfig/server_configurations/rome.lua index 1e426a7f..a99a1a28 100644 --- a/lua/lspconfig/server_configurations/rome.lua +++ b/lua/lspconfig/server_configurations/rome.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'rome' -local cmd = { bin_name, 'lsp-proxy' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, 'lsp-proxy' } -end - return { default_config = { - cmd = cmd, + cmd = { 'rome', 'lsp-proxy' }, filetypes = { 'javascript', 'javascriptreact', diff --git a/lua/lspconfig/server_configurations/ruby_ls.lua b/lua/lspconfig/server_configurations/ruby_ls.lua index ef490256..14a66425 100644 --- a/lua/lspconfig/server_configurations/ruby_ls.lua +++ b/lua/lspconfig/server_configurations/ruby_ls.lua @@ -1,17 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'ruby-lsp' - --- defaults to stdio -local cmd = { bin_name } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name } -end - return { default_config = { - cmd = cmd, + cmd = { 'ruby-lsp' }, filetypes = { 'ruby' }, root_dir = util.root_pattern('Gemfile', '.git'), init_options = { diff --git a/lua/lspconfig/server_configurations/smarty_ls.lua b/lua/lspconfig/server_configurations/smarty_ls.lua index 2a7c6ca9..fd6c212a 100644 --- a/lua/lspconfig/server_configurations/smarty_ls.lua +++ b/lua/lspconfig/server_configurations/smarty_ls.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'smarty-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'smarty-language-server', '--stdio' }, filetypes = { 'smarty' }, root_dir = function(pattern) local cwd = vim.loop.cwd() diff --git a/lua/lspconfig/server_configurations/solargraph.lua b/lua/lspconfig/server_configurations/solargraph.lua index 4fba4009..c33c34b6 100644 --- a/lua/lspconfig/server_configurations/solargraph.lua +++ b/lua/lspconfig/server_configurations/solargraph.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'solargraph' -local cmd = { bin_name, 'stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, 'stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'solargraph', 'stdio' }, settings = { solargraph = { diagnostics = true, diff --git a/lua/lspconfig/server_configurations/standardrb.lua b/lua/lspconfig/server_configurations/standardrb.lua index e5261e45..70608bf6 100644 --- a/lua/lspconfig/server_configurations/standardrb.lua +++ b/lua/lspconfig/server_configurations/standardrb.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'standardrb' -local cmd = { bin_name, '--lsp' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--lsp' } -end - return { default_config = { - cmd = cmd, + cmd = { 'standardrb', '--lsp' }, filetypes = { 'ruby' }, root_dir = util.root_pattern('Gemfile', '.git'), }, diff --git a/lua/lspconfig/server_configurations/stylelint_lsp.lua b/lua/lspconfig/server_configurations/stylelint_lsp.lua index 314bb89f..fedc1a73 100644 --- a/lua/lspconfig/server_configurations/stylelint_lsp.lua +++ b/lua/lspconfig/server_configurations/stylelint_lsp.lua @@ -1,12 +1,5 @@ local util = require 'lspconfig.util' -local bin_name = 'stylelint-lsp' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - local root_file = { '.stylelintrc', '.stylelintrc.cjs', @@ -22,7 +15,7 @@ root_file = util.insert_package_json(root_file, 'stylelint') return { default_config = { - cmd = cmd, + cmd = { 'stylelint-lsp', '--stdio' }, filetypes = { 'css', 'less', diff --git a/lua/lspconfig/server_configurations/svelte.lua b/lua/lspconfig/server_configurations/svelte.lua index 64ed468f..a08bb954 100644 --- a/lua/lspconfig/server_configurations/svelte.lua +++ b/lua/lspconfig/server_configurations/svelte.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'svelteserver' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'svelteserver', '--stdio' }, filetypes = { 'svelte' }, root_dir = util.root_pattern('package.json', '.git'), }, diff --git a/lua/lspconfig/server_configurations/svlangserver.lua b/lua/lspconfig/server_configurations/svlangserver.lua index 72eef65b..bc3591a1 100644 --- a/lua/lspconfig/server_configurations/svlangserver.lua +++ b/lua/lspconfig/server_configurations/svlangserver.lua @@ -1,12 +1,5 @@ local util = require 'lspconfig.util' -local bin_name = 'svlangserver' -local cmd = { bin_name } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name } -end - local function build_index() local params = { command = 'systemverilog.build_index', @@ -24,7 +17,7 @@ end return { default_config = { - cmd = cmd, + cmd = { 'svlangserver' }, filetypes = { 'verilog', 'systemverilog' }, root_dir = function(fname) return util.root_pattern '.svlangserver'(fname) or util.find_git_ancestor(fname) diff --git a/lua/lspconfig/server_configurations/syntax_tree.lua b/lua/lspconfig/server_configurations/syntax_tree.lua index 13f8df89..90a05ada 100644 --- a/lua/lspconfig/server_configurations/syntax_tree.lua +++ b/lua/lspconfig/server_configurations/syntax_tree.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'stree' -local cmd = { bin_name, 'lsp' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, 'lsp' } -end - return { default_config = { - cmd = cmd, + cmd = { 'stree', 'lsp' }, filetypes = { 'ruby' }, root_dir = function(fname) return util.root_pattern '.streerc'(fname) or util.root_pattern('Gemfile', '.git')(fname) diff --git a/lua/lspconfig/server_configurations/tailwindcss.lua b/lua/lspconfig/server_configurations/tailwindcss.lua index 89ed8189..d72aad6e 100644 --- a/lua/lspconfig/server_configurations/tailwindcss.lua +++ b/lua/lspconfig/server_configurations/tailwindcss.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'tailwindcss-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'tailwindcss-language-server', '--stdio' }, -- filetypes copied and adjusted from tailwindcss-intellisense filetypes = { -- html diff --git a/lua/lspconfig/server_configurations/textlsp.lua b/lua/lspconfig/server_configurations/textlsp.lua index 2fb71731..e4f7a91a 100644 --- a/lua/lspconfig/server_configurations/textlsp.lua +++ b/lua/lspconfig/server_configurations/textlsp.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'textlsp' -local cmd = { bin_name } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name } -end - return { default_config = { - cmd = cmd, + cmd = { 'textlsp' }, filetypes = { 'text', 'tex', 'org' }, root_dir = util.find_git_ancestor, single_file_support = true, diff --git a/lua/lspconfig/server_configurations/tsserver.lua b/lua/lspconfig/server_configurations/tsserver.lua index 817a4ebc..2a4cd1ab 100644 --- a/lua/lspconfig/server_configurations/tsserver.lua +++ b/lua/lspconfig/server_configurations/tsserver.lua @@ -1,16 +1,9 @@ local util = require 'lspconfig.util' -local bin_name = 'typescript-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { init_options = { hostInfo = 'neovim' }, - cmd = cmd, + cmd = { 'typescript-language-server', '--stdio' }, filetypes = { 'javascript', 'javascriptreact', diff --git a/lua/lspconfig/server_configurations/turtle_ls.lua b/lua/lspconfig/server_configurations/turtle_ls.lua index 0e58e956..21624a82 100644 --- a/lua/lspconfig/server_configurations/turtle_ls.lua +++ b/lua/lspconfig/server_configurations/turtle_ls.lua @@ -12,7 +12,7 @@ if bin_path == nil then local path = os.getenv 'PATH' if path ~= nil then for str in string.gmatch(path, '([^' .. sep .. ']+)') do - table.insert(paths, str) + paths[#paths + 1] = str end end for _, p in ipairs(paths) do @@ -26,15 +26,9 @@ else full_path = util.path.join(bin_path, bin_name) end -local cmd = { 'node', full_path, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', 'node', full_path, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'node', full_path, '--stdio' }, filetypes = { 'turtle', 'ttl' }, root_dir = function(fname) return util.find_git_ancestor(fname) diff --git a/lua/lspconfig/server_configurations/typst_lsp.lua b/lua/lspconfig/server_configurations/typst_lsp.lua index 25536859..219a5099 100644 --- a/lua/lspconfig/server_configurations/typst_lsp.lua +++ b/lua/lspconfig/server_configurations/typst_lsp.lua @@ -1,13 +1,8 @@ local util = require 'lspconfig.util' -local cmd = { 'typst-lsp' } -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', 'typst-lsp' } -end - return { default_config = { - cmd = cmd, + cmd = { 'typst-lsp' }, filetypes = { 'typst' }, root_dir = function(fname) return util.find_git_ancestor(fname) diff --git a/lua/lspconfig/server_configurations/unocss.lua b/lua/lspconfig/server_configurations/unocss.lua index 2849b0dc..b38693be 100644 --- a/lua/lspconfig/server_configurations/unocss.lua +++ b/lua/lspconfig/server_configurations/unocss.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'unocss-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'unocss-language-server', '--stdio' }, filetypes = { 'html', 'javascriptreact', diff --git a/lua/lspconfig/server_configurations/vhdl_ls.lua b/lua/lspconfig/server_configurations/vhdl_ls.lua index 26570195..46db3c8c 100644 --- a/lua/lspconfig/server_configurations/vhdl_ls.lua +++ b/lua/lspconfig/server_configurations/vhdl_ls.lua @@ -5,14 +5,9 @@ local root_files = { '.vhdl_ls.toml', } -local cmd = { 'vhdl_ls' } -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', 'vhdl_ls' } -end - return { default_config = { - cmd = cmd, + cmd = { 'vhdl_ls' }, filetypes = { 'vhd', 'vhdl' }, root_dir = util.root_pattern(unpack(root_files)), single_file_support = true, diff --git a/lua/lspconfig/server_configurations/vimls.lua b/lua/lspconfig/server_configurations/vimls.lua index 9b33d3a6..bcee4cca 100644 --- a/lua/lspconfig/server_configurations/vimls.lua +++ b/lua/lspconfig/server_configurations/vimls.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'vim-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'vim-language-server', '--stdio' }, filetypes = { 'vim' }, root_dir = util.find_git_ancestor, single_file_support = true, diff --git a/lua/lspconfig/server_configurations/volar.lua b/lua/lspconfig/server_configurations/volar.lua index eddcaf0f..8e34b7c5 100644 --- a/lua/lspconfig/server_configurations/volar.lua +++ b/lua/lspconfig/server_configurations/volar.lua @@ -12,15 +12,9 @@ local volar_init_options = { }, } -local bin_name = 'vue-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end return { default_config = { - cmd = cmd, + cmd = { 'vue-language-server', '--stdio' }, filetypes = { 'vue' }, root_dir = util.root_pattern 'package.json', init_options = volar_init_options, diff --git a/lua/lspconfig/server_configurations/vtsls.lua b/lua/lspconfig/server_configurations/vtsls.lua index 29f7c642..f8ea6305 100644 --- a/lua/lspconfig/server_configurations/vtsls.lua +++ b/lua/lspconfig/server_configurations/vtsls.lua @@ -1,14 +1,8 @@ local util = require 'lspconfig.util' -local cmd = { 'vtsls', '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', unpack(cmd) } -end - return { default_config = { - cmd = cmd, + cmd = { 'vtsls', '--stdio' }, filetypes = { 'javascript', 'javascriptreact', diff --git a/lua/lspconfig/server_configurations/vuels.lua b/lua/lspconfig/server_configurations/vuels.lua index d3d2d92e..34d0f28f 100644 --- a/lua/lspconfig/server_configurations/vuels.lua +++ b/lua/lspconfig/server_configurations/vuels.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'vls' -local cmd = { bin_name } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name } -end - return { default_config = { - cmd = cmd, + cmd = { 'vls' }, filetypes = { 'vue' }, root_dir = util.root_pattern('package.json', 'vue.config.js'), init_options = { diff --git a/lua/lspconfig/server_configurations/wgsl_analyzer.lua b/lua/lspconfig/server_configurations/wgsl_analyzer.lua index 859373ea..cf8913df 100644 --- a/lua/lspconfig/server_configurations/wgsl_analyzer.lua +++ b/lua/lspconfig/server_configurations/wgsl_analyzer.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'wgsl_analyzer' -local cmd = { bin_name } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name } -end - return { default_config = { - cmd = cmd, + cmd = { 'wgsl_analyzer' }, filetypes = { 'wgsl' }, root_dir = util.root_pattern '.git', settings = {}, diff --git a/lua/lspconfig/server_configurations/yamlls.lua b/lua/lspconfig/server_configurations/yamlls.lua index 52d8e6f6..43d04e48 100644 --- a/lua/lspconfig/server_configurations/yamlls.lua +++ b/lua/lspconfig/server_configurations/yamlls.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'yaml-language-server' -local cmd = { bin_name, '--stdio' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '--stdio' } -end - return { default_config = { - cmd = cmd, + cmd = { 'yaml-language-server', '--stdio' }, filetypes = { 'yaml', 'yaml.docker-compose' }, root_dir = util.find_git_ancestor, single_file_support = true, diff --git a/lua/lspconfig/server_configurations/yls.lua b/lua/lspconfig/server_configurations/yls.lua index 0fe15fb2..86cb3377 100644 --- a/lua/lspconfig/server_configurations/yls.lua +++ b/lua/lspconfig/server_configurations/yls.lua @@ -1,15 +1,8 @@ local util = require 'lspconfig.util' -local bin_name = 'yls' -local cmd = { bin_name, '-vv' } - -if vim.fn.has 'win32' == 1 then - cmd = { 'cmd.exe', '/C', bin_name, '-vv' } -end - return { default_config = { - cmd = cmd, + cmd = { 'yls', '-vv' }, filetypes = { 'yar', 'yara' }, root_dir = util.find_git_ancestor, single_file_support = true, |
