helix icon indicating copy to clipboard operation
helix copied to clipboard

feat(lsp): allow negative root pattern

Open xbwwj opened this issue 6 months ago • 1 comments

Close #13611

xbwwj avatar May 26 '25 04:05 xbwwj

Any comment or review there?

xbwwj avatar Jun 12 '25 00:06 xbwwj

It has been a long time since creation of this pull request without any review, so I suppose this feature will not get merged.

Here is a workaround for other users who want to use deno globally but disable it in nodejs projects:

  1. Set deno-lsp globally in ~/.helix/language.toml instead of ~/.config/helix/languages.toml. Since helix' search of project local config will not go across git repo, this setting will be invalidated in any git repo.
  2. Set both deno-lsp and typescript-language-server regularly in ~/.config/helix/languages.toml.

The full configuration is as below:

# ~/.helix/languages.toml
[[language]]
name = "typescript"
roots = ["deno.json", "deno.jsonc", "package.json"]
file-types = ["ts", "tsx"]
auto-format = true
language-servers = ["deno-lsp"]

[[language]]
name = "javascript"
roots = ["deno.json", "deno.jsonc", "package.json"]
file-types = ["js", "jsx"]
auto-format = true
language-servers = ["deno-lsp"]

[language-server.deno-lsp]
command = "deno"
args = ["lsp"]
required-root-patterns = []
config.deno.enable = true
# ~/.config/helix/languages.toml
[[language]]
name = "typescript"
roots = ["deno.json", "deno.jsonc", "package.json"]
file-types = ["ts", "tsx"]
auto-format = true
language-servers = ["deno-lsp", "typescript-language-server"]

[[language]]
name = "javascript"
roots = ["deno.json", "deno.jsonc", "package.json"]
file-types = ["js", "jsx"]
auto-format = true
language-servers = ["deno-lsp"]

[language-server.deno-lsp]
command = "deno"
args = ["lsp"]
required-root-patterns = ["deno.json", "deno.jsonc"]
config.deno.enable = true

[language-server.typescript-language-server]
required-root-patterns = ["package.json"]

xbwwj avatar Sep 08 '25 12:09 xbwwj