Skip to content

Commit 513f4f0

Browse files
committed
fix: fix incorrect root finding
1 parent cedf795 commit 513f4f0

File tree

5 files changed

+5
-5
lines changed

5 files changed

+5
-5
lines changed

lua/lspconfig/configs/angularls.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ local util = require 'lspconfig.util'
44
-- in order to use your projects configured versions.
55
-- This defaults to the vim cwd, but will get overwritten by the resolved root of the file.
66
local function get_probe_dir(root_dir)
7-
local project_root = vim.fs.find('node_modules', { path = root_dir, upward = true })[1]
7+
local project_root = vim.fs.dirname(vim.fs.find('node_modules', { path = root_dir, upward = true })[1])
88

99
return project_root and (project_root .. '/node_modules') or ''
1010
end

lua/lspconfig/configs/astro.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
local util = require 'lspconfig.util'
22

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

lua/lspconfig/configs/glint.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ return {
44
default_config = {
55
cmd = { 'glint-language-server' },
66
on_new_config = function(config, new_root_dir)
7-
local project_root = vim.fs.find('node_modules', { path = new_root_dir, upward = true })[1]
7+
local project_root = vim.fs.dirname(vim.fs.find('node_modules', { path = new_root_dir, upward = true })[1])
88
-- Glint should not be installed globally.
99
local node_bin_path = project_root .. '/node_modules/.bin'
1010
local path = node_bin_path .. (vim.fn.has('win32') == 1 and ';' or ':') .. vim.env.PATH

lua/lspconfig/configs/relay_lsp.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ return {
2323
},
2424
root_dir = util.root_pattern('relay.config.*', 'package.json'),
2525
on_new_config = function(config, root_dir)
26-
local project_root = vim.fs.find('node_modules', { path = root_dir, upward = true })[1]
26+
local project_root = vim.fs.dirname(vim.fs.find('node_modules', { path = root_dir, upward = true })[1])
2727
local node_bin_path = project_root .. '/node_modules/.bin'
2828
local compiler_cmd = { node_bin_path .. '/relay-compiler', '--watch' }
2929
local path = node_bin_path .. (vim.fn.has('win32') == 1 and ';' or ':') .. vim.env.PATH

lua/lspconfig/configs/volar.lua

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
local util = require 'lspconfig.util'
22

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

0 commit comments

Comments
 (0)