From ae8a01bb40848490548e5d07b97ed972ed43c2f9 Mon Sep 17 00:00:00 2001 From: apostoli <79337131+apostolos-geyer@users.noreply.github.com> Date: Sat, 14 Dec 2024 19:50:47 -0500 Subject: [PATCH] fix(ruff, ruff_lsp, crystalline, janet_lsp): returning a function from root pattern (#3513) * fix(ruff, ruff_lsp): error returning the function returned by util.root_pattern on lsp start * fix(crystalline, janet_lsp): invoke function returned by root pattern --- lua/lspconfig/configs/crystalline.lua | 3 ++- lua/lspconfig/configs/janet_lsp.lua | 2 +- lua/lspconfig/configs/ruff.lua | 2 +- lua/lspconfig/configs/ruff_lsp.lua | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lua/lspconfig/configs/crystalline.lua b/lua/lspconfig/configs/crystalline.lua index 9cf4841e3c..0b321f2ba8 100644 --- a/lua/lspconfig/configs/crystalline.lua +++ b/lua/lspconfig/configs/crystalline.lua @@ -5,7 +5,8 @@ return { cmd = { 'crystalline' }, filetypes = { 'crystal' }, root_dir = function(fname) - return util.root_pattern 'shard.yml' or vim.fs.dirname(vim.fs.find('.git', { path = fname, upward = true })[1]) + return util.root_pattern('shard.yml')(fname) + or vim.fs.dirname(vim.fs.find('.git', { path = fname, upward = true })[1]) end, single_file_support = true, }, diff --git a/lua/lspconfig/configs/janet_lsp.lua b/lua/lspconfig/configs/janet_lsp.lua index 5d3ca1d59d..ce0908ad2e 100644 --- a/lua/lspconfig/configs/janet_lsp.lua +++ b/lua/lspconfig/configs/janet_lsp.lua @@ -8,7 +8,7 @@ return { }, filetypes = { 'janet' }, root_dir = function(fname) - return util.root_pattern 'project.janet' + return util.root_pattern('project.janet')(fname) or vim.fs.dirname(vim.fs.find('.git', { path = fname, upward = true })[1]) end, single_file_support = true, diff --git a/lua/lspconfig/configs/ruff.lua b/lua/lspconfig/configs/ruff.lua index dbe5718b2b..bec2254b3b 100644 --- a/lua/lspconfig/configs/ruff.lua +++ b/lua/lspconfig/configs/ruff.lua @@ -5,7 +5,7 @@ return { cmd = { 'ruff', 'server' }, filetypes = { 'python' }, root_dir = function(fname) - return util.root_pattern('pyproject.toml', 'ruff.toml', '.ruff.toml') + return util.root_pattern('pyproject.toml', 'ruff.toml', '.ruff.toml')(fname) or vim.fs.dirname(vim.fs.find('.git', { path = fname, upward = true })[1]) end, single_file_support = true, diff --git a/lua/lspconfig/configs/ruff_lsp.lua b/lua/lspconfig/configs/ruff_lsp.lua index e304a52254..ea00352bd7 100644 --- a/lua/lspconfig/configs/ruff_lsp.lua +++ b/lua/lspconfig/configs/ruff_lsp.lua @@ -5,7 +5,7 @@ return { cmd = { 'ruff-lsp' }, filetypes = { 'python' }, root_dir = function(fname) - return util.root_pattern('pyproject.toml', 'ruff.toml') + return util.root_pattern('pyproject.toml', 'ruff.toml')(fname) or vim.fs.dirname(vim.fs.find('.git', { path = fname, upward = true })[1]) end, single_file_support = true,