Commit graph

119 commits

Author SHA1 Message Date
Kieran Siek
55ae574195 Fix panic!, assert*!, and dbg! macro queries. 2025-02-04 23:49:34 +01:00
flippette
427a90ae70
feat(rust): highlight "gen" and "raw" keywords (#7419) 2024-11-29 19:38:12 +01:00
Riley Bruins
01a92da438 fix(rust): highlight parameters with ref in definition 2024-11-03 11:46:40 +01:00
Riley Bruins
00d2190683 fix(rust): regex injections, highlights
**Problem:** Rust's regex injections were not applied since the string
content is behind a `(string_content)` node, and the injections were
applied to the parent node without the `include-children` directive.

**Solution:** Apply the injections to the string content. Also highlight
them accordingly.
2024-10-27 11:51:33 +01:00
Riley Bruins
649f6a1636
fix(rust): separate import folds from others (#7279) 2024-10-24 05:16:55 +00:00
Omar Valdez
188b1a6d01
feat(highlights): capture wildcard patterns as @character.special (#7153) 2024-09-20 08:15:01 +02:00
Amaan Qureshi
6a3c6a42a6
fix(rust): comment marker should not be @operator (#7135) 2024-09-10 17:47:17 +00:00
Tobias Schmitz
8724e7d028 feat(rust): add highlight for shorthand_field_identifier 2024-08-22 09:11:55 -04:00
Omar Valdez
d13f0183ba
feat(highlights): capture wildcard imports as @character.special 2024-08-01 10:24:40 +02:00
Riley Bruins
94f9a46b37
feat(rust): fold block expressions (#6754) 2024-06-10 09:44:00 -07:00
Riley Bruins
1be5aa99e3 feat(rust): underscore match arms, parameters 2024-05-08 08:34:42 -04:00
Riley Bruins
9a47a523e3 feat: import statement folds for common languages 2024-05-01 10:00:01 +02:00
Riley Bruins
f58cae6c22 feat: more @keyword.type captures 2024-05-01 09:59:50 +02:00
Amaan Qureshi
53c48a9229 fix(rust): update queries from upstream 2024-04-07 02:58:11 -04:00
ganhaque
1b050206e4
fix(rust): indentation in multi-line tuple pattern (#6402)
* fix(rust): indentation in multi-line tuple pattern

* test(indent): rust - add test for tuple pattern indent
2024-04-04 15:12:31 +00:00
ganhaque
5489e2150f fix(rust): indentation in multi-line for expression
Fix indentation when the for loop expression is on multiple lines

Example:

previous:

```rust
for (
    abc,
    def
) in thing.iter() {
        // ...
    }
```
new:

```rust
for (
    abc,
    def
) in thing.iter() {
    // ...
}
```
2024-04-04 09:50:27 +02:00
ganhaque
4d4b63692f fix(rust): indentation in tuple type patterns 2024-04-04 09:50:27 +02:00
Amaan Qureshi
3d473a4d5d fix(rust): indentation in tuple struct patterns 2024-03-26 22:34:53 -04:00
Phạm Huy Hoàng
722617e672 refactor(format): drop extra indentation for field 2024-03-21 15:51:26 +01:00
Amaan Qureshi
c28396de30 feat(rust): improve indents 2024-03-21 06:48:53 -04:00
Amaan Qureshi
4d76587eec fix(rust): dedent on macro definition end 2024-03-20 19:22:23 -04:00
Riley Bruins
3c7a0e9d94 feat(rust): move pub to @keyword.modifier
Also consolidates most of the captures
2024-03-16 20:45:29 -04:00
Jaehwang Jung
8f5513a1f2 feat(rust,lalrpop): @attribute for lifetimes
`@keyword` is only for language-defined keywords.
2024-03-16 20:51:16 +08:00
Jaehwang Jung
dccf31f9b1 feat(highlights)!: @keyword.storage@keyword.modifier 2024-03-16 20:51:16 +08:00
Jaehwang Jung
998b230a77 feat(highlights)!: keyword @type.qualifier@keyword.modifier 2024-03-16 20:51:16 +08:00
Christian Clason
99ddf57353
feat(highlights)!: enforce documented captures (#6232)
Problem: Allowing undocumented "secret" (sub)captures makes it harder
to write comprehensive colorschemes and catch inconsistent captures.

Solution: Only allow captures listed in CONTRIBUTING.md. Add useful
(cross-language) subcaptures and drop language-specific or too niche
ones.

Follow-up: Adding further `*.builtin` captures and changing queries to
use them.

Language-specific subcaptures should instead be added in user config or
a custom language plugin.
2024-03-03 11:00:11 +01:00
Amaan Qureshi
6f1f407d71 feat(rust): add more regex injection queries 2024-02-25 09:05:08 -05:00
Christian Clason
17d68ac13c feat(rust): add doc comments 2024-02-17 13:24:12 +01:00
Tobias Hunger
0f3183dda8
feat(slint)!: change to the official parser (#6027)
This change replaces the slint parser written and maintained by @jrmoulton
with the official one hosted in the slint-ui organization on github.

A huge thank you to @jrmoulton for all his work on the tree-sitter
parser!

---------

Co-authored-by: jrmoulton <jaredmoulton3@gmail.com>
2024-02-09 13:46:57 +00:00
Amaan Qureshi
527eb602ff chore(rust): update highlights 2024-01-24 01:29:48 -05:00
Phạm Huy Hoàng
41128a7724 fix(rust): Follow upstream injections
tree-sitter-rust and helix both have `injection.include-children` for
the pattern in this PR. So it's best to changed to match the intended
results
2024-01-24 12:18:32 +09:00
Phạm Huy Hoàng
77e298e4de chore: format queries 2024-01-21 23:55:02 +09:00
Amaan Qureshi
1ce6000a95 fix(rust): add const_item to folds 2024-01-20 18:50:31 +09:00
Pham Huy Hoang
c41d38b70e fix(rust): Add back 1 indent for macro rules (#5834) 2024-01-20 18:50:31 +09:00
Amaan Qureshi
8c629a9327 chore(rust): tweak injections, add json macro injection 2024-01-19 16:58:37 +01:00
Pham Huy Hoang
57a8acf0c4 chore: query formatting 2024-01-19 16:58:37 +01:00
Christian Clason
1ae9b0e455 feat!: align standard captures with upstream
Problem: Sharing highlight queries with upstream tree-sitter and
Helix is difficult.

Solution: Where reasonable, use capture names in tree-sitter's standard
list or Helix's Atom-style hierarchy.

Specifically:

* tree-sitter "standard capture names"
  (3f44b89685/highlight/src/lib.rs (L20-L72)):

  - `@parameter` -> `@variable.parameter`
  - `@field` -> `@variable.member`
  - `@namespace` -> `@module`
  - `@float` -> `@number.float`
  - `@symbol` -> `@string.special.symbol`
  - `@string.regex` -> `@string.regexp`
  - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below)
  - `@text.title` -> `@markup.heading`
  - `@text.literal` -> `@markup.raw`
  - `@text.reference` -> `@markup.link`
  - `@text.uri` -> `@markup.link.url` (in markup links)
  - `@string.special` -> `@markup.link.label` (non-url links)
  - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`)

* Helix captures
  (https://docs.helix-editor.com/master/themes.html#syntax-highlighting):

  - `@method` -> `@function.method`
  - `@method.call` -> `@function.method.call`
  - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}`
  - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}`
  - `@text.uri` -> `@string.special.url` (outside markup)
  - `@preproc` -> `@keyword.directive`
  - `@define` -> `@keyword.directive`(`.define`?)
  - `@storageclass` -> `@keyword.storage`
  - `@conditional` -> `@keyword.conditional`
  - `@debug` -> `@keyword.debug`
  - `@exception` -> `@keyword.exception`
  - `@include` -> `@keyword.import`
  - `@repeat` -> `@keyword.repeat`

* cleanup

  - remove some redundant `@conceal` (but still allow it for conceal-only patterns)
  - remove obsolete `@error` (syntax linting is out of scope for this repo)
  - sort, cleanup capture list in `CONTRIBUTING.md`
2024-01-19 16:58:37 +01:00
Christian Clason
5b90ea2aba feat(locals)!: switch to upstream captures 2024-01-19 16:58:37 +01:00
Riley Bruins
24be1534db fix(rust): highlight inline attributes properly 2023-12-18 11:47:01 -05:00
Amaan Qureshi
557561fbc1 chore(rust): update queries from upstream 2023-11-17 13:32:09 +01:00
Amaan Qureshi
6f8387f05d fix(rust): add foreign_mod_item to folds 2023-10-30 04:30:30 -04:00
Amaan Qureshi
a4f4fcdd3e feat: add Doxygen 2023-08-26 04:58:36 -04:00
Amaan Qureshi
c58694685d feat: add re2c 2023-08-24 02:52:48 -04:00
Pham Huy Hoang
78b54eb7f6 chore(injections)!: update injection syntax to 0.9
Since 0.9, @lang syntax is still available as fallback but will soon be deprecated.
Because of that, new syntax should be adopted once 0.9 becomes the
baseline requirements for nvim-treesitter

- update health check
- update doc
2023-08-12 17:34:15 +02:00
Christian Clason
e58bbe83f9 lint(locals): use #set! to keep query linter happy 2023-06-22 08:39:17 +02:00
Amaan Qureshi
5182759e17 style(rust): better formatting 2023-05-09 08:33:38 -04:00
Amaan Qureshi
6df6dd2622 feat(rust): distinguish enum members better 2023-05-09 08:33:38 -04:00
Iron-E
239bb86b54
feat(rust): capture debug macros as @debug
* ref(rust): highlight debug macros as `@debug`

E.g. `dbg!` and `debug_assert!`

* Update queries/rust/highlights.scm

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>

---------

Co-authored-by: Amaan Qureshi <amaanq12@gmail.com>
2023-05-04 15:49:20 -04:00
Amaan Qureshi
831f37635d feat(rust): move some keywords & operators to where they belong 2023-04-19 02:28:00 -04:00
Jaehwang Jung
fa9fe9a95b fix(rust): highlight SNAKE_CASE scoped identifier name as @constant 2023-04-09 08:12:17 -07:00