Skip to content
Open
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
3 changes: 3 additions & 0 deletions lsp/matlab_ls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Comment on lines +23 to 27
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the clear explanation. But I don't quite see why the solution was chosen.

I think it's more like a hint that getcwd() should not be used as a fallback. People really seem to love it though ...

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I think it's more like a hint that getcwd() should not be used as a fallback.

Good catch, I agree. I guess I subconsciously decided to use a guard to avoid introducing a breaking change.

However, I'm happy to remove calling getcwd(). As you indicate, arguably, the issue I ran into demonstrates the function isn't the proper approach to choose there because it's brittle.

Let me know if you'd be willing to introduce a breaking change.

end,
Expand Down
3 changes: 3 additions & 0 deletions lsp/ts_ls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions lsp/tsgo.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions lsp/vtsls.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading