Commit graph

140 commits

Author SHA1 Message Date
Omar Valdez
fc7657a071
feat(c): inject printf in concatenated strings 2024-05-05 23:16:26 -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
Jaehwang Jung
07a404570f fix(c): don't highlight preproc_arg
`preproc_arg` is used for the body of `#define` macro definition, which
is not appropriate to highlight with `@function.macro`. In addition,
this region has an injection to C, so it will get highlights anyway.
2024-03-27 14:48:11 +01:00
Phạm Huy Hoàng
722617e672 refactor(format): drop extra indentation for field 2024-03-21 15:51:26 +01: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
Chad Condon
b781fd0582
fix(c): improve doxygen comment matching (#6278) 2024-03-11 19:02:53 +02:00
Riley Bruins
18aa5ae3fd feat(c): local label highlights 2024-02-26 07:41:41 -05:00
Phạm Huy Hoàng
77e298e4de chore: format queries 2024-01-21 23:55:02 +09:00
Phạm Huy Hoàng
d198a75e2c
Fixup format (#5934)
* fix(format): newline between top-level field defs

* fixup: newline between node and comment

* fixup: optimize pattern
2024-01-20 18:47:56 +09:00
Pham Huy Hoang
57a8acf0c4 chore: query formatting 2024-01-19 16:58:37 +01:00
Pham Huy Hoang
edee83272e refactor: manual pre-cleanup
Moving comments, adding `format-ignore` to lines that will be better
with it
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
ObserverOfTime
17fae3f4a3 feat(injections): add printf format strings 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
Pham Huy Hoang
107e61afb7 refactor: Remove all (ERROR) @error captures
As discussed in PR#5421, capturing `@error` is inconsistent, requiring
deep nesting (or priority) in order to correctly have red backgrounds to
it.

Some queries has this capture, some don't. For consistency purposes,
removing all of them is more preferable.

For re-enabling error, either add `(ERROR) @error` or `(ERROR _ @error)`
to your custom queries.
2023-10-25 18:18:50 +02:00
Amaan Qureshi
eb96ca52a7 fix(c): add missing folds 2023-10-04 06:36:59 -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
Amaan Qureshi
b5f2030312 chore(c-family): inject all preproc args again 2023-08-13 18:57:23 -04:00
Amaan Qureshi
e0f4782978 feat(c): mention how to highlight K&R functions 2023-08-13 18:57:23 -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
Amaan Qureshi
41f35eac4f fix(c-family): inject into preproc args in preproc defs when it spans multiple lines only 2023-08-11 14:38:50 -04:00
Amaan Qureshi
acd9d2115d feat(c): update highlights 2023-08-11 14:38:50 -04:00
Amaan Qureshi
6aababfca4 chore: update C, improve preproc_arg highlights 2023-07-27 07:29:33 -04:00
Amaan Qureshi
f590e13d6d fix(c): only inject in preproc function calls/definitions 2023-07-27 05:40:44 -04:00
Amaan Qureshi
ad3805f5c3
fix(c)!: update C, CPP parsers and queries
also update derived parsers (arduino, cuda, glsl, hlsl, ispc, objc)
2023-07-27 09:51:13 +02:00
Christian Clason
e58bbe83f9 lint(locals): use #set! to keep query linter happy 2023-06-22 08:39:17 +02:00
Christian Clason
a034c7aa25
fix(highlights): lower priority for codeblocks with injections (#4905) 2023-06-05 14:09:44 +02:00
Amaan Qureshi
654216eb04 fix(c): types are optional in sized_type_specifier 2023-04-21 04:55:20 -04:00
Amaan Qureshi
b9ed96bb6f feat(c): highlight parenthesized function pointer decl identifiers as @function 2023-04-21 03:26:13 -04:00
Pham Huy Hoang
9161093fc7 fix(c_indents): fix expression leaking indents 2023-04-08 09:59:21 -07:00
George Harker
cb568af539 use indent.X syntax for captures and properties of set directives
update CONTRIBUTING.md

adjust indents for bass

fix doc capture comment
2023-03-24 13:07:53 -04:00
George Harker
b4fcc61175 split delimiter into open_delimiter and close_delimiter 2023-03-24 13:07:53 -04:00
Amaan Qureshi
5a87bc98da feat: add @comment.documentation where applicable 2023-03-05 17:15:32 -05:00
ObserverOfTime
6ae94e0341 highlights(c): extern in linkage specification 2023-01-26 17:39:24 +01:00
Pham Huy Hoang
f669924df2 indents(c): update if cases 2023-01-14 04:52:21 -08:00
Pham Huy Hoang
2f5deed456 indents(c): Refactor indent queries 2023-01-14 04:52:21 -08:00
Stephan Seitz
b019eb3032 indents(c): treat "#ifndef", "#elif" like "#ifdef" 2022-12-31 16:27:05 +01:00
Stephan Seitz
d6a2ecb8b7 highlights: create subscoping for ternary operator
After https://github.com/nvim-treesitter/nvim-treesitter/issues/470,
we decided to use `@conditional` for ternary operator instead of
operator despite `@conditional` is documented for keywords only.
A sub-scoping can make it easier for people to highlight this operator
group differently.

Also unify the usage of `@conditional...` across languages.
2022-12-02 21:42:11 +01:00
Aaron Rancsik
4b99343d6e highlights(c): primitive type as builtin 2022-12-01 15:08:07 +01:00
ObserverOfTime
7ce62670b2 highlights(c): use more specific groups
Co-Authored-By: Stephan Seitz <stephan.seitz@fau.de>
2022-11-26 13:17:51 +02:00
ObserverOfTime
9b43ab819c highlights: use @preproc where appropriate 2022-10-15 08:49:01 -07:00
ObserverOfTime
b945aa0aab highlights(c): highlight standard streams 2022-10-15 08:12:55 -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
04e62a2027 Split func/method definition from calls in C highlighting queries 2022-08-03 12:05:30 -07:00
Stephan Seitz
f9176e560c highlights(c/cpp): move attributes to C (again)
Let's hope that this time the C tests pass, also for the built-in C
parser.
2022-07-28 08:24:51 +02:00
mliszcz
71395d90c0 highlights(c): Lower the priority of @variable
Lower the priority of @variable to prefer @parameter
highlight when identifier appears in parameter_declaration.

Fixes #3061
2022-07-20 17:10:51 +02:00