Commit graph

387 commits

Author SHA1 Message Date
Philipp Mildenberger
bf74a4652d
JS/TS highlighting improvements (#3219) 2022-07-27 13:56:58 -05:00
Erasin
df5ab8b40c
Fix: Python hightlight (#3201) 2022-07-26 22:31:14 +09:00
Kirawi
0a2646e720
Improve python highlighting (#3103)
* improve python queries

* update python grammar to `0.20.2`

* fix variadic parameter scope

* add punctuation scopes

* fix order of punctuation scopes

* undo  `embedded` delete
2022-07-26 10:17:51 +09:00
Daniel Longeuay
2ede98c4b4
feat(tree-sitter): add go template support (#3091)
* feat(tree-sitter):  add go template support

* fix(tree-sitter): 🐛 go template highlight scope selectors

* chore(tree-sitter): 🔧 update go template grammar commit
2022-07-26 10:17:28 +09:00
Clay
b55573dc1d
Add elixir & heex comment textobjects (#3179) 2022-07-26 10:14:45 +09:00
Erasin
dad6d0f3b2
Fix: svelte indets.scm (#3147) 2022-07-24 17:42:27 +09:00
Clay
ec85fb9ab6
Improve HEEx comment highlights, inject comment lang (#3170) 2022-07-24 11:49:52 +09:00
Philipp Mildenberger
b6c700fce9
Replace '; inherits <language>' in treesitter queries with <language> queries instead of appending them (#2470)
Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2022-07-22 10:28:32 +09:00
Michael Davis
9753da6ab7
Fix locals tracking in Rust closures (#3027)
The fix comes from the rewriting of the `closure_parameters` stanza:
it was capturing the entire `closure_parameters` node including
paretheses, whitespace, and commas. Capturing the identifiers within
fixes the tracking.

In order to make sure locals definitions from closure parameters don't
leak out of the body of the closure, though, we should also mark the
closure itself as a locals scope.
2022-07-20 11:51:35 +09:00
Joe
0c9594e41e
Add SCSS language support (#3074) 2022-07-17 17:55:20 +08:00
Mateusz S. Szczygieł
5f69beb87f
Add textobjects.scm to GLSL (#3051) 2022-07-12 10:13:57 -05:00
Philipp Mildenberger
e97b8607c1
Added ungrammar language support (#3048) 2022-07-12 10:06:53 -05:00
Austen LeBeau
0cb0c30618
add fortran language (#3025) 2022-07-10 11:27:44 -05:00
Jake Langford
230ba264bf
Introduce storage highlighting for typescript/javascript (#2961) 2022-07-06 08:54:07 -05:00
Ivan Tham
e35abe38f3
Remove broken ledger tag highlight (#2988) 2022-07-06 07:35:36 -05:00
A-Walrus
1378b911b6
Fix some typos (#2978) 2022-07-05 21:49:54 -05:00
Ivan Tham
b612211070
Update tree-sitter-ledger (#2936) 2022-07-05 09:12:28 -05:00
Michael Davis
aacd0c8aa5
Update TSQ queries (#2960)
A few changes to make TSQ highlights better:

* A parsing error has been fixed in the grammar itself
    * Previously tree-sitter-tsq did not parse the variables
      in predicates like `(#set! injection.language "javascript")`
* Theme nodes as `tag`
    * The newly added node to the parser (from the above fix) is
      `variable` which takes over the `variable` capture from nodes
* Highlight known predicates as `function` and unsupported
  predicates as `error`
    * This may help when translating queries from nvim-treesitter.
      For example `#any-of?` is a common one used in nvim-treesitter
      queries but not implemented in Helix or tree-sitter-cli.
* Inject tree-sitter-regex into `#match?` predicates
2022-07-05 20:01:05 +09:00
rsteube
4c30a3609a
languages: added elvish (#2948) 2022-07-03 16:19:12 -05:00
Blaž Hrastnik
9ae70cc410 Disable tree-sitter python indents, use fallback for now
There's been a lot of complaints about the state of python indentation
and the fallback actually works better until the solution proposed
in https://github.com/helix-editor/helix/issues/763#issuecomment-1137894973=
is implemented.
2022-07-01 19:17:19 +09:00
Michael Davis
c5600c9c01 markdown: limit raw block highlight to code fence content 2022-07-01 11:04:23 +02:00
Michael Davis
c8dba2f4c6 erlang: highlight modules in behaviour attributes 2022-07-01 11:04:23 +02:00
Michael Davis
19acbfe02d erlang: highlight records with macro names
You might use a macro like `?MODULE` to name a record:

    -record(?MODULE, {a, b, c}).

With this fix, the record fields correctly get `variable.other.member`
highlights.
2022-07-01 11:04:23 +02:00
Michael Davis
bf1aa8876c git-commit: fix highlight edge cases
* branch message with current branch and diverged branch has been
  added to the parser
* scissors used in verbose commits are marked as a punctuation
  delimiter
    * we could use comment instead since they're visually the
      same but IMO this works better
2022-07-01 11:04:23 +02:00
Michael Davis
4a0dab8bc2 erlang: fix '#match?' for specs/callbacks 2022-07-01 11:04:23 +02:00
Michael Davis
e4e8a39bf7 replace module captures with namespace
`module` is undocumented and does not exist in other themes. The
equivalent existing scope based on usage (Elixir for example) is
`namespace`.
2022-07-01 11:04:23 +02:00
Michael Davis
016e97314c html: highlight punctuation
* `/>` as in self-closing tags like `<hr/>`
* `=` as in the separator between attribute name and value `<a href="bar">`
2022-07-01 11:04:23 +02:00
Michael Davis
7cf88f2bac edoc: prevent rogue punctuation highlights
Punctuation highlights would show up outside of where they
were valid, for example using parentheses in some text. This
change prevents that by gating the captures to being under
the named nodes in which they are valid.
2022-07-01 11:04:23 +02:00
Michael Davis
78c944ebc3 rust: fix highlight corner-cases
* add punctuation highlights for commas as in function parameters
* remove stray `variable.parameter` highlight
    * I couldn't find any regressions from this and it fixes an
      edge case I ran into (but sadly did not record 😓)
* highlight `fn` as `keyword.function`
    * the theme docs have `fn` as an example so it seems fitting
2022-07-01 11:04:23 +02:00
Michael Davis
ca82cd86e6 markdown: highlight punctuation 2022-07-01 11:04:23 +02:00
Michael Davis
bd527c84e6 erlang: highlight unary '#' as punctuation.bracket
The '#' character may either be interpreted as a map when used
like so:

    %% Example 1
    #{a => b}

Or as an operator which updates an existing map when the left-hand
side is an expression:

    %% Example 2
    MyMap#{a => b}

This commit changes the highlight to `punctuation.bracket` when used
as a character in a literal map (example 1) and keeps the `operator`
highlight when used for updating (example 2).
2022-07-01 11:04:23 +02:00
Michael Davis
d523280e85 erlang: highlight nullary macros as constants 2022-07-01 11:04:23 +02:00
Michael Davis
64cf4c859b
support Bazel languages (#2903) 2022-06-28 08:48:38 +05:30
Michael Davis
9f676dab57 add test textobjects queries for erlang,gleam,go,python,rust 2022-06-21 11:32:03 -05:00
Connor Lay (Clay)
67f6c85792 text-objects: add test capture & elixir queries 2022-06-21 11:32:03 -05:00
farwyler
cad4e03a00
adds missing tree-sitter-comment injection for js/ts (#2763) 2022-06-20 10:55:51 -05:00
A-Walrus
ad15e7b5e8
Add "<<=" operator to Rust syntax highlighting (#2805) 2022-06-18 11:44:21 -05:00
Clay
b13e534b92
HEEx: upgrade version and support new special_attribute node (#2800) 2022-06-17 17:30:28 -05:00
Axot
4d604d3b50
Add clojure language support (#2780)
Co-authored-by: Mateusz Ledwoń <mateusz.ledwon@iteo.com>
2022-06-16 11:47:52 -05:00
Anton Romanov
7983c71752
Introduce storage_class highlight scope (#2731) 2022-06-14 12:35:36 -05:00
Ivan
0bc7259672
add prisma tree-sitter and lsp support (#2703)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2022-06-12 14:08:51 -05:00
Michael Davis
4a27e2d938 capture rust closures as function textobjects
Closures like

    iter.map(|a| a + 1)

Are sort-of functions, so `]f` or `maf` or `mif` can apply to them
as well as named function definitions.
2022-06-07 20:03:31 +09:00
Michael Davis
f7a3d35752 add textobject queries for gleam 2022-06-07 20:03:31 +09:00
Michael Davis
bcafdf404f add textobject queries for elixir 2022-06-07 20:03:31 +09:00
Michael Davis
7a9147489e add textobject queries for erlang 2022-06-07 20:03:31 +09:00
farwyler
f0d1c85553
support for openscad (#2680)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2022-06-06 12:26:56 -05:00
Michael Davis
fd4858c03d
add tree-sitter-jsdoc (#2650) 2022-06-03 10:26:47 +05:30
Michael Davis
42d780b103
add tree-sitter-edoc (#2640)
* add tree-sitter-edoc

* fix escape character capture in markdown queries

* add field negation operator "!" to tsq highlights
2022-06-03 07:41:17 +08:00
Clay
fc8c488322
Elixir: inject Markdown into docs, remove h sigil HEEx injection (#2619)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2022-05-30 21:32:14 -05:00
Timothy DeHerrera
eba82250bb
feat(lang): Update Nix grammar & improve queries (#2472) 2022-05-30 13:47:18 -05:00
pancake
7706a4a0d8
Add Vlang tree-sitter in the languages.toml (#2526)
Co-authored-by: pancake <pancake@nopcode.org>
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2022-05-28 14:46:10 -05:00
Michael Davis
82da9bd4f2 update Erlang grammar and queries
The update to the grammar itself covers the case where the document
is a single expression without a trailing newline such as "min(A, B)".
A small change to the parser now parses these expressions correctly
which improves the display of the function head in the signature
help popup.

The update to the queries marks 'andalso', 'orelse', 'not', etc. as
`@keyword.operator` which improves the look - it looks odd to see
operators that are words highlighted the same as tokens like '->'
or '=:='.
2022-05-25 21:26:26 +09:00
Michael Davis
45dd54082e update Gleam grammar and queries
With respect to the queries:

The locals scope for functions was not large enough, so a function's
parameter could outlive the function body. To fix it, we just widen
the scope to the `function` node.

See also https://github.com/gleam-lang/tree-sitter-gleam/issues/25

With respect to the parser:

An external scanner has been added that fixes the parsing of strings.
Previously, a comment inside a string would act like a comment rather
than string contents.

See also https://github.com/gleam-lang/tree-sitter-gleam/issues/14#issuecomment-1129263640

A new constructor node has been added as well which makes type
highlighting more fine grained.

See also https://github.com/gleam-lang/tree-sitter-gleam/pull/29
2022-05-25 21:26:26 +09:00
Andrey Tkachenko
10463fe32c Add parameter.around text object query 2022-05-25 21:26:06 +09:00
Andrey Tkachenko
67fe16008e
Basic verilog support (#2552) 2022-05-24 12:52:32 -05:00
Blaž Hrastnik
d25bae844c
Add Scheme support
Skipped scm for now :/ it overlaps with tree-sitter-tsq
2022-05-22 00:01:07 +09:00
Paul Scott
09f9f70576 Python highlight decorator attribute 2022-05-20 10:28:52 +09:00
Paul Scott
2a2030142f Python highlight keyword argument as parameter 2022-05-20 10:28:52 +09:00
Paul Scott
e680f9644d Python handling highlighting parameters with defaults 2022-05-20 10:28:52 +09:00
Paul Scott
abef250c58 Python highlight improvements: type, parameter etc
* str, list, etc. handled as @function.builtin and @type.builtin
* None and non-conforming type indentifiers as @type in type hints
* class identifiers treated as @type
* @constructor used for constructor definitions and calls rather than
  as a catch-all for type-like things
* Parameters highlighted
* self and cls as @variable.builtin
* improved decorator highlighting as part of @function

Re-ordering of some statements to give more accurate priority.
2022-05-20 10:28:52 +09:00
Zeddicus414
a6da99a144 Change python highlights.scm to more fully utilize the themes.
Create type keywords
Allow _CONSTANTS to start with _
Highlight constants before constructors
Move some keywords into @keyword.control
2022-05-20 10:28:52 +09:00
Andrey Tkachenko
62fd1f6999
Include macro attributes to impls, structs, enums, functions etc. textobjects (#2494) 2022-05-20 10:19:46 +09:00
midnightexigent
8493b5fca6
Add tree-sitter ssh client config queries (#2498)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2022-05-18 14:49:50 -05:00
unrelentingtech
2cb1ea7127
feat(lang): add Meson language support (#2314)
https://mesonbuild.com/Syntax.html
2022-05-11 10:06:37 +09:00
ChrHorn
b38c268097
fix Markdown list highlighting (#2401) 2022-05-07 11:26:34 +09:00
Robert Walter
495ba40eaf
feat(languages): add odin language (#2399) 2022-05-05 12:09:09 -05:00
Matthew Toohey
a5f4925f53
feat(languages): git-ignore and git-attributes (#2397) 2022-05-05 08:47:28 -05:00
ChrHorn
fc61796895
TOML highlight: use variable.other.member instead of string for quoted keys (#2391) 2022-05-05 16:14:17 +09:00
ChrHorn
5ab669f1ac
replace constant.number with constant.numeric (#2389) 2022-05-04 14:51:31 +09:00
Fanda Vacek
1668183590
feat(lang): Cpon lang support (#2355)
Co-authored-by: Fanda Vacek <fvacek@elektroline.cz>
2022-05-01 09:34:46 -05:00
Blaž Hrastnik
73879052c1
Add Cairo support 2022-05-01 11:24:17 +09:00
unrelentingtech
8e77e3388c
feat(lang): add devicetree (Flattened Device Tree Source) (#2329) 2022-04-29 15:08:00 -05:00
Erin van der Veen
21487d13fd
feat(lang): Update nickel to include "rec" keyword (#2320) 2022-04-29 07:34:15 -05:00
meak
1a3d6252b9
feat(lang): add hare language support (#2289)
Co-authored-by: Mehdi Katranji <hello@mek.yt>
2022-04-26 14:55:00 -05:00
ttys3
a8cb46680d
feat(lsp): add vala language support (#2243) 2022-04-24 11:21:07 -05:00
Justin Ma
5c2570582b
feat(lang): add nushell language support (#2225)
Co-authored-by: Michael Davis <mcarsondavis@gmail.com>
2022-04-22 09:37:51 -05:00
ttys3
4144c9d2f2
feat(lang): add go.mod and go.work support (#2197) 2022-04-20 11:16:02 -05:00
Erin van der Veen
9616477197
Add Nickel language (#2173) 2022-04-20 09:31:59 -05:00
Michael Davis
4e877de54d
Fix Golang textobject queries (#2153)
* log textobject query construction errors

The current behavior is that invalid queries are discarded silently
which makes it difficult to debug invalid textobjects (either invalid
syntax or an update may have come through that changed the valid set
of nodes).

* fix golang textobject query

`method_spec_list` used to be a named node but was removed (I think
for Helix, it was when updated to pull in the support for generics).
Instead of a named node for the list of method specs we have a bunch
of `method_spec` children nodes now. We can match on the set of them
with a `+` wildcard.

Example go for this query:

    type Shape interface {
       area() float64
       perimeter() float64
    }

Which is parsed as:

    (source_file
      (type_declaration
        (type_spec
          name: (type_identifier)
          type: (interface_type
            (method_spec
              name: (field_identifier)
              parameters: (parameter_list)
              result: (type_identifier))
            (method_spec
              name: (field_identifier)
              parameters: (parameter_list)
              result: (type_identifier))))))
2022-04-18 23:14:48 +08:00
Ben Lee-Cohen
2bddec02e7
Fixing (in two ways) a small typo (#2156) 2022-04-18 13:12:47 +09:00
Danillo Melo
be656c14e3
Ruby TextObjects and more file extensions (#2143) 2022-04-17 19:25:44 -05:00
Michael Davis
ad36a024da
Update tree-sitters Erlang and HEEx (#2149) 2022-04-17 23:16:22 +05:30
Terry Brash
c45fb08a93
Add JavaScript control keywords (#2140) 2022-04-17 15:14:55 +09:00
EmmChriss
50df924811
gdscript support (#1985) 2022-04-16 00:35:23 +09:00
Jared Ramirez
460e6a857b
feat(languages): SQL (#2097) 2022-04-14 13:26:20 -05:00
Michael Davis
4836bb38d3 add tree-sitter-heex
HEEx is a templating engine on top of Elixir's EEx templating
language specific to HTML that is included in Phoenix.LiveView
(though I think the plan is to eventually include it in base
Phoenix). It's a superset of EEx with some additional features
like components and slots.

The injections don't work perfectly because the Elixir grammar is
newline sensitive (the _terminator rule). See
https://github.com/elixir-lang/tree-sitter-elixir/issues/24
for more information.
2022-04-13 14:28:51 +09:00
Michael Davis
9d095e0fdc add tree-sitter-eex
EEx is an templating language for Elixir. Since the incremental
parsing refactor we can used combined injections which allows us
to add EEx support.
2022-04-13 14:28:51 +09:00
Michael Davis
4ac94a5c43 remove error highlighting for tree-sitter-elixir
This will become more important with the HEEx grammar being added.
Error highlighting with the Elixir grammar is a bit jumpy because
in some scenarios, a bit of missing syntax can force tree-sitter to
give up on error recovery and mark the entire tree as an error.
This ends up looking bad when editing. We don't typically highlight
error nodes so I'm inclined to leave it out of the highlights here.
2022-04-13 14:28:51 +09:00
Michael Davis
494306ad7a
add tree-sitter-embedded-template (erb & ejs) (#2055)
After the incremental parsing rewrite for injections (which was released
in 22.03 https://helix-editor.com/news/release-22-03-highlights/#incremental-injection-parsing-rewrite),
we can now do combined injections which lets us pull in some templating
grammars. The most notable of those is embedded-template - a pretty
straightforward grammar that covers ERB and EJS.

The grammar and highlights queries are shared between the two but they have
different injections.
2022-04-10 08:23:06 +09:00
Aaron Housh
9caf7c0d5a
Add swift language (#2033) 2022-04-08 13:10:37 -05:00
Matthew Toohey
31c468ab95
add languages r and rmarkdown (#1998)
* add languages `r` and `rmarkdown`

* r: fix highlights

* rmarkdown: add eof in queries

* rmarkdown: update lang-support.md

* r: fix highlight query precedence
2022-04-08 09:30:44 +09:00
VuiMuich
eb84d9493c
add language ron (#1925) 2022-04-05 07:39:22 -05:00
Michael Davis
ffdc2f1793
separate JSX queries from javascript (#1921)
It looks like a24fb17b2a (and
855e438f55) broke the typescript
highlights because typescript

    ; inherits: javascript

but it doesn't have those named nodes in its grammar.

So instead we can separate out JSX into its own language and copy
over everything from javascript and supplement it with the new
JSX highlights. Luckily there isn't too much duplication, just the
language configuration parts - we can re-use the parser with the
languages.toml `grammar` key and most of the queries with `inherits`.
2022-04-02 10:07:35 +09:00
joezak11
deb7ee6595
Update bash tree sitter (#1917) 2022-04-01 08:48:39 -05:00
Blaž Hrastnik
855e438f55
jsx: Add special highlighting to component names 2022-04-01 17:18:44 +09:00
Blaž Hrastnik
a24fb17b2a
Add JSX highlighting queries 2022-04-01 17:14:25 +09:00
Triton171
58758fee61
Indentation rework (#1562)
* WIP: Rework indentation system

* Add ComplexNode for context-aware indentation (including a proof of concept for assignment statements in rust)

* Add switch statements to Go indents.toml (fixes the second half of issue #1523)
Remove commented-out code

* Migrate all existing indentation queries.
Add more options to ComplexNode and use them to improve C/C++ indentation.

* Add comments & replace Option<Vec<_>> with Vec<_>

* Add more detailed documentation for tree-sitter indentation

* Improve code style in indent.rs

* Use tree-sitter queries for indentation instead of TOML config.
Migrate existing indent queries.

* Add documentation for the new indent queries.
Change xtask docgen to look for indents.scm instead of indents.toml

* Improve code style in indent.rs.
Fix an issue with the rust indent query.

* Move indentation test sources to separate files.
Add `#not-kind-eq?`, `#same-line?` and `#not-same-line` custom predicates.
Improve the rust and c indent queries.

* Fix indent test.
Improve rust indent queries.

* Move indentation tests to integration test folder.

* Improve code style in indent.rs.
Reuse tree-sitter cursors for indentation queries.

* Migrate HCL indent query

* Replace custom loading in indent tests with a designated languages.toml

* Update indent query file name for --health command.

* Fix single-space formatting in indent queries.

* Add explanation for unwrapping.

Co-authored-by: Triton171 <triton0171@gmail.com>
2022-03-31 00:08:07 +09:00
Michael Davis
7cd6050235 add tree-sitter-gleam 2022-03-30 13:24:53 +09:00
Michael Davis
1819478940 update tree-sitter-elixir
news:

- tree-sitter-elixir now powers Elixir syntax highlighting on github.com
- GitHub now supports code-navigation for Elixir repos via
  tree-sitter-elixir

changes:

- modules now use the `@module` highlight, which was added upstream to
  tree-sitter
    - it seems appropriate to use `@namespace` to follow helix convention
- added nullary range operator (e.g. `Enum.to_list(..) == []`), a new syntax
  for elixir 1.14
- a fix for stab clause nodes mis-highlighting when the right hand side of
  the stab clause contained multiple simple expressions
2022-03-30 13:24:53 +09:00
Michael Davis
e2a50711d5 update tree-sitter-erlang
changes:

- typed fields within records which do not declare a default
  value are now correctly highlighted as record fields
- the EEP49 'maybe' form is now parsed
- fixes for highlights for 'begin' and 'after' tokens
2022-03-30 13:24:53 +09:00
Jared Ramirez
22ba668fad
Fix Rescript hightlights query (#1863) 2022-03-23 14:03:58 -05:00
Slin Lee
3e78b8fdad
Add syntax highlighting for Solidity (#1854) 2022-03-22 11:38:49 -05:00
zetashift
7eb013c6fb
Initial basic Org markup support thanks to tree-sitter-org (#1845) 2022-03-20 17:14:30 -05:00
Michael Davis
cfd992b151
update tree-sitter-git-commit (#1838)
changes:

- any text following a (scissors) is now contained in one (message)
    - this vastly improves performance on large verbose commits:
      no more slowness on huge commits
2022-03-19 14:43:13 +09:00
Philipp Mildenberger
6fdf5d0920
C# highlighting improvements (#1795) 2022-03-12 12:06:56 -06:00
Daniel S Poulin
9bfb0caf1b
Add comment textobject for surround selection and navigation (#1605) 2022-03-06 10:54:24 +05:30
Michael Daffin
93ec42d06e
Add support for HCL language (#1705)
Queries based on the neovims ones: https://github.com/nvim-treesitter/nvim-treesitter/tree/master/queries/hcl and modified for helix support.
2022-02-25 17:48:20 +09:00
Michael Daffin
f83843ceba
Add kotlin language (#1689)
* Add kotlin language

Queries taken from https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/kotlin seem to work well enough for my needs though I don't use kotlin heavily.

* Update lang-support doc

* Updates the kotlin highlight query to use helixs scopes

* Updates the queries from PR feedback

* Adds 'shallow = true' to gitmodules

* Removes kotlin locals.scm

* Remove blank line

Co-authored-by: Ivan Tham <pickfire@riseup.net>

Co-authored-by: Ivan Tham <pickfire@riseup.net>
2022-02-23 23:25:44 +09:00
Alex
d5ba0b5162
Allow separate styles for markup headings (#1618)
* update markdown highlighting to use separate heading themes

* remove markdown theme scopes in ui
2022-02-21 16:45:48 +09:00
Michael Davis
3a83a764e3
add tree-sitter-erlang (#1657) 2022-02-15 10:14:02 +09:00
Jared Ramirez
f5b95beef6
feat(languages): rescript (#1616)
* Add rescript language support

* cargo xtask docgen

* Add textobjects & file line ending

* Fix text objects & rerun docgen

* Fix textobjects queries
2022-02-06 14:24:01 +09:00
Daniel S Poulin
d6b6ad879e
epocsquadron/add tree sitter twig (#1602)
* Add tree-sitter-twig grammer and highlights

The gammar itself is quite basic, but is much better than nothing
for working with real files consisting mostly of html.

* Docgen for newly added grammar
2022-02-01 12:35:07 +09:00
Daniel S Poulin
e2833b5853
Add textobjects queries for php (#1601)
* Add textobjects queries for php

* Missing EOL fix

* Update generated docs after adding textobjects to php
2022-01-30 11:04:36 +09:00
Michael Davis
7bce91556a
add tree-sitter-iex (#1576)
* add tree-sitter-iex

* run docgen task

* fix url for iex submodule
2022-01-25 15:50:34 +09:00
Jared Ramirez
0b55b21f30
feat(languages): GraphQL (#1515)
* Add Graphql language support

* Fix docs gen

* Add JS Graphql injection query

* Updates based on PR feedback

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2022-01-21 23:16:40 +09:00
Mathis Brossier
fd7080498e
tree sitter comments injections (#1527)
* tree sitter comments injections

* trailing newlines & julia fix

* Update runtime/queries/julia/injections.scm

Co-authored-by: Michael Davis <michael.davis@nfiindustries.com>

Co-authored-by: Michael Davis <michael.davis@nfiindustries.com>
2022-01-21 00:50:06 +09:00
Jared Ramirez
b2c8aa1ee7
feat(languages): Elm (#1514)
* Add Elm language support

* Fix docs gen

* Updates based on PR feedback
2022-01-21 00:47:23 +09:00
Anders Christiansen Sørby
8ea5742b08
feat(languages): Lean experimental tree-sitter-lean (#1422)
* Add experimental tree-sitter-lean

* Run docgen

* Copy over the queries from lean.nvim

* Update .gitmodules

Co-authored-by: Ivan Tham <pickfire@riseup.net>

* Update lean highlights and run docgen

* Update runtime/queries/lean/injections.scm

Co-authored-by: Michael Davis <michael.davis@nfiindustries.com>

* Lean: Move variable matcher to bottom

* Update runtime/queries/lean/locals.scm

Co-authored-by: Michael Davis <michael.davis@nfiindustries.com>

Co-authored-by: Ivan Tham <pickfire@riseup.net>
Co-authored-by: Michael Davis <michael.davis@nfiindustries.com>
2022-01-17 23:05:17 +09:00
Daniel S Poulin
dd1f64d4dc
Update tree-sitter-php to latest upstream (#1521)
Brings in PHP 8.1 features, like enums, union types and the like.
2022-01-16 10:11:47 +09:00
voroskoi
6bfd001b48
Update zig tree-sitter (#1501)
use latest upstream version
move comptime from @keyword.function to @keyword.directive
use AssignOp
enhance indents
2022-01-14 22:29:24 +08:00
Blaž Hrastnik
ddbf03613d Update tree-sitter-go with generics support 2022-01-11 19:10:02 +09:00
Michael Davis
e0a99ae51a
add tree-sitter-git-config (#1426)
* add tree-sitter-git-config

* add todo comment for improving filetype check
2022-01-09 22:10:20 +08:00
Eric Crosson
1c6bc6d455 feat: add tree-sitter-make
This commit adds syntax highlighting for GNU Make[^1] makefiles
via tree-sitter-make[^2].

[^1]: https://www.gnu.org/software/make/
[^2]: https://github.com/alemuller/tree-sitter-make
2022-01-09 00:30:22 +09:00
Owen Shepherd
c238f20e1d Add fixity keywords to haskell's highlights.scm 2022-01-09 00:28:56 +09:00
Owen Shepherd
9eacbc1887 Upgrade haskell queries 2022-01-09 00:28:56 +09:00
Michael Davis
b799b0d50e
capture markdown link text as markup.link.text (#1456) 2022-01-09 00:27:50 +09:00
Michael Davis
a8fd33ac01
add tree-sitter-regex (#1362)
* add tree-sitter-regex

* adapt regex highlights from upstream

* inject regex into elixir sigil_r/2 and sigil_R/2

* generate lang-support docs

* capture interesting nodes in character-ranges

* make $.character_class captures more consistent

* fix fallthrough behavior for character classes

* capture pattern characters as 'string'

* use latest tree-sitter-regex

* set elixir regex injections as combined

* add link to upstream queries

* inject regex in rust into 'Regex::new' raw string literals
2022-01-06 23:00:00 +08:00
Philipp Mildenberger
66afbc9fff
Fix null and boolean constants in tree-sitter-nix highlights queries (#1428) 2022-01-06 11:04:55 +09:00
Sebastian Neubauer
5b1a628e81
Add textobjects and indents to c and cpp (#1293)
Indentation of single line statements doesn't work, i.e.

  for (;;)<hit enter>
leads to
  for(;;)
  <cursor here>

Only blocks with curly braces are indented.
2022-01-04 10:53:04 +09:00
Sebastian Neubauer
641255ccc8
Add llvm-mir highlighting (#1398)
* Add injection regex for more languages

To support embedding them in other languages like markdown.

* Add llvm-mir highlighting

LLVM Machine IR is dumped as yaml files that can embed LLVM IR and
Machine IR.

To support this, add a llvm-mir-yaml language that uses the yaml
parser, but uses different injections to highlight IR and MIR.

* Update submodule with fixed multiline comments

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2022-01-04 10:52:34 +09:00
Triton171
4da050b4bb
Add basic indentation for languages without treesitter-based indentation rules (always use the indent of the current line for a new line). (#1341)
Fix several bugs in the treesitter indentation calculation.

Co-authored-by: Triton171 <triton0171@gmail.com>
2022-01-03 11:03:57 +09:00
Sebastian Neubauer
8f2af71340
Add LLVM TableGen highlighting (#1409)
Add a tree-sitter grammar and highlights for TableGen files.
TableGen and its grammar are described here:
https://llvm.org/docs/TableGen/index.html

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2022-01-03 10:57:55 +09:00
Flakebi
0dab6c8c17 Fix markdown code-block highlighting
Markdown code blocks should be highlighted as a single block, so set
injection.include-children.
2022-01-01 17:36:12 +08:00
Michael Davis
8fda87af2b
add tree-sitter-git-rebase (#1402)
* add submodule on tree-sitter-rebase, add to languages

* add basic highlights query

* inject bash in execute statements

* update tree-sitter-rebase

* tree-sitter-rebase->tree-sitter-git-rebase

* get injection working with tree-sitter-git-commit

* set scope under source.gitrebase

* unset include-children on commit message injections

* Revert "unset include-children on commit message injections"

This reverts commit 2ecee155ea8e229651920b291062c2ee84b47944.

* fix generated language docs

* use rebase_command scopes from tree-sitter-git-commit
2021-12-31 06:58:47 +08:00
Michael Davis
bcf3808e97
Add tree-sitter-git-diff (#1373)
* add submodule on tree-sitter-git-diff

* add git-diff highlights

* inject git-diff into git-commit

* update tree-sitter-git-commit with fix for bad diff case

* add git-diff to language support docs

* include-children in diff injections

This ensures that children nodes of $.message are included in the
injection, such as $.user or issue/pr numbers. Without this change,
diffs containing '#' or '@' characters can trip up the injection and
be parsed separately.

See https://github.com/helix-editor/helix/pull/1373#issuecomment-1001215629

* set diff language's scope as source.diff
2021-12-30 00:31:23 +09:00
Sebastian Neubauer
8c29b76bcc
Improve llvm highlighting and queries (#1388)
* Improve llvm highlighting and queries

The llvm tree-sitter parser was updated to support scopes and more
accurate highlighting.

* Group highlight expressions better
2021-12-29 18:30:44 +09:00
Stuart Hinson
7001665342
Add ruby indents (#1372)
* Add ruby indents

* Include ruby in generated docs
2021-12-27 13:07:09 +09:00
Michael Davis
6af0d51dc5 highlight rebase-commands as markup.raw 2021-12-26 00:12:49 +09:00
Michael Davis
c3fb86cbaa tree-sitter-gitcommit->tree-sitter-git-commit 2021-12-26 00:12:49 +09:00
Michael Davis
28c9afdd0e add commented-out diff and rebase injection queries 2021-12-26 00:12:49 +09:00
Michael Davis
78f93239b5 add gitcommit highlights 2021-12-26 00:12:49 +09:00
Sebastian Neubauer
ec878e4011
Add textobjects and indents to cmake (#1307) 2021-12-26 00:10:19 +09:00
Stuart Hinson
bb684a2b42
Typo fix in ocaml indents.toml (#1342) 2021-12-24 10:05:29 +09:00
Gokul Soumya
a8618cf111
Add precise rust queries for use, mod, as (#1339)
- Differentiates between `as` keyword as a binary type cast
  operator and import renamer.
- `mod` and `use` are now under `@keyword.control.import`,
  but `mod` is a `@keyword` if used as `mod name;`.
2021-12-23 12:10:24 +09:00
Midnight Exigent
dba22c60ed
Support dockerfiles (#1303)
* allow language.config (in languages.toml) to be passed in as a toml object

* Change config field for languages from json string to toml object

* remove indents on languages.toml config

* fix: remove patch version from serde_json import in helix-core

* Use same tree-sitter-zig as upstream/master

* fix(completion_popup): Fixes #1256

* Update helix-term/src/ui/completion.rs

* feat(languages): Add support for `Dockerfile`s

* docs(cargo-xtask-docgen):

* improvement(langs-dockerfile): Add `injection-regex` to `languages.toml` for
`Dockerfile`

* improvement(langs-dockerfile): Add injections.scm

* Update .gitmodules

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2021-12-21 18:22:15 +09:00
Sebastian Neubauer
205dc8776b
Add fish highlighting (#1308)
The highlights were copied and modified from
https://github.com/nvim-treesitter/nvim-treesitter/blob/master/queries/fish/highlights.scm
2021-12-21 11:02:53 +09:00
Gokul Soumya
f1c634326b
Improve rust syntax highlighting (#1295)
- Highlight fragment specifiers (expr, tt, in macro
  definitions) with @type.
- Highlight attributes as macros
2021-12-20 11:47:40 +09:00
Sebastian Neubauer
23091c9d29
Highlight comments in c, cpp, cmake and llvm (#1309)
Also, reuse the c injections in glsl
2021-12-20 11:42:23 +09:00
Michael Davis
e72786df8e
Add tree-sitter-comment (#1300)
* Add tree-sitter-comment

Fix #1164

* fix precedence in tree-sitter-comment highlights

connects https://github.com/helix-editor/helix/pull/1170

* set injection-regex for comment language

* remove comment filetype

* fix comment injections for neovim-style injections tags

* add comment injections for elixir

* remove f.comment

* fix spacing in .gitmodules

* run 'cargo xtask docgen'

Co-authored-by: Ivan Tham <pickfire@riseup.net>
2021-12-19 23:56:56 +09:00
Gokul Soumya
7c01d92653 Add link and quote queries for markdown
- Rename markup.underline.link to markup.link.url
- Add markup.link.label
- Add markup.quote

(The constructor theme scope was missing from the
docs, so unrelated to this commit).
2021-12-19 15:23:39 +09:00
Gokul Soumya
d52eda5d1b
Improve yaml syntax highlighting highlighting (#1294) 2021-12-19 10:20:52 +09:00
Luke Jones
edf3c70c30
Add dart lsp config and queries (#1250)
* Add language: dart

The setup requires that dart be in the users path, such as:
```
export PATH="$HOME/Android/flutter/bin/cache/dart-sdk/bin/:$PATH"
```

Refactor the dart highlights

* lang: dart: add indents and locals

* lang: dart: corrections to local scope

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2021-12-18 13:41:32 +09:00
Oliver Hechtl
0683f0a20a
Add scala syntax highlights (#1278)
* add partial scala syntax highlights

* ran cargo xtask docgen

* updated tree-sitter-scala, fixed highlights

* fix comments

* move identifier to the end of the highlights

* add indents
2021-12-18 13:40:34 +09:00
Blaž Hrastnik
5d91335d6b Fix more highlight scopes 2021-12-17 17:04:59 +09:00
Blaž Hrastnik
9c484e88cf highlights: @include -> @keyword.control.import 2021-12-17 17:04:59 +09:00
Blaž Hrastnik
78b6155292 Partly fix julia's locals.scm 2021-12-17 17:04:59 +09:00
ath3
a8060c06d1
Add indents.toml to perl (#1280) 2021-12-17 09:56:07 +09:00
Blaž Hrastnik
ac4b72fcc8 Add injections query for markdown 2021-12-15 18:03:02 +09:00
Blaž Hrastnik
40969ad452 Partly fix latex highlights and add markup scope docs 2021-12-15 17:46:40 +09:00
Blaž Hrastnik
49e0678741 Add markdown grammar
Fixes #215
2021-12-15 00:50:11 +09:00
Kirawi
6f1a7b1220
Add llvm grammar (#1167) 2021-11-29 10:38:17 +09:00
Kirawi
4ec20eaeff
Add language support for WGSL (#1166) 2021-11-27 07:49:40 +05:30
Mateusz S. Szczygieł
e0540fbcc4
Add json indents.toml file (#1055)
* add glsl language support

* glsl: use indents.toml file

* add json indents.toml
2021-11-11 01:01:19 +09:00
Mateusz S. Szczygieł
3f0345ff58
glsl support (#993)
* add glsl language support

* glsl: use indents.toml file
2021-11-09 00:48:00 +09:00
ath3
30744646cb
Perl support (#978) 2021-11-08 10:05:12 +09:00
Kirawi
ee889aaa85
Updated tree-sitter query scopes (#896)
* updated theme scopes

variable.property -> variable.field
property -> variable.field

* updated theme scopes

* update book and themes

updated book and themes to reflect scope changes

* wip

* update more queries

* update dark_plus.toml
2021-11-03 12:00:52 +09:00
Daniel Poulin
9e247bf6ee Add indents definition based on the one from nvim-treesitter 2021-11-02 17:53:24 +09:00
Houkime
a1c7e55e3b
update cpp queries (#930)
Co-authored-by: Houkime <>
2021-10-29 14:11:19 +09:00
Michael Davis
7e6ade9290 fix: string.regex{=>p} 2021-10-27 10:03:33 +09:00
Michael Davis
bf20e51044 use punctuation.special for interpolation #{ } 2021-10-27 10:03:33 +09:00
Gokul Soumya
4ee92cad19
Add treesitter textobjects (#728)
* Add treesitter textobject queries

Only for Go, Python and Rust for now.

* Add tree-sitter textobjects

Only has functions and class objects as of now.

* Fix tests

* Add docs for tree-sitter textobjects

* Add guide for creating new textobject queries

* Add parameter textobject

Only parameter.inside is implemented now, parameter.around
will probably require custom predicates akin to nvim' `make-range`
since we want to select a trailing comma too (a comma will be
an anonymous node and matching against them doesn't work similar
to named nodes)

* Simplify TextObject cell init
2021-10-23 11:41:19 +09:00
ath3
787ba4f233
CMake support (#888) 2021-10-23 08:57:21 +09:00
Blaž Hrastnik
a03b12530c
Merge pull request #830 from the-mikedavis/official-elixir-tree-sitter
prefer elixir-lang/tree-sitter-elixir
2021-10-18 15:13:39 +09:00
WindSoilder
bb011f9fb2
Add indents for python, but it's not perfect. (#837)
* add indents for python, but it's not Perfect

* add last line
2021-10-18 10:01:53 +09:00
Michael Davis
4d8eb09b7c
scope arities in captures as operators 2021-10-17 10:50:20 -05:00
Michael Davis
80b54f2f69
use special.string.symbol instead of symbol
this aligns better with how ruby highlights symbols
2021-10-17 10:50:20 -05:00
Michael Davis
8f658f0dce
use latest tree-sitter-elixir with 'not in' query support
connects https://github.com/elixir-lang/tree-sitter-elixir/issues/9
2021-10-17 10:50:20 -05:00
Michael Davis
4771cc7ee4
align highlight scopes with documented scopes 2021-10-17 10:50:20 -05:00
Michael Davis
c502cafecc
highlight calls to erlang modules as types
connects https://github.com/elixir-lang/tree-sitter-elixir/pull/5
2021-10-17 10:50:20 -05:00
Michael Davis
b2655a7f5c
add LICENSE snippet at elixir hightlights top 2021-10-17 10:50:19 -05:00
Michael Davis
95ab40d171
use the warning type for tree-sitter ERRORs 2021-10-17 10:50:19 -05:00
Michael Davis
5db248cc1c
describe atoms as tags 2021-10-17 10:50:19 -05:00
Michael Davis
d1b434d230
add highlights query from elixir-lang/tree-sitter-elixir 2021-10-17 10:50:19 -05:00
Michael Davis
e216e9621e
Enable c-sharp language and highlights (#861) 2021-10-17 13:45:09 +09:00
Michael Davis
be428a295a
fix digit escapes in java & php highlights (#846) 2021-10-16 18:02:06 +09:00
Michael Davis
e069fb9dea
Add highlight support for tree-sitter-query language (tsq) (#845)
* add submodule on tree-sitter/tree-sitter-tsq

mark tsq submodule as shallow

* add tree-sitter-tsq to languages

* add highlight queries for tsq

* Update .gitmodules

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2021-10-16 17:58:04 +09:00
Thomas Wehmöller
a7f49fa56f
Add Vue tree sitter grammar (#787)
*  Add vue tree sitter support

* Update .gitmodules

Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
2021-10-10 22:09:17 +09:00
voroskoi
0e06c10d8c
Zig tree-sitter rework (#811)
- update tree-sitter-zig subproject
- use highlights.scm from upstream, just use helix scopes
- update indents.toml, this one actually works
2021-10-05 12:18:15 +09:00
Raphael Megzari
b2195e08b5
languages: add svelte support (#733)
* languages: add svelte support

* languages: add svelte injections
2021-09-17 11:04:55 +09:00
cbarrete
394cc4f30f
Update ledger treesitter injections (#732)
Co-authored-by: Cédric Barreteau <cbarrete@users.noreply.github.com>
2021-09-09 10:13:11 +09:00
Blaž Hrastnik
4cc562318a Improve docs, fix up a few highlight scopes 2021-09-07 13:03:48 +09:00
Blaž Hrastnik
4ac29434cb syntax: Add go & rust locals, improve tree-sitter error message 2021-09-06 18:13:52 +09:00
Blaž Hrastnik
2bef245b7a At least partly highlight tsx 2021-09-06 15:25:46 +09:00
Blaž Hrastnik
d85a8adb27 Improve highlighting scopes 2021-09-06 15:25:46 +09:00
Blaž Hrastnik
9b9c3c77f8 runtime: Query improvements 2021-09-06 15:25:46 +09:00
Blaž Hrastnik
ade1a453ef syntax: Improve go highlights 2021-09-06 15:25:46 +09:00
Blaž Hrastnik
a6108baec9 Improve grammar definitions 2021-09-06 15:25:46 +09:00
oberblastmeister
5766f5da8f
OCaml support (#666)
* added some stuff

* add interface

* indent

* highlights and locals

* scope

* change some stuff

* add indents

* fix blanket highlight

* macro

* use inherits
2021-09-02 01:08:08 +09:00
oberblastmeister
ae3f936611
Lua support (#665)
* added submodule

* small changes

* updated some stuff

* remove

* shallow clone

* correct indent

* shallow

* ok

* highlights

* proper captures
2021-09-02 00:54:21 +09:00
oberblastmeister
1586b0eec7
YAML support (#667)
* added submodule

* remove wrong one

* added highlights

* use property

* add indents

* shallow
2021-09-02 00:16:16 +09:00