Commit Graph

53 Commits

Author SHA1 Message Date
Justin M. Keyes
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
Christian Clason
ae917dbd06 fix(treesitter): sync queries from upstream 2024-09-12 13:41:15 +02:00
Christian Clason
9e80738f30 fix(runtime): sync bundled treesitter queries 2024-07-28 16:13:11 +02:00
Christian Clason
862338255d fix(runtime): sync bundled treesitter queries 2024-07-24 16:02:53 +02:00
Christian Clason
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
Christian Clason
105a9e3dcf build(deps): bump tree-sitter-vimdoc to v3.0.0 2024-06-08 10:19:28 +02:00
Christian Clason
61b3a26e5b build(deps): bump tree-sitter-query to v0.4.0 2024-05-26 12:38:20 +02:00
Christian Clason
3d4eb9d544 fix(treesitter): update queries 2024-05-05 23:22:11 +02:00
Christian Clason
39a0e6bf3c fix(treesitter): update parsers and queries 2024-04-05 18:36:17 +02:00
Christian Clason
5e875ae8d0 feat(treesitter): update Markdown parsers and queries to v0.2.1 2024-03-19 09:41:16 +01:00
Christian Clason
ff6092b4ee feat(treesitter): update Bash parser and queries to v0.21.0 2024-03-19 09:41:16 +01:00
Christian Clason
8a3385dde7 feat(treesitter): update Python parser and queries to v0.21.0 2024-03-19 09:41:16 +01:00
Christian Clason
987dff6713 feat(treesitter): update Vimdoc parser and queries to v2.4.0 2024-03-19 09:41:16 +01:00
Christian Clason
20dcbaaaf8 feat(treesitter): update Vim parser and queries to v0.4.0 2024-03-19 09:41:16 +01:00
Christian Clason
aca4ad430b feat(treesitter): update Lua parser and queries to v0.1.0 2024-03-19 09:41:16 +01:00
Christian Clason
8dda630ae9 feat(treesitter): update C parser and queries to v0.21.0 2024-03-19 09:41:16 +01:00
Gregory Anders
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
Christian Clason
71429c90ee build(deps): bump tree-sitter-bash to v0.20.5 2024-02-10 14:49:09 +01:00
Christian Clason
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
Maria José Solano
cfd4a9dfaf feat(lsp): use treesitter for stylize markdown 2023-09-19 14:47:37 +01:00
Sanchayan Maity
874b8172a6 build(deps): bump tree-sitter-python to v0.20.4 2023-08-27 10:03:24 +09:00
Christian Clason
3836eeb901 feat(treesitter): update C queries from upstream 2023-08-13 12:30:47 +02:00
Christian Clason
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
Christian Clason
41cefe5130
build(deps): bump tree-sitter-c to v0.20.4 (#24495) 2023-07-27 12:45:08 +02:00
Christian Clason
ad95b36985
fix(treesitter): update markdown parser and queries (#24429) 2023-07-22 19:57:58 +02:00
Christian Clason
cb0a1a10b2 feat(treesitter): add bash parser and queries 2023-07-01 11:28:32 +02:00
Christian Clason
88c8803aa1 feat(treesitter): add python parser and queries 2023-07-01 11:28:32 +02:00
Christian Clason
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
Christian Clason
b697c0cd4f
fix(treesitter): update lua parser and queries (#24148) 2023-06-26 09:25:46 +02:00
Christian Clason
edf9a897f0
fix(treesitter): update highlights for query (#23699)
captures for `; extends` and `; inherits`
2023-05-21 19:22:28 +02:00
Christian Clason
9ff59517cb fix(treesitter): update c queries 2023-05-15 14:13:42 +02:00
Christian Clason
c97de026e3 fix(treesitter): update vimdoc and vimscript queries 2023-05-15 14:13:31 +02:00
Christian Clason
0dbed7132b build(deps): update lua parser and queries 2023-05-15 14:13:31 +02:00
Christian Clason
d7f7450017 refactor(treesitter)!: rename help parser to vimdoc 2023-04-01 15:07:16 +02:00
Christian Clason
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
Lewis Russell
ddd257f753
feat(treesitter): use upstream format for injection queries 2023-03-08 11:03:11 +00:00
Christian Clason
98e051783c
feat(treesitter): bundle query parser and queries (#22483)
skip injections for now
2023-03-03 14:27:30 +01:00
Lewis Russell
1df3f5ec6a
feat(treesitter): upstream foldexpr from nvim-treesitter 2023-02-23 17:05:20 +00:00
Christian Clason
5093f38c9f feat(help): highlighted codeblocks 2022-11-29 13:32:46 +01:00
Christian Clason
915891f28c
build(deps): update viml parser and queries (#21158) 2022-11-22 21:25:51 +01:00
Christian Clason
582c044dbe
build(deps): bump lua parser to v0.0.14 (#20897) 2022-11-01 13:38:47 +01:00
Christian Clason
dab07be4d1
build(deps): bump vimdoc parser to v1.2.5 (#20829) 2022-10-27 09:16:16 +02:00
Christian Clason
29fe3348ba
build(deps): bump vimdoc parser and queries to v1.2.4 (#20788) 2022-10-24 09:35:00 +02:00
Justin M. Keyes
d339b4aad7
build(deps): bump vimdoc (help) parser to v1.2.1 #20642 2022-10-13 18:36:25 -07:00
Christian Clason
a5effcedd2
build(deps): bump help parser and queries (#20388) 2022-09-28 16:29:35 +02:00
Justin M. Keyes
bde6176c91 feat(treesitter): bundle :help parser and queries
parser from https://github.com/vigoux/tree-sitter-vimdoc
queries from nvim-treesitter
2022-09-22 15:36:27 +02:00
Christian Clason
79a9b00671
build(deps): bump tree-sitter-viml to 0.2.0 (#20121) 2022-09-08 19:46:40 +02:00
Thomas Vigouroux
75adfefc85 feat(extmarks,ts,spell): full support for spelling
- Added 'spell' option to extmarks:

  Extmarks with this set will have the region spellchecked.

- Added 'noplainbuffer' option to 'spelloptions':

  This is used to tell Neovim not to spellcheck the buffer. The old
  behaviour was to spell check the whole buffer unless :syntax was set.

- Added spelling support to the treesitter highlighter:

  @spell captures in highlights.scm are used to define regions which
  should be spell checked.

- Added support for navigating spell errors for extmarks:

  Works for both ephemeral and static extmarks

- Added '_on_spell_nav' callback for decoration providers:

  Since ephemeral callbacks are only drawn for the visible screen,
  providers must implement this callback to instruct Neovim which
  regions in the buffer need can be spell checked.

  The callback takes a start position and an end position.

  Note: this callback is subject to change hence the _ prefix.

- Added spell captures for built-in support languages

Co-authored-by: Lewis Russell <lewis6991@gmail.com>
Co-authored-by: Björn Linse <bjorn.linse@gmail.com>
2022-09-06 10:14:11 +01:00
Christian Clason
64cc78c9f3 feat(treesitter): add injections 2022-09-06 07:57:46 +02:00
Christian Clason
e85b8aa768 feat(treesitter): add viml parser and queries 2022-09-06 07:57:46 +02:00