Commit graph

69 commits

Author SHA1 Message Date
Riley Bruins
1be5aa99e3 feat(rust): underscore match arms, parameters 2024-05-08 08:34:42 -04: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
Phạm Huy Hoàng
722617e672 refactor(format): drop extra indentation for field 2024-03-21 15:51:26 +01: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
Christian Clason
17d68ac13c feat(rust): add doc comments 2024-02-17 13:24:12 +01:00
Amaan Qureshi
527eb602ff chore(rust): update highlights 2024-01-24 01:29:48 -05: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
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
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
Amaan Qureshi
5a87bc98da feat: add @comment.documentation where applicable 2023-03-05 17:15:32 -05:00
Amaan Qureshi
33ba346e60 feat!: add @keyword.coroutine capture 2023-03-03 07:07:52 -08:00
Stephan Seitz
6a31d9086e highlights(rust): use @namespace for [(crate) (self) (super)]
Fixes https://github.com/nvim-treesitter/nvim-treesitter/issues/3992
2023-01-01 15:32:07 +01:00
Trard
00b42ac6d4 rust: use @type.qualifier and @storageclass 2022-11-06 18:10:42 +01:00
Cormac Relf
00add7e4b4 highlights(rust): pub(self/super/crate), use super::thing, etc 2022-11-06 14:32:47 +01:00
Cormac Relf
68c3533852 highlights(rust): ["<" ">"] @punctuation.bracket in bracketed_type, for_lifetimes 2022-11-06 14:32:47 +01:00
Cormac Relf
1379119c31 highlights(rust): "for" @keyword everywhere else (for<'a>, HRTBs) 2022-11-06 14:32:47 +01:00
Cormac Relf
15d3849dcf highlights(rust): highlight Type in Type::Associated as @type instead of @namespace 2022-11-06 14:32:47 +01:00
Cormac Relf
8c7ffaf66b highlights(rust): panic!() and assert!() as @exception 2022-11-06 11:34:13 +01:00
Christian Clason
dd89cafd2b fix(rust): update queries to breaking changes
* `if_let_expression` was removed in https://github.com/tree-sitter/tree-sitter-rust/pull/152
* `attributes` were reworked in
  https://github.com/tree-sitter/tree-sitter-rust/pull/163 (no more
  `meta-item`)
2022-11-05 11:09:54 +01:00
Stephan Seitz
53742779e3 highlights(rust): distinguish between "for" in loops and impl_item
Fixes #3641
2022-10-15 04:02:20 -07:00
Lewis Russell
37398c7d68 feat(spell): support more languages 2022-09-26 13:47:12 +01:00
Lewis Russell
2a63ea5665 feat(spell): upstream spell queries from spellsitter 2022-09-06 12:44:19 +01:00
lfenzo
c784720917 Split func/method definition from calls in several programming language queries 2022-08-03 12:05:30 -07:00
Stephan Seitz
f301caffc5 highlights(rust): highlight as in <Struct as Trait>::Type 2022-03-11 19:07:11 +01:00
Stephan Seitz
7889b3aea8 highlights(rust): add "yield" keyword 2022-01-16 16:27:29 +01:00
Stephan Seitz
e6eeda7da9 rust(highlights): fix highlighting of char_literal 2021-12-06 21:20:58 +01:00
Sergio Alejandro Vargas
fbbcfa7b6c highlights(rust): organize keywords and literals
- sort keywords
- highlight super as a namespace (same as crate)
- highlight `break` and `continue` as `repeat` keywords
- don't highlight `macro_rules!` as a keyword
- place all literal queries together
- place function definition queries alongside function call queries
2021-11-25 23:53:41 +01:00
Sergio Alejandro Vargas
81f75a54ff highlights(rust): update operators
- sort operators
- remove duplicated `*`
- add missing `<<=`

- highlight `as` correctly in path aliasing
- highlight leading quote `'` as part of a label (not an operator)
- highlight never type `!` as a type

- sort and format punctuation
2021-11-25 23:53:41 +01:00
Lewis Russell
011ac894ec Prefer lua-match over match
as string.find is much quicker than vim.regex:match*
2021-11-23 10:02:06 +01:00
Santos Gallegos
bd13991050
Rust: highlight uppercase identifiers in match arms as constant (#1940)
* Rust: highlight uppercase identifiers in match arms as constant

Closes https://github.com/nvim-treesitter/nvim-treesitter/issues/1928

* Highlight builtins
2021-10-30 12:09:54 -05:00
Santos Gallegos
8cf90f81a4 Rust: highlight loop labels
Closes https://github.com/nvim-treesitter/nvim-treesitter/issues/1891
2021-10-01 22:33:49 +02:00
Santos Gallegos
f05f471185 Rust: fix some highlights
Closes https://github.com/nvim-treesitter/nvim-treesitter/issues/1856
2021-10-01 19:05:19 +02:00
Sergio Alejandro Vargas
eb3a09cb28 highlights(rust): Add colon : to delimiters 2021-09-26 12:24:48 +02:00
Sergio Alejandro Vargas
5ebc74c1a8 highlights(rust): fix bang ! in macro_invocation 2021-09-26 12:24:48 +02:00
Sergio Alejandro Vargas
0cd64db48f highlights(rust): Fix angle brackets, and closures
Highlight angle brackets in type parameters and bars in closures bars as
`@punctuation.bracket` not as `@operator`.
2021-09-26 12:24:48 +02:00
Sergio Alejandro Vargas
a2b9b9bd9d highlights(rust): Reorder macro queries
Derive macros have to be defined before attribute macros to highlight
them properly.

See #570
2021-07-08 23:37:38 +02:00
antonk52
90f15d9bf7 feat(keywords) merge return and yield into keyword.return group 2021-07-04 21:49:17 +02:00
antonk52
bd9095e969 feat(keywords) add keyword.return & keyword.yield 2021-07-04 21:49:17 +02:00
Santos Gallegos
709f3a73b3 Rust: fix macros highlights
- The derive query was incorrect, it was only matching `#[derive(derive)]`
- Macros were being highlighted as keywords
- Procedural macros symbols weren't highlighted (`#`, `#!`)
2021-06-11 07:54:56 +02:00