From 0bbe8253444a2894b6c45ce990ed44a61ab764ad Mon Sep 17 00:00:00 2001 From: Emilio Ziniades Date: Sun, 19 Nov 2023 10:07:05 +0200 Subject: [PATCH 01/11] fix(cairo_ls): update root_dir --- lua/lspconfig/server_configurations/cairo_ls.lua | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lua/lspconfig/server_configurations/cairo_ls.lua b/lua/lspconfig/server_configurations/cairo_ls.lua index dfdab9148a..e79b34aefe 100644 --- a/lua/lspconfig/server_configurations/cairo_ls.lua +++ b/lua/lspconfig/server_configurations/cairo_ls.lua @@ -8,10 +8,7 @@ return { init_options = { hostInfo = 'neovim' }, cmd = cmd, filetypes = { 'cairo' }, - root_dir = function(fname) - return util.root_pattern 'Scarb.toml'(fname) - or util.root_pattern('Scarb.toml', 'cairo_project.toml', '.git')(fname) - end, + root_dir = util.root_pattern('Scarb.toml', 'cairo_project.toml', '.git'), }, docs = { description = [[ @@ -27,7 +24,7 @@ require'lspconfig'.cairo_ls.setup{} *cairo-language-server is still under active development, some features might not work yet !* ]], default_config = { - root_dir = [[root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git")]], + root_dir = [[root_pattern("Scarb.toml", "cairo_project.toml", ".git")]], }, }, } From 06ef012906f14ecdec174a77f5dec33f4691fa92 Mon Sep 17 00:00:00 2001 From: Emilio Ziniades Date: Sun, 19 Nov 2023 10:08:17 +0200 Subject: [PATCH 02/11] fix(custom_elements_ls): update root_dir --- lua/lspconfig/server_configurations/custom_elements_ls.lua | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lua/lspconfig/server_configurations/custom_elements_ls.lua b/lua/lspconfig/server_configurations/custom_elements_ls.lua index cc2b2ca22c..e71d7f8b33 100644 --- a/lua/lspconfig/server_configurations/custom_elements_ls.lua +++ b/lua/lspconfig/server_configurations/custom_elements_ls.lua @@ -4,10 +4,7 @@ return { default_config = { init_options = { hostInfo = 'neovim' }, cmd = { 'custom-elements-languageserver', '--stdio' }, - root_dir = function(fname) - return util.root_pattern 'tsconfig.json'(fname) - or util.root_pattern('package.json', 'jsconfig.json', '.git')(fname) - end, + root_dir = util.root_pattern('tsconfig.json', 'package.json', 'jsconfig.json', '.git'), }, docs = { description = [[ @@ -36,7 +33,7 @@ Here's an example that disables type checking in JavaScript files. ``` ]], default_config = { - root_dir = [[root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git")]], + root_dir = [[root_pattern("tsconfig.json", "package.json", "jsconfig.json", ".git")]], }, }, } From 2dbe685a47c6bad330041ff4b2d41f4f5d368a1e Mon Sep 17 00:00:00 2001 From: Emilio Ziniades Date: Sun, 19 Nov 2023 10:09:03 +0200 Subject: [PATCH 03/11] fix(gopls): update root_dir --- lua/lspconfig/server_configurations/gopls.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lua/lspconfig/server_configurations/gopls.lua b/lua/lspconfig/server_configurations/gopls.lua index 1b922f3e12..f27033b79f 100644 --- a/lua/lspconfig/server_configurations/gopls.lua +++ b/lua/lspconfig/server_configurations/gopls.lua @@ -20,7 +20,7 @@ return { return clients[#clients].config.root_dir end end - return util.root_pattern 'go.work'(fname) or util.root_pattern('go.mod', '.git')(fname) + return util.root_pattern('go.work', 'go.mod', '.git')(fname) end, single_file_support = true, }, From 11400043be730e6eda44b2bcc40508799e3906ec Mon Sep 17 00:00:00 2001 From: Emilio Ziniades Date: Sun, 19 Nov 2023 10:11:39 +0200 Subject: [PATCH 04/11] fix(gradle_ls): update root_dir --- lua/lspconfig/server_configurations/gradle_ls.lua | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/lua/lspconfig/server_configurations/gradle_ls.lua b/lua/lspconfig/server_configurations/gradle_ls.lua index 47091b2db4..6af1ee6608 100644 --- a/lua/lspconfig/server_configurations/gradle_ls.lua +++ b/lua/lspconfig/server_configurations/gradle_ls.lua @@ -7,18 +7,13 @@ end local root_files = { 'settings.gradle', -- Gradle (multi-project) -} - -local fallback_root_files = { 'build.gradle', -- Gradle } return { default_config = { filetypes = { 'groovy' }, - root_dir = function(fname) - return util.root_pattern(unpack(root_files))(fname) or util.root_pattern(unpack(fallback_root_files))(fname) - end, + root_dir = util.root_pattern(unpack(root_files)), cmd = { bin_name }, -- gradle-language-server expects init_options.settings to be defined init_options = { @@ -36,7 +31,7 @@ Microsoft's lsp server for gradle files If you're setting this up manually, build vscode-gradle using `./gradlew installDist` and point `cmd` to the `gradle-language-server` generated in the build directory ]], default_config = { - root_dir = [[root_pattern("settings.gradle")]], + root_dir = [[root_pattern("settings.gradle", "build.gradle")]], cmd = { 'gradle-language-server' }, init_options = { settings = { From 9ecbb5a3e7157e3c2e010ce1309f6592113a6a06 Mon Sep 17 00:00:00 2001 From: Emilio Ziniades Date: Sun, 19 Nov 2023 10:13:16 +0200 Subject: [PATCH 05/11] fix(hls): update root_dir --- lua/lspconfig/server_configurations/hls.lua | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/lua/lspconfig/server_configurations/hls.lua b/lua/lspconfig/server_configurations/hls.lua index e0d0e70209..4390440d26 100644 --- a/lua/lspconfig/server_configurations/hls.lua +++ b/lua/lspconfig/server_configurations/hls.lua @@ -4,12 +4,7 @@ return { default_config = { cmd = { 'haskell-language-server-wrapper', '--lsp' }, filetypes = { 'haskell', 'lhaskell' }, - root_dir = function(filepath) - return ( - util.root_pattern('hie.yaml', 'stack.yaml', 'cabal.project')(filepath) - or util.root_pattern('*.cabal', 'package.yaml')(filepath) - ) - end, + root_dir = util.root_pattern('hie.yaml', 'stack.yaml', 'cabal.project', '*.cabal', 'package.yaml'), single_file_support = true, settings = { haskell = { @@ -51,14 +46,7 @@ require('lspconfig')['hls'].setup{ ]], default_config = { - root_dir = [[ -function (filepath) - return ( - util.root_pattern('hie.yaml', 'stack.yaml', 'cabal.project')(filepath) - or util.root_pattern('*.cabal', 'package.yaml')(filepath) - ) -end - ]], + root_dir = [[root_pattern("hie.yaml", "stack.yaml", "cabal.project", "*.cabal", "package.yaml")]], }, }, } From b86ddc32e81d3c7ae1add7e03f946e7253aa7301 Mon Sep 17 00:00:00 2001 From: Emilio Ziniades Date: Sun, 19 Nov 2023 10:15:50 +0200 Subject: [PATCH 06/11] fix(kotlin_language_server): update root_dir --- .../server_configurations/kotlin_language_server.lua | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/lua/lspconfig/server_configurations/kotlin_language_server.lua b/lua/lspconfig/server_configurations/kotlin_language_server.lua index a955fe6372..4f79b2a32a 100644 --- a/lua/lspconfig/server_configurations/kotlin_language_server.lua +++ b/lua/lspconfig/server_configurations/kotlin_language_server.lua @@ -15,9 +15,6 @@ local root_files = { 'settings.gradle.kts', -- Gradle (multi-project) 'build.xml', -- Ant 'pom.xml', -- Maven -} - -local fallback_root_files = { 'build.gradle', -- Gradle 'build.gradle.kts', -- Gradle } @@ -25,9 +22,7 @@ local fallback_root_files = { return { default_config = { filetypes = { 'kotlin' }, - root_dir = function(fname) - return util.root_pattern(unpack(root_files))(fname) or util.root_pattern(unpack(fallback_root_files))(fname) - end, + root_dir = util.root_pattern(unpack(root_files)), cmd = { bin_name }, }, docs = { From 0e80c4fe7860d57a59902710529a300f9b876507 Mon Sep 17 00:00:00 2001 From: Emilio Ziniades Date: Sun, 19 Nov 2023 10:18:02 +0200 Subject: [PATCH 07/11] fix(omnisharp): update root_dir --- lua/lspconfig/server_configurations/omnisharp.lua | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/lua/lspconfig/server_configurations/omnisharp.lua b/lua/lspconfig/server_configurations/omnisharp.lua index 9b20460850..611ea957c4 100644 --- a/lua/lspconfig/server_configurations/omnisharp.lua +++ b/lua/lspconfig/server_configurations/omnisharp.lua @@ -38,15 +38,7 @@ return { analyze_open_documents_only = false, filetypes = { 'cs', 'vb' }, - root_dir = function(fname) - local root_patterns = { '*.sln', '*.csproj', 'omnisharp.json', 'function.json' } - for _, pattern in ipairs(root_patterns) do - local found = util.root_pattern(pattern)(fname) - if found then - return found - end - end - end, + root_dir = util.root_pattern('*.sln', '*.csproj', 'omnisharp.json', 'function.json'), on_new_config = function(new_config, _) -- Get the initially configured value of `cmd` new_config.cmd = { unpack(new_config.cmd or {}) } @@ -149,7 +141,7 @@ require'lspconfig'.omnisharp.setup { ``` ]], default_config = { - root_dir = [[root_pattern(".sln") or root_pattern(".csproj")]], + root_dir = [[root_pattern("*.sln", "*.csproj", "omnisharp.json", "function.json")]], }, }, } From 7867711914fb409019a4eacc7e0abe9dad3e7a18 Mon Sep 17 00:00:00 2001 From: Emilio Ziniades Date: Sun, 19 Nov 2023 10:19:14 +0200 Subject: [PATCH 08/11] fix(syntax_tree): update root_dir --- lua/lspconfig/server_configurations/syntax_tree.lua | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lua/lspconfig/server_configurations/syntax_tree.lua b/lua/lspconfig/server_configurations/syntax_tree.lua index 90a05ada32..9b47ee5159 100644 --- a/lua/lspconfig/server_configurations/syntax_tree.lua +++ b/lua/lspconfig/server_configurations/syntax_tree.lua @@ -4,9 +4,7 @@ return { default_config = { cmd = { 'stree', 'lsp' }, filetypes = { 'ruby' }, - root_dir = function(fname) - return util.root_pattern '.streerc'(fname) or util.root_pattern('Gemfile', '.git')(fname) - end, + root_dir = util.root_pattern('.streerc', 'Gemfile', '.git'), }, docs = { description = [[ From 70d23898ceebebdfe34367644b0bbfb142c65522 Mon Sep 17 00:00:00 2001 From: Emilio Ziniades Date: Sun, 19 Nov 2023 10:20:51 +0200 Subject: [PATCH 09/11] fix(tailwindcss): update root_dir --- .../server_configurations/tailwindcss.lua | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lua/lspconfig/server_configurations/tailwindcss.lua b/lua/lspconfig/server_configurations/tailwindcss.lua index 5941e8b96d..b4f2469868 100644 --- a/lua/lspconfig/server_configurations/tailwindcss.lua +++ b/lua/lspconfig/server_configurations/tailwindcss.lua @@ -100,11 +100,16 @@ return { end end, root_dir = function(fname) - return util.root_pattern('tailwind.config.js', 'tailwind.config.cjs', 'tailwind.config.mjs', 'tailwind.config.ts')( - fname - ) or util.root_pattern('postcss.config.js', 'postcss.config.cjs', 'postcss.config.mjs', 'postcss.config.ts')( - fname - ) or util.find_package_json_ancestor(fname) or util.find_node_modules_ancestor(fname) or util.find_git_ancestor( + return util.root_pattern( + 'tailwind.config.js', + 'tailwind.config.cjs', + 'tailwind.config.mjs', + 'tailwind.config.ts', + 'postcss.config.js', + 'postcss.config.cjs', + 'postcss.config.mjs', + 'postcss.config.ts' + )(fname) or util.find_package_json_ancestor(fname) or util.find_node_modules_ancestor(fname) or util.find_git_ancestor( fname ) end, From 3f6d120721e3a2b2812af43e6a8ba5522aa421c5 Mon Sep 17 00:00:00 2001 From: Emilio Ziniades Date: Sun, 19 Nov 2023 10:22:11 +0200 Subject: [PATCH 10/11] fix(tsserver): update root_dir --- lua/lspconfig/server_configurations/tsserver.lua | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lua/lspconfig/server_configurations/tsserver.lua b/lua/lspconfig/server_configurations/tsserver.lua index 2a4cd1ab03..735889b343 100644 --- a/lua/lspconfig/server_configurations/tsserver.lua +++ b/lua/lspconfig/server_configurations/tsserver.lua @@ -12,10 +12,7 @@ return { 'typescriptreact', 'typescript.tsx', }, - root_dir = function(fname) - return util.root_pattern 'tsconfig.json'(fname) - or util.root_pattern('package.json', 'jsconfig.json', '.git')(fname) - end, + root_dir = util.root_pattern('tsconfig.json', 'package.json', 'jsconfig.json', '.git'), single_file_support = true, }, docs = { @@ -48,7 +45,7 @@ Here's an example that disables type checking in JavaScript files. ``` ]], default_config = { - root_dir = [[root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git")]], + root_dir = [[root_pattern("tsconfig.json", "package.json", "jsconfig.json", ".git")]], }, }, } From afd64417f2f8ca09e9965268dba6604e06e4a7b3 Mon Sep 17 00:00:00 2001 From: Emilio Ziniades Date: Sun, 19 Nov 2023 10:24:01 +0200 Subject: [PATCH 11/11] fix(vtsls): update root_dir --- lua/lspconfig/server_configurations/vtsls.lua | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lua/lspconfig/server_configurations/vtsls.lua b/lua/lspconfig/server_configurations/vtsls.lua index ee16278941..050052f703 100644 --- a/lua/lspconfig/server_configurations/vtsls.lua +++ b/lua/lspconfig/server_configurations/vtsls.lua @@ -11,10 +11,7 @@ return { 'typescriptreact', 'typescript.tsx', }, - root_dir = function(fname) - return util.root_pattern 'tsconfig.json'(fname) - or util.root_pattern('package.json', 'jsconfig.json', '.git')(fname) - end, + root_dir = util.root_pattern('tsconfig.json', 'package.json', 'jsconfig.json', '.git'), single_file_support = true, }, docs = { @@ -32,7 +29,7 @@ or [`jsconfig.json`](https://code.visualstudio.com/docs/languages/jsconfig) to the root of your project. ]], default_config = { - root_dir = [[root_pattern("package.json", "tsconfig.json", "jsconfig.json", ".git")]], + root_dir = [[root_pattern("tsconfig.json", "package.json", "jsconfig.json", ".git")]], }, }, }