feat(nvim): add nvm node to PATH in mason and configure ts_ls watchOptions
This commit is contained in:
@@ -122,6 +122,12 @@ return {
|
|||||||
init = function()
|
init = function()
|
||||||
-- Do not crowd home directory with NPM cache folder
|
-- Do not crowd home directory with NPM cache folder
|
||||||
vim.env.npm_config_cache = vim.env.HOME .. "/.cache/npm"
|
vim.env.npm_config_cache = vim.env.HOME .. "/.cache/npm"
|
||||||
|
|
||||||
|
-- Ensure nvm node is in PATH for LSP servers
|
||||||
|
local nvm_node = vim.env.HOME .. "/.nvm/versions/node/v22.14.0/bin"
|
||||||
|
if vim.fn.isdirectory(nvm_node) == 1 and not vim.env.PATH:find(nvm_node, 1, true) then
|
||||||
|
vim.env.PATH = nvm_node .. ":" .. vim.env.PATH
|
||||||
|
end
|
||||||
end,
|
end,
|
||||||
opts = {
|
opts = {
|
||||||
ui = {
|
ui = {
|
||||||
@@ -202,6 +208,23 @@ return {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
workspace_folders = {
|
||||||
|
{
|
||||||
|
name = "root",
|
||||||
|
uri = vim.uri_from_fname(vim.fn.getcwd()),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
on_new_config = function(config, root_dir)
|
||||||
|
config.settings = config.settings or {}
|
||||||
|
config.settings.typescript = config.settings.typescript or {}
|
||||||
|
config.settings.typescript.tsserver = config.settings.typescript.tsserver or {}
|
||||||
|
config.settings.typescript.tsserver.watchOptions = {
|
||||||
|
excludeDirectories = {
|
||||||
|
"**/node_modules",
|
||||||
|
"**/.git",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
end,
|
||||||
})
|
})
|
||||||
vim.lsp.enable("ts_ls")
|
vim.lsp.enable("ts_ls")
|
||||||
|
|
||||||
@@ -219,6 +242,14 @@ return {
|
|||||||
format = {
|
format = {
|
||||||
enable = true,
|
enable = true,
|
||||||
},
|
},
|
||||||
|
files = {
|
||||||
|
exclude = {
|
||||||
|
"**/.git/**",
|
||||||
|
"**/node_modules/**",
|
||||||
|
"**/vendor/**/{Tests,tests}/**",
|
||||||
|
"**/.history/**",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user