From 768a1d8d4368fc0928e6da14bd552d5b1c74ea7d Mon Sep 17 00:00:00 2001 From: Oliver Date: Fri, 13 Mar 2026 15:11:34 +0100 Subject: [PATCH] feat(nvim): add nvm node to PATH in mason and configure ts_ls watchOptions --- nvim/lua/olinpin/plugins/mason.lua | 31 ++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/nvim/lua/olinpin/plugins/mason.lua b/nvim/lua/olinpin/plugins/mason.lua index 7352408..7b29258 100644 --- a/nvim/lua/olinpin/plugins/mason.lua +++ b/nvim/lua/olinpin/plugins/mason.lua @@ -122,6 +122,12 @@ return { init = function() -- Do not crowd home directory with NPM cache folder 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, opts = { 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") @@ -219,6 +242,14 @@ return { format = { enable = true, }, + files = { + exclude = { + "**/.git/**", + "**/node_modules/**", + "**/vendor/**/{Tests,tests}/**", + "**/.history/**", + }, + }, }, }, })