Language Servers are now configured in a separate table in `languages.toml`:
```toml
[langauge-server.mylang-lsp]
command = "mylang-lsp"
args = ["--stdio"]
config = { provideFormatter = true }
[language-server.efm-lsp-prettier]
command = "efm-langserver"
[language-server.efm-lsp-prettier.config]
documentFormatting = true
languages = { typescript = [ { formatCommand ="prettier --stdin-filepath ${INPUT}", formatStdin = true } ] }
```
The language server for a language is configured like this (`typescript-language-server` is configured by default):
```toml
[[language]]
name = "typescript"
language-servers = [ { name = "efm-lsp-prettier", only-features = [ "format" ] }, "typescript-language-server" ]
```
or equivalent:
```toml
[[language]]
name = "typescript"
language-servers = [ { name = "typescript-language-server", except-features = [ "format" ] }, "efm-lsp-prettier" ]
```
Each requested LSP feature is priorized in the order of the `language-servers` array.
For example the first `goto-definition` supported language server (in this case `typescript-language-server`) will be taken for the relevant LSP request (command `goto_definition`).
If no `except-features` or `only-features` is given all features for the language server are enabled, as long as the language server supports these. If it doesn't the next language server which supports the feature is tried.
The list of supported features are:
- `format`
- `goto-definition`
- `goto-declaration`
- `goto-type-definition`
- `goto-reference`
- `goto-implementation`
- `signature-help`
- `hover`
- `document-highlight`
- `completion`
- `code-action`
- `workspace-command`
- `document-symbols`
- `workspace-symbols`
- `diagnostics`
- `rename-symbol`
- `inlay-hints`
Another side-effect/difference that comes with this PR, is that only one language server instance is started if different languages use the same language server.
* inject language based on file extension
Nodes can now be captured with "injection.filename". If this capture
contains a valid file extension known to Helix, then the content will
be highlighted as that language.
* inject language by shebang
Nodes can now be captured with "injection.shebang". If this capture
contains a valid shebang line known to Helix, then the content will
be highlighted as the language the shebang calls for.
* add documentation for language injection
* nix: fix highlights
The `@` is now highlighted properly on either side of the function arg.
Also, extending the phases with `buildPhase = prev.buildPhase + ''''`
is now highlighted properly.
Fix highlighting of `''$` style escapes (requires tree-sitter-nix bump)
Fix `inherit` highlighting.
* simplify injection_for_match
Split out injection pair logic into its own method to make the overall
flow easier to follow.
Also transform the top-level function into a method on a
HighlightConfiguration.
* markdown: add shebang injection query
* Change Odin grammar to `ap29600/tree-sitter-odin`
The previously adopted grammar, `MineBill/tree-sitter-odin`, is unmaintained and mentions my repository as an alternative source.
* update queries
* docgen
* fix queries
* Update runtime/queries/odin/highlights.scm
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
* remove `ERROR` query for `odin`
* track the latest rev in `ap29600/tree-sitter-odin`
* runtime/queries/odin/highlights.scm: update rune highlight class
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
---------
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
Gopkg.toml was used by dep, Go's original dependency management tool.
It was an experiment that culminated in official and built-in support
for Go modules in mid 2018, and dep was deprecated and archived
in mid 2020 per https://github.com/golang/go/issues/38158.
Now, in 2023, Gopkg.toml files are incredibly rare in actively developed
Go projects, as people use go.mod with Go modules instead.
While here, also add go.work as a root file, since that is used by
Go module workspaces, added in Go 1.18 in early 2022.
gopls or commands like `go build` work inside either go.work or go.mod.
These two root files are the same ones used by gopls integrations with
other editors like vim or neovim.
`roots` doesn't support wildcards. As such this root is dropped, and `cabal.project` is added, which is probably the best we can do for Cabal-based projects for now.