Commit graph

442 commits

Author SHA1 Message Date
Philipp Mildenberger
71551d395b Adds support for multiple language servers per language.
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.
2023-05-18 21:48:30 +02:00
gibbz00
6f135e58a3
languages.toml: recognize gml files. (#7055) 2023-05-16 13:02:22 +09:00
gibbz00
e9efcebdb0
languages.toml: recognize geojson files. (#7054) 2023-05-16 13:01:27 +09:00
Vitalii Solodilov
5938e2c0dc
fix: update upstream tree-sitter-dockerfile (#6895)
* fix: update upstream tree-sitter-dockerfile

Fixes: #6797

* fix: review

* fix: review
2023-05-12 03:29:06 +02:00
Ollie Charles
8424f387b5
Remove tree-sitter-cabal (#6996) 2023-05-09 21:31:22 +02:00
Andrius Pukšta
3a9e77934b
Treat .sty and .cls files as latex (#6986) 2023-05-08 19:11:23 +02:00
Diego Pontoriero
fc1e9a6ff9
languages: add build.gradle.kts to java and scala roots (#6970)
Gradle scripts written in kotlin use a .kts extension:

https://docs.gradle.org/current/userguide/kotlin_dsl.html#sec:scripts
2023-05-05 10:02:19 +09:00
taupiqueur
c49faf5681
Add language server command for Crystal (#6948) 2023-05-03 09:43:37 +09:00
Scott Stevenson
015623720c
Recognise Jupyter notebooks as JSON documents (#6927) 2023-05-01 16:21:30 +02:00
Scott Stevenson
d7878238c1
Recognise poetry.lock as TOML (#6928) 2023-05-01 16:21:10 +02:00
Timothy DeHerrera
9c6c63a2be
inject language based on file extension & shebang (#3970)
* 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
2023-04-28 18:21:34 +09:00
ap29600
9cdc6b2e8a
Change Odin grammar to ap29600/tree-sitter-odin (#6766)
* 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>
2023-04-27 16:32:21 +02:00
Wesley
903bdaae87
Set PerlNavigator as the language server for Perl (#6860) 2023-04-27 01:28:54 +02:00
Daniel Martí
488707c7c8
add go.work and remove Gopkg.toml as Go roots (#6884)
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.
2023-04-26 22:51:04 +09:00
Timothy DeHerrera
080f85c34f
fix(nix): fix superflous / that breaks the build (#6880)
Resolves #1779
2023-04-26 10:15:16 +09:00
Ollie Charles
5aedf11493
Replace *.cabal in Haskell roots with cabal.project (#6828)
`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.
2023-04-21 12:51:17 +09:00
Lakshya Singh
4f03c03556
update tree-sitter-markdown (#6785)
* chore: fix bump tree-sitter-markdown

Signed-off-by: Lakshya Singh <lakshay.singh1108@gmail.com>

* chore: bump markdown_inline to latest rev

Signed-off-by: Lakshya Singh <lakshay.singh1108@gmail.com>

---------

Signed-off-by: Lakshya Singh <lakshay.singh1108@gmail.com>
2023-04-19 01:21:15 +02:00
VuiMuich
4cdba7cccd
Add standalone language support for just (#6453)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2023-04-14 17:03:21 +02:00
zetashift
cd7ef57818
Change smithy language server to the one from AWS (#6572) 2023-04-14 09:08:11 -05:00
Michael
161fef2166
Add DTD language support (#6644)
- Added syntax highlighting for the DTD subset of the XML spec.
- Included .dtd and .ent as common file extensions
2023-04-12 15:28:51 -05:00
lefp
fff8543b58
Add OpenCL tree-sitter and LSP config (#6473) 2023-04-12 14:42:41 -05:00
Matouš Dzivjak
70de5026b8
feat(languages): Support markdoc (#6432)
Add basic support for [markdoc](https://markdoc.dev/).

For language server, see: https://github.com/markdoc-extra/markdoc-ls
For tree sitter, see: https://github.com/markdoc-extra/tree-sitter-markdoc
2023-04-12 10:28:03 -05:00
Ollie Charles
deab323c28
Update tree-sitter-haskell (#6317) 2023-04-12 09:35:01 -05:00
Ollie Charles
92c5f5f18c
Initial Cabal language support (#6485) 2023-04-12 08:38:11 -05:00
Michael Davis
686a1e2f31
Update tree-sitter-git-commit (#6692)
Trailers are now supported, for example 'Co-authored-by' or
'Signed-off-by'. Commits are also now recognized in message bodies.
2023-04-11 00:52:03 +09:00
Arnar
6dabd36491
Update gleam grammar (#6641) 2023-04-09 14:23:01 -05:00
karei
1148ce1fd9
Add support for Robot Framework files (#6611)
* Add support for Robot Framework files

* Run docgen
2023-04-07 08:19:48 +08:00
Michael
b663b89529
xml: highlight .xsd as XML files (#6631)
xsd or "XML Schema Definition" files are in XML format and should therefore be
highlighted as such
2023-04-06 14:48:10 -05:00
Danillo Melo
3dd715a115
Update Ruby Highlights (#6587)
* update ruby highlights

* Updated SQL injection.scm

* Move private, public, protected to builtin methods
2023-04-07 00:37:45 +08:00
Erasin Wang
c22ebfe62e
Add Hurl Support (#6450)
* Add http Support

It's like [vscode-restclient](https://github.com/Huachao/vscode-restclient)

- https://github.com/erasin/tree-sitter-http/tree/main/tests

* Add Hurl Support
2023-04-07 00:26:41 +08:00
Ivan Ermakov
b6909bc41a
Add gdformat support (#6614) 2023-04-06 12:28:08 +09:00
Jack Wolfard
577aded04a
Recognize CUDA files as C++ (#6521) 2023-04-04 14:25:06 -05:00
Rowan Shi
789833c995
minor: R lang config update --slave to --no-echo (#6570) 2023-04-03 11:36:54 -05:00
Michael Davis
565445be60
Update tree-sitter-git-commit (#6493)
The last update introduced a bug with comments where a comment would
be recognized as a message if there were multiple newlines between
the last message or subject and the comment, causing a noticeable
change in highlighting. This change fixes that behavior.
2023-03-31 10:32:49 +09:00
Philip Giuliani
5323020c3f
Add .arb as a supported extension with json highlighting (#6452) 2023-03-27 12:24:17 -05:00
Michael Davis
d7431db55c
Update tree-sitter-git-commit, add comment textobject (#6439)
The update includes a fix for comments in commit messages where there
was no space separating the '#' and the comment text.

The comment textobject can be useful occasionally to jump to the
summary part of the commit edit message.
2023-03-27 15:27:38 +09:00
JJ
c8fde8b6f9
Initial Nim language support (#6123) 2023-03-26 17:06:48 -05:00
Juan C. Müller
5d7c90c5cf
Add language support for rego (OpenPolicyAgent) (#6415) 2023-03-26 16:49:37 -05:00
Tom Burdick
685ae2365a
Add vhdl language support (#5826)
Simple highlight query file with keywords and builtin types
matching. Many VHDL types however are defined in std libraries
which do not currently get matched on.

This is because the grammar doesn't consider them builtin types.
2023-03-25 12:10:54 -05:00
Matouš Dzivjak
2f64c768df
feat(languages): highlight .svg as xml (#6431)
Add "svg" as a file type for xml.

Fixes: https://github.com/helix-editor/helix/issues/6337
2023-03-25 08:40:19 -05:00
Alexis-Lapierre
9a65118899
Recognize .cts and .mts file type as TypeScript (#6424)
TypeScript can use three type of file extensions:
  - .ts  for regular TypeScript
  - .cts for CommonJS modules
  - .mts for ES modules

Official documentation on supported file extensions:
https://www.typescriptlang.org/docs/handbook/esm-node.html#new-file-extensions
2023-03-24 13:13:01 -05:00
Aleksey Kuznetsov
2904a10fb1
Add xib and storyboard file types (#6407) 2023-03-22 12:30:33 -05:00
zetashift
0e0c16e6fa
Add initial Smithy support (#6370) 2023-03-21 17:12:24 -05:00
pithlessly
78613ac0f2
Disable auto-pairing ' by default in OCaml (#6381)
Since OCaml uses 'a syntax for type variables, the editor shouldn't insert a
second ', for the same reason as Rust.
2023-03-20 12:51:26 -05:00
angelodlfrtr
ac2a7731a6
Add language support for Cap’n Proto format (#6325) 2023-03-18 09:17:02 -05:00
Erasin Wang
fb56a4bb75
Improve tree-sitter queries for vlang (#6279)
- Update hightlight
- add indents
- add textobject
- add injections
2023-03-15 16:22:24 -05:00
Michael Davis
fb4d703b9f Update Nix highlights
* Switch nix grammar repository location to the new repo. The author
  has transferred the repository to 'nix-community'.
* Capture ':' and '...' as 'punctuation.delimiter'.
2023-03-14 10:56:49 +09:00
Michael Davis
cdd6c8d91e Update Erlang highlights
* Macros that start with underscore were incorrectly marked as
  'comment.unused' rather than 'keyword.directive' due to an ordering
  issue of those two patterns.
* Recognize escripts as Erlang by the shebang.
2023-03-14 10:56:49 +09:00
Poliorcetics
bdcd4d9411
Feat: LSP Type Hints (#5934)
* misc: missing inline, outdated link

* doc: Add new theme keys and config option to book

* fix: don't panic in Tree::try_get(view_id)

Necessary for later, where we could be receiving an LSP response
for a closed window, in which case we don't want to crash while
checking for its existence

* fix: reset idle timer on all mouse events

* refacto: Introduce Overlay::new and InlineAnnotation::new

* refacto: extract make_job_callback from Context::callback

* feat: add LSP display_inlay_hint option to config

* feat: communicate inlay hints support capabilities of helix to LSP server

* feat: Add function to request range of inlay hint from LSP

* feat: Save inlay hints in document, per view

* feat: Update inlay hints on document changes

* feat: Compute inlay hints on idle timeout

* nit: Add todo's about inlay hints for later

* fix: compute text annotations for current view in view.rs, not document.rs

* doc: Improve Document::text_annotations() description

* nit: getters don't use 'get_' in front

* fix: Drop inlay hints annotations on config refresh if necessary

* fix: padding theming for LSP inlay hints

* fix: tracking of outdated inlay hints should not be dependant on document revision (because of undos and such)

* fix: follow LSP spec and don't highlight padding as virtual text

* config: add some LSP inlay hint configs
2023-03-11 11:32:14 +09:00
Philipp Mildenberger
98415f288f
Improved yuck highlighting (and parser), and introduced a tag.builtin scope (#6242) 2023-03-10 10:32:45 -06:00