Commit graph

22 commits

Author SHA1 Message Date
Christian Clason
3d08cdd741 fix(comment): remove duplicate 'FIXME' 2024-03-03 16:03:26 +01:00
Phạm Huy Hoàng
77e298e4de chore: format queries 2024-01-21 23:55:02 +09:00
Christian Clason
5cc5627487 fix(comments)!: consolidate note captures
Distinguishing `hint` and `info` is too confusing; it's enough to have
`error`, `warning`, `todo`, and `note`.
2024-01-20 17:52:50 +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
Jaehwang Jung
905e782e80 perf(comment): remove spell capture
Problem:
Comment highlight query produces too many @spell captures.

Solution:
Remove the query. This is fine because comment parser is only used in
injection and the parent language has @spell for comment.
2023-09-12 17:34:58 +02:00
pseudometa
74a7da4e4b
feat(comment): highlight more comment tags 2023-07-25 09:03:54 -04:00
Santos Gallegos
1b9f704eb8 fix(comment): use #any-of? predicate 2023-06-16 21:21:40 +02:00
pseudometa
e040eda997
feat(comment): Add some common comment tags (#4909)
see also: https://github.com/stsewd/tree-sitter-comment/issues/22
2023-06-09 10:14:08 +02:00
Santos Gallegos
48f4f3ead1
feat(comment): add support for URIs
https and https links are recognized now
ref https://github.com/stsewd/tree-sitter-comment/pull/21
2023-06-04 00:03:09 -04:00
ObserverOfTime
f9cfd40c08 comment: remove user mention highlight 2023-05-10 18:53:57 +03:00
ObserverOfTime
25b656a4b7 comment(highlights): reduce user mention priority 2023-03-20 04:47:56 -04:00
Yochem van Rosmalen
252c1011c4 comment(highlights): add @nospell to tags and user mentions 2023-03-01 15:22:10 -05:00
Santos Gallegos
1ec36fdcd5
comment(highlights): reduce false positives (#4298)
There are a couple cases where the comment highlights
will match things that aren't necessary a tag.
For example in Rust, when commenting a block that deals with
generics (generics are declared as `T: Type`),
this may be distracting.

So, instead of highlighting all tags, we can restrict
to highlighting the explicit keywords.

Ref https://github.com/stsewd/tree-sitter-comment/issues/14
2023-02-13 09:43:26 +01:00
ObserverOfTime
53c26dd4af highlights(comment): improve note tags 2022-11-26 13:17:51 +02:00
Lewis Russell
37398c7d68 feat(spell): support more languages 2022-09-26 13:47:12 +01:00
Erik Westrup
26105050aa
feat(comment): highlight NOTE as @text.note (#3537) 2022-09-23 17:52:00 +00: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
Jaehwang Jerry Jung
c04aa172a3 fix typo in query 2021-06-26 12:19:08 +02:00
Joakker
c699cc2e47 Use #any-of? instead of #match? where posible 2021-06-25 00:22:48 +02:00
Santos Gallegos
4bfccba843 Comment: highlight text nodes
As requested in https://github.com/nvim-treesitter/nvim-treesitter/issues/236#issuecomment-797878646
2021-04-03 10:48:09 +02:00
Santos Gallegos
e4083fc8e1
Add comment parser to highlight comment tags (#893)
Closes #236
2021-03-12 11:21:46 -05:00