From 39b9240c70bd6235120ed1c25c4d870ae07a3697 Mon Sep 17 00:00:00 2001 From: Niklaas Baudet von Gersdorff Date: Sat, 14 Mar 2026 18:15:37 +0100 Subject: [PATCH 1/4] fix(ts_ls): skip buffers with URI schemes in root_dir Problem: Buffers with non-file URI schemes (e.g. fugitive://, oil://) have no real file path. The root_dir function unconditionally calls on_dir(project_root or vim.fn.getcwd()), which causes ts_ls to attach to such buffers and error because LSP cannot handle non-file:// URIs. Solution: Return early from root_dir when the buffer name starts with a URI scheme, preventing attachment to buffers that LSP cannot handle. --- lsp/ts_ls.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lsp/ts_ls.lua b/lsp/ts_ls.lua index 84534618ff..52db8ec885 100644 --- a/lsp/ts_ls.lua +++ b/lsp/ts_ls.lua @@ -84,6 +84,9 @@ return { 'typescriptreact', }, root_dir = function(bufnr, on_dir) + if vim.api.nvim_buf_get_name(bufnr):match('^%a+://') then + return + end -- The project root is where the LSP can be started from -- As stated in the documentation above, this LSP supports monorepos and simple projects. -- We select then from the project root, which is identified by the presence of a package From 848079b1e4a1c51f858eb48096fbaaf7841fb011 Mon Sep 17 00:00:00 2001 From: Niklaas Baudet von Gersdorff Date: Sat, 14 Mar 2026 18:15:39 +0100 Subject: [PATCH 2/4] fix(tsgo): skip buffers with URI schemes in root_dir Problem: Buffers with non-file URI schemes (e.g. fugitive://, oil://) have no real file path. The root_dir function unconditionally calls on_dir(project_root or vim.fn.getcwd()), which causes tsgo to attach to such buffers and error because LSP cannot handle non-file:// URIs. Solution: Return early from root_dir when the buffer name starts with a URI scheme, preventing attachment to buffers that LSP cannot handle. --- lsp/tsgo.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lsp/tsgo.lua b/lsp/tsgo.lua index d27a61c208..bc05035c0c 100644 --- a/lsp/tsgo.lua +++ b/lsp/tsgo.lua @@ -61,6 +61,9 @@ return { 'typescriptreact', }, root_dir = function(bufnr, on_dir) + if vim.api.nvim_buf_get_name(bufnr):match('^%a+://') then + return + end -- The project root is where the LSP can be started from -- As stated in the documentation above, this LSP supports monorepos and simple projects. -- We select then from the project root, which is identified by the presence of a package From 257c9cf9b3f94581dba0bff30729fd47c88f3979 Mon Sep 17 00:00:00 2001 From: Niklaas Baudet von Gersdorff Date: Sat, 14 Mar 2026 18:15:42 +0100 Subject: [PATCH 3/4] fix(vtsls): skip buffers with URI schemes in root_dir Problem: Buffers with non-file URI schemes (e.g. fugitive://, oil://) have no real file path. The root_dir function unconditionally calls on_dir(project_root or vim.fn.getcwd()), which causes vtsls to attach to such buffers and error because LSP cannot handle non-file:// URIs. Solution: Return early from root_dir when the buffer name starts with a URI scheme, preventing attachment to buffers that LSP cannot handle. --- lsp/vtsls.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lsp/vtsls.lua b/lsp/vtsls.lua index 04f270bfa9..2d9845ae18 100644 --- a/lsp/vtsls.lua +++ b/lsp/vtsls.lua @@ -80,6 +80,9 @@ return { 'typescriptreact', }, root_dir = function(bufnr, on_dir) + if vim.api.nvim_buf_get_name(bufnr):match('^%a+://') then + return + end -- The project root is where the LSP can be started from -- As stated in the documentation above, this LSP supports monorepos and simple projects. -- We select then from the project root, which is identified by the presence of a package From c1f4b9e1d4352700bf5eda8c3da7b4beb3cc327e Mon Sep 17 00:00:00 2001 From: Niklaas Baudet von Gersdorff Date: Sat, 14 Mar 2026 18:15:45 +0100 Subject: [PATCH 4/4] fix(matlab_ls): skip buffers with URI schemes in root_dir Problem: Buffers with non-file URI schemes (e.g. fugitive://, oil://) have no real file path. The root_dir function unconditionally calls on_dir(root_dir or vim.fn.getcwd()), which causes matlab_ls to attach to such buffers and error because LSP cannot handle non-file:// URIs. Solution: Return early from root_dir when the buffer name starts with a URI scheme, preventing attachment to buffers that LSP cannot handle. --- lsp/matlab_ls.lua | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lsp/matlab_ls.lua b/lsp/matlab_ls.lua index 6da14a0d89..807c7b7b53 100644 --- a/lsp/matlab_ls.lua +++ b/lsp/matlab_ls.lua @@ -20,6 +20,9 @@ return { cmd = { 'matlab-language-server', '--stdio' }, filetypes = { 'matlab' }, root_dir = function(bufnr, on_dir) + if vim.api.nvim_buf_get_name(bufnr):match('^%a+://') then + return + end local root_dir = vim.fs.root(bufnr, '.git') on_dir(root_dir or vim.fn.getcwd()) end,