Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix incorrect root finding #3581

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lua/lspconfig/configs/angularls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ local util = require 'lspconfig.util'
-- in order to use your projects configured versions.
-- This defaults to the vim cwd, but will get overwritten by the resolved root of the file.
local function get_probe_dir(root_dir)
local project_root = vim.fs.find('node_modules', { path = root_dir, upward = true })[1]
local project_root = vim.fs.dirname(vim.fs.find('node_modules', { path = root_dir, upward = true })[1])

return project_root and (project_root .. '/node_modules') or ''
end
Expand Down
2 changes: 1 addition & 1 deletion lua/lspconfig/configs/astro.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local util = require 'lspconfig.util'

local function get_typescript_server_path(root_dir)
local project_root = vim.fs.find('node_modules', { path = root_dir, upward = true })[1]
local project_root = vim.fs.dirname(vim.fs.find('node_modules', { path = root_dir, upward = true })[1])
return project_root and (project_root .. '/typescript/lib') or ''
end

Expand Down
2 changes: 1 addition & 1 deletion lua/lspconfig/configs/glint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ return {
default_config = {
cmd = { 'glint-language-server' },
on_new_config = function(config, new_root_dir)
local project_root = vim.fs.find('node_modules', { path = new_root_dir, upward = true })[1]
local project_root = vim.fs.dirname(vim.fs.find('node_modules', { path = new_root_dir, upward = true })[1])
-- Glint should not be installed globally.
local node_bin_path = project_root .. '/node_modules/.bin'
local path = node_bin_path .. (vim.fn.has('win32') == 1 and ';' or ':') .. vim.env.PATH
Expand Down
2 changes: 1 addition & 1 deletion lua/lspconfig/configs/relay_lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ return {
},
root_dir = util.root_pattern('relay.config.*', 'package.json'),
on_new_config = function(config, root_dir)
local project_root = vim.fs.find('node_modules', { path = root_dir, upward = true })[1]
local project_root = vim.fs.dirname(vim.fs.find('node_modules', { path = root_dir, upward = true })[1])
local node_bin_path = project_root .. '/node_modules/.bin'
local compiler_cmd = { node_bin_path .. '/relay-compiler', '--watch' }
local path = node_bin_path .. (vim.fn.has('win32') == 1 and ';' or ':') .. vim.env.PATH
Expand Down
2 changes: 1 addition & 1 deletion lua/lspconfig/configs/volar.lua
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
local util = require 'lspconfig.util'

local function get_typescript_server_path(root_dir)
local project_root = vim.fs.find('node_modules', { path = root_dir, upward = true })[1]
local project_root = vim.fs.dirname(vim.fs.find('node_modules', { path = root_dir, upward = true })[1])
return project_root and (project_root .. '/typescript/lib') or ''

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be:

return project_root and (project_root .. '/node_modules/typescript/lib') or ''

This applies to the change in astro.lua as well.

end

Expand Down
Loading