1

Refresh generated neovim config

This commit is contained in:
2024-08-15 13:01:03 +02:00
parent 64b51cf53a
commit f5af8e2b28
1836 changed files with 38979 additions and 31094 deletions

View File

@ -57,7 +57,6 @@ jobs:
'./lua/nvim-treesitter/shell_selectors.lua') }}
- name: Compile parsers Unix like
if: ${{ runner.os != 'Windows' && steps.parsers-cache.outputs.cache-hit != 'true' }}
run: |
nvim --headless -c "TSInstallSync all" -c "q"

View File

@ -31,7 +31,7 @@ jobs:
- name: Update parsers
env:
SKIP_LOCKFILE_UPDATE_FOR_LANGS: ""
SKIP_LOCKFILE_UPDATE_FOR_LANGS: "javascript"
run: |
cp lockfile.json /tmp/old_lockfile.json
nvim -l scripts/write-lockfile.lua

View File

@ -287,7 +287,7 @@ A conceal can be restricted to part of the capture via the [`#offset!` directive
#### Priority
Captures can be assigned a priority to control precedence of highlights via the
`#set! "priority" <number>` directive (see `:h treesitter-highlight-priority`).
`#set! priority <number>` directive (see `:h treesitter-highlight-priority`).
The default priority for treesitter highlights is `100`; queries should only
set priorities between `90` and `120`, to avoid conflict with other sources of
highlighting (such as diagnostics or LSP semantic tokens).
@ -336,7 +336,7 @@ doSomething(); // Should point to the declaration as the definition
```query
(function_declaration
((identifier) @local.definition.var)
(#set! "definition.var.scope" "parent"))
(#set! definition.var.scope "parent"))
```
Possible scope values are:

View File

@ -105,8 +105,8 @@ All modules are disabled by default and need to be activated explicitly in your
```lua
require'nvim-treesitter.configs'.setup {
-- A list of parser names, or "all" (the five listed parsers should always be installed)
ensure_installed = { "c", "lua", "vim", "vimdoc", "query" },
-- A list of parser names, or "all" (the listed parsers MUST always be installed)
ensure_installed = { "c", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline" },
-- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false,
@ -220,6 +220,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [dtd](https://github.com/tree-sitter-grammars/tree-sitter-xml) (maintained by @ObserverOfTime)
- [x] [earthfile](https://github.com/glehmann/tree-sitter-earthfile) (maintained by @glehmann)
- [x] [ebnf](https://github.com/RubixDev/ebnf) (experimental, maintained by @RubixDev)
- [x] [editorconfig](https://github.com/ValdezFOmar/tree-sitter-editorconfig) (maintained by @ValdezFOmar)
- [x] [eds](https://github.com/uyha/tree-sitter-eds) (maintained by @uyha)
- [x] [eex](https://github.com/connorlay/tree-sitter-eex) (maintained by @connorlay)
- [x] [elixir](https://github.com/elixir-lang/tree-sitter-elixir) (maintained by @connorlay)
@ -253,6 +254,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [GN (Generate Ninja)](https://github.com/amaanq/tree-sitter-gn) (maintained by @amaanq)
- [x] [gnuplot](https://github.com/dpezto/tree-sitter-gnuplot) (maintained by @dpezto)
- [x] [go](https://github.com/tree-sitter/tree-sitter-go) (maintained by @theHamsta, @WinWisely268)
- [x] [goctl](https://github.com/chaozwn/tree-sitter-goctl) (maintained by @chaozwn)
- [x] [Godot Resources (gdresource)](https://github.com/PrestonKnopp/tree-sitter-godot-resource) (maintained by @pierpo)
- [x] [gomod](https://github.com/camdencheek/tree-sitter-go-mod) (maintained by @camdencheek)
- [x] [gosum](https://github.com/amaanq/tree-sitter-go-sum) (maintained by @amaanq)
@ -279,7 +281,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [http](https://github.com/rest-nvim/tree-sitter-http) (maintained by @amaanq, @NTBBloodbath)
- [x] [hurl](https://github.com/pfeiferj/tree-sitter-hurl) (maintained by @pfeiferj)
- [x] [hyprlang](https://github.com/luckasRanarison/tree-sitter-hyprlang) (maintained by @luckasRanarison)
- [x] [idl](https://github.com/cathaysia/tree-sitter-idl) (maintained by @cathaysa)
- [x] [idl](https://github.com/cathaysia/tree-sitter-idl) (maintained by @cathaysia)
- [x] [ini](https://github.com/justinmk/tree-sitter-ini) (experimental, maintained by @theHamsta)
- [x] [inko](https://github.com/inko-lang/tree-sitter-inko) (maintained by @yorickpeterse)
- [x] [ispc](https://github.com/fab4100/tree-sitter-ispc) (maintained by @fab4100)
@ -322,6 +324,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [mlir](https://github.com/artagnon/tree-sitter-mlir) (experimental, maintained by @artagnon)
- [x] [muttrc](https://github.com/neomutt/tree-sitter-muttrc) (maintained by @Freed-Wu)
- [x] [nasm](https://github.com/naclsn/tree-sitter-nasm) (maintained by @ObserverOfTime)
- [x] [nginx](https://github.com/opa-oz/tree-sitter-nginx) (maintained by @opa-oz)
- [ ] [nickel](https://github.com/nickel-lang/tree-sitter-nickel)
- [x] [nim](https://github.com/alaviss/tree-sitter-nim) (maintained by @aMOPel)
- [x] [nim_format_string](https://github.com/aMOPel/tree-sitter-nim-format-string) (maintained by @aMOPel)
@ -336,7 +339,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [ocamllex](https://github.com/atom-ocaml/tree-sitter-ocamllex) (maintained by @undu)
- [x] [odin](https://github.com/amaanq/tree-sitter-odin) (maintained by @amaanq)
- [ ] [org](https://github.com/milisims/tree-sitter-org)
- [x] [pascal](https://github.com/Isopod/tree-sitter-pascal.git) (maintained by @Isopod)
- [x] [pascal](https://github.com/Isopod/tree-sitter-pascal) (maintained by @Isopod)
- [x] [passwd](https://github.com/ath3/tree-sitter-passwd) (maintained by @amaanq)
- [x] [pem](https://github.com/ObserverOfTime/tree-sitter-pem) (maintained by @ObserverOfTime)
- [x] [perl](https://github.com/tree-sitter-perl/tree-sitter-perl) (maintained by @RabbiVeesh, @LeoNerd)
@ -348,8 +351,11 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [pod](https://github.com/tree-sitter-perl/tree-sitter-pod) (maintained by @RabbiVeesh, @LeoNerd)
- [x] [Path of Exile item filter](https://github.com/ObserverOfTime/tree-sitter-poe-filter) (experimental, maintained by @ObserverOfTime)
- [x] [pony](https://github.com/amaanq/tree-sitter-pony) (maintained by @amaanq, @mfelsche)
- [x] [powershell](https://github.com/airbus-cert/tree-sitter-powershell) (maintained by @L2jLiga)
- [x] [printf](https://github.com/ObserverOfTime/tree-sitter-printf) (maintained by @ObserverOfTime)
- [x] [prisma](https://github.com/victorhqc/tree-sitter-prisma) (maintained by @elianiva)
- [x] [problog](https://github.com/foxyseta/tree-sitter-prolog) (maintained by @foxyseta)
- [x] [prolog](https://github.com/foxyseta/tree-sitter-prolog) (maintained by @foxyseta)
- [x] [promql](https://github.com/MichaHoffmann/tree-sitter-promql) (maintained by @MichaHoffmann)
- [x] [properties](https://github.com/tree-sitter-grammars/tree-sitter-properties) (maintained by @ObserverOfTime)
- [x] [proto](https://github.com/treywood/tree-sitter-proto) (maintained by @treywood)
@ -364,7 +370,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [qmldir](https://github.com/Decodetalkers/tree-sitter-qmldir) (maintained by @amaanq)
- [x] [qmljs](https://github.com/yuja/tree-sitter-qmljs) (maintained by @Decodetalkers)
- [x] [Tree-Sitter query language](https://github.com/nvim-treesitter/tree-sitter-query) (maintained by @steelsojka)
- [x] [r](https://github.com/r-lib/tree-sitter-r) (maintained by @echasnovski)
- [x] [r](https://github.com/r-lib/tree-sitter-r) (maintained by @ribru17)
- [ ] [racket](https://github.com/6cdh/tree-sitter-racket)
- [x] [ralph](https://github.com/alephium/tree-sitter-ralph) (maintained by @tdroxler)
- [x] [rasi](https://github.com/Fymyte/tree-sitter-rasi) (maintained by @Fymyte)
@ -374,15 +380,17 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [regex](https://github.com/tree-sitter/tree-sitter-regex) (maintained by @theHamsta)
- [x] [rego](https://github.com/FallenAngel97/tree-sitter-rego) (maintained by @FallenAngel97)
- [x] [pip requirements](https://github.com/ObserverOfTime/tree-sitter-requirements) (maintained by @ObserverOfTime)
- [x] [rescript](https://github.com/rescript-lang/tree-sitter-rescript) (maintained by @ribru17)
- [x] [rnoweb](https://github.com/bamonroe/tree-sitter-rnoweb) (maintained by @bamonroe)
- [x] [robot](https://github.com/Hubro/tree-sitter-robot) (maintained by @Hubro)
- [x] [robots](https://github.com/opa-oz/tree-sitter-robots-txt) (maintained by @opa-oz)
- [x] [roc](https://github.com/faldor20/tree-sitter-roc) (maintained by @nat-418)
- [x] [ron](https://github.com/amaanq/tree-sitter-ron) (maintained by @amaanq)
- [x] [rst](https://github.com/stsewd/tree-sitter-rst) (maintained by @stsewd)
- [x] [ruby](https://github.com/tree-sitter/tree-sitter-ruby) (maintained by @TravonteD)
- [x] [rust](https://github.com/tree-sitter/tree-sitter-rust) (maintained by @amaanq)
- [x] [scala](https://github.com/tree-sitter/tree-sitter-scala) (maintained by @stevanmilic)
- [x] [scfg](https://git.sr.ht/~rockorager/tree-sitter-scfg) (maintained by @WhyNotHugo)
- [x] [scfg](https://github.com/rockorager/tree-sitter-scfg) (maintained by @WhyNotHugo)
- [ ] [scheme](https://github.com/6cdh/tree-sitter-scheme)
- [x] [scss](https://github.com/serenadeai/tree-sitter-scss) (maintained by @elianiva)
- [x] [slang](https://github.com/theHamsta/tree-sitter-slang) (experimental, maintained by @theHamsta)
@ -394,7 +402,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [soql](https://github.com/aheber/tree-sitter-sfapex) (maintained by @aheber)
- [x] [sosl](https://github.com/aheber/tree-sitter-sfapex) (maintained by @aheber)
- [x] [sourcepawn](https://github.com/nilshelmig/tree-sitter-sourcepawn) (maintained by @Sarrus1)
- [x] [sparql](https://github.com/BonaBeavis/tree-sitter-sparql) (maintained by @BonaBeavis)
- [x] [sparql](https://github.com/GordianDziwis/tree-sitter-sparql) (maintained by @GordianDziwis)
- [x] [sql](https://github.com/derekstride/tree-sitter-sql) (maintained by @derekstride)
- [x] [squirrel](https://github.com/amaanq/tree-sitter-squirrel) (maintained by @amaanq)
- [x] [ssh_config](https://github.com/ObserverOfTime/tree-sitter-ssh-config) (maintained by @ObserverOfTime)
@ -407,6 +415,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [swift](https://github.com/alex-pinkus/tree-sitter-swift) (maintained by @alex-pinkus)
- [x] [sxhkdrc](https://github.com/RaafatTurki/tree-sitter-sxhkdrc) (maintained by @RaafatTurki)
- [x] [systemtap](https://github.com/ok-ryoko/tree-sitter-systemtap) (maintained by @ok-ryoko)
- [x] [systemverilog](https://github.com/zhangwwpeng/tree-sitter-systemverilog) (maintained by @zhangwwpeng)
- [x] [t32](https://gitlab.com/xasc/tree-sitter-t32.git) (maintained by @xasc)
- [x] [tablegen](https://github.com/amaanq/tree-sitter-tablegen) (maintained by @amaanq)
- [x] [tact](https://github.com/tact-lang/tree-sitter-tact) (maintained by @novusnota)
@ -419,11 +428,11 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [tiger](https://github.com/ambroisie/tree-sitter-tiger) (maintained by @ambroisie)
- [x] [tlaplus](https://github.com/tlaplus-community/tree-sitter-tlaplus) (maintained by @ahelwer, @susliko)
- [x] [tmux](https://github.com/Freed-Wu/tree-sitter-tmux) (maintained by @Freed-Wu)
- [x] [todotxt](https://github.com/arnarg/tree-sitter-todotxt.git) (experimental, maintained by @arnarg)
- [x] [todotxt](https://github.com/arnarg/tree-sitter-todotxt) (experimental, maintained by @arnarg)
- [x] [toml](https://github.com/tree-sitter-grammars/tree-sitter-toml) (maintained by @tk-shirasaka)
- [x] [tsv](https://github.com/amaanq/tree-sitter-csv) (maintained by @amaanq)
- [x] [tsx](https://github.com/tree-sitter/tree-sitter-typescript) (maintained by @steelsojka)
- [x] [turtle](https://github.com/BonaBeavis/tree-sitter-turtle) (maintained by @BonaBeavis)
- [x] [turtle](https://github.com/GordianDziwis/tree-sitter-turtle) (maintained by @GordianDziwis)
- [x] [twig](https://github.com/gbprod/tree-sitter-twig) (maintained by @gbprod)
- [x] [typescript](https://github.com/tree-sitter/tree-sitter-typescript) (maintained by @steelsojka)
- [x] [typespec](https://github.com/happenslol/tree-sitter-typespec) (maintained by @happenslol)
@ -438,9 +447,11 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [vala](https://github.com/vala-lang/tree-sitter-vala) (maintained by @Prince781)
- [x] [vento](https://github.com/ventojs/tree-sitter-vento) (maintained by @wrapperup, @oscarotero)
- [x] [verilog](https://github.com/tree-sitter/tree-sitter-verilog) (maintained by @zegervdv)
- [x] [vhdl](https://github.com/jpt13653903/tree-sitter-vhdl) (maintained by @jpt13653903)
- [x] [vhs](https://github.com/charmbracelet/tree-sitter-vhs) (maintained by @caarlos0)
- [x] [vim](https://github.com/neovim/tree-sitter-vim) (maintained by @clason)
- [x] [vimdoc](https://github.com/neovim/tree-sitter-vimdoc) (maintained by @clason)
- [x] [vrl](https://github.com/belltoy/tree-sitter-vrl) (maintained by @belltoy)
- [x] [vue](https://github.com/tree-sitter-grammars/tree-sitter-vue) (maintained by @WhyNotHugo, @lucario387)
- [x] [wgsl](https://github.com/szebniok/tree-sitter-wgsl) (maintained by @szebniok)
- [x] [wgsl_bevy](https://github.com/theHamsta/tree-sitter-wgsl-bevy) (maintained by @theHamsta)
@ -530,12 +541,11 @@ require'nvim-treesitter.configs'.setup {
#### Folding
Tree-sitter based folding. _(Technically not a module because it's per windows and not per buffer.)_
Tree-sitter based folding (implemented in Neovim itself, see `:h vim.treesitter.foldexpr()`). To enable it for the current window, set
```vim
set foldmethod=expr
set foldexpr=nvim_treesitter#foldexpr()
set nofoldenable " Disable folding at startup.
```lua
vim.wo.foldmethod = 'expr'
vim.wo.foldexpr = 'v:lua.vim.treesitter.foldexpr()'
```
This will respect your `foldminlines` and `foldnestmax` settings.
@ -630,18 +640,18 @@ like the `queries` folder of this plugin, e.g. `queries/{language}/{locals,highl
Other modules may require additional queries such as `folding.scm`. You can find a
list of all supported capture names in [CONTRIBUTING.md](https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#parser-configurations).
All queries found in the runtime directories will be combined.
By convention, if you want to write a query, use the `queries/` directory,
but if you want to extend a query use the `after/queries/` directory.
The first query file on `runtimepath` will be used (see `:h treesitter-query`).
If you want to make a query on the user config extend other queries instead of
replacing them, see `:h treesitter-query-modeline-extends`.
If you want to completely override a query, you can use `:h set_query()`.
If you want to completely override a query, you can use `:h vim.treesitter.query.set()`.
For example, to override the `injections` queries from `c` with your own:
```lua
require("vim.treesitter.query").set_query("c", "injections", "(comment) @comment")
vim.treesitter.query.set("c", "injections", "(comment) @comment")
```
Note: when using `set_query`, all queries in the runtime directories will be ignored.
Note: when using `query.set()`, all queries in the runtime directories will be ignored.
## Adding modules

View File

@ -6,7 +6,7 @@
"revision": "d3dc807692e6bca671d4491b3bf5c67eeca8c016"
},
"angular": {
"revision": "10f21f3f1b10584e62ecc113ab3cda1196d0ceb8"
"revision": "31182d43b062a350d4bd2449f2fc0d5654972be9"
},
"apex": {
"revision": "c99ad4b16d112fea91745e3f1b769754239fdaba"
@ -33,7 +33,7 @@
"revision": "28dc7059722be090d04cd751aed915b2fee2f89a"
},
"beancount": {
"revision": "c25f8034c977681653a8acd541c8b4877a58f474"
"revision": "384c55ede2a1f13e83d8e18dbef8f11304c379c2"
},
"bibtex": {
"revision": "ccfd77db0ed799b6c22c214fe9d2937f47bc8b34"
@ -48,13 +48,13 @@
"revision": "60ba73739c6083c693d86a1a7cf039c07eb4ed59"
},
"bp": {
"revision": "2326d709fb9cf73cf124fdbc803c267f851721a4"
"revision": "4e60cf3c2e613625c06f6f85540b3631e2d06cd3"
},
"c": {
"revision": "deca017a554045b4c203e7ddff39ae64ff05e071"
"revision": "be23d2c9d8e5b550e713ef0f86126a248462ca6e"
},
"c_sharp": {
"revision": "82fa8f05f41a33e9bc830f85d74a9548f0291738"
"revision": "31a64b28292aac6adf44071e449fa03fb80eaf4e"
},
"cairo": {
"revision": "6238f609bea233040fe927858156dee5515a0745"
@ -69,7 +69,7 @@
"revision": "f4236d4da8aa92bc105d9c118746474c608e6af7"
},
"cmake": {
"revision": "4864abb95a1f6e54d6b362677beef9fb674b41e9"
"revision": "69d7a8b0f7493b0dbb07d54e8fea96c5421e8a71"
},
"comment": {
"revision": "5d8b29f6ef3bf64d59430dcfe76b31cc44b5abfd"
@ -87,7 +87,7 @@
"revision": "594289eadfec719198e560f9d7fd243c4db678d5"
},
"cpp": {
"revision": "7ce8946cae4bb25adebe5b50394f702beb007026"
"revision": "0b4aa47f07d958a49260aadc87e8474b03897c23"
},
"css": {
"revision": "f6be52c3d1cdb1c5e4dd7d8bce0a57497f55d6af"
@ -96,13 +96,13 @@
"revision": "7eb7297823605392d2bbcc4c09b1cd18d6fa9529"
},
"cuda": {
"revision": "1f188eff83b562ffae36d13e1b804ec6f3b9f1d9"
"revision": "7c97acb8398734d790c86210c53c320df61ff66b"
},
"cue": {
"revision": "8a5f273bfa281c66354da562f2307c2d394b6c81"
},
"d": {
"revision": "750dde90ed9cdbd82493bc28478d8ab1976b0e9f"
"revision": "ac584585a15c4cacd6cda8e6bfe7cb1ca7b3898e"
},
"dart": {
"revision": "ac0bb849ccd1a923963af47573b5e396736ff582"
@ -114,13 +114,13 @@
"revision": "affb6ee38d629c9296749767ab832d69bb0d9ea8"
},
"diff": {
"revision": "629676fc3919606964231b2c7b9677d6998a2cb4"
"revision": "19dd5aa52fe339a1d974768a09ee2537303e8ca5"
},
"disassembly": {
"revision": "0229c0211dba909c5d45129ac784a3f4d49c243a"
},
"djot": {
"revision": "87bf82874c86dcf563f5521069d603ed50e5f0cc"
"revision": "886601b67d1f4690173a4925c214343c30704d32"
},
"dockerfile": {
"revision": "087daa20438a6cc01fa5e6fe6906d77c869d19fe"
@ -132,14 +132,17 @@
"revision": "ccd998f378c3f9345ea4eeb223f56d7b84d16687"
},
"dtd": {
"revision": "648183d86f6f8ffb240ea11b4c6873f6f45d8b67"
"revision": "809266ed1694d64dedc168a18893cc254e3edf7e"
},
"earthfile": {
"revision": "b5bdcb5813ce0e582fbd8e03eb42c80d3cc8984e"
"revision": "b0a9bc5737340a9b80b489fe9ae93d7b2fe78cd7"
},
"ebnf": {
"revision": "8e635b0b723c620774dfb8abf382a7f531894b40"
},
"editorconfig": {
"revision": "fd0d64d2fc91eab903bed4c11ce280b62e46f16e"
},
"eds": {
"revision": "0ad62cb635c2f4353359a88dec9e3a57bbf9f66d"
},
@ -162,10 +165,10 @@
"revision": "38d5004a797298dc42c85e7706c5ceac46a3f29f"
},
"erlang": {
"revision": "b8e44bc0a3b2ce6bceea47c0b1c0f303a6b322b8"
"revision": "8f41b588fe38b981156651ef56b192ed3d158efd"
},
"facility": {
"revision": "a52579670e2b14ec03d410c3c980fafaf6d659c4"
"revision": "2d037f2f2bf668737f72e6be6eda4b7918b68d86"
},
"faust": {
"revision": "f3b9274514b5f9bf6b0dd4a01c30f9cc15c58bc4"
@ -189,7 +192,7 @@
"revision": "90189238385cf636b9ee99ce548b9e5b5e569d48"
},
"fortran": {
"revision": "f73d473e3530862dee7cbb38520f28824e7804f6"
"revision": "6b633433fb3f132f21250cf8e8be76d5a6389b7e"
},
"fsh": {
"revision": "fad2e175099a45efbc98f000cc196d3674cc45e0"
@ -210,25 +213,25 @@
"revision": "9c2a1b7894e6d9eedfe99805b829b4ecd871375e"
},
"git_rebase": {
"revision": "d8a4207ebbc47bd78bacdf48f883db58283f9fd8"
"revision": "bff4b66b44b020d918d67e2828eada1974a966aa"
},
"gitattributes": {
"revision": "41940e199ba5763abea1d21b4f717014b45f01ea"
},
"gitcommit": {
"revision": "edd817e0532f179b7f7f371dc180629070945f0c"
"revision": "aa5c279287f0895a7ebc76a06e55ac3e4b2df7c7"
},
"gitignore": {
"revision": "f4685bf11ac466dd278449bcfe5fd014e94aa504"
},
"gleam": {
"revision": "02a17bf9d0553406268cdbf466d57808ae712bf3"
"revision": "426e67087fd62be5f4533581b5916b2cf010fb5b"
},
"glimmer": {
"revision": "6b25d265c990139353e1f7f97baf84987ebb7bf0"
},
"glsl": {
"revision": "7f91bf34cadc06a96efc475df501ffca4dda9410"
"revision": "ddc3137a2d775aca93084ff997fa13cc1691058a"
},
"gn": {
"revision": "bc06955bc1e3c9ff8e9b2b2a55b38b94da923c05"
@ -239,11 +242,14 @@
"go": {
"revision": "7ee8d928db5202f6831a78f8112fd693bf69f98b"
},
"goctl": {
"revision": "f107937259c7ec4bb05f7e3d2c24b89ac36d4cc3"
},
"godot_resource": {
"revision": "2ffb90de47417018651fc3b970e5f6b67214dc9d"
},
"gomod": {
"revision": "bbe2fe3be4b87e06a613e685250f473d2267f430"
"revision": "1f55029bacd0a6a11f6eb894c4312d429dcf735c"
},
"gosum": {
"revision": "e2ac513b2240c7ff1069ae33b2df29ce90777c11"
@ -261,7 +267,7 @@
"revision": "5e66e961eee421786bdda8495ed1db045e06b5fe"
},
"groovy": {
"revision": "6c5c8813233fe326e24c5ef032858d13f8006a8d"
"revision": "105ee343682b7eee86b38ec6858a269e16474a72"
},
"gstlaunch": {
"revision": "549aef253fd38a53995cda1bf55c501174372bf7"
@ -270,7 +276,7 @@
"revision": "fca1e294f6dce8ec5659233a6a21f5bd0ed5b4f2"
},
"hare": {
"revision": "070524937539eb8bb4f10debd9c83b66c434f3a2"
"revision": "4af5d82cf9ec39f67cb1db5b7a9269d337406592"
},
"haskell": {
"revision": "a50070d5bb5bd5c1281740a6102ecf1f4b0c4f19"
@ -279,10 +285,10 @@
"revision": "577259b4068b2c281c9ebf94c109bd50a74d5857"
},
"hcl": {
"revision": "422cbe1d93a8ae3847744b664041fc76876babcd"
"revision": "9e3ec9848f28d26845ba300fd73c740459b83e9b"
},
"heex": {
"revision": "b5ad6e34eea18a15bbd1466ca707a17f9bff7b93"
"revision": "6dd0303acf7138dd2b9b432a229e16539581c701"
},
"helm": {
"revision": "9d3f6e526dd074b9edae9070b7bb778f00e87a5b"
@ -291,7 +297,7 @@
"revision": "02fa3b79b3ff9a296066da6277adfc3f26cbc9e0"
},
"hlsl": {
"revision": "5e1225a30712ca0a9040509806c7ba274a1bbcde"
"revision": "81dbfa44a2e0f9e36d16f449fc792020e2f38426"
},
"hlsplaylist": {
"revision": "64f19029339e75d6762feae39e7878595860c980"
@ -309,16 +315,16 @@
"revision": "ea71012d3fe14dd0b69f36be4f96bdfe9155ebae"
},
"http": {
"revision": "8d22f33faa5aa95c6526606fb656ada342e59e40"
"revision": "5ae6c7cfa62a7d7325c26171a1de4f6b866702b5"
},
"hurl": {
"revision": "ad705af8c44c737bdb965fc081329c50716d2d03"
"revision": "fba6ed8db3a009b9e7d656511931b181a3ee5b08"
},
"hyprlang": {
"revision": "c9012d6dcaaa939f17c21e1fdb17b013d139e6b9"
"revision": "6858695eba0e63b9e0fceef081d291eb352abce8"
},
"idl": {
"revision": "9f56001f8ed29b0ea9fa4f02813f3e83ab0a2aaa"
"revision": "1a6683f6809f7bc630f10fcad7d9ac6471deb706"
},
"ini": {
"revision": "87176e524f0a98f5be75fa44f4f0ff5c6eac069c"
@ -330,13 +336,13 @@
"revision": "9b2f9aec2106b94b4e099fe75e73ebd8ae707c04"
},
"janet_simple": {
"revision": "2a05cab838dfec52daa76f10920917d2e69a85bc"
"revision": "ea842cb57a90865c8f50bcb4499de1a94860f3a4"
},
"java": {
"revision": "953abfc8bb3eb2f578e1f461edba4a9885f974b8"
},
"javascript": {
"revision": "391a8fcc48a11f63bf18ec9885f6f069e760949a"
"revision": "12e45374422f6051648717be62f0ffc40a279ee2"
},
"jq": {
"revision": "13990f530e8e6709b7978503da9bc8701d366791"
@ -360,7 +366,7 @@
"revision": "f1baa5f8e271109d01cc8ff7473c11df2d8a9aee"
},
"just": {
"revision": "fd814fc6c579f68c2a642f5e0268cf69daae92d7"
"revision": "6648ac1c0cdadaec8ee8bcf9a4ca6ace5102cf21"
},
"kconfig": {
"revision": "486fea71f61ad9f3fd4072a118402e97fe88d26c"
@ -369,7 +375,7 @@
"revision": "b37e3d58e5c5cf8d739b315d6114e02d42e66664"
},
"kotlin": {
"revision": "c9cb8504b81684375e7beb8907517dbd6947a1be"
"revision": "8d9d372b09fa4c3735657c5fc2ad03e53a5f05f5"
},
"koto": {
"revision": "d4109879ba1387d19095269a7473bd7d274ab848"
@ -381,7 +387,7 @@
"revision": "854a40e99f7c70258e522bdb8ab584ede6196e2e"
},
"latex": {
"revision": "cd82eb40d31bdfe65f846f4e06292d6c804b5e0e"
"revision": "efe5afdbb59b70214e6d70db5197dc945d5b213e"
},
"ledger": {
"revision": "8a841fb20ce683bfbb3469e6ba67f2851cfdf94a"
@ -393,7 +399,7 @@
"revision": "f99011a3554213b654985a4b0a65b3b032ec4621"
},
"liquid": {
"revision": "0419ac4868585320eee8615c90b864a1b04ef433"
"revision": "7862a3424832c3a9d45eb21143b375837bd6573b"
},
"liquidsoap": {
"revision": "14feafa91630afb1ab9988cf9b738b7ea29f3f89"
@ -411,10 +417,10 @@
"revision": "c134aaec6acf4fa95fe4aa0dc9aba3eacdbbe55a"
},
"luau": {
"revision": "5aa9b88a8e3327276ec6e72de997f04ac80b1ae4"
"revision": "fbadc96272f718dba267628ba7b0e694c368cef3"
},
"m68k": {
"revision": "d097b123f19c6eaba2bf181c05420d88b9fc489d"
"revision": "e128454c2210c0e0c10b68fe45ddb8fee80182a3"
},
"make": {
"revision": "a4b9187417d6be349ee5fd4b6e77b4172c6827dd"
@ -426,7 +432,7 @@
"revision": "7fe453beacecf02c86f7736439f238f5bb8b5c9b"
},
"matlab": {
"revision": "79d8b25f57b48f83ae1333aff6723b83c9532e37"
"revision": "0d5a05e543af2de60cdb5e71f0f5888c95ab936f"
},
"menhir": {
"revision": "be8866a6bcc2b563ab0de895af69daeffa88fe70"
@ -438,7 +444,7 @@
"revision": "bd17c824196ce70800f64ad39cfddd1b17acc13f"
},
"mlir": {
"revision": "00c32d8562dc957b187da110a3443307962b8da8"
"revision": "affbd6f3b08155826a22cfa8373147acbf60f1f1"
},
"muttrc": {
"revision": "90ef60852c410bd964cd3b954366e4c403c17314"
@ -446,11 +452,14 @@
"nasm": {
"revision": "570f3d7be01fffc751237f4cfcf52d04e20532d1"
},
"nginx": {
"revision": "281d184b8240b2b22670b8907b57b6d6842db6f3"
},
"nickel": {
"revision": "43433d8477b24cd13acaac20a66deda49b7e2547"
"revision": "3039ad9e9af3c1ffe049a04ee83a2b489915b0b9"
},
"nim": {
"revision": "961c2798cec9250c44f7d7225ddb33d47d25856a"
"revision": "897e5d346f0b59ed62b517cfb0f1a845ad8f0ab7"
},
"nim_format_string": {
"revision": "d45f75022d147cda056e98bfba68222c9c8eca3a"
@ -459,7 +468,7 @@
"revision": "0a95cfdc0745b6ae82f60d3a339b37f19b7b9267"
},
"nix": {
"revision": "b3cda619248e7dd0f216088bd152f59ce0bbe488"
"revision": "68d3b7999ad89d31690461884270e5658e0a22c4"
},
"norg": {
"revision": "aa1a1a7ded81a094cc3d5cb14bea6f34b86d8688"
@ -474,10 +483,10 @@
"revision": "28d3b2e25a0b1881d1b47ed1924ca276c7003d45"
},
"ocaml": {
"revision": "0b12614ded3ec7ed7ab7933a9ba4f695ba4c342e"
"revision": "036226e5edb410aec004cc7ac0f4b2014dd04a0e"
},
"ocaml_interface": {
"revision": "0b12614ded3ec7ed7ab7933a9ba4f695ba4c342e"
"revision": "036226e5edb410aec004cc7ac0f4b2014dd04a0e"
},
"ocamllex": {
"revision": "4b9898ccbf198602bb0dec9cd67cc1d2c0a4fad2"
@ -498,13 +507,13 @@
"revision": "217ff2af3f2db15a79ab7e3d21ea1e0c17e71a1a"
},
"perl": {
"revision": "309cb8d33bcfd0a81050b21be08f9eb3f2fe2138"
"revision": "3a21d9cb2a20a062c17f8f53d5983fd473c4673c"
},
"php": {
"revision": "4f124bc6075e1c3333e80190c1c170933ed72c95"
"revision": "c07d69739ba71b5a449bdbb7735991f8aabf8546"
},
"php_only": {
"revision": "4f124bc6075e1c3333e80190c1c170933ed72c95"
"revision": "c07d69739ba71b5a449bdbb7735991f8aabf8546"
},
"phpdoc": {
"revision": "1d0e255b37477d0ca46f1c9e9268c8fa76c0b3fc"
@ -524,12 +533,21 @@
"pony": {
"revision": "73ff874ae4c9e9b45462673cbc0a1e350e2522a7"
},
"powershell": {
"revision": "fc15514b2f1dbba9c58528d15a3708f89eda6a01"
},
"printf": {
"revision": "0e0aceabbf607ea09e03562f5d8a56f048ddea3d"
},
"prisma": {
"revision": "eca2596a355b1a9952b4f80f8f9caed300a272b5"
},
"problog": {
"revision": "93c69d2f84d8a167c0a3f4a8d51ccefe365a4dc8"
},
"prolog": {
"revision": "93c69d2f84d8a167c0a3f4a8d51ccefe365a4dc8"
},
"promql": {
"revision": "77625d78eebc3ffc44d114a07b2f348dff3061b0"
},
@ -558,7 +576,7 @@
"revision": "be062582956165019d3253794b4d712f66dfeaaa"
},
"python": {
"revision": "71778c2a472ed00a64abf4219544edbf8e4b86d7"
"revision": "0dee05ef958ba2eae88d1e65f24b33cad70d4367"
},
"ql": {
"revision": "42becd6f8f7bae82c818fa3abb1b6ff34b552310"
@ -573,19 +591,19 @@
"revision": "f767fb0ac5e711b6d44c5e0c8d1f349687a86ce0"
},
"r": {
"revision": "391400572538ff9854341a175ed8ab4b1e45f44b"
"revision": "b1e211f52ad8f8e1e182bbbcc16dcd5e3688eb7d"
},
"racket": {
"revision": "171f52a8c0ed635b85cd42d1e36d82f1066a03b4"
},
"ralph": {
"revision": "48b9d9d6e2b55ce8f9eb09ceb0d952e4b1cc87a0"
"revision": "f6d81bf7a4599c77388035439cf5801cd461ff77"
},
"rasi": {
"revision": "6c9bbcfdf5f0f553d9ebc01750a3aa247a37b8aa"
},
"rbs": {
"revision": "88d8ed487b5449ddda2fc0c4fe23b71cba29ca24"
"revision": "8d8e65ac3f77fbc9e15b1cdb9f980a3e0ac3ab99"
},
"re2c": {
"revision": "47aa19cf5f7aba2ed30e2b377f7172df76e819a6"
@ -602,14 +620,20 @@
"requirements": {
"revision": "5ad9b7581b3334f6ad492847d007f2fac6e6e5f2"
},
"rescript": {
"revision": "4606cd81c4c31d1d02390fee530858323410a74c"
},
"rnoweb": {
"revision": "1a74dc0ed731ad07db39f063e2c5a6fe528cae7f"
},
"robot": {
"revision": "322e4cc65754d2b3fdef4f2f8a71e0762e3d13af"
},
"robots": {
"revision": "8e3a4205b76236bb6dbebdbee5afc262ce38bb62"
},
"roc": {
"revision": "df46a85abda9f948d38f5d4e3684cec49c42fef2"
"revision": "ef46edd0c03ea30a22f7e92bc68628fb7231dc8a"
},
"ron": {
"revision": "78938553b93075e638035f624973083451b29055"
@ -618,16 +642,16 @@
"revision": "5120f6e59284cb8b85b450bd2db0bd352635ba9f"
},
"ruby": {
"revision": "dc2d7d6b50f9975bc3c35bbec0ba11b2617b736b"
"revision": "0ffe457fb6aabf064f173fd30ea356845cef2513"
},
"rust": {
"revision": "9c84af007b0f144954adb26b3f336495cbb320a7"
},
"scala": {
"revision": "b76db435a7f876cf1ede837d66054c534783c72f"
"revision": "a13f2d1ee9609cc5c4c8ffce9640c353b77a24d8"
},
"scfg": {
"revision": "6deae0cbb458c849a4d1e2985093e9c9c32d7fd0"
"revision": "a5512800ea0220da4abbae61b8aea8423d1549aa"
},
"scheme": {
"revision": "8f9dff3d038f09934db5ea113cebc59c74447743"
@ -636,10 +660,10 @@
"revision": "c478c6868648eff49eb04a4df90d703dc45b312a"
},
"slang": {
"revision": "865d79e236c7f0e04276c969453d021d1da4b15f"
"revision": "d84b43d75d65bbc4ba57166ce17555f32c0b8983"
},
"slint": {
"revision": "d82ab8c19ea1b60ff570256eaef7d137cc5ecb63"
"revision": "4a0558cc0fcd7a6110815b9bbd7cc12d7ab31e74"
},
"smali": {
"revision": "fdfa6a1febc43c7467aa7e937b87b607956f2346"
@ -648,7 +672,7 @@
"revision": "fa898ac0885d1da9a253695c3e0e91f5efc587cd"
},
"snakemake": {
"revision": "5a7b14074bca95b25935e865ca8f1efad32317e4"
"revision": "46d4de8e6cfca8a97c0489aea936bb15beeaf666"
},
"solidity": {
"revision": "ee5a2d2ba30b487c4bbf613d2ef310a454c09c7c"
@ -660,16 +684,16 @@
"revision": "c99ad4b16d112fea91745e3f1b769754239fdaba"
},
"sourcepawn": {
"revision": "645d093763bcaaf7535edbdf6575a5c978b16491"
"revision": "6b9bf9cbab91443380d2ca8a2f6c491cc7fac5bf"
},
"sparql": {
"revision": "05f949d3c1c15e3261473a244d3ce87777374dec"
"revision": "d853661ca680d8ff7f8d800182d5782b61d0dd58"
},
"sql": {
"revision": "89fd00d0aff3bc9985ac37caf362ec4fd9b2ba1d"
"revision": "b8175006d9c8120d41cf40a4ef3711bbbbc08973"
},
"squirrel": {
"revision": "0a50d31098e83c668d34d1160a0f6c7d23b571cc"
"revision": "072c969749e66f000dba35a33c387650e203e96e"
},
"ssh_config": {
"revision": "77450e8bce8853921512348f83c73c168c71fdfb"
@ -690,10 +714,10 @@
"revision": "f4586b35ac8548667a9aaa4eae44456c1f43d032"
},
"svelte": {
"revision": "7218cf622b057ae9c530e1f0a7a3ce49806ca55e"
"revision": "7ab8221e3f378a3b04b4b488f07c1f408c5bd0d8"
},
"swift": {
"revision": "d657f98dd6bbc34cb48438c9e5956f15a6d89f1d"
"revision": "769bb834feb2947f2c706d82830b0a05958727de"
},
"sxhkdrc": {
"revision": "440d5f913d9465c9c776a1bd92334d32febcf065"
@ -701,6 +725,9 @@
"systemtap": {
"revision": "1af543a96d060b1f808982037bfc54cc02218edd"
},
"systemverilog": {
"revision": "4f897d5e3f0e38bf8fbb55e8f39dc97d2bc2229e"
},
"t32": {
"revision": "6182836f4128725f1e74ce986840d7317021a015"
},
@ -708,7 +735,7 @@
"revision": "b1170880c61355aaf38fc06f4af7d3c55abdabc4"
},
"tact": {
"revision": "034df2162ed7b654efd999942e266be713c7cde0"
"revision": "91cc49a83f4f0b3a756bf7d0e65403a9cf757003"
},
"tcl": {
"revision": "8784024358c233efd0f3a6fd9e7a3c5852e628bc"
@ -717,10 +744,10 @@
"revision": "19b02da829d1721a521bf7b802eb80a50bd53aab"
},
"templ": {
"revision": "cf84ea53e2e2531f23009d676ac206090c1e2392"
"revision": "de0d0ee129cf643872e8e0d5c4a6589b5a3aae23"
},
"terraform": {
"revision": "422cbe1d93a8ae3847744b664041fc76876babcd"
"revision": "9e3ec9848f28d26845ba300fd73c740459b83e9b"
},
"textproto": {
"revision": "8dacf02aa402892c91079f8577998ed5148c0496"
@ -732,7 +759,7 @@
"revision": "a7f11d946b44244f71df41d2a78af0665d618dae"
},
"tlaplus": {
"revision": "200f9dab6b23f3b9bb8f67fc811221517f56c373"
"revision": "bba02e79f85e335f310fc95e21c677e49f2c4439"
},
"tmux": {
"revision": "9138ea508410e0f34da2666609f600f65e944f22"
@ -747,25 +774,25 @@
"revision": "7eb7297823605392d2bbcc4c09b1cd18d6fa9529"
},
"tsx": {
"revision": "4f3eb6655a1cd1a1f87ef10201f8e22886dcd76e"
"revision": "198d03553f43a45b92ac5d0ee167db3fec6a6fd6"
},
"turtle": {
"revision": "085437f5cb117703b7f520dd92161140a684f092"
"revision": "7f789ea7ef765080f71a298fc96b7c957fa24422"
},
"twig": {
"revision": "085648e01d1422163a1702a44e72303b4e2a0bd1"
},
"typescript": {
"revision": "4f3eb6655a1cd1a1f87ef10201f8e22886dcd76e"
"revision": "198d03553f43a45b92ac5d0ee167db3fec6a6fd6"
},
"typespec": {
"revision": "28821d0d6da5f0a6b5eb02b9bad953fecafd7248"
"revision": "0ee05546d73d8eb64635ed8125de6f35c77759fe"
},
"typoscript": {
"revision": "43b221c0b76e77244efdaa9963e402a17c930fbc"
},
"typst": {
"revision": "3924cb9ed9e0e62ce7df9c4fe0faa4c234795999"
"revision": "abe60cbed7986ee475d93f816c1be287f220c5d8"
},
"udev": {
"revision": "8f58696e79092b4ad6bf197415bbd0970acf15cd"
@ -783,7 +810,7 @@
"revision": "ad9b638b914095320de85d59c49ab271603af048"
},
"v": {
"revision": "e91f8a42de7842f24f4ce600754f2b6651985fd4"
"revision": "7f80a0441ff2ca6aa8ced8e1ee87cead9dd26515"
},
"vala": {
"revision": "8f690bfa639f2b83d1fb938ed3dd98a7ba453e8b"
@ -794,15 +821,21 @@
"verilog": {
"revision": "075ebfc84543675f12e79a955f79d717772dcef3"
},
"vhdl": {
"revision": "4ab3e251eae8890a020d083d00acd1b8c2653c07"
},
"vhs": {
"revision": "90028bbadb267ead5b87830380f6a825147f0c0f"
},
"vim": {
"revision": "b448ca63f972ade12c373c808acdd2bf972937db"
"revision": "f3cd62d8bd043ef20507e84bb6b4b53731ccf3a7"
},
"vimdoc": {
"revision": "2249c44ecd3f5cf22da3dcccfb74f816ddb29245"
},
"vrl": {
"revision": "274b3ce63f72aa8ffea18e7fc280d3062d28f0ba"
},
"vue": {
"revision": "22bdfa6c9fc0f5ffa44c6e938ec46869ac8a99ff"
},
@ -810,19 +843,19 @@
"revision": "40259f3c77ea856841a4e0c4c807705f3e4a2b65"
},
"wgsl_bevy": {
"revision": "1e12c7925c41bb09818d86e30cd78644fde7d31a"
"revision": "0f06f24e259ac725045956436b9025dab008ff9f"
},
"wing": {
"revision": "bd1d35cf3e013dc7e189b46a593bdc2b281b0dd7"
},
"wit": {
"revision": "cab94791450524a542324d8cbe8017d69c516d8e"
"revision": "c52f0b07786603df17ad0197f6cef680f312eb2c"
},
"xcompose": {
"revision": "2383cc69a2c42cfade41c7cb971fb3862bec6df1"
"revision": "fff3e72242aa110ebba6441946ea4d12d200fa68"
},
"xml": {
"revision": "648183d86f6f8ffb240ea11b4c6873f6f45d8b67"
"revision": "809266ed1694d64dedc168a18893cc254e3edf7e"
},
"yaml": {
"revision": "7b03feefd36b5f155465ca736c6304aca983b267"
@ -837,6 +870,6 @@
"revision": "6e7c8edfcd6f5f7c12b2fa9ffc6d042f1b6d7068"
},
"zig": {
"revision": "7c5a29b721d409be8842017351bf007d7e384401"
"revision": "2bac4cc6c697d46a193905fef6d003bfa0bfabfd"
}
}

View File

@ -17,12 +17,19 @@ local function getline(lnum)
return vim.api.nvim_buf_get_lines(0, lnum - 1, lnum, false)[1] or ""
end
---@param lnum integer
---@return integer
local function get_indentcols_at_line(lnum)
local _, indentcols = getline(lnum):find "^%s*"
return indentcols or 0
end
---@param root TSNode
---@param lnum integer
---@param col? integer
---@return TSNode
local function get_first_node_at_line(root, lnum, col)
col = col or vim.fn.indent(lnum)
col = col or get_indentcols_at_line(lnum)
return root:descendant_for_range(lnum - 1, col, lnum - 1, col + 1)
end
@ -152,20 +159,20 @@ function M.get_indent(lnum)
local node ---@type TSNode
if is_empty_line then
local prevlnum = vim.fn.prevnonblank(lnum)
local indent = vim.fn.indent(prevlnum)
local indentcols = get_indentcols_at_line(prevlnum)
local prevline = vim.trim(getline(prevlnum))
-- The final position can be trailing spaces, which should not affect indentation
node = get_last_node_at_line(root, prevlnum, indent + #prevline - 1)
node = get_last_node_at_line(root, prevlnum, indentcols + #prevline - 1)
if node:type():match "comment" then
-- The final node we capture of the previous line can be a comment node, which should also be ignored
-- Unless the last line is an entire line of comment, ignore the comment range and find the last node again
local first_node = get_first_node_at_line(root, prevlnum, indent)
local first_node = get_first_node_at_line(root, prevlnum, indentcols)
local _, scol, _, _ = node:range()
if first_node:id() ~= node:id() then
-- In case the last captured node is a trailing comment node, re-trim the string
prevline = vim.trim(prevline:sub(1, scol - indent))
prevline = vim.trim(prevline:sub(1, scol - indentcols))
-- Add back indent as indent of prevline was trimmed away
local col = indent + #prevline - 1
local col = indentcols + #prevline - 1
node = get_last_node_at_line(root, prevlnum, col)
end
end

View File

@ -1,40 +1,16 @@
local api = vim.api
local ts = vim.treesitter
local new_lang_api = ts.language.register ~= nil
local filetype_to_parsername = {}
if new_lang_api then
filetype_to_parsername = setmetatable({}, {
__newindex = function(_, k, v)
require("nvim-treesitter.utils").notify(
"filetype_to_parsername is deprecated, please use 'vim.treesitter.language.register'",
vim.log.levels.WARN
)
ts.language.register(v, k)
end,
})
end
local function register_lang(lang, ft)
if new_lang_api then
ts.language.register(lang, ft)
return
end
filetype_to_parsername[ft] = lang
end
for ft, lang in pairs {
automake = "make",
javascriptreact = "javascript",
ecma = "javascript",
jsx = "javascript",
sh = "bash",
gyp = "python",
html_tags = "html",
["typescript.tsx"] = "tsx",
["terraform-vars"] = "terraform",
["html.handlebars"] = "glimmer",
systemverilog = "verilog",
pandoc = "markdown",
rmd = "markdown",
quarto = "markdown",
@ -47,8 +23,20 @@ for ft, lang in pairs {
mysql = "sql",
sbt = "scala",
neomuttrc = "muttrc",
--- short-hand list from https://github.com/helix-editor/helix/blob/master/languages.toml
rs = "rust",
ex = "elixir",
js = "javascript",
ts = "typescript",
["c-sharp"] = "csharp",
hs = "haskell",
py = "python",
erl = "erlang",
typ = "typst",
pl = "perl",
uxn = "uxntal",
} do
register_lang(lang, ft)
ts.language.register(lang, ft)
end
---@class InstallInfo
@ -73,7 +61,7 @@ end
local list = setmetatable({}, {
__newindex = function(table, parsername, parserconfig)
rawset(table, parsername, parserconfig)
register_lang(parsername, parserconfig.filetype or parsername)
ts.language.register(parsername, parserconfig.filetype or parsername)
end,
})
@ -99,6 +87,7 @@ list.angular = {
files = { "src/parser.c", "src/scanner.c" },
generate_requires_npm = true,
},
filetype = "htmlangular",
maintainers = { "@dlvandenberg" },
experimental = true,
}
@ -469,6 +458,14 @@ list.ebnf = {
experimental = true,
}
list.editorconfig = {
install_info = {
url = "https://github.com/ValdezFOmar/tree-sitter-editorconfig",
files = { "src/parser.c", "src/scanner.c" },
},
maintainers = { "@ValdezFOmar" },
}
list.eds = {
install_info = {
url = "https://github.com/uyha/tree-sitter-eds",
@ -529,7 +526,7 @@ list.embedded_template = {
list.erlang = {
install_info = {
url = "https://github.com/WhatsApp/tree-sitter-erlang",
files = { "src/parser.c" },
files = { "src/parser.c", "src/scanner.c" },
},
maintainers = { "@filmor" },
}
@ -749,6 +746,14 @@ list.go = {
maintainers = { "@theHamsta", "@WinWisely268" },
}
list.goctl = {
install_info = {
url = "https://github.com/chaozwn/tree-sitter-goctl",
files = { "src/parser.c" },
},
maintainers = { "@chaozwn" },
}
list.godot_resource = {
install_info = {
url = "https://github.com/PrestonKnopp/tree-sitter-godot-resource",
@ -962,7 +967,7 @@ list.idl = {
url = "https://github.com/cathaysia/tree-sitter-idl",
files = { "src/parser.c" },
},
maintainers = { "@cathaysa" },
maintainers = { "@cathaysia" },
}
list.ini = {
@ -1327,6 +1332,14 @@ list.nasm = {
maintainers = { "@ObserverOfTime" },
}
list.nginx = {
install_info = {
url = "https://github.com/opa-oz/tree-sitter-nginx",
files = { "src/parser.c", "src/scanner.c" },
},
maintainers = { "@opa-oz" },
}
list.nickel = {
install_info = {
url = "https://github.com/nickel-lang/tree-sitter-nickel",
@ -1445,7 +1458,7 @@ list.org = {
list.pascal = {
install_info = {
url = "https://github.com/Isopod/tree-sitter-pascal.git",
url = "https://github.com/Isopod/tree-sitter-pascal",
files = { "src/parser.c" },
},
maintainers = { "@Isopod" },
@ -1549,6 +1562,15 @@ list.pony = {
maintainers = { "@amaanq", "@mfelsche" },
}
list.powershell = {
install_info = {
url = "https://github.com/airbus-cert/tree-sitter-powershell",
files = { "src/parser.c", "src/scanner.c" },
},
filetype = "ps1",
maintainers = { "@L2jLiga" },
}
list.printf = {
install_info = {
url = "https://github.com/ObserverOfTime/tree-sitter-printf",
@ -1565,6 +1587,24 @@ list.prisma = {
maintainers = { "@elianiva" },
}
list.problog = {
install_info = {
url = "https://github.com/foxyseta/tree-sitter-prolog",
files = { "src/parser.c" },
location = "grammars/problog",
},
maintainers = { "@foxyseta" },
}
list.prolog = {
install_info = {
url = "https://github.com/foxyseta/tree-sitter-prolog",
files = { "src/parser.c" },
location = "grammars/prolog",
},
maintainers = { "@foxyseta" },
}
list.promql = {
install_info = {
url = "https://github.com/MichaHoffmann/tree-sitter-promql",
@ -1689,7 +1729,7 @@ list.r = {
url = "https://github.com/r-lib/tree-sitter-r",
files = { "src/parser.c", "src/scanner.c" },
},
maintainers = { "@echasnovski" },
maintainers = { "@ribru17" },
}
list.racket = {
@ -1764,6 +1804,14 @@ list.requirements = {
readme_name = "pip requirements",
}
list.rescript = {
install_info = {
url = "https://github.com/rescript-lang/tree-sitter-rescript",
files = { "src/parser.c", "src/scanner.c" },
},
maintainers = { "@ribru17" },
}
list.rnoweb = {
install_info = {
url = "https://github.com/bamonroe/tree-sitter-rnoweb",
@ -1780,6 +1828,14 @@ list.robot = {
maintainers = { "@Hubro" },
}
list.robots = {
install_info = {
url = "https://github.com/opa-oz/tree-sitter-robots-txt",
files = { "src/parser.c", "src/scanner.c" },
},
maintainers = { "@opa-oz" },
}
list.roc = {
install_info = {
url = "https://github.com/faldor20/tree-sitter-roc",
@ -1830,7 +1886,7 @@ list.scala = {
list.scfg = {
install_info = {
url = "https://git.sr.ht/~rockorager/tree-sitter-scfg",
url = "https://github.com/rockorager/tree-sitter-scfg",
files = { "src/parser.c" },
requires_generate_from_grammar = true,
},
@ -1933,10 +1989,10 @@ list.sourcepawn = {
list.sparql = {
install_info = {
url = "https://github.com/BonaBeavis/tree-sitter-sparql",
url = "https://github.com/GordianDziwis/tree-sitter-sparql",
files = { "src/parser.c" },
},
maintainers = { "@BonaBeavis" },
maintainers = { "@GordianDziwis" },
}
list.sql = {
@ -2040,6 +2096,14 @@ list.systemtap = {
maintainers = { "@ok-ryoko" },
}
list.systemverilog = {
install_info = {
url = "https://github.com/zhangwwpeng/tree-sitter-systemverilog",
files = { "src/parser.c" },
},
maintainers = { "@zhangwwpeng" },
}
list.t32 = {
install_info = {
url = "https://gitlab.com/xasc/tree-sitter-t32.git",
@ -2135,7 +2199,7 @@ list.tmux = {
list.todotxt = {
install_info = {
url = "https://github.com/arnarg/tree-sitter-todotxt.git",
url = "https://github.com/arnarg/tree-sitter-todotxt",
files = { "src/parser.c" },
},
maintainers = { "@arnarg" },
@ -2173,10 +2237,10 @@ list.tsx = {
list.turtle = {
install_info = {
url = "https://github.com/BonaBeavis/tree-sitter-turtle",
url = "https://github.com/GordianDziwis/tree-sitter-turtle",
files = { "src/parser.c" },
},
maintainers = { "@BonaBeavis" },
maintainers = { "@GordianDziwis" },
}
list.twig = {
@ -2300,6 +2364,14 @@ list.verilog = {
maintainers = { "@zegervdv" },
}
list.vhdl = {
install_info = {
url = "https://github.com/jpt13653903/tree-sitter-vhdl",
files = { "src/parser.c", "src/scanner.c" },
},
maintainers = { "@jpt13653903" },
}
list.vhs = {
install_info = {
url = "https://github.com/charmbracelet/tree-sitter-vhs",
@ -2326,6 +2398,14 @@ list.vimdoc = {
maintainers = { "@clason" },
}
list.vrl = {
install_info = {
url = "https://github.com/belltoy/tree-sitter-vrl",
files = { "src/parser.c" },
},
maintainers = { "@belltoy" },
}
list.vue = {
install_info = {
url = "https://github.com/tree-sitter-grammars/tree-sitter-vue",
@ -2435,23 +2515,15 @@ list.templ = {
local M = {
list = list,
filetype_to_parsername = filetype_to_parsername,
}
local function get_lang(ft)
if new_lang_api then
return ts.language.get_lang(ft)
end
return filetype_to_parsername[ft]
end
function M.ft_to_lang(ft)
local result = get_lang(ft)
local result = ts.language.get_lang(ft)
if result then
return result
else
ft = vim.split(ft, ".", { plain = true })[1]
return get_lang(ft) or ft
return ts.language.get_lang(ft) or ft
end
end

View File

@ -252,6 +252,7 @@ function M.select_download_commands(repo, project_name, cache_folder, revision,
opts = {
args = {
"--silent",
"--show-error",
"-L", -- follow redirects
is_github and url .. "/archive/" .. revision .. ".tar.gz"
or url .. "/-/archive/" .. revision .. "/" .. project_name .. "-" .. revision .. ".tar.gz",
@ -288,6 +289,31 @@ function M.select_download_commands(repo, project_name, cache_folder, revision,
local git_folder = utils.join_path(cache_folder, project_name)
local clone_error = "Error during download, please verify your internet connection"
-- Running `git clone` or `git checkout` while running under Git (such as
-- editing a `git commit` message) will likely fail to install parsers
-- (such as 'gitcommit') and can also corrupt the index file of the current
-- Git repository. Check for typical git environment variables and abort if found.
for _, k in pairs {
"GIT_ALTERNATE_OBJECT_DIRECTORIES",
"GIT_CEILING_DIRECTORIES",
"GIT_DIR",
"GIT_INDEX",
"GIT_INDEX_FILE",
"GIT_OBJECT_DIRECTORY",
"GIT_PREFIX",
"GIT_WORK_TREE",
} do
if vim.uv.os_getenv(k) then
vim.api.nvim_err_writeln(
string.format(
"Cannot install %s with git in an active git session. Exit the session and run ':TSInstall %s' manually",
project_name
)
)
return {}
end
end
return {
{
cmd = "git",

View File

@ -57,13 +57,13 @@ function M._get_line_for_node(node, type_patterns, transform_fn, bufnr)
end
-- Gets the actual text content of a node
-- @deprecated Use vim.treesitter.query.get_node_text
-- @deprecated Use vim.treesitter.get_node_text
-- @param node the node to get the text from
-- @param bufnr the buffer containing the node
-- @return list of lines of text of the node
function M.get_node_text(node, bufnr)
vim.notify_once(
"nvim-treesitter.ts_utils.get_node_text is deprecated: use vim.treesitter.query.get_node_text",
"nvim-treesitter.ts_utils.get_node_text is deprecated: use vim.treesitter.get_node_text",
vim.log.levels.WARN
)
return get_node_text(node, bufnr)

View File

@ -92,13 +92,6 @@
"{"
"}"
"@"
"} @"
(if_end_expression)
(for_end_expression)
(switch_end_expression)
(case_end_expression)
(default_end_expression)
(defer_end_expression)
] @punctuation.bracket
(two_way_binding

View File

@ -1 +1,16 @@
; inherits: html_tags
[
(statement_block)
(switch_statement)
] @indent.begin
(statement_block
"{" @indent.branch)
(statement_block
"}" @indent.end)
"}" @indent.branch
"}" @indent.end

View File

@ -65,3 +65,15 @@
(#eq? @_command "printf")
(#eq? @_arg "--")
(#set! injection.language "printf"))
((command
name: (command_name) @_command
.
argument: [
(string)
(raw_string)
] @injection.content)
(#eq? @_command "bind")
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children)
(#set! injection.language "readline"))

View File

@ -42,6 +42,7 @@
[
(unset)
(default)
(any)
] @variable.builtin
(condition

View File

@ -9,4 +9,7 @@
(assignment
left: (identifier) @local.definition.var)
(pattern_binding
binding: (identifier) @local.definition.var)
(identifier) @local.reference

View File

@ -1,6 +1,6 @@
; Lower priority to prefer @variable.parameter when identifier appears in parameter_declaration.
((identifier) @variable
(#set! "priority" 95))
(#set! priority 95))
(preproc_def
(preproc_arg) @variable)

View File

@ -11,7 +11,7 @@
; have multiple highlight groups applied to them.
; >> Literals
((dis_expr) @comment
(#set! "priority" 105)
(#set! priority 105)
; Higher priority to mark the whole sexpr as a comment
)

View File

@ -3,11 +3,12 @@
((call_expression
(type) @_printf
(arguments
(named_arguments
"("
.
(expression
(string_literal) @injection.content)))
(named_argument
(expression
(string_literal) @injection.content))))
(#eq? @_printf "printf")
(#offset! @injection.content 0 1 0 -1)
(#set! injection.language "printf"))

View File

@ -12,7 +12,7 @@
(module_def
(module_declaration
(module_fqn) @local.definition.namespace)
(#set! "definition.namespace.scope" "global"))
(#set! definition.namespace.scope "global"))
(enum_declaration
(enum_member

View File

@ -1,3 +1,5 @@
(comment) @comment @spell
[
(addition)
(new_file)

View File

@ -22,7 +22,7 @@
(raw_block)
(frontmatter)
] @markup.raw.block
(#set! "priority" 90))
(#set! priority 90))
; Remove @markup.raw for code with a language spec
(code_block
@ -30,7 +30,7 @@
(code_block_marker_begin)
(language)
(code) @none
(#set! "priority" 90))
(#set! priority 90))
[
(code_block_marker_begin)
@ -204,12 +204,12 @@
(#set! conceal ""))
((math) @markup.math
(#set! "priority" 90))
(#set! priority 90))
(verbatim) @markup.raw
((raw_inline) @markup.raw
(#set! "priority" 90))
(#set! priority 90))
(comment
"%" @comment

View File

@ -43,7 +43,7 @@
((heredoc_block
(heredoc_line) @string)
(#set! "priority" 90))
(#set! priority 90))
(expansion
[

View File

@ -1,5 +1,5 @@
((tag_name) @keyword
(#set! "priority" 105))
(#set! priority 105))
[
"@code"

View File

@ -69,7 +69,7 @@
(ExternalID
(SystemLiteral
(URI) @string.special.url))
(#set! "priority" 105))
(#set! priority 105))
; Attlist declaration
(AttlistDecl

View File

@ -132,11 +132,6 @@
(new_expression
constructor: (identifier) @constructor)
; Variables
;----------
(namespace_import
(identifier) @module)
; Decorators
;----------
(decorator
@ -302,6 +297,19 @@
"}"
] @punctuation.special) @none
; Imports
;----------
(namespace_import
"*" @character.special
(identifier) @module)
(namespace_export
"*" @character.special
(identifier) @module)
(export_statement
"*" @character.special)
; Keywords
;----------
[

View File

@ -59,10 +59,11 @@
(statement_block
"{" @indent.branch)
(parenthesized_expression
("("
(_)
")" @indent.end))
((parenthesized_expression
"("
(_)
")" @indent.end) @_outer
(#not-has-parent? @_outer if_statement))
[
"}"
@ -75,3 +76,7 @@
(comment)
(ERROR)
] @indent.auto
(if_statement
consequence: (_) @indent.dedent
(#not-kind-eq? @indent.dedent statement_block)) @indent.begin

View File

@ -43,6 +43,25 @@
(#set! injection.include-children)
(#set! injection.language "html"))
; Vercel PostgreSQL
; foo.sql`...` or foo.sql(`...`)
(call_expression
function: [
(await_expression
(member_expression
property: (property_identifier) @injection.language))
(member_expression
property: (property_identifier) @injection.language)
]
arguments: [
(arguments
(template_string) @injection.content)
(template_string) @injection.content
]
(#eq? @injection.language "sql")
(#offset! @injection.content 0 1 0 -1)
(#set! injection.include-children))
(call_expression
function: [
(await_expression

View File

@ -1,5 +1,5 @@
((atom) @constant
(#set! "priority" "90"))
(#set! priority "90"))
(var) @variable
@ -86,15 +86,15 @@
; Macros
((macro_call_expr) @constant.macro
(#set! "priority" 101))
(#set! priority 101))
; Preprocessor
(pp_define
lhs: _ @constant.macro
(#set! "priority" 101))
(#set! priority 101))
(_preprocessor_directive) @keyword.directive
(#set! "priority" 99)
(#set! priority 99)
; Attributes
(pp_include) @keyword.import
@ -108,7 +108,7 @@
(export_type_attribute
types: (fa
fun: _ @type
(#set! "priority" 101)))
(#set! priority 101)))
(behaviour_attribute) @keyword.import

View File

@ -22,7 +22,10 @@
"errors"
] @keyword
"method" @keyword.function
[
"method"
"event"
] @keyword.function
[
"enum"

View File

@ -90,7 +90,7 @@
] @variable.member
((field_id) @variable.member
(#set! "priority" 105))
(#set! priority 105))
(port
(identifier) @variable.member)

View File

@ -48,7 +48,7 @@
; Function Definition
((function_definition
(name) @local.definition.function)
(#set! "definition.function.scope" "parent"))
(#set! definition.function.scope "parent"))
; Lambda
; lambda names are not accessible and are only for debugging.
@ -74,7 +74,7 @@
; Class
((class_definition
(name) @local.definition.type)
(#set! "definition.type.scope" "parent"))
(#set! definition.type.scope "parent"))
(class_definition
(body
@ -102,7 +102,7 @@
(body
(function_definition
(name) @local.definition.method)))
(#set! "definition.method.scope" "parent"))
(#set! definition.method.scope "parent"))
; Enum
(enum_definition

View File

@ -15,8 +15,6 @@
(subject) @markup.heading @spell
(overflow) @comment.warning @spell
(subject
(subject_prefix) @function @nospell)

View File

@ -1,5 +1,7 @@
(comment) @comment @spell
(pattern_char) @string.special.path
[
(directory_separator)
(directory_separator_escaped)
@ -9,16 +11,17 @@
(wildcard_char_single)
(wildcard_chars)
(wildcard_chars_allow_slash)
(bracket_negation)
] @operator
(negation) @punctuation.special
] @character.special
[
(pattern_char_escaped)
(bracket_char_escaped)
] @string.escape
(negation) @punctuation.special
(bracket_negation) @operator
; bracket expressions
[
"["

View File

@ -12,10 +12,21 @@
(block)
(call_expression)
(parameter_list)
(struct_type)
(field_declaration_list)
(interface_type)
] @indent.begin
"}" @indent.branch
(literal_value
"}" @indent.branch)
(block
"}" @indent.branch)
(field_declaration_list
"}" @indent.branch)
(interface_type
"}" @indent.branch)
(const_declaration
")" @indent.branch)

View File

@ -1,39 +1,49 @@
; Priorities of the highlight queries are raised, so that they overrule the
; often surrounding and overlapping highlights from the non-gotmpl injections.
;
; Identifiers
[
([
(field)
(field_identifier)
] @variable.member
(#set! priority 110))
(variable) @variable
((variable) @variable
(#set! priority 110))
; Function calls
(function_call
function: (identifier) @function)
function: (identifier) @function
(#set! priority 110))
(method_call
method: (selector_expression
field: (field_identifier) @function))
field: (field_identifier) @function
(#set! priority 110)))
; Builtin functions
(function_call
function: (identifier) @function.builtin
(#set! priority 110)
(#any-of? @function.builtin
"and" "call" "html" "index" "slice" "js" "len" "not" "or" "print" "printf" "println" "urlquery"
"eq" "ne" "lt" "ge" "gt" "ge"))
; Operators
[
([
"|"
":="
] @operator
(#set! priority 110))
; Delimiters
[
([
"."
","
] @punctuation.delimiter
(#set! priority 110))
[
([
"{{"
"}}"
"{{-"
@ -41,6 +51,7 @@
")"
"("
] @punctuation.bracket
(#set! priority 110))
; Actions
(if_action
@ -49,59 +60,73 @@
"else"
"else if"
"end"
] @keyword.conditional)
] @keyword.conditional
(#set! priority 110))
(range_action
[
"range"
"else"
"end"
] @keyword.repeat)
] @keyword.repeat
(#set! priority 110))
(template_action
"template" @function.builtin)
"template" @function.builtin
(#set! priority 110))
(block_action
[
"block"
"end"
] @keyword.directive)
] @keyword.directive
(#set! priority 110))
(define_action
[
"define"
"end"
] @keyword.directive.define)
] @keyword.directive.define
(#set! priority 110))
(with_action
[
"with"
"else"
"end"
] @keyword.conditional)
] @keyword.conditional
(#set! priority 110))
; Literals
[
([
(interpreted_string_literal)
(raw_string_literal)
] @string
(#set! priority 110))
(rune_literal) @string.special.symbol
((rune_literal) @string.special.symbol
(#set! priority 110))
(escape_sequence) @string.escape
((escape_sequence) @string.escape
(#set! priority 110))
[
([
(int_literal)
(imaginary_literal)
] @number
(#set! priority 110))
(float_literal) @number.float
((float_literal) @number.float
(#set! priority 110))
[
([
(true)
(false)
] @boolean
(#set! priority 110))
(nil) @constant.builtin
((nil) @constant.builtin
(#set! priority 110))
(comment) @comment @spell
((comment) @comment @spell
(#set! priority 110))

View File

@ -148,6 +148,8 @@
"!"
] @operator
(wildcard_import) @character.special
(string
"/" @string)

View File

@ -39,7 +39,7 @@
((scoped_type_identifier
path: (_) @module)
(#set! "priority" 105))
(#set! priority 105))
; Keywords
[
@ -93,7 +93,7 @@
; Labels
((label) @label
(#set! "priority" 105))
(#set! priority 105))
; Functions
(function_declaration
@ -144,7 +144,7 @@
((member_expression
"."
(_) @variable.member)
(#set! "priority" 105))
(#set! priority 105))
(field
.

View File

@ -14,7 +14,8 @@
(if_statement
("("
condition: (_)")") @indent.begin)
condition: (_)
")") @indent.begin)
[
"}"

View File

@ -144,7 +144,8 @@
.
(decl
name: (variable) @variable)
match: (_)(#eq? @_name @variable))
match: (_)
(#eq? @_name @variable))
; but consider a type that involves 'IO' a decl/function
(decl/signature
@ -161,7 +162,8 @@
.
(decl
name: (variable) @function)
match: (_)(#eq? @_name @function))
match: (_)
(#eq? @_name @function))
((decl/signature) @function
.

View File

@ -1,8 +1,11 @@
; inherits: gotmpl
; For the reasoning concerning the priorities, see gotmpl highlights.
;
; Builtin functions
(function_call
function: (identifier) @function.builtin
(#set! priority 110)
(#any-of? @function.builtin
"and" "or" "not" "eq" "ne" "lt" "le" "gt" "ge" "default" "required" "empty" "fail" "coalesce"
"ternary" "print" "println" "printf" "trim" "trimAll" "trimPrefix" "trimSuffix" "lower" "upper"
@ -33,6 +36,7 @@
(selector_expression
operand: (field
name: (identifier) @constant.builtin
(#set! priority 110)
(#any-of? @constant.builtin
"Values" "Chart" "Release" "Capabilities" "Files" "Subcharts" "Template"))
(field_identifier))
@ -41,5 +45,6 @@
(selector_expression
operand: (variable)
field: (field_identifier) @constant.builtin
(#set! priority 110)
(#any-of? @constant.builtin
"Values" "Chart" "Release" "Capabilities" "Files" "Subcharts" "Template"))

View File

@ -7,7 +7,7 @@
((attribute
(quoted_attribute_value) @string)
(#set! "priority" 99))
(#set! priority 99))
(text) @none @spell
@ -86,14 +86,15 @@
((element
(start_tag
(tag_name) @_tag)
(text) @string.special.url)
(text) @markup.link.label)
(#eq? @_tag "a"))
((attribute
(attribute_name) @_attr
(quoted_attribute_value
(attribute_value) @string.special.url))
(#any-of? @_attr "href" "src"))
(#any-of? @_attr "href" "src")
(#set! @string.special.url url @string.special.url))
[
"<"

View File

@ -11,4 +11,5 @@
(multiline_string
(multiline_string_type) @_lang
(multiline_string_content) @injection.content
(#set-lang-from-info-string! @_lang))
(#set-lang-from-info-string! @_lang)
(#set! injection.combined))

View File

@ -77,18 +77,31 @@
(map_type)
(object_type)
(value_base_type)
(wide_string_type)
(wide_char_type)
] @type.builtin
(escape_sequence) @string.escape
(scoped_name) @type
(boolean_literal) @boolean
(number_literal) @number
(integer_literal) @number
[
(floating_pt_literal)
(fixed_pt_literal)
] @number.float
(char_literal) @character
(wide_character_literal) @character
(string_literal) @string
(wide_string_literal) @string
[
"("
")"
@ -111,7 +124,7 @@
"~"
"|"
"^"
"$"
"&"
] @operator
[
@ -128,15 +141,19 @@
(simple_declarator) @variable.member)
(annotation_appl
"@" @attribute
"@" @attribute)
(annotation_appl_custom_body
(scoped_name) @attribute)
(op_dcl
(identifier) @function.method)
(type_declarator
(simple_type_spec) @type
(any_declarators) @type)
(simple_type_spec) @type)
(type_declarator
(any_declarators) @variable.member)
(param_dcl
(simple_declarator) @variable.parameter)
@ -205,8 +222,8 @@
(bitfield_spec
"bitfield" @keyword.modifier
(positive_int_const) @number
(destination_type)* @type)
(identifier) @variable.member)
(destination_type)? @type)
(identifier)* @variable.member)
(bit_value) @constant
@ -327,3 +344,36 @@
(factory_param_dcl
(simple_declarator) @variable.parameter)
(element_spec
(declarator) @variable.member)
(preproc_include
(keyword_include) @type
path: (_) @string)
(system_lib_string
"<" @string
">" @string)
(extend_annotation_appl
"//@" @attribute
(annotation_appl_custom_body))
(extend_annotation_appl
"//@" @attribute.builtin
(annotation_appl_builtin_body))
[
(autoid_kind)
(extensibility_kind)
(verbatim_language)
(placement_kind)
(service_platform)
(try_construct_fail_action)
(data_representation_mask)
] @constant
(anno_name) @attribute.builtin
(range_kind) @attribute.builtin

View File

@ -257,6 +257,10 @@
"uses"
] @keyword.import
(import_declaration
(asterisk
"*" @character.special))
; Punctuation
[
";"

View File

@ -1,3 +1,40 @@
(tag_name) @keyword @nospell
(type) @type @nospell
[
"{"
"}"
"["
"]"
] @punctuation.bracket
[
":"
"/"
"."
"#"
"~"
] @punctuation.delimiter
(identifier) @variable
(tag
(tag_name) @_name
(identifier) @function
(#any-of? @_name "@callback" "@function" "@func" "@method"))
(tag
(tag_name) @_name
(identifier) @variable.parameter
(#any-of? @_name "@param" "@arg" "@argument"))
(tag
(tag_name) @_name
(identifier) @property
(#any-of? @_name "@prop" "@property"))
(tag
(tag_name) @_name
(identifier) @type
(#eq? @_name "@typedef"))

View File

@ -11,7 +11,7 @@
(field
function: (fieldname
(id) @local.definition.function)
(#set! "definition.function.scope" "parent"))
(#set! definition.function.scope "parent"))
(bind
(id) @local.definition.var)

View File

@ -65,3 +65,87 @@
(jsx_text) @none @spell
(html_character_reference) @character.special
((jsx_element
(jsx_opening_element
name: (identifier) @_tag)
(jsx_text) @markup.heading)
(#eq? @_tag "title"))
((jsx_element
(jsx_opening_element
name: (identifier) @_tag)
(jsx_text) @markup.heading.1)
(#eq? @_tag "h1"))
((jsx_element
(jsx_opening_element
name: (identifier) @_tag)
(jsx_text) @markup.heading.2)
(#eq? @_tag "h2"))
((jsx_element
(jsx_opening_element
name: (identifier) @_tag)
(jsx_text) @markup.heading.3)
(#eq? @_tag "h3"))
((jsx_element
(jsx_opening_element
name: (identifier) @_tag)
(jsx_text) @markup.heading.4)
(#eq? @_tag "h4"))
((jsx_element
(jsx_opening_element
name: (identifier) @_tag)
(jsx_text) @markup.heading.5)
(#eq? @_tag "h5"))
((jsx_element
(jsx_opening_element
name: (identifier) @_tag)
(jsx_text) @markup.heading.6)
(#eq? @_tag "h6"))
((jsx_element
(jsx_opening_element
name: (identifier) @_tag)
(jsx_text) @markup.strong)
(#any-of? @_tag "strong" "b"))
((jsx_element
(jsx_opening_element
name: (identifier) @_tag)
(jsx_text) @markup.italic)
(#any-of? @_tag "em" "i"))
((jsx_element
(jsx_opening_element
name: (identifier) @_tag)
(jsx_text) @markup.strikethrough)
(#any-of? @_tag "s" "del"))
((jsx_element
(jsx_opening_element
name: (identifier) @_tag)
(jsx_text) @markup.underline)
(#eq? @_tag "u"))
((jsx_element
(jsx_opening_element
name: (identifier) @_tag)
(jsx_text) @markup.raw)
(#any-of? @_tag "code" "kbd"))
((jsx_element
(jsx_opening_element
name: (identifier) @_tag)
(jsx_text) @markup.link.label)
(#eq? @_tag "a"))
((jsx_attribute
(property_identifier) @_attr
(string
(string_fragment) @string.special.url))
(#any-of? @_attr "href" "src"))

View File

@ -13,14 +13,27 @@
(#set! injection.language "markdown")
(#offset! @injection.content 0 3 0 -3))
; Inject comments
([
(line_comment)
(block_comment)
] @injection.content
(#set! injection.language "comment"))
; Inject regex in r"hello\bworld"
((prefixed_string_literal
prefix: (identifier) @_prefix) @injection.content
(#eq? @_prefix "r")
(#set! injection.language "regex")
(#offset! @injection.content 0 2 0 -1))
; Inject markdown in md"**Bold** and _Italics_"
((prefixed_string_literal
prefix: (identifier) @_prefix) @injection.content
(#eq? @_prefix "md")
(#set! injection.language "markdown")
(#offset! @injection.content 0 3 0 -1))
; Inject bash in `git add --help`
((command_literal) @injection.content
(#set! injection.language "bash"))

View File

@ -101,7 +101,7 @@
; Fallback highlighting for recipe bodies
(recipe
(recipe_body) @string
(#set! "priority" 90))
(#set! priority 90))
; Ref: https://just.systems/man/en/chapter_26.html
;(setting (identifier) @error)

View File

@ -58,13 +58,13 @@
(node
(node_comment)
(#set! "priority" 105)) @comment
(#set! priority 105)) @comment
(node
(node_field
(node_field_comment)
(#set! "priority" 105)) @comment)
(#set! priority 105)) @comment)
(node_children
(node_children_comment)
(#set! "priority" 105)) @comment
(#set! priority 105)) @comment

View File

@ -73,6 +73,8 @@
(import_header
"import" @keyword.import)
(wildcard_import) @character.special
; The last `simple_identifier` in a `import_header` will always either be a function
; or a type. Classes can appear anywhere in the import path, unlike functions
(import_header

View File

@ -13,13 +13,13 @@
(function_declaration
.
(simple_identifier) @local.definition.function
(#set! "definition.function.scope" "parent"))
(#set! definition.function.scope "parent"))
(class_body
(function_declaration
.
(simple_identifier) @local.definition.method)
(#set! "definition.method.scope" "parent"))
(#set! definition.method.scope "parent"))
; Variables
(function_declaration
@ -52,11 +52,11 @@
; Types
(class_declaration
(type_identifier) @local.definition.type
(#set! "definition.type.scope" "parent"))
(#set! definition.type.scope "parent"))
(type_alias
(type_identifier) @local.definition.type
(#set! "definition.type.scope" "parent"))
(#set! definition.type.scope "parent"))
; Scopes
[

View File

@ -1,24 +1,29 @@
; General syntax
(command_name) @function
(text_mode
[
"\\text"
"\\intertext"
"\\shortintertext"
] @function)
(command_name) @function @nospell
(caption
command: _ @function)
; Turn spelling on for text
(text) @spell
; \text, \intertext, \shortintertext, ...
(text_mode
command: _ @function @nospell
content: (curly_group
(_) @none @spell))
; Variables, parameters
(placeholder) @variable
(key_value_pair
key: (_) @variable.parameter
key: (_) @variable.parameter @nospell
value: (_))
[
(brack_group)
(brack_group_argc)
] @variable.parameter
(curly_group_spec
(text) @variable.parameter)
(brack_group_argc) @variable.parameter
[
(operator)
@ -29,8 +34,13 @@
"\\item" @punctuation.special
((word) @punctuation.delimiter
(#eq? @punctuation.delimiter "&"))
(delimiter) @punctuation.delimiter
(math_delimiter
left_command: _ @punctuation.delimiter
left_delimiter: _ @punctuation.delimiter
right_command: _ @punctuation.delimiter
right_delimiter: _ @punctuation.delimiter)
[
"["
@ -43,46 +53,42 @@
(begin
command: _ @module
name: (curly_group_text
(text) @label))
(text) @label @nospell))
(end
command: _ @module
name: (curly_group_text
(text) @label))
(text) @label @nospell))
; Definitions and references
(new_command_definition
command: _ @function.macro
declaration: (curly_group_command_name
(_) @function))
command: _ @function.macro @nospell)
(old_command_definition
command: _ @function.macro
declaration: (_) @function)
command: _ @function.macro @nospell)
(let_command_definition
command: _ @function.macro
declaration: (_) @function)
command: _ @function.macro @nospell)
(environment_definition
command: _ @function.macro
command: _ @function.macro @nospell
name: (curly_group_text
(_) @markup.link))
(_) @label @nospell))
(theorem_definition
command: _ @function.macro
command: _ @function.macro @nospell
name: (curly_group_text_list
(_) @label))
(_) @label @nospell))
(paired_delimiter_definition
command: _ @function.macro
command: _ @function.macro @nospell
declaration: (curly_group_command_name
(_) @function))
(label_definition
command: _ @function.macro
name: (curly_group_text
(_) @markup.link))
(_) @markup.link @nospell))
(label_reference_range
command: _ @function.macro
@ -103,13 +109,18 @@
number: (_) @markup.link)
(citation
command: _ @function.macro
keys: (curly_group_text_list) @markup.link)
command: _ @function.macro @nospell
keys: (curly_group_text_list) @markup.link @nospell)
(hyperlink
command: _ @function @nospell
uri: (curly_group_uri
(_) @markup.link.url @nospell))
(glossary_entry_definition
command: _ @function.macro
command: _ @function.macro @nospell
name: (curly_group_text
(_) @markup.link))
(_) @markup.link @nospell))
(glossary_entry_reference
command: _ @function.macro
@ -117,9 +128,9 @@
(_) @markup.link))
(acronym_definition
command: _ @function.macro
command: _ @function.macro @nospell
name: (curly_group_text
(_) @markup.link))
(_) @markup.link @nospell))
(acronym_reference
command: _ @function.macro
@ -136,26 +147,6 @@
name: (curly_group_text
(_) @markup.link))
; Formatting
(text_mode
content: (curly_group
(_) @none @spell))
(math_environment
(begin
command: _ @markup.math
name: (curly_group_text
(_) @markup.math)))
(math_environment
(_) @markup.math)
(math_environment
(end
command: _ @markup.math
name: (curly_group_text
(_) @markup.math)))
; Sectioning
(title_declaration
command: _ @module
@ -231,20 +222,14 @@
((generic_command
command: (command_name) @_name
arg: (curly_group
(text) @markup.heading))
(_) @markup.heading))
(#eq? @_name "\\frametitle"))
((generic_command
command: (command_name) @_name
arg: (curly_group
(_) @markup.italic))
(#eq? @_name "\\emph"))
((generic_command
command: (command_name) @_name
arg: (curly_group
(_) @markup.italic))
(#any-of? @_name "\\textit" "\\mathit"))
(#any-of? @_name "\\emph" "\\textit" "\\mathit"))
((generic_command
command: (command_name) @_name
@ -252,13 +237,6 @@
(_) @markup.strong))
(#any-of? @_name "\\textbf" "\\mathbf"))
((generic_command
command: (command_name) @_name
.
arg: (curly_group
(_) @markup.link.url))
(#any-of? @_name "\\url" "\\href"))
; File inclusion commands
(class_include
command: _ @keyword.import
@ -270,12 +248,16 @@
(latex_include
command: _ @keyword.import
path: (curly_group_path) @string)
path: (curly_group_path) @string.special.path)
(verbatim_include
command: _ @keyword.import
path: (curly_group_path) @string.special.path)
(import_include
command: _ @keyword.import
directory: (curly_group_path) @string
file: (curly_group_path) @string)
directory: (curly_group_path) @string.special.path
file: (curly_group_path) @string.special.path)
(bibstyle_include
command: _ @keyword.import
@ -283,7 +265,7 @@
(bibtex_include
command: _ @keyword.import
paths: (curly_group_path_list) @string)
paths: (curly_group_path_list) @string.special.path)
(biblatex_include
"\\addbibresource" @keyword.import
@ -291,41 +273,53 @@
(graphics_include
command: _ @keyword.import
path: (curly_group_path) @string)
path: (curly_group_path) @string.special.path)
(svg_include
command: _ @keyword.import
path: (curly_group_path) @string.special.path)
(inkscape_include
command: _ @keyword.import
path: (curly_group_path) @string.special.path)
(tikz_library_import
command: _ @keyword.import
paths: (curly_group_path_list) @string)
(text) @spell
(inline_formula) @nospell
(displayed_equation) @nospell
(key_value_pair) @nospell
(generic_environment
begin: _ @nospell
end: _ @nospell)
(citation
keys: _ @nospell)
(command_name) @nospell
(label_definition) @nospell
(label_reference) @nospell
(label_reference_range) @nospell
; Turn spelling off for whole nodes
[
(label_reference)
(label_reference_range)
(label_number)
(glossary_entry_reference)
(acronym_reference)
(color_definition)
(color_reference)
(class_include)
(package_include)
(latex_include)
(verbatim_include)
(import_include)
(bibstyle_include)
(bibtex_include)
(biblatex_include)
(graphics_include)
(svg_include)
(inkscape_include)
(tikz_library_import)
] @nospell
; Math
[
(displayed_equation)
(inline_formula)
] @markup.math
] @markup.math @nospell
(math_environment
(_) @markup.math)
; Comments
[
(line_comment)
(block_comment)

View File

@ -17,15 +17,20 @@
code: (source_code) @injection.content
(#set! injection.language "python"))
(luacode_environment
code: (source_code) @injection.content
(#set! injection.language "lua"))
(asy_environment
code: (source_code) @injection.content
(#set! injection.language "c"))
(asydef_environment
code: (source_code) @injection.content
(#set! injection.language "c"))
(minted_environment
(begin
language: (curly_group_text
(text) @injection.language))
(source_code) @injection.content)
((generic_environment
(begin
name: (curly_group_text
(text) @_env))) @injection.content
(#set! injection.language "c")
(#any-of? @_env "asy" "asydef"))

View File

@ -181,7 +181,7 @@
(address_literal)
(signature_literal)
((affine_group_literal)
(#set! "priority" 101))
(#set! priority 101))
(field_literal)
(product_group_literal)
(scalar_literal)

View File

@ -59,9 +59,9 @@
(#set! priority 110))
([
"break"
(break_statement)
(continue_statement)
"by"
"continue"
"cycle"
"endfor"
"endpaginate"

View File

@ -162,7 +162,7 @@
; Tables
(field
name: (identifier) @variable.member)
name: (identifier) @property)
(dot_index_expression
field: (identifier) @variable.member)

View File

@ -16,10 +16,12 @@
[
"end"
")"
"}"
] @indent.end
(")" @indent.end
(#not-has-parent? @indent.end parameters))
(return_statement
(expression_list
(function_call))) @indent.dedent
@ -39,3 +41,6 @@
(comment) @indent.auto
(string) @indent.auto
(ERROR
"function") @indent.begin

View File

@ -121,7 +121,7 @@
"["
"]"
] @type)
(#set! "priority" 105))
(#set! priority 105))
(type) @type

View File

@ -32,7 +32,11 @@
(negated_set
(character) @constant)
(class) @keyword
(class) @string.escape
(class
"%" @string.regexp
(escape_char) @string.regexp)
(negated_set
"^" @operator)

View File

@ -45,7 +45,7 @@
(indented_code_block) @markup.raw.block
((fenced_code_block) @markup.raw.block
(#set! "priority" 90))
(#set! priority 90))
(fenced_code_block
(fenced_code_block_delimiter) @markup.raw.block
@ -103,13 +103,13 @@
(task_list_marker_checked) @markup.list.checked
((block_quote) @markup.quote
(#set! "priority" 90))
(#set! priority 90))
([
(plus_metadata)
(minus_metadata)
] @keyword.directive
(#set! "priority" 90))
(#set! priority 90))
[
(block_continuation)

View File

@ -43,7 +43,7 @@
(inline_link
(link_text) @_label
(link_destination) @_url
(#set! @_label "url" @_url))
(#set! @_label url @_url))
; Conceal image links
(image
@ -88,6 +88,13 @@
(email_autolink)
] @markup.link.url @nospell
((link_destination) @_url
(#set! @_url url @_url))
((uri_autolink) @_url
(#offset! @_url 0 1 0 -1)
(#set! @_url url @_url))
(entity_reference) @nospell
; Replace common HTML entities.

View File

@ -4,7 +4,7 @@
; =============================================================================
; catch all rules
((identifier) @variable
(#set! "priority" 99))
(#set! priority 99))
; NOTE: we need priority, since (identifier) is most specific and we have to
; capture nodes containing (identifier) as a whole, while overruling the
@ -12,7 +12,7 @@
(type_expression) @type
; NOTE: has to be after
; ((identifier) @variable (#set! "priority" 99))
; ((identifier) @variable (#set! priority 99))
; overrule identifiers in pragmas in (proc_type)s and (pragma_expression)s
(proc_type
pragmas: (pragma_list) @variable)

View File

@ -33,7 +33,7 @@
(exported_symbol
(accent_quoted) @local.definition.function)
]
(#set! "definition.function.scope" "parent"))
(#set! definition.function.scope "parent"))
(func_declaration
name: [
@ -44,7 +44,7 @@
(exported_symbol
(accent_quoted) @local.definition.function)
]
(#set! "definition.function.scope" "parent"))
(#set! definition.function.scope "parent"))
(iterator_declaration
name: [
@ -55,7 +55,7 @@
(exported_symbol
(accent_quoted) @local.definition.function)
]
(#set! "definition.function.scope" "parent"))
(#set! definition.function.scope "parent"))
(converter_declaration
name: [
@ -66,7 +66,7 @@
(exported_symbol
(accent_quoted) @local.definition.function)
]
(#set! "definition.function.scope" "parent"))
(#set! definition.function.scope "parent"))
; ==============================================================================
; @local.definition.method ; methods
@ -79,7 +79,7 @@
(exported_symbol
(accent_quoted) @local.definition.method)
]
(#set! "definition.method.scope" "parent"))
(#set! definition.method.scope "parent"))
; ==============================================================================
; @local.definition.var ; variables
@ -193,7 +193,7 @@
(exported_symbol
(accent_quoted) @local.definition.macro)
]
(#set! "definition.macro.scope" "parent"))
(#set! definition.macro.scope "parent"))
(macro_declaration
name: [
@ -204,7 +204,7 @@
(exported_symbol
(accent_quoted) @local.definition.macro)
]
(#set! "definition.macro.scope" "parent"))
(#set! definition.macro.scope "parent"))
; ==============================================================================
; @local.definition.type ; types or classes

View File

@ -89,7 +89,7 @@
;----------
; Don't let normal parens take priority over this
((unit) @constant.builtin
(#set! "priority" 105))
(#set! priority 105))
(boolean) @boolean

View File

@ -64,7 +64,7 @@
"else"
"when"
] @keyword.conditional.ternary)
(#set! "priority" 105))
(#set! priority 105))
; Repeats
[

View File

@ -270,4 +270,4 @@
")"
] @punctuation.bracket
; priority hack so nvim + ts-cli behave the same
(#set! "priority" 90))
(#set! priority 90))

View File

@ -40,6 +40,12 @@
(compound_statement
"}" @indent.end)
(declaration_list
"}" @indent.end)
(enum_declaration_list
"}" @indent.end)
(return_statement
";" @indent.end)

View File

@ -8,7 +8,7 @@
((command_paragraph
(command) @keyword
(content) @string)
(#set! "priority" 99))
(#set! priority 99))
(command_paragraph
(command) @keyword

View File

@ -133,7 +133,7 @@
((ffi_method
(string) @string.special)
(#set! "priority" 105))
(#set! priority 105))
(call_expression
callee: [

View File

@ -59,7 +59,7 @@
; Decorators
((decorator
"@" @attribute)
(#set! "priority" 101))
(#set! priority 101))
(decorator
(identifier) @attribute)
@ -199,46 +199,27 @@
] @string.escape
; doc-strings
(module
.
(comment)*
.
(expression_statement
(string) @string.documentation))
(class_definition
body: (block
.
(expression_statement
(string) @string.documentation)))
(function_definition
body: (block
.
(expression_statement
(string) @string.documentation)))
(module
.
(comment)*
.
(expression_statement
(string
(string_content) @spell)))
(string_content) @spell) @string.documentation))
(class_definition
body: (block
.
(expression_statement
(string
(string_content) @spell))))
(string_content) @spell) @string.documentation)))
(function_definition
body: (block
.
(expression_statement
(string
(string_content) @spell))))
(string_content) @spell) @string.documentation)))
; Tokens
[
@ -339,6 +320,9 @@
(aliased_import
"as" @keyword.import)
(wildcard_import
"*" @character.special)
[
"if"
"elif"

View File

@ -1,6 +1,5 @@
[
(import_from_statement)
(parenthesized_expression)
(generator_expression)
(list_comprehension)
(set_comprehension)
@ -24,6 +23,10 @@
(#set! indent.open_delimiter "{")
(#set! indent.close_delimiter "}"))
((parenthesized_expression) @indent.align
(#set! indent.open_delimiter "(")
(#set! indent.close_delimiter ")"))
((for_statement) @indent.begin
(#set! indent.immediate 1))
@ -67,14 +70,40 @@
((case_clause) @indent.begin
(#set! indent.immediate 1))
; if (cond1
; or cond2
; or cond3):
; pass
;
(if_statement
condition: (parenthesized_expression) @indent.align
(#lua-match? @indent.align "^%([^\n]")
(#set! indent.open_delimiter "(")
(#set! indent.close_delimiter ")")
(#set! indent.avoid_last_matching_next 1))
; while (
; cond1
; or cond2
; or cond3):
; pass
;
(while_statement
condition: (parenthesized_expression) @indent.align
(#lua-match? @indent.align "[^\n ]%)$")
(#set! indent.open_delimiter "(")
(#set! indent.close_delimiter ")")
(#set! indent.avoid_last_matching_next 1))
; if (
; cond1
; or cond2
; or cond3):
; pass
;
(if_statement
condition: (parenthesized_expression) @indent.align
(#lua-match? @indent.align "[^\n ]%)$")
(#set! indent.open_delimiter "(")
(#set! indent.close_delimiter ")")
(#set! indent.avoid_last_matching_next 1))
@ -91,6 +120,11 @@
(#set! indent.close_delimiter ")"))
((parameters) @indent.align
(#set! indent.open_delimiter "(")
(#set! indent.close_delimiter ")"))
((parameters) @indent.align
(#lua-match? @indent.align "[^\n ]%)$")
(#set! indent.open_delimiter "(")
(#set! indent.close_delimiter ")")
(#set! indent.avoid_last_matching_next 1))
@ -130,9 +164,6 @@
.
(#lua-match? @indent.branch "^elif"))
(parenthesized_expression
")" @indent.end)
(generator_expression
")" @indent.end)

View File

@ -12,7 +12,7 @@
name: (identifier) @variable)
(field_definition
name: (identifier) @property)
name: (identifier) @variable.member)
(negated_field
"!" @operator
@ -63,6 +63,15 @@
((comment) @keyword.directive @nospell
(#lua-match? @keyword.directive "^;+%s*format%-ignore%s*$"))
((predicate
name: (identifier) @_name
parameters: (parameters
.
(capture)?
.
(identifier) @property))
(#eq? @_name "set"))
((predicate
name: (identifier) @_name
parameters: (parameters

View File

@ -12,7 +12,12 @@
"]" @indent.branch @indent.end
")" @indent.end
[
")"
"?"
"*"
"+"
] @indent.end
; Captures always mark the end of a node
; Because of that, mark it as indent.end

View File

@ -1,28 +1,28 @@
((predicate
name: (identifier) @_name
parameters: (parameters
(string) @injection.content))
(string
(string_content) @injection.content)))
(#any-of? @_name "match" "not-match" "any-match" "vim-match" "not-vim-match" "any-vim-match")
(#set! injection.language "regex")
(#offset! @injection.content 0 1 0 -1))
(#set! injection.language "regex"))
((predicate
name: (identifier) @_name
parameters: (parameters
(string) @injection.content))
(string
(string_content) @injection.content)))
(#any-of? @_name "lua-match" "not-lua-match" "any-lua-match")
(#set! injection.language "luap")
(#offset! @injection.content 0 1 0 -1))
(#set! injection.language "luap"))
((predicate
name: (identifier) @_name
parameters: (parameters
(string) @injection.content
(string
(string_content) @injection.content)
.
(string) .))
(#any-of? @_name "gsub" "not-gsub")
(#set! injection.language "luap")
(#offset! @injection.content 0 1 0 -1))
(#set! injection.language "luap"))
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -1,4 +1,3 @@
; highlights.scm
; Literals
(integer) @number
@ -9,8 +8,10 @@
(string) @string
(string
(escape_sequence) @string.escape)
(string_content
(escape_sequence) @string.escape))
; Comments
(comment) @comment @spell
((program
@ -18,116 +19,109 @@
(comment) @keyword.directive @nospell)
(#lua-match? @keyword.directive "^#!/"))
(identifier) @variable
((dollar
(identifier) @variable.builtin)
(#eq? @variable.builtin "self"))
(dollar
_
(identifier) @variable.member)
; Parameters
(formal_parameters
(identifier) @variable.parameter)
(formal_parameters
(default_parameter
name: (identifier) @variable.parameter))
(default_argument
name: (identifier) @variable.parameter)
; Namespace
(namespace_get
namespace: (identifier) @module)
(namespace_get_internal
namespace: (identifier) @module)
; Operators
[
"?"
":="
"="
"<-"
"<<-"
"->"
] @operator
(unary
operator: [
"-"
"+"
"!"
"~"
"?"
] @operator)
(binary
operator: [
"-"
"+"
"*"
"/"
"^"
"<"
">"
"<="
">="
"=="
"!="
"||"
"|"
"&&"
"&"
":"
"~"
] @operator)
[
"->>"
"~"
"|>"
(special)
"||"
"|"
"&&"
"&"
"<"
"<="
">"
">="
"=="
"!="
"+"
"-"
"*"
"/"
"::"
":::"
"**"
"^"
"$"
"@"
":"
"!"
"special"
] @operator
(lambda_function
"\\" @operator)
; Punctuation
[
"("
")"
"["
"]"
"{"
"}"
"["
"]"
"[["
"]]"
] @punctuation.bracket
"," @punctuation.delimiter
(comma) @punctuation.delimiter
(dollar
_
"$" @operator)
; Variables
(identifier) @variable
(subset2
"[[" @punctuation.bracket
"]]" @punctuation.bracket)
; Functions
(binary_operator
lhs: (identifier) @function
operator: "<-"
rhs: (function_definition))
[
(dots)
(break)
(next)
] @keyword
(binary_operator
lhs: (identifier) @function
operator: "="
rhs: (function_definition))
[
(nan)
(na)
(null)
(inf)
] @constant.builtin
; Calls
(call
function: (identifier) @function.call)
(extract_operator
rhs: (identifier) @variable.member)
function: (extract_operator
rhs: (identifier) @function.method.call)
; Parameters
(parameters
(parameter
name: (identifier) @variable.parameter))
(arguments
(argument
name: (identifier) @variable.parameter))
; Namespace
(namespace_operator
lhs: (identifier) @module)
(call
function: (namespace_operator
rhs: (identifier) @function))
; Keywords
(function_definition
name: "function" @keyword.function)
(function_definition
name: "\\" @operator)
(return) @keyword.return
[
"if"
"else"
"switch"
] @keyword.conditional
[
@ -135,6 +129,8 @@
"repeat"
"for"
"in"
(break)
(next)
] @keyword.repeat
[
@ -142,21 +138,11 @@
(false)
] @boolean
"function" @keyword.function
; Functions/Methods
(call
function: (identifier) @function.call)
(call
(namespace_get
function: (identifier) @function.call))
(call
(namespace_get_internal
function: (identifier) @function.call))
(call
function: (dollar
_
(identifier) @function.method.call))
[
(null)
(inf)
(nan)
(na)
(dots)
(dot_dot_i)
] @constant.builtin

View File

@ -1,10 +1,7 @@
[
(brace_list)
(paren_list)
(special)
(pipe)
(braced_expression)
(parenthesized_expression)
(call)
"|>"
"if"
"else"
"while"
@ -12,16 +9,19 @@
"for"
] @indent.begin
(binary
operator: (special)) @indent.begin
(binary_operator
rhs: (_) @_no_indent
(#not-kind-eq? @_no_indent function_definition)) @indent.begin
[
"}"
")"
] @indent.branch
((formal_parameters
(identifier)) @indent.align
((parameters
.
(parameter
name: (identifier))) @indent.align
(#set! indent.open_delimiter "(")
(#set! indent.close_delimiter ")"))

View File

@ -1,16 +1,22 @@
; locals.scm
(function_definition) @local.scope
(formal_parameters
(identifier) @local.definition.parameter)
(left_assignment
(argument
name: (identifier) @local.definition)
(equals_assignment
(parameter
name: (identifier) @local.definition)
(right_assignment
name: (identifier) @local.definition)
(binary_operator
lhs: (identifier) @local.definition
operator: "<-")
(binary_operator
lhs: (identifier) @local.definition
operator: "=")
(binary_operator
operator: "->"
rhs: (identifier) @local.definition)
(identifier) @local.reference

View File

@ -674,12 +674,12 @@
.
(symbol) @keyword.import
(#eq? @keyword.import "require")
(#set! "priority" 101))
(#set! priority 101))
(quote
.
(symbol)
(#set! "priority" 105)) @string.special.symbol
(#set! priority 105)) @string.special.symbol
((sexp_comment) @comment
(#set! "priority" 110))
(#set! priority 110))

View File

@ -71,9 +71,6 @@
"ensure"
] @keyword.exception
((identifier) @keyword.exception
(#any-of? @keyword.exception "fail" "raise"))
; Function calls
"defined?" @function
@ -127,6 +124,14 @@
(#any-of? @constant.builtin
"__callee__" "__dir__" "__id__" "__method__" "__send__" "__ENCODING__" "__FILE__" "__LINE__"))
((identifier) @function.builtin
(#any-of? @function.builtin
"include" "extend" "prepend" "attr_reader" "attr_writer" "attr_accessor" "module_function"
"refine" "using"))
((identifier) @keyword.exception
(#any-of? @keyword.exception "raise" "fail" "catch" "throw"))
((constant) @type
(#not-lua-match? @type "^[A-Z0-9_]+$"))
@ -270,6 +275,7 @@
","
";"
"."
"&."
] @punctuation.delimiter
[

View File

@ -382,6 +382,9 @@
"||"
] @operator
(use_wildcard
"*" @character.special)
; Punctuation
[
"("

View File

@ -213,7 +213,11 @@
(wildcard) @variable.parameter
(namespace_wildcard) @punctuation.special
(namespace_wildcard
[
"*"
"_"
] @character.special)
(annotation) @attribute

View File

@ -20,7 +20,7 @@
(comment)
(directive)
] @comment
(#set! "priority" 105))
(#set! priority 105))
(escape_sequence) @string.escape

View File

@ -51,7 +51,7 @@
(trait_statement
(shape_id
(#set! "priority" 105)) @attribute)
(#set! priority 105)) @attribute)
; Operators
[

View File

@ -44,7 +44,8 @@
; Wildcard names
(wildcard
(identifier) @variable)
(identifier) @variable
(flag) @variable.parameter.builtin)
; builtin variables
((identifier) @variable.builtin

View File

@ -4,11 +4,11 @@
((sub_select
(select_clause
(var) @local.definition.var))
(#set! "definition.var.scope" "parent"))
(#set! definition.var.scope "parent"))
((select_query
(select_clause
(var) @local.definition.var))
(#set! "definition.var.scope" "parent"))
(#set! definition.var.scope "parent"))
(var) @local.reference

View File

@ -104,7 +104,7 @@
"="
":"
])
(#set! "priority" 105))
(#set! priority 105))
; Types
((identifier) @type

View File

@ -40,7 +40,7 @@
; Decorators
((decorator
"@" @attribute)
(#set! "priority" 101))
(#set! priority 101))
(decorator
(identifier) @attribute)

View File

@ -1,2 +1,2 @@
((comment) @injection.language
(#set! @injection.language "comment"))
((comment) @injection.content
(#set! injection.language "comment"))

View File

@ -9,7 +9,7 @@
; Definitions
(argument
name: (identifier) @local.definition.parameter
(#set! "definition.var.scope" "local"))
(#set! definition.var.scope "local"))
(variable_definition
name: (variable
@ -20,10 +20,10 @@
name: (variable
(environment_var
(identifier) @local.definition.var))
(#set! "definition.var.scope" "global"))
(#set! definition.var.scope "global"))
(function_definition
name: (variable) @local.definition.var
(#set! "definition.var.scope" "parent"))
(#set! definition.var.scope "parent"))
(identifier) @local.reference

View File

@ -98,7 +98,7 @@
(bang_operator)
(cond_operator)
] @function
(#set! "priority" 105))
(#set! priority 105))
; Operators
[

View File

@ -1,6 +1,6 @@
[
; import …
(import_statement)+
(import)+
; (…, …)
(parameter_list)
(argument_list)

View File

@ -108,7 +108,7 @@
; string.special.path
; -------------------
(import_statement
(import
library: (string) @string.special.path)
; boolean
@ -117,7 +117,10 @@
; constant
; --------
(constant
(global_constant
name: (identifier) @constant)
(storage_constant
name: (identifier) @constant)
; constant.builtin
@ -142,17 +145,12 @@
(field_access_expression
name: (identifier) @variable.member)
(trait_body
(constant
name: (identifier) @variable.member))
(contract_body
(constant
name: (identifier) @variable.member))
(field
name: (identifier) @variable.member)
(storage_variable
name: (identifier) @variable.member)
; number
; ------
(integer) @number
@ -248,7 +246,7 @@
(native_function
name: (identifier) @function)
(static_function
(global_function
name: (identifier) @function)
(func_identifier) @function
@ -267,7 +265,7 @@
(external_function
"external" @function.method)
(function
(storage_function
name: (identifier) @function.method)
; function.call
@ -289,19 +287,19 @@
"contractAddress" "contractAddressExt" "emit" "cell" "ton" "dump" "dumpStack" "beginString"
"beginComment" "beginTailString" "beginStringFromBuilder" "beginCell" "emptyCell" "randomInt"
"random" "checkSignature" "checkDataSignature" "sha256" "min" "max" "abs" "pow" "pow2" "throw"
"nativeThrowWhen" "nativeThrowUnless" "getConfigParam" "nativeRandomize" "nativeRandomizeLt"
"nativeThrowIf" "nativeThrowUnless" "getConfigParam" "nativeRandomize" "nativeRandomizeLt"
"nativePrepareRandom" "nativeRandom" "nativeRandomInterval" "nativeReserve"))
; comment
; -------
(comment) @comment @spell
((comment) @comment.documentation
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
; attribute
; ---------
[
"@name"
"@interface"
] @attribute
; comment
; -------
(comment) @comment @spell
((comment) @comment.documentation
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))

View File

@ -1,12 +1,12 @@
; Scopes @local.scope
; -------------------------
[
(static_function)
(global_function)
(init_function)
(bounced_function)
(receive_function)
(external_function)
(function)
(storage_function)
(block_statement)
] @local.scope
@ -17,11 +17,14 @@
name: (identifier) @local.definition.var)
; constants
(constant
(global_constant
name: (identifier) @local.definition.constant)
(storage_constant
name: (identifier) @local.definition.constant)
; functions
(static_function
(global_function
name: (identifier) @local.definition.function
(#set! definition.var.scope parent))
@ -42,7 +45,7 @@
"external" @local.definition.method
(#set! definition.var.scope parent))
(function
(storage_function
name: (identifier) @local.definition.method
(#set! definition.var.scope parent))
@ -53,12 +56,12 @@
; user-defined types (structs and messages)
(type_identifier) @local.definition.type
; fields (and properties)
; fields (of messages and structs)
(field
name: (identifier) @local.definition.field)
; imports
(import_statement
(import
(string) @local.definition.import)
; References @local.reference

View File

@ -16,8 +16,8 @@
(expr)
(arguments)
] @indent.align
(#set! "indent.open_delimiter" "{")
(#set! "indent.close_delimiter" "}"))
(#set! indent.open_delimiter "{")
(#set! indent.close_delimiter "}"))
[
"}"

View File

@ -1,6 +1,6 @@
; Variables
((identifier) @variable
(#set! "priority" 95))
(#set! priority 95))
; Includes
[

View File

@ -14,22 +14,22 @@
; Definitions {{{
(type_declaration
name: (identifier) @local.definition.type
(#set! "definition.var.scope" "parent"))
(#set! definition.var.scope "parent"))
(parameters
name: (identifier) @local.definition.parameter)
(function_declaration
name: (identifier) @local.definition.function
(#set! "definition.var.scope" "parent"))
(#set! definition.var.scope "parent"))
(primitive_declaration
name: (identifier) @local.definition.function
(#set! "definition.var.scope" "parent"))
(#set! definition.var.scope "parent"))
(variable_declaration
name: (identifier) @local.definition.var
(#set! "definition.var.scope" "parent"))
(#set! definition.var.scope "parent"))
; }}}
; References {{{

View File

@ -86,7 +86,7 @@
"or"
"procedure"
"process"
"skip"
(pcal_skip)
"variable"
"variables"
"when"
@ -119,7 +119,7 @@
(pcal_end_with)
] @keyword.repeat
"return" @keyword.return
(pcal_return) @keyword.return
"print" @function.macro

View File

@ -30,14 +30,14 @@
(function_definition
name: (identifier) @local.definition.function
(#set! "definition.function.scope" "parent"))
(#set! definition.function.scope "parent"))
(lambda
(identifier) @local.definition.parameter)
(module_definition
name: (_) @local.definition.import
(#set! "definition.import.scope" "parent"))
(#set! definition.import.scope "parent"))
(module_definition
parameter: (identifier) @local.definition.parameter)
@ -48,7 +48,7 @@
(operator_definition
name: (_) @local.definition.macro
(#set! "definition.macro.scope" "parent"))
(#set! definition.macro.scope "parent"))
(operator_definition
parameter: (identifier) @local.definition.parameter)
@ -97,7 +97,7 @@
(theorem
name: (identifier) @local.definition.constant
(#set! "definition.constant.scope" "parent"))
(#set! definition.constant.scope "parent"))
; PlusCal scopes and definitions
[

View File

@ -1,4 +1,5 @@
[
(statement)
(directive)
(triple)
(blank_node_property_list)
] @fold

View File

@ -1,5 +1,6 @@
[
(statement)
(directive)
(triple)
(blank_node_property_list)
(collection)
] @indent.begin

Some files were not shown because too many files have changed in this diff Show More