Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Unable to mix Deno and non-Deno files in the same workspace #3019

Open
3 tasks done
eriklindebratt opened this issue Apr 19, 2024 · 3 comments
Open
3 tasks done
Labels
bug Something isn't working

Comments

@eriklindebratt
Copy link

eriklindebratt commented Apr 19, 2024

Did you check docs and existing issues?

  • I have read all the LazyVim docs
  • I have searched the existing issues of LazyVim
  • I have searched the existing issues of plugins related to this issue

Neovim version (nvim -v)

0.9.5, latest stable release from Homebrew

Operating system/version

macOS 14.4.1

Describe the bug

The Deno LSP has the setting deno.enablePaths so that one can choose to only run Deno in parts of a workspace. In a TypeScript workspace where just a part of the files should use Deno – with a package.json file but no deno.json – these lines completely disables the Deno LSP:

if LazyVim.lsp.get_config("denols") and LazyVim.lsp.get_config("tsserver") then
local is_deno = require("lspconfig.util").root_pattern("deno.json", "deno.jsonc")
LazyVim.lsp.disable("tsserver", is_deno)
LazyVim.lsp.disable("denols", function(root_dir)
return not is_deno(root_dir)
end)
end

The only way around it as I have found it is to add this to my own LazyVim config but with the lines above removed/commented out, something I'd ideally like to avoid.

Steps To Reproduce

  1. Make sure you have the denols and tsserver LSPs installed.
  2. Clone my example repo.
  3. Run pnpm install in the root directory.
  4. Open deno-scripts/my-deno-script.ts in Neovim and check the output of :LspInfo. denols will be listed but as not attached to buffer.

(In my example repo I haven't explicitly added deno.enablePaths to any Neovim/LazyVim config but as I understanded it, Neoconf should pick it up from .vscode/settings.json. And running :Neoconf lsp in the workspace shows deno.enablePaths being applied from .vscode/settings.json.)

Expected Behavior

  1. Even without a deno.json file, the denols LSP should still remain enabled if "deno.enablePaths": ["some/path"] is set and it matches the current buffer.

  2. Paths matching deno.enablePaths should disable the tsserver LSP.

Using VS Code and their TypeScript/Deno LSP extensions, both of these expected behaviors work.

Repro

No response

@eriklindebratt eriklindebratt added the bug Something isn't working label Apr 19, 2024
@dpetka2001
Copy link
Contributor

Maybe you could add an additional check in is_deno with LazyVim.opts("nvim-lspconfig").servers.denols.settings.deno.enablePaths to see if that option is enabled in the user's nvim-lspconfig configuration. If you could try that out and see if it's working for you, then maybe you could submit a PR that rectifies this behavior.

@eriklindebratt
Copy link
Author

@dpetka2001 Thanks for the suggestion! Inspecting LazyVim.opts("nvim-lspconfig").servers, denols doesn't appear to be defined. I thought the config resolved from Neoconf would populate that?

@dpetka2001
Copy link
Contributor

dpetka2001 commented Apr 19, 2024

Yes, apparently it doesn't. LazyVim.opts only shows the options for the corresponding spec of lazy.nvim. Since, it's not defined in nvim-lspconfig spec it won't find it. I'm sorry, but I don't know how you can check it against Neoconf importing the .vscode.settings.json. Hopefully the maintainer will get back to you with a better solution.

@eriklindebratt eriklindebratt changed the title bug: Unable to use mix Deno and non-Deno files in the same workspace bug: Unable to mix Deno and non-Deno files in the same workspace Apr 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants