60 Commits

Author SHA1 Message Date
eb5b4b9e57 build(deps): bump tree-sitter-vim to v0.7.0 2025-07-12 18:57:52 +02:00
6b233cd1a1 build(deps): bump tree-sitter-vim to v0.6.0 2025-05-03 11:29:34 +02:00
c4e9ff30a6 fix(treesitter): sync queries with upstream
Update C highlight query from nvim-treesitter
2025-03-24 16:45:36 +01:00
d8eec81560 fix(treesitter): update lua, markdown queries 2025-03-15 12:10:22 +01:00
8ba047e33f feat(treesitter): vertical conceal support for highlighter
TSHighlighter now places marks for conceal_lines metadata. A new
internal decor provider callback _on_conceal_line was added that
instructs the highlighter to place conceal_lines marks whenever the
editor needs to know whether a line is concealed. The bundled markdown
queries use conceal_lines metadata to conceal code block fence lines.
2025-02-25 13:09:01 +01:00
1103d9fc10 build(deps): bump tree-sitter-query to v0.5.0 (#32299)
and sync queries from nvim-treesitter (adds support for `MISSING` nodes).
2025-02-04 09:56:11 +01:00
6e44a6a289 fix(treesitter): update queries 2024-11-22 09:39:45 +01:00
09d76afe84 feat(defaults): pretty :help headings #30544
Problem:
Headings in :help do not stand out visually.

Solution:
Define a non-standard `@markup.heading.1.delimiter` group and
special-case it in `highlight_group.c`.

FUTURE:
This is a cheap workaround until we have #25718 which will enable:
- fully driven by `vimdoc/highlights.scm` instead of using highlight
  tricks (`guibg=bg guifg=bg guisp=fg`)
- better support of "cterm" ('notermguicolors')
2024-09-27 08:53:30 -07:00
ae917dbd06 fix(treesitter): sync queries from upstream 2024-09-12 13:41:15 +02:00
9e80738f30 fix(runtime): sync bundled treesitter queries 2024-07-28 16:13:11 +02:00
862338255d fix(runtime): sync bundled treesitter queries 2024-07-24 16:02:53 +02:00
51d85f7ea5 build(deps): drop unused bundled bash, python parsers and queries
Problem: Neovim bundles treesitter parsers for bash and python but does
not use them by default. This dilutes the messaging about the bundled
parsers being required for functionality or reasonable out-of-the-box
experience. It also increases the risk of query incompatibilities for no
gain.

Solution: Stop bundling bash and python parser and queries.
2024-07-09 15:26:48 +02:00
105a9e3dcf build(deps): bump tree-sitter-vimdoc to v3.0.0 2024-06-08 10:19:28 +02:00
61b3a26e5b build(deps): bump tree-sitter-query to v0.4.0 2024-05-26 12:38:20 +02:00
3d4eb9d544 fix(treesitter): update queries 2024-05-05 23:22:11 +02:00
39a0e6bf3c fix(treesitter): update parsers and queries 2024-04-05 18:36:17 +02:00
5e875ae8d0 feat(treesitter): update Markdown parsers and queries to v0.2.1 2024-03-19 09:41:16 +01:00
ff6092b4ee feat(treesitter): update Bash parser and queries to v0.21.0 2024-03-19 09:41:16 +01:00
8a3385dde7 feat(treesitter): update Python parser and queries to v0.21.0 2024-03-19 09:41:16 +01:00
987dff6713 feat(treesitter): update Vimdoc parser and queries to v2.4.0 2024-03-19 09:41:16 +01:00
20dcbaaaf8 feat(treesitter): update Vim parser and queries to v0.4.0 2024-03-19 09:41:16 +01:00
aca4ad430b feat(treesitter): update Lua parser and queries to v0.1.0 2024-03-19 09:41:16 +01:00
8dda630ae9 feat(treesitter): update C parser and queries to v0.21.0 2024-03-19 09:41:16 +01:00
cb46f6e467 feat(treesitter): support URLs (#27132)
Tree-sitter queries can add URLs to a capture using the `#set!`
directive, e.g.

  (inline_link
    (link_text) @text.reference
    (link_destination) @text.uri
    (#set! @text.reference "url" @text.uri))

The pattern above is included by default in the `markdown_inline`
highlight query so that users with supporting terminals will see
hyperlinks. For now, this creates a hyperlink for *all* Markdown URLs of
the pattern [link text](link url), even if `link url` does not contain
a valid protocol (e.g. if `link url` is a path to a file). We may wish to
change this in the future to only linkify when the URL has a valid
protocol scheme, but for now we delegate handling this to the terminal
emulator.

In order to support directives which reference other nodes, the
highlighter must be updated to use `iter_matches` rather than
`iter_captures`. The former provides the `match` table which maps
capture IDs to nodes. However, this has its own challenges:

- `iter_matches` does not guarantee the order in which patterns are
  iterated matches the order in the query file. So we must enforce
  ordering manually using "subpriorities" (#27131). The pattern index of
  each match dictates the extmark's subpriority.
- When injections are used, the highlighter contains multiple trees. The
  pattern indices of each tree must be offset relative to the maximum
  pattern index from all previous trees to ensure that extmarks appear
  in the correct order.
- The `iter_captures` implementation currently has a bug where the
  "match" table is only returned for the first capture within a pattern
  (see #27274). This bug means that `#set!` directives in a query
  apply only to the first capture within a pattern. Unfortunately, many
  queries in the wild have come to depend on this behavior.
  `iter_matches` does not share this flaw, so switching to
  `iter_matches` exposed bugs in existing highlight queries. These
  queries have been updated in this repo, but may still need to be
  updated by users. The `#set!` directive applies to the _entire_ query
  pattern when used without a capture argument. To make `#set!`
  apply only to a single capture, the capture must be given as an
  argument.
2024-03-12 09:32:17 -05:00
71429c90ee build(deps): bump tree-sitter-bash to v0.20.5 2024-02-10 14:49:09 +01:00
f5dc453109 feat(treesitter)!: new standard capture names
Problem: Sharing queries with upstream and Helix is difficult due to
different capture names.

Solution: Define and document a new set of standard captures that
matches tree-sitter "standard captures" (where defined) and is closer to
Helix' Atom-style nested groups.

This is a breaking change for colorschemes that defined highlights based
on the old captures. On the other hand, the default colorscheme now
defines links for all standard captures (not just those used in bundled
queries), improving the out-of-the-box experience.
2024-01-21 10:41:18 +01:00
cfd4a9dfaf feat(lsp): use treesitter for stylize markdown 2023-09-19 14:47:37 +01:00
874b8172a6 build(deps): bump tree-sitter-python to v0.20.4 2023-08-27 10:03:24 +09:00
3836eeb901 feat(treesitter): update C queries from upstream 2023-08-13 12:30:47 +02:00
31c4ed26bc feat(treesitter): add injection language fallback (#24659)
* feat(treesitter): add injection language fallback

Problem: injection languages are often specified via aliases (e.g.,
filetype or in upper case), requiring custom directives.

Solution: include lookup logic (try as parser name, then filetype, then
lowercase) in LanguageTree itself and remove `#inject-language`
directive.

Co-authored-by: Lewis Russell <me@lewisr.dev>
2023-08-11 17:05:17 +02:00
41cefe5130 build(deps): bump tree-sitter-c to v0.20.4 (#24495) 2023-07-27 12:45:08 +02:00
ad95b36985 fix(treesitter): update markdown parser and queries (#24429) 2023-07-22 19:57:58 +02:00
cb0a1a10b2 feat(treesitter): add bash parser and queries 2023-07-01 11:28:32 +02:00
88c8803aa1 feat(treesitter): add python parser and queries 2023-07-01 11:28:32 +02:00
11844dde81 feat(treesitter): bundle markdown parser and queries (#22481)
* bundle split Markdown parser from https://github.com/MDeiml/tree-sitter-markdown
* add queries from https://github.com/nvim-treesitter/nvim-treesitter/tree/main
* upstream `#trim!` and `#inject-language!` directives

Co-authored-by: dundargoc <gocdundar@gmail.com>
2023-07-01 11:08:06 +02:00
b697c0cd4f fix(treesitter): update lua parser and queries (#24148) 2023-06-26 09:25:46 +02:00
edf9a897f0 fix(treesitter): update highlights for query (#23699)
captures for `; extends` and `; inherits`
2023-05-21 19:22:28 +02:00
9ff59517cb fix(treesitter): update c queries 2023-05-15 14:13:42 +02:00
c97de026e3 fix(treesitter): update vimdoc and vimscript queries 2023-05-15 14:13:31 +02:00
0dbed7132b build(deps): update lua parser and queries 2023-05-15 14:13:31 +02:00
d7f7450017 refactor(treesitter)!: rename help parser to vimdoc 2023-04-01 15:07:16 +02:00
2a298f2e48 fix(treesitter): update queries from nvim-treesitter
remove self-injection for C preprocessor macros (can be very slow)
2023-04-01 12:19:15 +02:00
ddd257f753 feat(treesitter): use upstream format for injection queries 2023-03-08 11:03:11 +00:00
98e051783c feat(treesitter): bundle query parser and queries (#22483)
skip injections for now
2023-03-03 14:27:30 +01:00
1df3f5ec6a feat(treesitter): upstream foldexpr from nvim-treesitter 2023-02-23 17:05:20 +00:00
5093f38c9f feat(help): highlighted codeblocks 2022-11-29 13:32:46 +01:00
915891f28c build(deps): update viml parser and queries (#21158) 2022-11-22 21:25:51 +01:00
582c044dbe build(deps): bump lua parser to v0.0.14 (#20897) 2022-11-01 13:38:47 +01:00
dab07be4d1 build(deps): bump vimdoc parser to v1.2.5 (#20829) 2022-10-27 09:16:16 +02:00
29fe3348ba build(deps): bump vimdoc parser and queries to v1.2.4 (#20788) 2022-10-24 09:35:00 +02:00