Commit graph

46 commits

Author SHA1 Message Date
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
gi1242
6a2572c9ed fix(latex): Fold \iffalse..\fi comments 2024-03-17 19:46:21 -04: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
lnay
efe06e3057 Add extra language injections for latex (#4896)
Add python injections to contents of `sagetex` defined environments, similarly to how `pycode` currently treated.
2023-08-12 17:34:15 +02: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
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
Stephan Seitz
31e33b0e66 injections(latex): add support for minted language injection 2022-02-04 22:15:47 +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
Ashish Panigrahi
aba5e9b4d5 feat: add comment highlighting in LaTeX 2021-07-01 10:33:16 +02: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
Stephan Seitz
d89d698c26 highlights(latex): add more math environments
Fix #1293
2021-05-17 20:36:33 +02:00
Stephan Seitz
bb2846fd9b highlights(latex): add more commands 2021-05-17 20:36:33 +02:00
Stephan Seitz
efbb1c66d2 highlights(latex): fix regexes with backslashes
https://github.com/neovim/neovim/pull/14382 requires to escape `\` is regexes if they are verbatim `\`

They change in Neovim was incompatible so people that are still behind that revision will have this regex not matching (but it should at least not error)
2021-05-12 01:12:24 +02:00
Stephan Seitz
712cc78a1e Add text.reference and text.environment 2021-03-30 19:26:37 +02:00
Stephan Seitz
0556edf5f3 latex: add TSMath that behaves like vimtex math highlighting 2021-03-30 19:26:37 +02:00
Stephan Seitz
ea8c3b2850 feat: Add Latex basic highlights and folds
Fix #1104
2021-03-30 19:26:37 +02:00