Commit graph

56 commits

Author SHA1 Message Date
Christian Clason
692b051b09 feat!: drop modules, general refactor and cleanup 2025-05-12 18:43:40 +02:00
Jonáš Dujava
245ffff7ac
fix(latex): capture nameless color change (#7243)
Color can be changed by directly passing color `model` and `spec`,
so make the `name` field optional.

Signed-off-by: Jonas Dujava <jonas.dujava@gmail.com>
2024-10-14 15:33:36 +02:00
Jonas Dujava
13ee7f8844 feat(latex): capture conditionals
Generically, macros/commands in LaTeX starting on `if` are either
directly conditionals, or have similar purpose/funcionality.

Signed-off-by: Jonas Dujava <jonas.dujava@gmail.com>
2024-09-10 08:23:48 +02:00
Jonas Dujava
4e47268c6d feat(latex): set url attribute for hyperlinks
Signed-off-by: Jonas Dujava <jonas.dujava@gmail.com>
2024-09-01 17:26:13 +02:00
Jonas Dujava
88aa09e6e9 feat(latex): capture left/right math delimiters
Capture math delimiters provided by commands such as
`\left` and `\right`.

Signed-off-by: Jonas Dujava <jonas.dujava@gmail.com>
2024-07-28 11:16:09 +02:00
Jonas Dujava
e265fec94c fix(latex): environment name should be label
Environment names are captured as `@label` in `(begin)` and `(end)`
nodes, and so should they be when we are defining environments.

Signed-off-by: Jonas Dujava <jonas.dujava@gmail.com>
2024-07-26 14:11:34 +02:00
Jonas Dujava
3fa183e34e feat(latex): improve parameters
Signed-off-by: Jonas Dujava <jonas.dujava@gmail.com>
2024-07-23 09:35:25 +02:00
Jonas Dujava
803e5bd14d fix(latex): more @nospell
Apply `@nospell` to command/label names, paths, etc.
Where appropriate, turn spelling off for the whole node.

Signed-off-by: Jonas Dujava <jonas.dujava@gmail.com>
2024-07-23 09:00:11 +02:00
Jonáš Dujava
4ee9f12ff5
refactor(latex): deduplicate captures, reorder 2024-07-22 23:12:18 +02:00
Jonas Dujava
002537a3e3 feat(latex): simplify captures of font changing
Signed-off-by: Jonas Dujava <jonas.dujava@gmail.com>
2024-07-22 00:07:52 +02:00
Jonáš Dujava
625e7e58d0
feat(latex): capture & as @punctuation.delimiter
Signed-off-by: Jonas Dujava <jonas.dujava@gmail.com>
2024-07-21 10:53:59 +02:00
Jonas Dujava
4e387dd478 feat(latex): capture placeholder as variable
Signed-off-by: Jonas Dujava <jonas.dujava@gmail.com>
2024-07-19 17:20:44 +02:00
Jonas Dujava
d9ea5035d4 feat(latex): add additional include highlights
Signed-off-by: Jonas Dujava <jonas.dujava@gmail.com>
2024-07-19 14:53:39 +02:00
Jonas Dujava
c233773abf feat(latex): improve hyperlinks
Signed-off-by: Jonas Dujava <jonas.dujava@gmail.com>
2024-06-23 16:40:32 +02:00
Christian Clason
55d5772a6c feat(latex): highlight hyperlinks 2024-06-23 12:16:51 +02:00
Kai Moschcau
ead283734b feat(latex, query, tablegen, thrift): disable spelling in shebangs 2024-05-01 15:01:48 +02:00
Christian Clason
dbbaa3f66e fix(latex): update parser and queries 2024-04-28 11:58:06 +02:00
Phạm Huy Hoàng
722617e672 refactor(format): drop extra indentation for field 2024-03-21 15:51:26 +01: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
Riley Bruins
eb1914bb10 feat(latex): more text func highlights 2024-02-17 10:58:27 +01:00
gi1242
69e4b99f13
fix(latex): update bibstyle queries (#6102)
Match grammar.js from commit 0d598bb95ffe3ba63403979d0d32158210974ca5 in
latex-lsp/tree-sitter-latex

Co-authored-by: gi1242 <gi1242+nvim-treesitter@gmail.com>
2024-02-15 07:59:28 +00:00
Riley Bruins
127cf25737 feat(latex): pre-compiled header highlights, tests
Also moves comment highlights to the very end to make them more
future-proof.
2024-02-06 10:29:09 +01:00
Riley Bruins
8d6192baa9 fix(latex): give comments higher precedence
This commit also moves things around to give text better precedence in
the case of `textit` and `textbf`.
2024-02-06 10:29:09 +01:00
Riley Bruins
c62874656e feat(latex): operator highlights for _ and ^ 2024-01-24 13:25:42 +01:00
Riley Bruins
f72d9169f2 fix(latex): better environment precedence 2024-01-24 13:25:42 +01:00
Phạm Huy Hoàng
77e298e4de chore: format queries 2024-01-21 23:55:02 +09: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
8ae4080c5b fix(latex): highlight text functions 2024-01-04 20:07:31 +01:00
Ahnaf Rafi
c153019e11 Add @nospell annotation to label definitions and references 2023-12-21 10:55:50 +01:00
Riley Bruins
075a64addc feat: highlight regular latex text to maintain consistency with boldfaced and italic text 2023-11-11 10:14:43 +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
Jaehwang Jung
9567185621 feat: @spell on comments 2023-09-12 17:34:58 +02:00
ObserverOfTime
05fe2c38a3 refactor: replace some match & vim-match usages 2023-08-23 16:57:18 +03:00
Christian Clason
680807fa6a highlights(markup): distinguish heading level in queries
also add a few queries from Helix and remove controversial
code block conceal in Markdown
2023-05-13 16:50:32 +02:00
david-pikas
caa28be705
latex: @nospell for environment names, citations and commands (#3948)
* Added @nospell for environment names and commands

* Added citations to @nospell

Co-authored-by: David Pikas <David.Pikas@iar.com>
2022-12-08 11:01:56 +01:00
ObserverOfTime
9b43ab819c highlights: use @preproc where appropriate 2022-10-15 08:49:01 -07:00
Lewis Russell
2a63ea5665 feat(spell): upstream spell queries from spellsitter 2022-09-06 12:44:19 +01:00
Stephan Seitz
d605120dcc highlights(latex): only highlight command name, not whole command 2022-05-21 13:13:59 +02:00
Christian Clason
db0e519291 latex: capture math env contents 2022-04-15 15:04:29 +02:00
Christian Clason
94f19cad29 latex: update queries
Make use of parser updates
* add `\{re}newenvironment`
* add `\DeclarePairedDelimiter{X}`
* add `\title` and `\author`
* add optional arguments to sectioning commands
* use builtin nodes for math environments
2022-04-14 12:02:20 +02:00
Christian Clason
b6ebdaeb44 fix(latex): update parser and queries 2022-02-27 12:38:45 +01:00
Christian Clason
5e116977e0
fix(latex): update parser and query (#2547) 2022-02-19 11:22:25 +01:00
Christian Clason
3c363ebd26
fix(latex): some highlight query fixes (#2534)
* add \caption to @function
* only highlight contents of curly text groups in references
2022-02-16 17:29:56 +01:00
Christian Clason
8e780a4c9d
refactor(latex): improve queries (#2457) 2022-02-05 16:09:35 +01:00
Christian Clason
a80c8bc506
chore(latex)!: update parser and queries (#2436)
BREAKING CHANGE: queries for latex need adaptation
2022-02-04 10:29:46 +00:00
Jendrik Stelzner
31fe7ee4f9 Add a missing LaTeX hightlight.
Add \eqref to the list of referencing commands.
2022-01-13 09:44:03 +01:00
Jendrik Stelzner
41a097d9c5 Add LaTeX highlights: addpart, addchap, addsec.
Add highlight for the LaTeX sectioning commands \addpart, \addchap, \addsec and their starred variants.
2022-01-12 00:41:26 +01:00
Stephan Seitz
b09e889e3d highlights(latex): highlight chapter*, section*, part* ...
Fixes #1454
2021-06-30 20:36:02 +02:00
Stephan Seitz
89d464744b highlights(latex): use any-of? 2021-05-17 20:36:33 +02:00