Refresh generated neovim config
This commit is contained in:
@ -1,11 +1,16 @@
|
||||
-- Add the plugin itself to the runtime path so we can use it in our tests.
|
||||
vim.opt.runtimepath:append(vim.fn.getcwd())
|
||||
|
||||
-- Tree-sitter highlighting needs to be running, otherwise rainbow highlighting
|
||||
-- won't get updated on tree changes. The following autocommand enables it on
|
||||
-- every file type change.
|
||||
|
||||
|
||||
local function on_file_type(_args)
|
||||
vim.treesitter.start()
|
||||
local function on_buf_win_enter(_args)
|
||||
if vim.bo.filetype ~= '' then
|
||||
vim.treesitter.start()
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
vim.api.nvim_create_autocmd('FileType', {pattern = '*', callback = on_file_type})
|
||||
vim.api.nvim_create_autocmd('BufWinEnter', {pattern = '*', callback = on_buf_win_enter})
|
||||
|
||||
@ -1,6 +1,11 @@
|
||||
-- Custom configuration for Busted
|
||||
|
||||
local say = require 'say'
|
||||
-- If busted is not available this configuration is not running as part of a
|
||||
-- test, so there is nothing to do.
|
||||
local success, say = pcall(require, 'say')
|
||||
if not success then
|
||||
return
|
||||
end
|
||||
local assert = require 'luassert'
|
||||
|
||||
|
||||
|
||||
@ -11,10 +11,10 @@ body:
|
||||
- I have updated my neovim version to latest _master_.
|
||||
- I have updated my plugin to the latest version.
|
||||
- I have run `:TSUpdate`.
|
||||
- I have inspected the syntax tree using https://github.com/nvim-treesitter/playground and made sure
|
||||
- I have inspected the syntax tree using `:InspectTree` and made sure
|
||||
that no `ERROR` nodes are in the syntax tree. nvim-treesitter can not guarantee correct highlighting in the
|
||||
presence of `ERROR`s -- in this case, please report the bug directly at corresponding parser's repository. (You can find all repository URLs in [README.md](https://github.com/nvim-treesitter/nvim-treesitter#supported-languages).)
|
||||
- I have used `:TSHighlightCapturesUnderCursor` from https://github.com/nvim-treesitter/playground to inspect which highlight groups Neovim is using and that legacy syntax highlighting is not interfering (i.e., what you are observing is actual tree-sitter highlighting).
|
||||
- I have used `:Inspect` to inspect which highlight groups Neovim is using and that legacy syntax highlighting is not interfering (i.e., what you are observing is actual tree-sitter highlighting).
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
@ -34,8 +34,8 @@ body:
|
||||
attributes:
|
||||
label: Tree-sitter parsing result
|
||||
description: |
|
||||
Please provide the output of `:TSPlaygroundToggle` from https://github.com/nvim-treesitter/playground
|
||||
(screenshot or plain text) with the following options enabled (pressing the key):
|
||||
Please provide the output of `:InspectTree` (screenshot or plain text)
|
||||
with the following options enabled (pressing the key):
|
||||
- `I` (name of the parsed language)
|
||||
- `t` (toggle injected languages)
|
||||
- `a` (show anonymous nodes)
|
||||
@ -66,7 +66,7 @@ body:
|
||||
description: |
|
||||
Please provide a screenshot of the current highlighting. Please also tell us the `:h colorscheme` you are using
|
||||
and how to install it. If applicable, you can also upload a screenshot with the contents of
|
||||
`:TSHighlightCapturesUnderCursor`.
|
||||
`:Inspect`.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
|
||||
@ -1,37 +0,0 @@
|
||||
pull_request_rules:
|
||||
- name: Merge lockfile updates
|
||||
conditions:
|
||||
- "title=Update lockfile.json"
|
||||
actions:
|
||||
review:
|
||||
type: APPROVE
|
||||
message: Automatically approving lockfile updates
|
||||
merge:
|
||||
method: merge
|
||||
|
||||
- name: Prepare for merge
|
||||
conditions:
|
||||
- and:
|
||||
- "-draft"
|
||||
- "#approved-reviews-by=1"
|
||||
- "#review-requested=0"
|
||||
actions:
|
||||
comment:
|
||||
message: |
|
||||
This PR is ready to be merged, and will be in 1 day if nothing happens before.
|
||||
If you want other people to review your PR, request their reviews.
|
||||
If you don't want this PR to be merged now, mark it as a Draft.
|
||||
|
||||
- name: Merge on approval
|
||||
conditions:
|
||||
- and:
|
||||
- or:
|
||||
- "#approved-reviews-by>=2"
|
||||
- and:
|
||||
- "#approved-reviews-by=1"
|
||||
- "updated-at>=1 day ago"
|
||||
- "-draft"
|
||||
- "#review-requested=0"
|
||||
actions:
|
||||
merge:
|
||||
method: rebase
|
||||
@ -1,8 +1,9 @@
|
||||
name: Linting and style checking
|
||||
|
||||
on:
|
||||
push:
|
||||
pull_request:
|
||||
branches:
|
||||
- "master"
|
||||
|
||||
jobs:
|
||||
luacheck:
|
||||
@ -31,3 +32,20 @@ jobs:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
version: latest
|
||||
args: --check .
|
||||
|
||||
format-queries:
|
||||
name: Lint queries
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
NVIM_TAG: stable
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Prepare
|
||||
run: |
|
||||
bash ./scripts/ci-install.sh
|
||||
|
||||
- name: Lint
|
||||
run: |
|
||||
nvim --headless -c "TSInstallSync query" -c "q"
|
||||
nvim -l scripts/format-queries.lua
|
||||
git diff --exit-code
|
||||
|
||||
@ -22,7 +22,7 @@ jobs:
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [ubuntu-latest, windows-2022, macos-latest]
|
||||
os: [ubuntu-latest, windows-latest, macos-14]
|
||||
cc: [gcc, clang]
|
||||
nvim_tag: [stable]
|
||||
exclude:
|
||||
@ -30,18 +30,18 @@ jobs:
|
||||
cc: clang
|
||||
nvim_tag: stable
|
||||
|
||||
- os: macos-latest
|
||||
- os: macos-14
|
||||
cc: gcc
|
||||
nvim_tag: stable
|
||||
|
||||
- os: windows-2022
|
||||
- os: windows-latest
|
||||
cc: clang
|
||||
nvim_tag: stable
|
||||
|
||||
include:
|
||||
- os: windows-2022
|
||||
- os: windows-latest
|
||||
cc: cl
|
||||
nvim_tag: stable
|
||||
nvim_tag: nightly
|
||||
|
||||
- os: ubuntu-latest
|
||||
cc: gcc
|
||||
@ -51,36 +51,37 @@ jobs:
|
||||
runs-on: ${{ matrix.os }}
|
||||
env:
|
||||
CC: ${{ matrix.cc }}
|
||||
NVIM: ${{ matrix.os == 'windows-2022' && 'nvim-win64\\bin\\nvim.exe' || 'nvim' }}
|
||||
ALLOWED_INSTALLATION_FAILURES: ${{ matrix.os == 'windows-2022' && 'rnoweb' }}
|
||||
NVIM: ${{ matrix.os == 'windows-latest' && 'nvim-win64\\bin\\nvim.exe' || 'nvim' }}
|
||||
ALLOWED_INSTALLATION_FAILURES: ${{ matrix.os == 'windows-latest' && 'rnoweb' }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: tree-sitter/setup-action/cli@v1
|
||||
- uses: ilammy/msvc-dev-cmd@v1
|
||||
- uses: actions/setup-node@v4
|
||||
|
||||
- name: Install tree-sitter CLI
|
||||
run: npm i -g tree-sitter-cli
|
||||
|
||||
- name: Install and prepare Neovim
|
||||
env:
|
||||
NVIM_TAG: ${{ matrix.nvim_tag }}
|
||||
run: |
|
||||
bash ./scripts/ci-install-${{ matrix.os }}.sh
|
||||
bash ./scripts/ci-install.sh
|
||||
|
||||
- name: Setup Parsers Cache
|
||||
id: parsers-cache
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./parser/
|
||||
~/AppData/Local/nvim/pack/nvim-treesitter/start/nvim-treesitter/parser/
|
||||
key: ${{ matrix.os }}-${{ matrix.cc }}-${{ matrix.nvim_tag }}-parsers-v1-${{ hashFiles('./lockfile.json', './lua/nvim-treesitter/parsers.lua', './lua/nvim-treesitter/install.lua', './lua/nvim-treesitter/shell_command_selectors.lua') }}
|
||||
key: parsers-${{ join(matrix.*, '-') }}-${{ hashFiles(
|
||||
'./lockfile.json',
|
||||
'./lua/nvim-treesitter/install.lua',
|
||||
'./lua/nvim-treesitter/parsers.lua',
|
||||
'./lua/nvim-treesitter/shell_command_selectors.lua') }}
|
||||
|
||||
- name: Compile parsers
|
||||
run: $NVIM --headless -c "lua require'nvim-treesitter.install'.prefer_git=false" -c "TSInstallSync all" -c "q"
|
||||
|
||||
- name: Post compile Windows
|
||||
if: matrix.os == 'windows-2022'
|
||||
if: runner.os == 'Windows'
|
||||
run: cp -r ~/AppData/Local/nvim/pack/nvim-treesitter/start/nvim-treesitter/parser/* parser
|
||||
|
||||
- name: Check query files
|
||||
|
||||
@ -27,10 +27,7 @@ jobs:
|
||||
CC: ${{ matrix.cc }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
|
||||
- name: Install tree-sitter CLI
|
||||
run: npm i -g tree-sitter-cli
|
||||
- uses: tree-sitter/setup-action/cli@v1
|
||||
|
||||
- name: Test Dependencies
|
||||
run: |
|
||||
@ -43,21 +40,23 @@ jobs:
|
||||
- name: Install and prepare Neovim
|
||||
env:
|
||||
NVIM_TAG: stable
|
||||
TREE_SITTER_CLI_TAG: v0.20.8
|
||||
run: |
|
||||
bash ./scripts/ci-install-${{ matrix.os }}.sh
|
||||
bash ./scripts/ci-install.sh
|
||||
|
||||
- name: Setup Parsers Cache
|
||||
id: parsers-cache
|
||||
uses: actions/cache@v3
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: |
|
||||
./parser/
|
||||
~/AppData/Local/nvim/pack/nvim-treesitter/start/nvim-treesitter/parser/
|
||||
key: ${{ matrix.os }}-${{ matrix.cc }}-parsers-v1-${{ hashFiles('./lockfile.json', './lua/nvim-treesitter/parsers.lua', './lua/nvim-treesitter/install.lua', './lua/nvim-treesitter/shell_selectors.lua') }}
|
||||
key: parsers-${{ join(matrix.*, '-') }}-${{ hashFiles(
|
||||
'./lockfile.json',
|
||||
'./lua/nvim-treesitter/install.lua',
|
||||
'./lua/nvim-treesitter/parsers.lua',
|
||||
'./lua/nvim-treesitter/shell_selectors.lua') }}
|
||||
|
||||
- name: Compile parsers Unix like
|
||||
if: ${{ matrix.os != 'windows-latest' && steps.parsers-cache.outputs.cache-hit != 'true' }}
|
||||
run: |
|
||||
nvim --headless -c "TSInstallSync all" -c "q"
|
||||
|
||||
|
||||
@ -14,6 +14,12 @@ jobs:
|
||||
with:
|
||||
ref: master
|
||||
|
||||
- uses: actions/create-github-app-token@v1
|
||||
id: app-token
|
||||
with:
|
||||
app-id: ${{ vars.TOKEN_ID }}
|
||||
private-key: ${{ secrets.TOKEN_PRIVATE_KEY }}
|
||||
|
||||
- name: Prepare
|
||||
env:
|
||||
NVIM_TAG: stable
|
||||
@ -21,7 +27,7 @@ jobs:
|
||||
wget https://github.com/josephburnett/jd/releases/download/v1.7.1/jd-amd64-linux
|
||||
mv jd-amd64-linux /tmp/jd
|
||||
chmod +x /tmp/jd
|
||||
bash scripts/ci-install-ubuntu-latest.sh
|
||||
bash scripts/ci-install.sh
|
||||
|
||||
- name: Update parsers
|
||||
env:
|
||||
@ -32,21 +38,21 @@ jobs:
|
||||
# Pretty print
|
||||
cp lockfile.json /tmp/lockfile.json
|
||||
cat /tmp/lockfile.json | jq --sort-keys > lockfile.json
|
||||
|
||||
- name: Commit changes
|
||||
run: |
|
||||
git config user.name 'GitHub'
|
||||
git config user.email 'noreply@github.com'
|
||||
git add lockfile.json
|
||||
UPDATED_PARSERS=$(/tmp/jd -f merge /tmp/old_lockfile.json lockfile.json | jq -r 'keys | join(", ")')
|
||||
echo "UPDATED_PARSERS=$UPDATED_PARSERS" >> $GITHUB_ENV
|
||||
git commit -m "Update parsers: $UPDATED_PARSERS" || echo 'No commit necessary!'
|
||||
git clean -xf
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v5
|
||||
uses: peter-evans/create-pull-request@v6
|
||||
with:
|
||||
token: ${{ steps.app-token.outputs.token }}
|
||||
author: "nvim-treesitter-bot[bot] <157957100+nvim-treesitter-bot[bot]@users.noreply.github.com>"
|
||||
commit-message: "bot(lockfile): update ${{ env.UPDATED_PARSERS }}"
|
||||
title: "Update lockfile.json: ${{ env.UPDATED_PARSERS }}"
|
||||
body: "[beep boop](https://github.com/peter-evans/create-pull-request)"
|
||||
branch: update-lockfile-pr
|
||||
base: ${{ github.head_ref }}
|
||||
draft: true
|
||||
|
||||
- name: Enable Pull Request Automerge
|
||||
env:
|
||||
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||
run: gh pr merge --rebase --auto update-lockfile-pr
|
||||
|
||||
@ -13,26 +13,34 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/create-github-app-token@v1
|
||||
id: app-token
|
||||
with:
|
||||
app-id: ${{ vars.TOKEN_ID }}
|
||||
private-key: ${{ secrets.TOKEN_PRIVATE_KEY }}
|
||||
|
||||
- name: Prepare
|
||||
env:
|
||||
NVIM_TAG: stable
|
||||
run: |
|
||||
bash ./scripts/ci-install-ubuntu-latest.sh
|
||||
bash ./scripts/ci-install.sh
|
||||
|
||||
- name: Check README
|
||||
run: |
|
||||
git config user.email 'actions@github'
|
||||
git config user.name 'Github Actions'
|
||||
nvim -l scripts/update-readme.lua || echo 'Needs update'
|
||||
git add README.md
|
||||
git commit -m 'Update README' || echo 'No commit necessary!'
|
||||
git clean -xf
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v5
|
||||
uses: peter-evans/create-pull-request@v6
|
||||
with:
|
||||
commit-message: Update README
|
||||
token: ${{ steps.app-token.outputs.token }}
|
||||
author: "nvim-treesitter-bot[bot] <157957100+nvim-treesitter-bot[bot]@users.noreply.github.com>"
|
||||
commit-message: "bot(readme): update"
|
||||
title: Update README
|
||||
body: "[beep boop](https://github.com/peter-evans/create-pull-request)"
|
||||
branch: update-readme-pr
|
||||
base: ${{ github.head_ref }}
|
||||
draft: true
|
||||
|
||||
- name: Enable Pull Request Automerge
|
||||
env:
|
||||
GH_TOKEN: ${{ steps.app-token.outputs.token }}
|
||||
run: gh pr merge --rebase --auto update-readme-pr
|
||||
|
||||
@ -8,7 +8,7 @@ If you haven't already, you should really come and reach out to us on our
|
||||
As you know, `nvim-treesitter` is roughly split in two parts:
|
||||
|
||||
- Parser configurations : for various things like `locals`, `highlights`
|
||||
- What we like to call _modules_ : tiny lua modules that provide a given feature, based on parser configurations
|
||||
- What we like to call _modules_ : tiny Lua modules that provide a given feature, based on parser configurations
|
||||
|
||||
Depending on which part of the plugin you want to contribute to, please read the appropriate section.
|
||||
|
||||
@ -63,12 +63,14 @@ Here are some global advices:
|
||||
you can install the [playground plugin](https://github.com/nvim-treesitter/playground).
|
||||
- If your language is listed [here](https://github.com/nvim-treesitter/nvim-treesitter#supported-languages),
|
||||
you can debug and experiment with your queries there.
|
||||
- If not, you should consider installing the [tree-sitter cli](https://github.com/tree-sitter/tree-sitter/tree/master/cli),
|
||||
- If not, you should consider installing the [tree-sitter CLI](https://github.com/tree-sitter/tree-sitter/tree/master/cli),
|
||||
you should then be able to open a local playground using `tree-sitter build-wasm && tree-sitter web-ui` within the
|
||||
parsers repo.
|
||||
- Examples of queries can be found in [queries/](queries/)
|
||||
- Matches in the bottom will override queries that are above of them.
|
||||
|
||||
#### Inheriting languages
|
||||
|
||||
If your language is an extension of a language (TypeScript is an extension of JavaScript for
|
||||
example), you can include the queries from your base language by adding the following _as the first
|
||||
line of your file_.
|
||||
@ -80,161 +82,181 @@ line of your file_.
|
||||
If you want to inherit a language, but don't want the languages inheriting from yours to inherit it,
|
||||
you can mark the language as optional (by putting it between parenthesis).
|
||||
|
||||
#### Formatting
|
||||
|
||||
All queries are expected to follow a standard format, with every node on a single line and indented by two spaces for each level of nesting. You can automatically format the bundled queries by running the provided formatter `./scripts/format-queries.lua` on a single file (ending in `.scm`) or directory to format.
|
||||
|
||||
Should you need to preserve a specific format for a node, you can exempt it (and all contained nodes) by placing before it
|
||||
```query
|
||||
; format-ignore
|
||||
```
|
||||
|
||||
### Highlights
|
||||
|
||||
As languages differ quite a lot, here is a set of captures available to you when building a `highlights.scm` query. Note that your colorscheme needs to define (or link) these captures as highlight groups.
|
||||
As languages differ quite a lot, here is a set of captures available to you when building a `highlights.scm` query. Note that your color scheme needs to define (or link) these captures as highlight groups.
|
||||
|
||||
#### Misc
|
||||
#### Identifiers
|
||||
|
||||
```scheme
|
||||
@comment ; line and block comments
|
||||
@comment.documentation ; comments documenting code
|
||||
@error ; syntax/parser errors
|
||||
@none ; completely disable the highlight
|
||||
@preproc ; various preprocessor directives & shebangs
|
||||
@define ; preprocessor definition directives
|
||||
@operator ; symbolic operators (e.g. `+` / `*`)
|
||||
```query
|
||||
@variable ; various variable names
|
||||
@variable.builtin ; built-in variable names (e.g. `this`)
|
||||
@variable.parameter ; parameters of a function
|
||||
@variable.parameter.builtin ; special parameters (e.g. `_`, `it`)
|
||||
@variable.member ; object and struct fields
|
||||
|
||||
@constant ; constant identifiers
|
||||
@constant.builtin ; built-in constant values
|
||||
@constant.macro ; constants defined by the preprocessor
|
||||
|
||||
@module ; modules or namespaces
|
||||
@module.builtin ; built-in modules or namespaces
|
||||
@label ; GOTO and other labels (e.g. `label:` in C), including heredoc labels
|
||||
```
|
||||
|
||||
#### Literals
|
||||
|
||||
```query
|
||||
@string ; string literals
|
||||
@string.documentation ; string documenting code (e.g. Python docstrings)
|
||||
@string.regexp ; regular expressions
|
||||
@string.escape ; escape sequences
|
||||
@string.special ; other special strings (e.g. dates)
|
||||
@string.special.symbol ; symbols or atoms
|
||||
@string.special.url ; URIs (e.g. hyperlinks)
|
||||
@string.special.path ; filenames
|
||||
|
||||
@character ; character literals
|
||||
@character.special ; special characters (e.g. wildcards)
|
||||
|
||||
@boolean ; boolean literals
|
||||
@number ; numeric literals
|
||||
@number.float ; floating-point number literals
|
||||
```
|
||||
|
||||
#### Types
|
||||
|
||||
```query
|
||||
@type ; type or class definitions and annotations
|
||||
@type.builtin ; built-in types
|
||||
@type.definition ; identifiers in type definitions (e.g. `typedef <type> <identifier>` in C)
|
||||
|
||||
@attribute ; attribute annotations (e.g. Python decorators, Rust lifetimes)
|
||||
@attribute.builtin ; builtin annotations (e.g. `@property` in Python)
|
||||
@property ; the key in key/value pairs
|
||||
```
|
||||
|
||||
#### Functions
|
||||
|
||||
```query
|
||||
@function ; function definitions
|
||||
@function.builtin ; built-in functions
|
||||
@function.call ; function calls
|
||||
@function.macro ; preprocessor macros
|
||||
|
||||
@function.method ; method definitions
|
||||
@function.method.call ; method calls
|
||||
|
||||
@constructor ; constructor calls and definitions
|
||||
@operator ; symbolic operators (e.g. `+` / `*`)
|
||||
```
|
||||
|
||||
#### Keywords
|
||||
|
||||
```query
|
||||
@keyword ; keywords not fitting into specific categories
|
||||
@keyword.coroutine ; keywords related to coroutines (e.g. `go` in Go, `async/await` in Python)
|
||||
@keyword.function ; keywords that define a function (e.g. `func` in Go, `def` in Python)
|
||||
@keyword.operator ; operators that are English words (e.g. `and` / `or`)
|
||||
@keyword.import ; keywords for including or exporting modules (e.g. `import` / `from` in Python)
|
||||
@keyword.type ; keywords describing namespaces and composite types (e.g. `struct`, `enum`)
|
||||
@keyword.modifier ; keywords modifying other constructs (e.g. `const`, `static`, `public`)
|
||||
@keyword.repeat ; keywords related to loops (e.g. `for` / `while`)
|
||||
@keyword.return ; keywords like `return` and `yield`
|
||||
@keyword.debug ; keywords related to debugging
|
||||
@keyword.exception ; keywords related to exceptions (e.g. `throw` / `catch`)
|
||||
|
||||
@keyword.conditional ; keywords related to conditionals (e.g. `if` / `else`)
|
||||
@keyword.conditional.ternary ; ternary operator (e.g. `?` / `:`)
|
||||
|
||||
@keyword.directive ; various preprocessor directives & shebangs
|
||||
@keyword.directive.define ; preprocessor definition directives
|
||||
```
|
||||
|
||||
#### Punctuation
|
||||
|
||||
```scheme
|
||||
```query
|
||||
@punctuation.delimiter ; delimiters (e.g. `;` / `.` / `,`)
|
||||
@punctuation.bracket ; brackets (e.g. `()` / `{}` / `[]`)
|
||||
@punctuation.special ; special symbols (e.g. `{}` in string interpolation)
|
||||
```
|
||||
|
||||
#### Literals
|
||||
#### Comments
|
||||
|
||||
```scheme
|
||||
@string ; string literals
|
||||
@string.documentation ; string documenting code (e.g. Python docstrings)
|
||||
@string.regex ; regular expressions
|
||||
@string.escape ; escape sequences
|
||||
@string.special ; other special strings (e.g. dates)
|
||||
```query
|
||||
@comment ; line and block comments
|
||||
@comment.documentation ; comments documenting code
|
||||
|
||||
@character ; character literals
|
||||
@character.special ; special characters (e.g. wildcards)
|
||||
|
||||
@boolean ; boolean literals
|
||||
@number ; numeric literals
|
||||
@float ; floating-point number literals
|
||||
@comment.error ; error-type comments (e.g. `ERROR`, `FIXME`, `DEPRECATED`)
|
||||
@comment.warning ; warning-type comments (e.g. `WARNING`, `FIX`, `HACK`)
|
||||
@comment.todo ; todo-type comments (e.g. `TODO`, `WIP`)
|
||||
@comment.note ; note-type comments (e.g. `NOTE`, `INFO`, `XXX`)
|
||||
```
|
||||
|
||||
#### Functions
|
||||
|
||||
```scheme
|
||||
@function ; function definitions
|
||||
@function.builtin ; built-in functions
|
||||
@function.call ; function calls
|
||||
@function.macro ; preprocessor macros
|
||||
|
||||
@method ; method definitions
|
||||
@method.call ; method calls
|
||||
|
||||
@constructor ; constructor calls and definitions
|
||||
@parameter ; parameters of a function
|
||||
```
|
||||
|
||||
#### Keywords
|
||||
|
||||
```scheme
|
||||
@keyword ; various keywords
|
||||
@keyword.coroutine ; keywords related to coroutines (e.g. `go` in Go, `async/await` in Python)
|
||||
@keyword.function ; keywords that define a function (e.g. `func` in Go, `def` in Python)
|
||||
@keyword.operator ; operators that are English words (e.g. `and` / `or`)
|
||||
@keyword.return ; keywords like `return` and `yield`
|
||||
|
||||
@conditional ; keywords related to conditionals (e.g. `if` / `else`)
|
||||
@conditional.ternary ; ternary operator (e.g. `?` / `:`)
|
||||
|
||||
@repeat ; keywords related to loops (e.g. `for` / `while`)
|
||||
@debug ; keywords related to debugging
|
||||
@label ; GOTO and other labels (e.g. `label:` in C)
|
||||
@include ; keywords for including modules (e.g. `import` / `from` in Python)
|
||||
@exception ; keywords related to exceptions (e.g. `throw` / `catch`)
|
||||
```
|
||||
|
||||
#### Types
|
||||
|
||||
```scheme
|
||||
@type ; type or class definitions and annotations
|
||||
@type.builtin ; built-in types
|
||||
@type.definition ; identifiers in type definitions (e.g. `typedef <type> <identifier>` in C)
|
||||
@type.qualifier ; type qualifiers (e.g. `const`)
|
||||
|
||||
@storageclass ; modifiers that affect storage in memory or life-time
|
||||
@attribute ; attribute annotations (e.g. Python decorators)
|
||||
@field ; object and struct fields
|
||||
@property ; similar to `@field`
|
||||
```
|
||||
|
||||
#### Identifiers
|
||||
|
||||
```scheme
|
||||
@variable ; various variable names
|
||||
@variable.builtin ; built-in variable names (e.g. `this`)
|
||||
|
||||
@constant ; constant identifiers
|
||||
@constant.builtin ; built-in constant values
|
||||
@constant.macro ; constants defined by the preprocessor
|
||||
|
||||
@namespace ; modules or namespaces
|
||||
@symbol ; symbols or atoms
|
||||
```
|
||||
|
||||
#### Text
|
||||
#### Markup
|
||||
|
||||
Mainly for markup languages.
|
||||
|
||||
```scheme
|
||||
@text ; non-structured text
|
||||
@text.strong ; bold text
|
||||
@text.emphasis ; text with emphasis
|
||||
@text.underline ; underlined text
|
||||
@text.strike ; strikethrough text
|
||||
@text.title ; text that is part of a title
|
||||
@text.quote ; text quotations
|
||||
@text.uri ; URIs (e.g. hyperlinks)
|
||||
@text.math ; math environments (e.g. `$ ... $` in LaTeX)
|
||||
@text.environment ; text environments of markup languages
|
||||
@text.environment.name ; text indicating the type of an environment
|
||||
@text.reference ; text references, footnotes, citations, etc.
|
||||
```query
|
||||
@markup.strong ; bold text
|
||||
@markup.italic ; italic text
|
||||
@markup.strikethrough ; struck-through text
|
||||
@markup.underline ; underlined text (only for literal underline markup!)
|
||||
|
||||
@text.literal ; literal or verbatim text (e.g., inline code)
|
||||
@text.literal.block ; literal or verbatim text as a stand-alone block
|
||||
@markup.heading ; headings, titles (including markers)
|
||||
@markup.heading.1 ; top-level heading
|
||||
@markup.heading.2 ; section heading
|
||||
@markup.heading.3 ; subsection heading
|
||||
@markup.heading.4 ; and so on
|
||||
@markup.heading.5 ; and so forth
|
||||
@markup.heading.6 ; six levels ought to be enough for anybody
|
||||
|
||||
@markup.quote ; block quotes
|
||||
@markup.math ; math environments (e.g. `$ ... $` in LaTeX)
|
||||
|
||||
@markup.link ; text references, footnotes, citations, etc.
|
||||
@markup.link.label ; link, reference descriptions
|
||||
@markup.link.url ; URL-style links
|
||||
|
||||
@markup.raw ; literal or verbatim text (e.g. inline code)
|
||||
@markup.raw.block ; literal or verbatim text as a stand-alone block
|
||||
; (use priority 90 for blocks with injections)
|
||||
|
||||
@text.todo ; todo notes
|
||||
@text.note ; info notes
|
||||
@text.warning ; warning notes
|
||||
@text.danger ; danger/error notes
|
||||
|
||||
@text.diff.add ; added text (for diff files)
|
||||
@text.diff.delete ; deleted text (for diff files)
|
||||
@markup.list ; list markers
|
||||
@markup.list.checked ; checked todo-style list markers
|
||||
@markup.list.unchecked ; unchecked todo-style list markers
|
||||
```
|
||||
|
||||
#### Tags
|
||||
|
||||
Used for XML-like tags.
|
||||
|
||||
```scheme
|
||||
@tag ; XML tag names
|
||||
@tag.attribute ; XML tag attributes
|
||||
@tag.delimiter ; XML tag delimiters
|
||||
```query
|
||||
@diff.plus ; added text (for diff files)
|
||||
@diff.minus ; deleted text (for diff files)
|
||||
@diff.delta ; changed text (for diff files)
|
||||
```
|
||||
|
||||
#### Conceal
|
||||
|
||||
```scheme
|
||||
@conceal ; for captures that are only used for concealing
|
||||
```query
|
||||
@tag ; XML-style tag names (and similar)
|
||||
@tag.builtin ; builtin tag names (e.g. HTML5 tags)
|
||||
@tag.attribute ; XML-style tag attributes
|
||||
@tag.delimiter ; XML-style tag delimiters
|
||||
```
|
||||
|
||||
`@conceal` must be followed by `(#set! conceal "")`.
|
||||
#### Non-highlighting captures
|
||||
|
||||
#### Spell
|
||||
```query
|
||||
@none ; completely disable the highlight
|
||||
@conceal ; captures that are only meant to be concealed
|
||||
```
|
||||
|
||||
```scheme
|
||||
```query
|
||||
@spell ; for defining regions to be spellchecked
|
||||
@nospell ; for defining regions that should NOT be spellchecked
|
||||
```
|
||||
@ -243,6 +265,25 @@ The main types of nodes which are spell checked are:
|
||||
- Comments
|
||||
- Strings; where it makes sense. Strings that have interpolation or are typically used for non text purposes are not spell checked (e.g. bash).
|
||||
|
||||
#### Predicates
|
||||
|
||||
Captures can be restricted according to node contents using [predicates](https://neovim.io/doc/user/treesitter.html#treesitter-predicates). For performance reasons, prefer earlier predicates in this list:
|
||||
|
||||
1. `#eq?` (literal match)
|
||||
2. `#any-of?` (one of several literal matches)
|
||||
3. `#lua-match?` (match against a [Lua pattern](https://neovim.io/doc/user/luaref.html#lua-pattern))
|
||||
4. `#match?`/`#vim-match?` (match against a [Vim regular expression](https://neovim.io/doc/user/pattern.html#regexp)
|
||||
|
||||
#### Conceal
|
||||
|
||||
Captures can be concealed by setting the [`conceal` metadata](https://neovim.io/doc/user/treesitter.html#treesitter-highlight-conceal), e.g..,
|
||||
```query
|
||||
(fenced_code_block_delimiter @markup.raw.block (#set! conceal ""))
|
||||
```
|
||||
The capture should be meaningful to allow proper highlighting when `set conceallevel=0`. If the unconcealed capture should not be highlighted (e.g., because an earlier pattern handles this), you can use `@conceal`.
|
||||
|
||||
A conceal can be restricted to part of the capture via the [`#offset!` directive](https://neovim.io/doc/user/treesitter.html#treesitter-directive-offset%21).
|
||||
|
||||
#### Priority
|
||||
|
||||
Captures can be assigned a priority to control precedence of highlights via the
|
||||
@ -253,29 +294,29 @@ highlighting (such as diagnostics or LSP semantic tokens).
|
||||
|
||||
### Locals
|
||||
|
||||
Note: pay specific attention to the captures here as they are a bit different to
|
||||
those listed in the upstream [Local Variables
|
||||
docs](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables).
|
||||
Some of these docs didn't exist when `nvim-treesitter` was created and the
|
||||
upstream captures are more limiting than what we have here.
|
||||
Locals are used to keep track of definitions and references in local or global
|
||||
scopes, see [upstream
|
||||
documentation](https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables).
|
||||
Note that nvim-treesitter uses more specific subcaptures for definitions and
|
||||
**does not use locals for highlighting**.
|
||||
|
||||
```scheme
|
||||
@definition ; various definitions
|
||||
@definition.constant ; constants
|
||||
@definition.function ; functions
|
||||
@definition.method ; methods
|
||||
@definition.var ; variables
|
||||
@definition.parameter ; parameters
|
||||
@definition.macro ; preprocessor macros
|
||||
@definition.type ; types or classes
|
||||
@definition.field ; fields or properties
|
||||
@definition.enum ; enumerations
|
||||
@definition.namespace ; modules or namespaces
|
||||
@definition.import ; imported names
|
||||
@definition.associated ; the associated type of a variable
|
||||
```query
|
||||
@local.definition ; various definitions
|
||||
@local.definition.constant ; constants
|
||||
@local.definition.function ; functions
|
||||
@local.definition.method ; methods
|
||||
@local.definition.var ; variables
|
||||
@local.definition.parameter ; parameters
|
||||
@local.definition.macro ; preprocessor macros
|
||||
@local.definition.type ; types or classes
|
||||
@local.definition.field ; fields or properties
|
||||
@local.definition.enum ; enumerations
|
||||
@local.definition.namespace ; modules or namespaces
|
||||
@local.definition.import ; imported names
|
||||
@local.definition.associated ; the associated type of a variable
|
||||
|
||||
@scope ; scope block
|
||||
@reference ; identifier reference
|
||||
@local.scope ; scope block
|
||||
@local.reference ; identifier reference
|
||||
```
|
||||
|
||||
#### Definition Scope
|
||||
@ -294,7 +335,7 @@ doSomething(); // Should point to the declaration as the definition
|
||||
|
||||
```query
|
||||
(function_declaration
|
||||
((identifier) @definition.var)
|
||||
((identifier) @local.definition.var)
|
||||
(#set! "definition.var.scope" "parent"))
|
||||
```
|
||||
|
||||
@ -308,11 +349,11 @@ Possible scope values are:
|
||||
|
||||
You can define folds for a given language by adding a `folds.scm` query :
|
||||
|
||||
```scheme
|
||||
```query
|
||||
@fold ; fold this node
|
||||
```
|
||||
|
||||
If the `folds.scm` query is not present, this will fall back to the `@scope` captures in the `locals`
|
||||
If the `folds.scm` query is not present, this will fall back to the `@local.scope` captures in the `locals`
|
||||
query.
|
||||
|
||||
### Injections
|
||||
@ -322,7 +363,7 @@ Some captures are related to language injection (like markdown code blocks). The
|
||||
If you want to dynamically detect the language (e.g. for Markdown blocks) use the `@injection.language` to capture
|
||||
the node describing the language and `@injection.content` to describe the injection region.
|
||||
|
||||
```scheme
|
||||
```query
|
||||
@injection.language ; dynamic detection of the injection language (i.e. the text of the captured node describes the language)
|
||||
@injection.content ; region for the dynamically detected language
|
||||
```
|
||||
@ -346,7 +387,7 @@ To combine all matches of a pattern as one single block of content, add `(#set!
|
||||
|
||||
### Indents
|
||||
|
||||
```scheme
|
||||
```query
|
||||
@indent.begin ; indent children when matching this node
|
||||
@indent.end ; marks the end of indented block
|
||||
@indent.align ; behaves like python aligned/hanging indent
|
||||
|
||||
@ -39,7 +39,7 @@ More examples can be found in [our gallery](https://github.com/nvim-treesitter/n
|
||||
**Warning: Treesitter and nvim-treesitter highlighting are an experimental feature of Neovim.
|
||||
Please consider the experience with this plug-in as experimental until Tree-Sitter support in Neovim is stable!
|
||||
We recommend using the nightly builds of Neovim if possible.
|
||||
You can find the current roadmap [here](https://github.com/nvim-treesitter/nvim-treesitter/projects/1).
|
||||
You can find the current roadmap [here](https://github.com/nvim-treesitter/nvim-treesitter/issues/4767).
|
||||
The roadmap and all features of this plugin are open to change, and any suggestion will be highly appreciated!**
|
||||
|
||||
Nvim-treesitter is based on three interlocking features: [**language parsers**](#language-parsers), [**queries**](#adding-queries), and [**modules**](#available-modules), where _modules_ provide features – e.g., highlighting – based on _queries_ for syntax objects extracted from a given buffer by _language parsers_.
|
||||
@ -63,7 +63,7 @@ For more detailed information on setting these up, see ["Advanced setup"](#advan
|
||||
|
||||
## Requirements
|
||||
|
||||
- **Neovim 0.9.1** or later ([nightly](https://github.com/neovim/neovim#install-from-source) recommended)
|
||||
- **Neovim 0.9.2** or later ([nightly](https://github.com/neovim/neovim#install-from-source) recommended)
|
||||
- `tar` and `curl` in your path (or alternatively `git`)
|
||||
- A C compiler in your path and libstdc++ installed ([Windows users please read this!](https://github.com/nvim-treesitter/nvim-treesitter/wiki/Windows-support)).
|
||||
|
||||
@ -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,
|
||||
@ -175,21 +175,23 @@ We are looking for maintainers to add more parsers and to write query files for
|
||||
<!--parserinfo-->
|
||||
- [x] [ada](https://github.com/briot/tree-sitter-ada) (maintained by @briot)
|
||||
- [x] [agda](https://github.com/tree-sitter/tree-sitter-agda) (maintained by @Decodetalkers)
|
||||
- [ ] [angular](https://github.com/steelsojka/tree-sitter-angular) (experimental)
|
||||
- [x] [angular](https://github.com/dlvandenberg/tree-sitter-angular) (experimental, maintained by @dlvandenberg)
|
||||
- [x] [apex](https://github.com/aheber/tree-sitter-sfapex) (maintained by @aheber)
|
||||
- [x] [arduino](https://github.com/ObserverOfTime/tree-sitter-arduino) (maintained by @ObserverOfTime)
|
||||
- [x] [asm](https://github.com/RubixDev/tree-sitter-asm) (maintained by @RubixDev)
|
||||
- [x] [astro](https://github.com/virchau13/tree-sitter-astro) (maintained by @virchau13)
|
||||
- [x] [authzed](https://github.com/mleonidas/tree-sitter-authzed) (maintained by @mattpolzin)
|
||||
- [ ] [awk](https://github.com/Beaglefoot/tree-sitter-awk)
|
||||
- [x] [bash](https://github.com/tree-sitter/tree-sitter-bash) (maintained by @TravonteD)
|
||||
- [x] [bass](https://github.com/amaanq/tree-sitter-bass) (maintained by @amaanq)
|
||||
- [x] [bass](https://github.com/vito/tree-sitter-bass) (maintained by @amaanq)
|
||||
- [x] [beancount](https://github.com/polarmutex/tree-sitter-beancount) (maintained by @polarmutex)
|
||||
- [x] [bibtex](https://github.com/latex-lsp/tree-sitter-bibtex) (maintained by @theHamsta, @clason)
|
||||
- [x] [bicep](https://github.com/amaanq/tree-sitter-bicep) (maintained by @amaanq)
|
||||
- [x] [bitbake](https://github.com/amaanq/tree-sitter-bitbake) (maintained by @amaanq)
|
||||
- [x] [blueprint](https://gitlab.com/gabmus/tree-sitter-blueprint.git) (experimental, maintained by @gabmus)
|
||||
- [x] [bp](https://github.com/ambroisie/tree-sitter-bp) (maintained by @ambroisie)
|
||||
- [x] [c](https://github.com/tree-sitter/tree-sitter-c) (maintained by @amaanq)
|
||||
- [x] [c_sharp](https://github.com/tree-sitter/tree-sitter-c-sharp) (maintained by @Luxed)
|
||||
- [x] [c_sharp](https://github.com/tree-sitter/tree-sitter-c-sharp) (maintained by @amaanq)
|
||||
- [x] [cairo](https://github.com/amaanq/tree-sitter-cairo) (maintained by @amaanq)
|
||||
- [x] [capnp](https://github.com/amaanq/tree-sitter-capnp) (maintained by @amaanq)
|
||||
- [x] [chatito](https://github.com/ObserverOfTime/tree-sitter-chatito) (maintained by @ObserverOfTime)
|
||||
@ -205,16 +207,20 @@ We are looking for maintainers to add more parsers and to write query files for
|
||||
- [x] [csv](https://github.com/amaanq/tree-sitter-csv) (maintained by @amaanq)
|
||||
- [x] [cuda](https://github.com/theHamsta/tree-sitter-cuda) (maintained by @theHamsta)
|
||||
- [x] [cue](https://github.com/eonpatapon/tree-sitter-cue) (maintained by @amaanq)
|
||||
- [x] [d](https://github.com/CyberShadow/tree-sitter-d) (experimental, maintained by @nawordar)
|
||||
- [x] [d](https://github.com/gdamore/tree-sitter-d) (maintained by @amaanq)
|
||||
- [x] [dart](https://github.com/UserNobody14/tree-sitter-dart) (maintained by @akinsho)
|
||||
- [x] [devicetree](https://github.com/joelspadin/tree-sitter-devicetree) (maintained by @jedrzejboczar)
|
||||
- [x] [dhall](https://github.com/jbellerb/tree-sitter-dhall) (maintained by @amaanq)
|
||||
- [x] [diff](https://github.com/the-mikedavis/tree-sitter-diff) (maintained by @gbprod)
|
||||
- [x] [disassembly](https://github.com/ColinKennedy/tree-sitter-disassembly) (maintained by @ColinKennedy)
|
||||
- [x] [djot](https://github.com/treeman/tree-sitter-djot) (maintained by @NoahTheDuke)
|
||||
- [x] [dockerfile](https://github.com/camdencheek/tree-sitter-dockerfile) (maintained by @camdencheek)
|
||||
- [x] [dot](https://github.com/rydesun/tree-sitter-dot) (maintained by @rydesun)
|
||||
- [x] [doxygen](https://github.com/amaanq/tree-sitter-doxygen) (maintained by @amaanq)
|
||||
- [x] [dtd](https://github.com/ObserverOfTime/tree-sitter-xml) (maintained by @ObserverOfTime)
|
||||
- [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)
|
||||
@ -224,7 +230,9 @@ We are looking for maintainers to add more parsers and to write query files for
|
||||
- [ ] [embedded_template](https://github.com/tree-sitter/tree-sitter-embedded-template)
|
||||
- [x] [erlang](https://github.com/WhatsApp/tree-sitter-erlang) (maintained by @filmor)
|
||||
- [x] [facility](https://github.com/FacilityApi/tree-sitter-facility) (maintained by @bryankenote)
|
||||
- [x] [fennel](https://github.com/travonted/tree-sitter-fennel) (maintained by @TravonteD)
|
||||
- [x] [faust](https://github.com/khiner/tree-sitter-faust) (maintained by @khiner)
|
||||
- [x] [fennel](https://github.com/alexmozaidze/tree-sitter-fennel) (maintained by @alexmozaidze)
|
||||
- [x] [fidl](https://github.com/google/tree-sitter-fidl) (maintained by @chaopeng)
|
||||
- [x] [firrtl](https://github.com/amaanq/tree-sitter-firrtl) (maintained by @amaanq)
|
||||
- [x] [fish](https://github.com/ram02z/tree-sitter-fish) (maintained by @ram02z)
|
||||
- [x] [foam](https://github.com/FoamScience/tree-sitter-foam) (experimental, maintained by @FoamScience)
|
||||
@ -234,6 +242,7 @@ We are looking for maintainers to add more parsers and to write query files for
|
||||
- [x] [func](https://github.com/amaanq/tree-sitter-func) (maintained by @amaanq)
|
||||
- [x] [fusion](https://gitlab.com/jirgn/tree-sitter-fusion.git) (maintained by @jirgn)
|
||||
- [x] [Godot (gdscript)](https://github.com/PrestonKnopp/tree-sitter-gdscript) (maintained by @PrestonKnopp)
|
||||
- [x] [gdshader](https://github.com/GodOfAvacyn/tree-sitter-gdshader) (maintained by @godofavacyn)
|
||||
- [x] [git_config](https://github.com/the-mikedavis/tree-sitter-git-config) (maintained by @amaanq)
|
||||
- [x] [git_rebase](https://github.com/the-mikedavis/tree-sitter-git-rebase) (maintained by @gbprod)
|
||||
- [x] [gitattributes](https://github.com/ObserverOfTime/tree-sitter-gitattributes) (maintained by @ObserverOfTime)
|
||||
@ -243,14 +252,17 @@ We are looking for maintainers to add more parsers and to write query files for
|
||||
- [x] [Glimmer and Ember](https://github.com/alexlafroscia/tree-sitter-glimmer) (maintained by @NullVoxPopuli)
|
||||
- [x] [glsl](https://github.com/theHamsta/tree-sitter-glsl) (maintained by @theHamsta)
|
||||
- [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)
|
||||
- [x] [gotmpl](https://github.com/ngalaiko/tree-sitter-go-template) (maintained by @qvalentin)
|
||||
- [x] [gowork](https://github.com/omertuc/tree-sitter-go-work) (maintained by @omertuc)
|
||||
- [x] [gpg](https://github.com/ObserverOfTime/tree-sitter-gpg-config) (maintained by @ObserverOfTime)
|
||||
- [x] [graphql](https://github.com/bkegley/tree-sitter-graphql) (maintained by @bkegley)
|
||||
- [x] [groovy](https://github.com/Decodetalkers/tree-sitter-groovy) (maintained by @Decodetalkers)
|
||||
- [x] [groovy](https://github.com/murtaza64/tree-sitter-groovy) (maintained by @murtaza64)
|
||||
- [x] [gstlaunch](https://github.com/theHamsta/tree-sitter-gstlaunch) (maintained by @theHamsta)
|
||||
- [ ] [hack](https://github.com/slackhq/tree-sitter-hack)
|
||||
- [x] [hare](https://github.com/amaanq/tree-sitter-hare) (maintained by @amaanq)
|
||||
@ -258,15 +270,20 @@ We are looking for maintainers to add more parsers and to write query files for
|
||||
- [x] [haskell_persistent](https://github.com/MercuryTechnologies/tree-sitter-haskell-persistent) (maintained by @lykahb)
|
||||
- [x] [hcl](https://github.com/MichaHoffmann/tree-sitter-hcl) (maintained by @MichaHoffmann)
|
||||
- [x] [heex](https://github.com/connorlay/tree-sitter-heex) (maintained by @connorlay)
|
||||
- [x] [helm](https://github.com/ngalaiko/tree-sitter-go-template) (maintained by @qvalentin)
|
||||
- [x] [hjson](https://github.com/winston0410/tree-sitter-hjson) (maintained by @winston0410)
|
||||
- [x] [hlsl](https://github.com/theHamsta/tree-sitter-hlsl) (maintained by @theHamsta)
|
||||
- [x] [hlsplaylist](https://github.com/Freed-Wu/tree-sitter-hlsplaylist) (maintained by @Freed-Wu)
|
||||
- [x] [hocon](https://github.com/antosha417/tree-sitter-hocon) (maintained by @antosha417)
|
||||
- [x] [hoon](https://github.com/urbit-pilled/tree-sitter-hoon) (experimental, maintained by @urbit-pilled)
|
||||
- [x] [html](https://github.com/tree-sitter/tree-sitter-html) (maintained by @TravonteD)
|
||||
- [x] [htmldjango](https://github.com/interdependence/tree-sitter-htmldjango) (experimental, maintained by @ObserverOfTime)
|
||||
- [x] [http](https://github.com/rest-nvim/tree-sitter-http) (maintained by @amaanq)
|
||||
- [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 @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)
|
||||
- [x] [janet_simple](https://github.com/sogaiu/tree-sitter-janet-simple) (maintained by @sogaiu)
|
||||
- [x] [java](https://github.com/tree-sitter/tree-sitter-java) (maintained by @p00f)
|
||||
@ -278,15 +295,18 @@ We are looking for maintainers to add more parsers and to write query files for
|
||||
- [x] [JSON with comments](https://gitlab.com/WhyNotHugo/tree-sitter-jsonc.git) (maintained by @WhyNotHugo)
|
||||
- [x] [jsonnet](https://github.com/sourcegraph/tree-sitter-jsonnet) (maintained by @nawordar)
|
||||
- [x] [julia](https://github.com/tree-sitter/tree-sitter-julia) (maintained by @theHamsta)
|
||||
- [x] [just](https://github.com/IndianBoy42/tree-sitter-just) (maintained by @Hubro)
|
||||
- [x] [kconfig](https://github.com/amaanq/tree-sitter-kconfig) (maintained by @amaanq)
|
||||
- [x] [kdl](https://github.com/amaanq/tree-sitter-kdl) (maintained by @amaanq)
|
||||
- [x] [kotlin](https://github.com/fwcd/tree-sitter-kotlin) (maintained by @SalBakraa)
|
||||
- [x] [koto](https://github.com/koto-lang/tree-sitter-koto) (maintained by @irh)
|
||||
- [x] [kusto](https://github.com/Willem-J-an/tree-sitter-kusto) (maintained by @Willem-J-an)
|
||||
- [x] [lalrpop](https://github.com/traxys/tree-sitter-lalrpop) (maintained by @traxys)
|
||||
- [x] [latex](https://github.com/latex-lsp/tree-sitter-latex) (maintained by @theHamsta, @clason)
|
||||
- [x] [ledger](https://github.com/cbarrete/tree-sitter-ledger) (maintained by @cbarrete)
|
||||
- [x] [leo](https://github.com/r001/tree-sitter-leo) (maintained by @r001)
|
||||
- [x] [linkerscript](https://github.com/amaanq/tree-sitter-linkerscript) (maintained by @amaanq)
|
||||
- [x] [liquid](https://github.com/hankthetank27/tree-sitter-liquid) (maintained by @hankthetank27)
|
||||
- [x] [liquidsoap](https://github.com/savonet/tree-sitter-liquidsoap) (maintained by @toots)
|
||||
- [x] [llvm](https://github.com/benwilliamgraham/tree-sitter-llvm) (maintained by @benwilliamgraham)
|
||||
- [x] [lua](https://github.com/MunifTanjim/tree-sitter-lua) (maintained by @muniftanjim)
|
||||
@ -302,7 +322,9 @@ We are looking for maintainers to add more parsers and to write query files for
|
||||
- [ ] [mermaid](https://github.com/monaqa/tree-sitter-mermaid) (experimental)
|
||||
- [x] [meson](https://github.com/Decodetalkers/tree-sitter-meson) (maintained by @Decodetalkers)
|
||||
- [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)
|
||||
@ -317,20 +339,24 @@ 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)
|
||||
- [x] [php](https://github.com/tree-sitter/tree-sitter-php) (maintained by @tk-shirasaka)
|
||||
- [x] [php_only](https://github.com/tree-sitter/tree-sitter-php) (maintained by @tk-shirasaka)
|
||||
- [x] [phpdoc](https://github.com/claytonrcarter/tree-sitter-phpdoc) (experimental, maintained by @mikehaertl)
|
||||
- [x] [pioasm](https://github.com/leo60228/tree-sitter-pioasm) (maintained by @leo60228)
|
||||
- [x] [po](https://github.com/erasin/tree-sitter-po) (maintained by @amaanq)
|
||||
- [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] [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/ObserverOfTime/tree-sitter-properties) (maintained by @ObserverOfTime)
|
||||
- [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)
|
||||
- [x] [prql](https://github.com/PRQL/tree-sitter-prql) (maintained by @matthias-Q)
|
||||
- [x] [psv](https://github.com/amaanq/tree-sitter-csv) (maintained by @amaanq)
|
||||
@ -343,33 +369,38 @@ 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)
|
||||
- [x] [rbs](https://github.com/joker1007/tree-sitter-rbs) (maintained by @joker1007)
|
||||
- [x] [re2c](https://github.com/amaanq/tree-sitter-re2c) (maintained by @amaanq)
|
||||
- [x] [readline](https://github.com/ribru17/tree-sitter-readline) (maintained by @ribru17)
|
||||
- [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] [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)
|
||||
- [x] [slint](https://github.com/jrmoulton/tree-sitter-slint) (experimental, maintained by @jrmoulton)
|
||||
- [x] [smali](https://git.sr.ht/~yotam/tree-sitter-smali) (maintained by @amaanq)
|
||||
- [x] [slint](https://github.com/slint-ui/tree-sitter-slint) (maintained by @hunger)
|
||||
- [x] [smali](https://github.com/tree-sitter-grammars/tree-sitter-smali) (maintained by @amaanq)
|
||||
- [x] [smithy](https://github.com/indoorvivants/tree-sitter-smithy) (maintained by @amaanq, @keynmol)
|
||||
- [ ] [snakemake](https://github.com/osthomas/tree-sitter-snakemake) (experimental)
|
||||
- [x] [solidity](https://github.com/JoranHonig/tree-sitter-solidity) (maintained by @amaanq)
|
||||
- [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] [sparql](https://github.com/BonaBeavis/tree-sitter-sparql) (maintained by @BonaBeavis)
|
||||
- [x] [sourcepawn](https://github.com/nilshelmig/tree-sitter-sourcepawn) (maintained by @Sarrus1)
|
||||
- [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)
|
||||
@ -378,12 +409,15 @@ We are looking for maintainers to add more parsers and to write query files for
|
||||
- [x] [styled](https://github.com/mskelton/tree-sitter-styled) (maintained by @mskelton)
|
||||
- [x] [supercollider](https://github.com/madskjeldgaard/tree-sitter-supercollider) (maintained by @madskjeldgaard)
|
||||
- [x] [surface](https://github.com/connorlay/tree-sitter-surface) (maintained by @connorlay)
|
||||
- [x] [svelte](https://github.com/Himujjal/tree-sitter-svelte) (maintained by @elianiva)
|
||||
- [x] [svelte](https://github.com/tree-sitter-grammars/tree-sitter-svelte) (maintained by @amaanq)
|
||||
- [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)
|
||||
- [x] [tcl](https://github.com/tree-sitter-grammars/tree-sitter-tcl) (maintained by @lewis6991)
|
||||
- [x] [teal](https://github.com/euclidianAce/tree-sitter-teal) (maintained by @euclidianAce)
|
||||
- [x] [templ](https://github.com/vrischmann/tree-sitter-templ) (maintained by @vrischmann)
|
||||
- [x] [terraform](https://github.com/MichaHoffmann/tree-sitter-hcl) (maintained by @MichaHoffmann)
|
||||
@ -391,34 +425,41 @@ We are looking for maintainers to add more parsers and to write query files for
|
||||
- [x] [thrift](https://github.com/duskmoon314/tree-sitter-thrift) (maintained by @amaanq, @duskmoon314)
|
||||
- [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] [todotxt](https://github.com/arnarg/tree-sitter-todotxt.git) (experimental, maintained by @arnarg)
|
||||
- [x] [toml](https://github.com/ikatyang/tree-sitter-toml) (maintained by @tk-shirasaka)
|
||||
- [x] [tmux](https://github.com/Freed-Wu/tree-sitter-tmux) (maintained by @Freed-Wu)
|
||||
- [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)
|
||||
- [x] [typoscript](https://github.com/Teddytrombone/tree-sitter-typoscript) (maintained by @Teddytrombone)
|
||||
- [x] [typst](https://github.com/uben0/tree-sitter-typst) (maintained by @uben0, @RaafatTurki)
|
||||
- [x] [udev](https://github.com/ObserverOfTime/tree-sitter-udev) (maintained by @ObserverOfTime)
|
||||
- [x] [ungrammar](https://github.com/Philipp-M/tree-sitter-ungrammar) (maintained by @Philipp-M, @amaanq)
|
||||
- [x] [unison](https://github.com/kylegoetz/tree-sitter-unison) (maintained by @tapegram)
|
||||
- [x] [usd](https://github.com/ColinKennedy/tree-sitter-usd) (maintained by @ColinKennedy)
|
||||
- [x] [uxn tal](https://github.com/amaanq/tree-sitter-uxntal) (maintained by @amaanq)
|
||||
- [x] [v](https://github.com/v-analyzer/v-analyzer) (maintained by @kkharji, @amaanq)
|
||||
- [x] [v](https://github.com/vlang/v-analyzer) (maintained by @kkharji, @amaanq)
|
||||
- [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] [vue](https://github.com/ikatyang/tree-sitter-vue) (maintained by @WhyNotHugo)
|
||||
- [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)
|
||||
- [x] [wing](https://github.com/winglang/wing) (experimental, maintained by @gshpychka, @MarkMcCulloh)
|
||||
- [x] [wing](https://github.com/winglang/tree-sitter-wing) (maintained by @gshpychka, @MarkMcCulloh)
|
||||
- [x] [wit](https://github.com/liamwh/tree-sitter-wit) (maintained by @liamwh)
|
||||
- [x] [xcompose](https://github.com/ObserverOfTime/tree-sitter-xcompose) (maintained by @ObserverOfTime)
|
||||
- [x] [xml](https://github.com/ObserverOfTime/tree-sitter-xml) (maintained by @ObserverOfTime)
|
||||
- [x] [yaml](https://github.com/ikatyang/tree-sitter-yaml) (maintained by @stsewd)
|
||||
- [x] [xml](https://github.com/tree-sitter-grammars/tree-sitter-xml) (maintained by @ObserverOfTime)
|
||||
- [x] [yaml](https://github.com/tree-sitter-grammars/tree-sitter-yaml) (maintained by @amaanq)
|
||||
- [x] [yang](https://github.com/Hubro/tree-sitter-yang) (maintained by @Hubro)
|
||||
- [x] [yuck](https://github.com/Philipp-M/tree-sitter-yuck) (maintained by @Philipp-M, @amaanq)
|
||||
- [x] [zathurarc](https://github.com/Freed-Wu/tree-sitter-zathurarc) (maintained by @Freed-Wu)
|
||||
- [x] [zig](https://github.com/maxxnino/tree-sitter-zig) (maintained by @maxxnino)
|
||||
<!--parserinfo-->
|
||||
|
||||
@ -497,12 +538,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.
|
||||
@ -515,11 +555,13 @@ If you want to install the parsers to a custom directory you can specify this
|
||||
directory with `parser_install_dir` option in that is passed to `setup`.
|
||||
`nvim-treesitter` will then install the parser files into this directory.
|
||||
|
||||
This directory must be writeable and must be explicitly added to the
|
||||
This directory must be writeable and must be explicitly prepended to the
|
||||
`runtimepath`. For example:
|
||||
|
||||
```lua
|
||||
vim.opt.runtimepath:append("/some/path/to/store/parsers")
|
||||
-- It MUST be at the beginning of runtimepath. Otherwise the parsers from Neovim itself
|
||||
-- is loaded that may not be compatible with the queries from the 'nvim-treesitter' plugin.
|
||||
vim.opt.runtimepath:prepend("/some/path/to/store/parsers")
|
||||
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
parser_install_dir = "/some/path/to/store/parsers",
|
||||
@ -595,18 +637,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
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -24,4 +24,16 @@ function M.get_node_text(node, bufnr)
|
||||
return (ts.get_node_text or tsq.get_node_text)(node, bufnr)
|
||||
end
|
||||
|
||||
function M.require_language(lang, opts)
|
||||
return (ts.language.add or ts.language.require_language)(lang, opts)
|
||||
end
|
||||
|
||||
function M.flatten(t)
|
||||
if vim.fn.has "nvim-0.11" == 1 then
|
||||
return vim.iter(t):flatten():totable()
|
||||
else
|
||||
return vim.tbl_flatten(t)
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
@ -23,8 +23,8 @@ local NVIM_TREESITTER_MINIMUM_ABI = 13
|
||||
local function install_health()
|
||||
_start "Installation"
|
||||
|
||||
if fn.has "nvim-0.9.1" ~= 1 then
|
||||
_error "Nvim-treesitter requires Neovim 0.9.1+"
|
||||
if fn.has "nvim-0.9.2" ~= 1 then
|
||||
_error "Nvim-treesitter requires Nvim 0.9.2 or newer"
|
||||
end
|
||||
|
||||
if fn.executable "tree-sitter" == 0 then
|
||||
|
||||
@ -5,6 +5,7 @@ local ts_utils = require "nvim-treesitter.ts_utils"
|
||||
local locals = require "nvim-treesitter.locals"
|
||||
local parsers = require "nvim-treesitter.parsers"
|
||||
local queries = require "nvim-treesitter.query"
|
||||
local utils = require "nvim-treesitter.utils"
|
||||
|
||||
local M = {}
|
||||
|
||||
@ -23,8 +24,8 @@ end
|
||||
-- The range starts with 1 and the ending is inclusive.
|
||||
---@return integer, integer, integer, integer
|
||||
local function visual_selection_range()
|
||||
local _, csrow, cscol, _ = unpack(vim.fn.getpos "'<") ---@type integer, integer, integer, integer
|
||||
local _, cerow, cecol, _ = unpack(vim.fn.getpos "'>") ---@type integer, integer, integer, integer
|
||||
local _, csrow, cscol, _ = unpack(vim.fn.getpos "v") ---@type integer, integer, integer, integer
|
||||
local _, cerow, cecol, _ = unpack(vim.fn.getpos ".") ---@type integer, integer, integer, integer
|
||||
|
||||
local start_row, start_col, end_row, end_col ---@type integer, integer, integer, integer
|
||||
|
||||
@ -138,24 +139,14 @@ function M.attach(bufnr)
|
||||
local config = configs.get_module "incremental_selection"
|
||||
for funcname, mapping in pairs(config.keymaps) do
|
||||
if mapping then
|
||||
---@type string, string|function
|
||||
local mode, rhs
|
||||
if funcname == "init_selection" then
|
||||
mode = "n"
|
||||
---@type function
|
||||
rhs = M[funcname]
|
||||
local mode = funcname == "init_selection" and "n" or "x"
|
||||
local rhs = M[funcname] ---@type function
|
||||
|
||||
if not rhs then
|
||||
utils.notify("Unknown keybinding: " .. funcname .. debug.traceback(), vim.log.levels.ERROR)
|
||||
else
|
||||
mode = "x"
|
||||
-- We need to move to command mode to access marks '< (visual area start) and '> (visual area end) which are not
|
||||
-- properly accessible in visual mode.
|
||||
rhs = string.format(":lua require'nvim-treesitter.incremental_selection'.%s()<CR>", funcname)
|
||||
vim.keymap.set(mode, mapping, rhs, { buffer = bufnr, silent = true, desc = FUNCTION_DESCRIPTIONS[funcname] })
|
||||
end
|
||||
vim.keymap.set(
|
||||
mode,
|
||||
mapping,
|
||||
rhs,
|
||||
{ buffer = bufnr, silent = true, noremap = true, desc = FUNCTION_DESCRIPTIONS[funcname] }
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -164,10 +155,10 @@ function M.detach(bufnr)
|
||||
local config = configs.get_module "incremental_selection"
|
||||
for f, mapping in pairs(config.keymaps) do
|
||||
if mapping then
|
||||
if f == "init_selection" then
|
||||
vim.keymap.del("n", mapping, { buffer = bufnr })
|
||||
else
|
||||
vim.keymap.del("x", mapping, { buffer = bufnr })
|
||||
local mode = f == "init_selection" and "n" or "x"
|
||||
local ok, err = pcall(vim.keymap.del, mode, mapping, { buffer = bufnr })
|
||||
if not ok then
|
||||
utils.notify(string.format('%s "%s" for mode %s', err, mapping, mode), vim.log.levels.ERROR)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -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
|
||||
@ -249,9 +256,9 @@ function M.get_indent(lnum)
|
||||
if is_in_err and not q["indent.align"][node:id()] then
|
||||
-- only when the node is in error, promote the
|
||||
-- first child's aligned indent to the error node
|
||||
-- to work around ((ERROR "X" . (_)) @aligned_indent (#set! "delimeter" "AB"))
|
||||
-- to work around ((ERROR "X" . (_)) @aligned_indent (#set! "delimiter" "AB"))
|
||||
-- matching for all X, instead set do
|
||||
-- (ERROR "X" @aligned_indent (#set! "delimeter" "AB") . (_))
|
||||
-- (ERROR "X" @aligned_indent (#set! "delimiter" "AB") . (_))
|
||||
-- and we will fish it out here.
|
||||
for c in node:iter_children() do
|
||||
if q["indent.align"][c:id()] then
|
||||
|
||||
@ -7,6 +7,7 @@ local parsers = require "nvim-treesitter.parsers"
|
||||
local info = require "nvim-treesitter.info"
|
||||
local configs = require "nvim-treesitter.configs"
|
||||
local shell = require "nvim-treesitter.shell_command_selectors"
|
||||
local compat = require "nvim-treesitter.compat"
|
||||
|
||||
local M = {}
|
||||
|
||||
@ -59,7 +60,7 @@ local function reattach_if_possible_fn(lang, error_on_fail)
|
||||
local ft = vim.bo[buf].filetype
|
||||
ok, err = pcall(vim.treesitter.language.add, lang, { filetype = ft })
|
||||
else
|
||||
ok, err = pcall(vim.treesitter.language.require_language, lang)
|
||||
ok, err = pcall(compat.require_language, lang)
|
||||
end
|
||||
if not ok and error_on_fail then
|
||||
vim.notify("Could not load parser for " .. lang .. ": " .. vim.inspect(err))
|
||||
@ -360,9 +361,9 @@ local function run_install(cache_folder, install_folder, lang, repo, with_sync,
|
||||
if not M.ts_generate_args then
|
||||
local ts_cli_version = utils.ts_cli_version()
|
||||
if ts_cli_version and vim.split(ts_cli_version, " ")[1] > "0.20.2" then
|
||||
M.ts_generate_args = { "generate", "--abi", vim.treesitter.language_version }
|
||||
M.ts_generate_args = { "generate", "--no-bindings", "--abi", vim.treesitter.language_version }
|
||||
else
|
||||
M.ts_generate_args = { "generate" }
|
||||
M.ts_generate_args = { "generate", "--no-bindings" }
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -526,6 +527,7 @@ local function install(options)
|
||||
if err then
|
||||
return api.nvim_err_writeln(err)
|
||||
end
|
||||
install_folder = install_folder and clean_path(install_folder)
|
||||
assert(install_folder)
|
||||
|
||||
local languages ---@type string[]
|
||||
@ -534,7 +536,7 @@ local function install(options)
|
||||
languages = parsers.available_parsers()
|
||||
ask = false
|
||||
else
|
||||
languages = vim.tbl_flatten { ... }
|
||||
languages = compat.flatten { ... }
|
||||
ask = ask_reinstall
|
||||
end
|
||||
|
||||
@ -555,6 +557,7 @@ end
|
||||
function M.setup_auto_install()
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { "*" },
|
||||
group = vim.api.nvim_create_augroup("NvimTreesitter-auto_install", { clear = true }),
|
||||
callback = function()
|
||||
local lang = parsers.get_buf_lang()
|
||||
if parsers.get_parser_configs()[lang] and not is_installed(lang) and not is_ignored_parser(lang) then
|
||||
@ -571,7 +574,7 @@ function M.update(options)
|
||||
reset_progress_counter()
|
||||
if ... and ... ~= "all" then
|
||||
---@type string[]
|
||||
local languages = vim.tbl_flatten { ... }
|
||||
local languages = compat.flatten { ... }
|
||||
local installed = 0
|
||||
for _, lang in ipairs(languages) do
|
||||
if (not is_installed(lang)) or (needs_update(lang)) then
|
||||
@ -614,12 +617,13 @@ function M.uninstall(...)
|
||||
ensure_installed_parsers = utils.difference(ensure_installed_parsers, configs.get_ignored_parser_installs())
|
||||
|
||||
---@type string[]
|
||||
local languages = vim.tbl_flatten { ... }
|
||||
local languages = compat.flatten { ... }
|
||||
for _, lang in ipairs(languages) do
|
||||
local install_dir, err = configs.get_parser_install_dir()
|
||||
if err then
|
||||
return api.nvim_err_writeln(err)
|
||||
end
|
||||
install_dir = install_dir and clean_path(install_dir)
|
||||
|
||||
if vim.tbl_contains(ensure_installed_parsers, lang) then
|
||||
vim.notify(
|
||||
|
||||
@ -41,8 +41,8 @@ function M.get_definitions(bufnr)
|
||||
local defs = {}
|
||||
|
||||
for _, loc in ipairs(locals) do
|
||||
if loc.definition then
|
||||
table.insert(defs, loc.definition)
|
||||
if loc["local"]["definition"] then
|
||||
table.insert(defs, loc["local"]["definition"])
|
||||
end
|
||||
end
|
||||
|
||||
@ -55,8 +55,8 @@ function M.get_scopes(bufnr)
|
||||
local scopes = {}
|
||||
|
||||
for _, loc in ipairs(locals) do
|
||||
if loc.scope and loc.scope.node then
|
||||
table.insert(scopes, loc.scope.node)
|
||||
if loc["local"]["scope"] and loc["local"]["scope"].node then
|
||||
table.insert(scopes, loc["local"]["scope"].node)
|
||||
end
|
||||
end
|
||||
|
||||
@ -69,8 +69,8 @@ function M.get_references(bufnr)
|
||||
local refs = {}
|
||||
|
||||
for _, loc in ipairs(locals) do
|
||||
if loc.reference and loc.reference.node then
|
||||
table.insert(refs, loc.reference.node)
|
||||
if loc["local"]["reference"] and loc["local"]["reference"].node then
|
||||
table.insert(refs, loc["local"]["reference"].node)
|
||||
end
|
||||
end
|
||||
|
||||
@ -254,6 +254,7 @@ function M.find_usages(node, scope_node, bufnr)
|
||||
local usages = {}
|
||||
|
||||
for match in M.iter_locals(bufnr, scope_node) do
|
||||
match = match["local"]
|
||||
if match.reference and match.reference.node and ts.get_node_text(match.reference.node, bufnr) == node_text then
|
||||
local def_node, _, kind = M.find_definition(match.reference.node, bufnr)
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -124,7 +124,7 @@ end, true)
|
||||
---@param _bufnr integer
|
||||
---@param pred string[]
|
||||
---@return boolean|nil
|
||||
query.add_predicate("has-type?", function(match, _pattern, _bufnr, pred)
|
||||
query.add_predicate("kind-eq?", function(match, _pattern, _bufnr, pred)
|
||||
if not valid_args(pred[1], pred, 2) then
|
||||
return
|
||||
end
|
||||
@ -171,7 +171,7 @@ query.add_directive("set-lang-from-info-string!", function(match, _, bufnr, pred
|
||||
if not node then
|
||||
return
|
||||
end
|
||||
local injection_alias = vim.treesitter.get_node_text(node, bufnr)
|
||||
local injection_alias = vim.treesitter.get_node_text(node, bufnr):lower()
|
||||
metadata["injection.language"] = get_parser_from_markdown_info_string(injection_alias)
|
||||
end, true)
|
||||
|
||||
|
||||
@ -91,6 +91,7 @@ function M.select_compiler_args(repo, compiler)
|
||||
"/Isrc",
|
||||
repo.files,
|
||||
"-Os",
|
||||
"/utf-8",
|
||||
"/LD",
|
||||
}
|
||||
elseif string.match(compiler, "zig$") or string.match(compiler, "zig.exe$") then
|
||||
@ -151,7 +152,7 @@ function M.select_compile_command(repo, cc, compile_location)
|
||||
info = "Compiling...",
|
||||
err = "Error during compilation",
|
||||
opts = {
|
||||
args = vim.tbl_flatten(M.select_compiler_args(repo, cc)),
|
||||
args = require("nvim-treesitter.compat").flatten(M.select_compiler_args(repo, cc)),
|
||||
cwd = compile_location,
|
||||
},
|
||||
}
|
||||
@ -251,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",
|
||||
@ -287,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 environemnt 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",
|
||||
@ -297,6 +324,7 @@ function M.select_download_commands(repo, project_name, cache_folder, revision,
|
||||
"clone",
|
||||
repo.url,
|
||||
project_name,
|
||||
"--filter=blob:none",
|
||||
},
|
||||
cwd = cache_folder,
|
||||
},
|
||||
@ -328,7 +356,7 @@ function M.make_directory_change_for_command(dir, command)
|
||||
return string.format("pushd %s ; %s ; popd", cmdpath(dir), command)
|
||||
end
|
||||
else
|
||||
return string.format("cd %s;\n %s", dir, command)
|
||||
return string.format("cd %s;\n%s", dir, command)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -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)
|
||||
@ -397,6 +397,7 @@ function M.swap_nodes(node_or_range1, node_or_range2, bufnr, cursor_to_second)
|
||||
|
||||
local edit1 = { range = range1, newText = table.concat(text2, "\n") }
|
||||
local edit2 = { range = range2, newText = table.concat(text1, "\n") }
|
||||
bufnr = bufnr == 0 and vim.api.nvim_get_current_buf() or bufnr
|
||||
vim.lsp.util.apply_text_edits({ edit1, edit2 }, bufnr, "utf-8")
|
||||
|
||||
if cursor_to_second then
|
||||
|
||||
@ -83,7 +83,7 @@ function M.setup_commands(mod, commands)
|
||||
local f_args = def.f_args or "<f-args>"
|
||||
local call_fn =
|
||||
string.format("lua require'nvim-treesitter.%s'.commands.%s['run<bang>'](%s)", mod, command_name, f_args)
|
||||
local parts = vim.tbl_flatten {
|
||||
local parts = require("nvim-treesitter.compat").flatten {
|
||||
"command!",
|
||||
"-bar",
|
||||
def.args,
|
||||
|
||||
@ -1,14 +1,13 @@
|
||||
;; Support for folding in Ada
|
||||
;; za toggles folding a package, subprogram, if statement or loop
|
||||
|
||||
; Support for folding in Ada
|
||||
; za toggles folding a package, subprogram, if statement or loop
|
||||
[
|
||||
(package_declaration)
|
||||
(generic_package_declaration)
|
||||
(package_body)
|
||||
(subprogram_body)
|
||||
(block_statement)
|
||||
(if_statement)
|
||||
(loop_statement)
|
||||
(gnatprep_declarative_if_statement)
|
||||
(gnatprep_if_statement)
|
||||
(package_declaration)
|
||||
(generic_package_declaration)
|
||||
(package_body)
|
||||
(subprogram_body)
|
||||
(block_statement)
|
||||
(if_statement)
|
||||
(loop_statement)
|
||||
(gnatprep_declarative_if_statement)
|
||||
(gnatprep_if_statement)
|
||||
] @fold
|
||||
|
||||
@ -1,190 +1,286 @@
|
||||
;; highlight queries.
|
||||
;; See the syntax at https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries
|
||||
;; See also https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#parser-configurations
|
||||
;; for a list of recommended @ tags, though not all of them have matching
|
||||
;; highlights in neovim.
|
||||
; highlight queries.
|
||||
; See the syntax at https://tree-sitter.github.io/tree-sitter/using-parsers#pattern-matching-with-queries
|
||||
; See also https://github.com/nvim-treesitter/nvim-treesitter/blob/master/CONTRIBUTING.md#parser-configurations
|
||||
; for a list of recommended @ tags, though not all of them have matching
|
||||
; highlights in neovim.
|
||||
[
|
||||
"abort"
|
||||
"abs"
|
||||
"abstract"
|
||||
"accept"
|
||||
"access"
|
||||
"all"
|
||||
"array"
|
||||
"at"
|
||||
"begin"
|
||||
"body"
|
||||
"declare"
|
||||
"delay"
|
||||
"delta"
|
||||
"digits"
|
||||
"do"
|
||||
"end"
|
||||
"entry"
|
||||
"exit"
|
||||
"generic"
|
||||
"interface"
|
||||
"is"
|
||||
"limited"
|
||||
"mod"
|
||||
"new"
|
||||
"null"
|
||||
"of"
|
||||
"others"
|
||||
"out"
|
||||
"overriding"
|
||||
"package"
|
||||
"pragma"
|
||||
"private"
|
||||
"protected"
|
||||
"range"
|
||||
"separate"
|
||||
"subtype"
|
||||
"synchronized"
|
||||
"tagged"
|
||||
"task"
|
||||
"terminate"
|
||||
"type"
|
||||
"until"
|
||||
"when"
|
||||
] @keyword
|
||||
|
||||
"record" @keyword.type
|
||||
|
||||
[
|
||||
"abort"
|
||||
"abs"
|
||||
"abstract"
|
||||
"accept"
|
||||
"access"
|
||||
"all"
|
||||
"array"
|
||||
"at"
|
||||
"begin"
|
||||
"declare"
|
||||
"delay"
|
||||
"delta"
|
||||
"digits"
|
||||
"do"
|
||||
"end"
|
||||
"entry"
|
||||
"exit"
|
||||
"generic"
|
||||
"interface"
|
||||
"is"
|
||||
"limited"
|
||||
"null"
|
||||
"of"
|
||||
"others"
|
||||
"out"
|
||||
"pragma"
|
||||
"private"
|
||||
"range"
|
||||
"synchronized"
|
||||
"tagged"
|
||||
"task"
|
||||
"terminate"
|
||||
"until"
|
||||
"when"
|
||||
] @keyword
|
||||
"aliased"
|
||||
"constant"
|
||||
"renames"
|
||||
] @keyword.modifier
|
||||
|
||||
[
|
||||
"aliased"
|
||||
"constant"
|
||||
"renames"
|
||||
] @storageclass
|
||||
"with"
|
||||
"use"
|
||||
] @keyword.import
|
||||
|
||||
[
|
||||
"mod"
|
||||
"new"
|
||||
"protected"
|
||||
"record"
|
||||
"subtype"
|
||||
"type"
|
||||
] @keyword.type
|
||||
[
|
||||
"with"
|
||||
"use"
|
||||
] @include
|
||||
[
|
||||
"body"
|
||||
"function"
|
||||
"overriding"
|
||||
"procedure"
|
||||
"package"
|
||||
"separate"
|
||||
"function"
|
||||
"procedure"
|
||||
] @keyword.function
|
||||
|
||||
[
|
||||
"and"
|
||||
"in"
|
||||
"not"
|
||||
"or"
|
||||
"xor"
|
||||
"and"
|
||||
"in"
|
||||
"not"
|
||||
"or"
|
||||
"xor"
|
||||
] @keyword.operator
|
||||
|
||||
[
|
||||
"while"
|
||||
"loop"
|
||||
"for"
|
||||
"parallel"
|
||||
"reverse"
|
||||
"some"
|
||||
] @repeat
|
||||
"while"
|
||||
"loop"
|
||||
"for"
|
||||
"parallel"
|
||||
"reverse"
|
||||
"some"
|
||||
] @keyword.repeat
|
||||
|
||||
"return" @keyword.return
|
||||
|
||||
[
|
||||
"return"
|
||||
] @keyword.return
|
||||
"case"
|
||||
"if"
|
||||
"else"
|
||||
"then"
|
||||
"elsif"
|
||||
"select"
|
||||
] @keyword.conditional
|
||||
|
||||
[
|
||||
"case"
|
||||
"if"
|
||||
"else"
|
||||
"then"
|
||||
"elsif"
|
||||
"select"
|
||||
] @conditional
|
||||
[
|
||||
"exception"
|
||||
"raise"
|
||||
] @exception
|
||||
"exception"
|
||||
"raise"
|
||||
] @keyword.exception
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
(string_literal) @string
|
||||
|
||||
(character_literal) @string
|
||||
|
||||
(numeric_literal) @number
|
||||
|
||||
;; Highlight the name of subprograms
|
||||
(procedure_specification name: (_) @function)
|
||||
(function_specification name: (_) @function)
|
||||
(package_declaration name: (_) @function)
|
||||
(package_body name: (_) @function)
|
||||
(generic_instantiation name: (_) @function)
|
||||
(entry_declaration . (identifier) @function)
|
||||
; Highlight the name of subprograms
|
||||
(procedure_specification
|
||||
name: (_) @function)
|
||||
|
||||
;; Some keywords should take different categories depending on the context
|
||||
(use_clause "use" @include "type" @include)
|
||||
(with_clause "private" @include)
|
||||
(with_clause "limited" @include)
|
||||
(use_clause (_) @namespace)
|
||||
(with_clause (_) @namespace)
|
||||
(function_specification
|
||||
name: (_) @function)
|
||||
|
||||
(loop_statement "end" @keyword.repeat)
|
||||
(if_statement "end" @conditional)
|
||||
(loop_parameter_specification "in" @keyword.repeat)
|
||||
(loop_parameter_specification "in" @keyword.repeat)
|
||||
(iterator_specification ["in" "of"] @keyword.repeat)
|
||||
(range_attribute_designator "range" @keyword.repeat)
|
||||
(package_declaration
|
||||
name: (_) @function)
|
||||
|
||||
(raise_statement "with" @exception)
|
||||
(package_body
|
||||
name: (_) @function)
|
||||
|
||||
(gnatprep_declarative_if_statement) @preproc
|
||||
(gnatprep_if_statement) @preproc
|
||||
(gnatprep_identifier) @preproc
|
||||
(generic_instantiation
|
||||
name: (_) @function)
|
||||
|
||||
(subprogram_declaration "is" @keyword.function "abstract" @keyword.function)
|
||||
(aspect_specification "with" @keyword.function)
|
||||
(entry_declaration
|
||||
.
|
||||
(identifier) @function)
|
||||
|
||||
(full_type_declaration "is" @keyword.type)
|
||||
(subtype_declaration "is" @keyword.type)
|
||||
(record_definition "end" @keyword.type)
|
||||
(full_type_declaration (_ "access" @keyword.type))
|
||||
(array_type_definition "array" @keyword.type "of" @keyword.type)
|
||||
(access_to_object_definition "access" @keyword.type)
|
||||
(access_to_object_definition "access" @keyword.type
|
||||
[
|
||||
(general_access_modifier "constant" @keyword.type)
|
||||
(general_access_modifier "all" @keyword.type)
|
||||
]
|
||||
)
|
||||
(range_constraint "range" @keyword.type)
|
||||
(signed_integer_type_definition "range" @keyword.type)
|
||||
(index_subtype_definition "range" @keyword.type)
|
||||
(record_type_definition "abstract" @keyword.type)
|
||||
(record_type_definition "tagged" @keyword.type)
|
||||
(record_type_definition "limited" @keyword.type)
|
||||
(record_type_definition (record_definition "null" @keyword.type))
|
||||
(private_type_declaration "is" @keyword.type "private" @keyword.type)
|
||||
(private_type_declaration "tagged" @keyword.type)
|
||||
(private_type_declaration "limited" @keyword.type)
|
||||
(task_type_declaration "task" @keyword.type "is" @keyword.type)
|
||||
; Some keywords should take different categories depending on the context
|
||||
(use_clause
|
||||
"use" @keyword.import
|
||||
"type" @keyword.import)
|
||||
|
||||
;; Gray the body of expression functions
|
||||
(with_clause
|
||||
"private" @keyword.import)
|
||||
|
||||
(with_clause
|
||||
"limited" @keyword.import)
|
||||
|
||||
(use_clause
|
||||
(_) @module)
|
||||
|
||||
(with_clause
|
||||
(_) @module)
|
||||
|
||||
(loop_statement
|
||||
"end" @keyword.repeat)
|
||||
|
||||
(if_statement
|
||||
"end" @keyword.conditional)
|
||||
|
||||
(loop_parameter_specification
|
||||
"in" @keyword.repeat)
|
||||
|
||||
(loop_parameter_specification
|
||||
"in" @keyword.repeat)
|
||||
|
||||
(iterator_specification
|
||||
[
|
||||
"in"
|
||||
"of"
|
||||
] @keyword.repeat)
|
||||
|
||||
(range_attribute_designator
|
||||
"range" @keyword.repeat)
|
||||
|
||||
(raise_statement
|
||||
"with" @keyword.exception)
|
||||
|
||||
(gnatprep_declarative_if_statement) @keyword.directive
|
||||
|
||||
(gnatprep_if_statement) @keyword.directive
|
||||
|
||||
(gnatprep_identifier) @keyword.directive
|
||||
|
||||
(subprogram_declaration
|
||||
"is" @keyword.function
|
||||
"abstract" @keyword.function)
|
||||
|
||||
(aspect_specification
|
||||
"with" @keyword.function)
|
||||
|
||||
(full_type_declaration
|
||||
"is" @keyword.type)
|
||||
|
||||
(subtype_declaration
|
||||
"is" @keyword.type)
|
||||
|
||||
(record_definition
|
||||
"end" @keyword.type)
|
||||
|
||||
(full_type_declaration
|
||||
(_
|
||||
"access" @keyword.type))
|
||||
|
||||
(array_type_definition
|
||||
"array" @keyword.type
|
||||
"of" @keyword.type)
|
||||
|
||||
(access_to_object_definition
|
||||
"access" @keyword.type)
|
||||
|
||||
(access_to_object_definition
|
||||
"access" @keyword.type
|
||||
[
|
||||
(general_access_modifier
|
||||
"constant" @keyword.type)
|
||||
(general_access_modifier
|
||||
"all" @keyword.type)
|
||||
])
|
||||
|
||||
(range_constraint
|
||||
"range" @keyword.type)
|
||||
|
||||
(signed_integer_type_definition
|
||||
"range" @keyword.type)
|
||||
|
||||
(index_subtype_definition
|
||||
"range" @keyword.type)
|
||||
|
||||
(record_type_definition
|
||||
"abstract" @keyword.type)
|
||||
|
||||
(record_type_definition
|
||||
"tagged" @keyword.type)
|
||||
|
||||
(record_type_definition
|
||||
"limited" @keyword.type)
|
||||
|
||||
(record_type_definition
|
||||
(record_definition
|
||||
"null" @keyword.type))
|
||||
|
||||
(private_type_declaration
|
||||
"is" @keyword.type
|
||||
"private" @keyword.type)
|
||||
|
||||
(private_type_declaration
|
||||
"tagged" @keyword.type)
|
||||
|
||||
(private_type_declaration
|
||||
"limited" @keyword.type)
|
||||
|
||||
(task_type_declaration
|
||||
"task" @keyword.type
|
||||
"is" @keyword.type)
|
||||
|
||||
; Gray the body of expression functions
|
||||
(expression_function_declaration
|
||||
(function_specification)
|
||||
"is"
|
||||
(_) @attribute
|
||||
)
|
||||
(subprogram_declaration (aspect_specification) @attribute)
|
||||
(function_specification)
|
||||
"is"
|
||||
(_) @attribute)
|
||||
|
||||
;; Highlight full subprogram specifications
|
||||
(subprogram_declaration
|
||||
(aspect_specification) @attribute)
|
||||
|
||||
; Highlight full subprogram specifications
|
||||
;(subprogram_body
|
||||
; [
|
||||
; (procedure_specification)
|
||||
; (function_specification)
|
||||
; ] @function.spec
|
||||
;)
|
||||
|
||||
((comment) @comment.documentation
|
||||
. [
|
||||
(entry_declaration)
|
||||
(subprogram_declaration)
|
||||
(parameter_specification)
|
||||
])
|
||||
.
|
||||
[
|
||||
(entry_declaration)
|
||||
(subprogram_declaration)
|
||||
(parameter_specification)
|
||||
])
|
||||
|
||||
(compilation_unit
|
||||
. (comment) @comment.documentation)
|
||||
(compilation_unit
|
||||
.
|
||||
(comment) @comment.documentation)
|
||||
|
||||
(component_list
|
||||
(component_declaration)
|
||||
. (comment) @comment.documentation)
|
||||
.
|
||||
(comment) @comment.documentation)
|
||||
|
||||
(enumeration_type_definition
|
||||
(enumeration_type_definition
|
||||
(identifier)
|
||||
. (comment) @comment.documentation)
|
||||
.
|
||||
(comment) @comment.documentation)
|
||||
|
||||
@ -1,33 +1,91 @@
|
||||
;; Better highlighting by referencing to the definition, for variable
|
||||
;; references. However, this is not yet supported by neovim
|
||||
;; See https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables
|
||||
; Better highlighting by referencing to the definition, for variable
|
||||
; references. However, this is not yet supported by neovim
|
||||
; See https://tree-sitter.github.io/tree-sitter/syntax-highlighting#local-variables
|
||||
(compilation) @local.scope
|
||||
|
||||
(compilation) @scope
|
||||
(package_declaration) @scope
|
||||
(package_body) @scope
|
||||
(subprogram_declaration) @scope
|
||||
(subprogram_body) @scope
|
||||
(block_statement) @scope
|
||||
(package_declaration) @local.scope
|
||||
|
||||
(with_clause (identifier) @definition.import)
|
||||
(procedure_specification name: (_) @definition.function)
|
||||
(function_specification name: (_) @definition.function)
|
||||
(package_declaration name: (_) @definition.var)
|
||||
(package_body name: (_) @definition.var)
|
||||
(generic_instantiation . name: (_) @definition.var)
|
||||
(component_declaration . (identifier) @definition.var)
|
||||
(exception_declaration . (identifier) @definition.var)
|
||||
(formal_object_declaration . (identifier) @definition.var)
|
||||
(object_declaration . (identifier) @definition.var)
|
||||
(parameter_specification . (identifier) @definition.var)
|
||||
(full_type_declaration . (identifier) @definition.type)
|
||||
(private_type_declaration . (identifier) @definition.type)
|
||||
(private_extension_declaration . (identifier) @definition.type)
|
||||
(incomplete_type_declaration . (identifier) @definition.type)
|
||||
(protected_type_declaration . (identifier) @definition.type)
|
||||
(formal_complete_type_declaration . (identifier) @definition.type)
|
||||
(formal_incomplete_type_declaration . (identifier) @definition.type)
|
||||
(task_type_declaration . (identifier) @definition.type)
|
||||
(subtype_declaration . (identifier) @definition.type)
|
||||
(package_body) @local.scope
|
||||
|
||||
(identifier) @reference
|
||||
(subprogram_declaration) @local.scope
|
||||
|
||||
(subprogram_body) @local.scope
|
||||
|
||||
(block_statement) @local.scope
|
||||
|
||||
(with_clause
|
||||
(identifier) @local.definition.import)
|
||||
|
||||
(procedure_specification
|
||||
name: (_) @local.definition.function)
|
||||
|
||||
(function_specification
|
||||
name: (_) @local.definition.function)
|
||||
|
||||
(package_declaration
|
||||
name: (_) @local.definition.var)
|
||||
|
||||
(package_body
|
||||
name: (_) @local.definition.var)
|
||||
|
||||
(generic_instantiation
|
||||
.
|
||||
name: (_) @local.definition.var)
|
||||
|
||||
(component_declaration
|
||||
.
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(exception_declaration
|
||||
.
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(formal_object_declaration
|
||||
.
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(object_declaration
|
||||
.
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(parameter_specification
|
||||
.
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(full_type_declaration
|
||||
.
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(private_type_declaration
|
||||
.
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(private_extension_declaration
|
||||
.
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(incomplete_type_declaration
|
||||
.
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(protected_type_declaration
|
||||
.
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(formal_complete_type_declaration
|
||||
.
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(formal_incomplete_type_declaration
|
||||
.
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(task_type_declaration
|
||||
.
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(subtype_declaration
|
||||
.
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(identifier) @local.reference
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
[
|
||||
(record)
|
||||
(module)
|
||||
(record)
|
||||
(module)
|
||||
] @fold
|
||||
|
||||
@ -1,43 +1,52 @@
|
||||
|
||||
;; Constants
|
||||
; Constants
|
||||
(integer) @number
|
||||
|
||||
;; Variables and Symbols
|
||||
; Variables and Symbols
|
||||
(typed_binding
|
||||
(atom
|
||||
(qid) @variable))
|
||||
|
||||
(typed_binding (atom (qid) @variable))
|
||||
(untyped_binding) @variable
|
||||
(typed_binding (expr) @type)
|
||||
|
||||
(typed_binding
|
||||
(expr) @type)
|
||||
|
||||
(id) @function
|
||||
|
||||
(bid) @function
|
||||
|
||||
(function_name (atom (qid) @function))
|
||||
(function_name
|
||||
(atom
|
||||
(qid) @function))
|
||||
|
||||
(field_name) @function
|
||||
|
||||
|
||||
[(data_name) (record_name)] @constructor
|
||||
[
|
||||
(data_name)
|
||||
(record_name)
|
||||
] @constructor
|
||||
|
||||
; Set
|
||||
(SetN) @type.builtin
|
||||
|
||||
(expr . (atom) @function)
|
||||
(expr
|
||||
.
|
||||
(atom) @function)
|
||||
|
||||
((atom) @boolean
|
||||
(#any-of? @boolean "true" "false" "True" "False"))
|
||||
|
||||
;; Imports and Module Declarations
|
||||
; Imports and Module Declarations
|
||||
"import" @keyword.import
|
||||
|
||||
"import" @include
|
||||
(module_name) @module
|
||||
|
||||
(module_name) @namespace
|
||||
|
||||
;; Pragmas and comments
|
||||
|
||||
(pragma) @preproc
|
||||
; Pragmas and comments
|
||||
(pragma) @keyword.directive
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
;; Keywords
|
||||
; Keywords
|
||||
[
|
||||
"where"
|
||||
"data"
|
||||
@ -61,21 +70,18 @@
|
||||
"infix"
|
||||
"infixl"
|
||||
"infixr"
|
||||
"record"
|
||||
]
|
||||
@keyword
|
||||
] @keyword
|
||||
|
||||
;;;(expr
|
||||
;;; f_name: (atom) @function)
|
||||
;; Brackets
|
||||
"record" @keyword.type
|
||||
|
||||
;(expr
|
||||
; f_name: (atom) @function)
|
||||
; Brackets
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"{"
|
||||
"}"]
|
||||
@punctuation.bracket
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"="
|
||||
] @operator
|
||||
"=" @operator
|
||||
|
||||
@ -1,12 +1,43 @@
|
||||
; inherits: html_tags
|
||||
|
||||
(identifier) @variable
|
||||
(pipe_sequence "|" @operator)
|
||||
(string) @string
|
||||
|
||||
(pipe_operator) @operator
|
||||
|
||||
[
|
||||
(string)
|
||||
(static_member_expression)
|
||||
] @string
|
||||
|
||||
(number) @number
|
||||
|
||||
(pipe_call
|
||||
name: (identifier) @function)
|
||||
|
||||
(pipe_call
|
||||
arguments: (pipe_arguments
|
||||
(identifier) @parameter))
|
||||
(identifier) @variable.parameter))
|
||||
|
||||
(structural_directive
|
||||
"*" @keyword
|
||||
(identifier) @keyword)
|
||||
|
||||
(attribute
|
||||
(attribute_name) @variable.member
|
||||
(#lua-match? @variable.member "#.*"))
|
||||
|
||||
(binding_name
|
||||
(identifier) @keyword)
|
||||
|
||||
(event_binding
|
||||
(binding_name
|
||||
(identifier) @keyword))
|
||||
|
||||
(event_binding
|
||||
"\"" @punctuation.delimiter)
|
||||
|
||||
(property_binding
|
||||
"\"" @punctuation.delimiter)
|
||||
|
||||
(structural_assignment
|
||||
operator: (identifier) @keyword)
|
||||
@ -21,47 +52,92 @@
|
||||
function: ((identifier) @function.builtin
|
||||
(#eq? @function.builtin "$any")))
|
||||
|
||||
[
|
||||
"let"
|
||||
"as"
|
||||
] @keyword
|
||||
(pair
|
||||
key: ((identifier) @variable.builtin
|
||||
(#eq? @variable.builtin "$implicit")))
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
((control_keyword) @keyword.repeat
|
||||
(#any-of? @keyword.repeat "for" "empty"))
|
||||
|
||||
[
|
||||
";"
|
||||
"."
|
||||
","
|
||||
"?."
|
||||
] @punctuation.delimiter
|
||||
((control_keyword) @keyword.conditional
|
||||
(#any-of? @keyword.conditional "if" "else" "switch" "case" "default"))
|
||||
|
||||
((control_keyword) @keyword.coroutine
|
||||
(#any-of? @keyword.coroutine "defer" "placeholder" "loading"))
|
||||
|
||||
((control_keyword) @keyword.exception
|
||||
(#eq? @keyword.exception "error"))
|
||||
|
||||
(special_keyword) @keyword
|
||||
|
||||
((identifier) @boolean
|
||||
(#any-of? @boolean "true" "false"))
|
||||
|
||||
((identifier) @variable.builtin
|
||||
(#any-of? @variable.builtin "this" "\$event" "null"))
|
||||
(#any-of? @variable.builtin "this" "$event"))
|
||||
|
||||
((identifier) @constant.builtin
|
||||
(#eq? @constant.builtin "null"))
|
||||
|
||||
[
|
||||
"-"
|
||||
"&&"
|
||||
"+"
|
||||
"<"
|
||||
"<="
|
||||
"="
|
||||
"=="
|
||||
"==="
|
||||
"!="
|
||||
"!=="
|
||||
">"
|
||||
">="
|
||||
"*"
|
||||
"/"
|
||||
"||"
|
||||
"%"
|
||||
] @operator
|
||||
(ternary_operator)
|
||||
(conditional_operator)
|
||||
] @keyword.conditional.ternary
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
"@"
|
||||
] @punctuation.bracket
|
||||
|
||||
(two_way_binding
|
||||
[
|
||||
"[("
|
||||
")]"
|
||||
] @punctuation.bracket)
|
||||
|
||||
[
|
||||
"{{"
|
||||
"}}"
|
||||
] @punctuation.special
|
||||
|
||||
[
|
||||
";"
|
||||
"."
|
||||
","
|
||||
"?."
|
||||
] @punctuation.delimiter
|
||||
|
||||
(nullish_coalescing_expression
|
||||
(coalescing_operator) @operator)
|
||||
|
||||
(concatenation_expression
|
||||
"+" @operator)
|
||||
|
||||
(icu_clause) @keyword.operator
|
||||
|
||||
(icu_category) @keyword.conditional
|
||||
|
||||
(binary_expression
|
||||
[
|
||||
"-"
|
||||
"&&"
|
||||
"+"
|
||||
"<"
|
||||
"<="
|
||||
"="
|
||||
"=="
|
||||
"==="
|
||||
"!="
|
||||
"!=="
|
||||
">"
|
||||
">="
|
||||
"*"
|
||||
"/"
|
||||
"||"
|
||||
"%"
|
||||
] @operator)
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[
|
||||
(class_body)
|
||||
(constructor_declaration)
|
||||
(argument_list)
|
||||
(annotation_argument_list)
|
||||
(class_body)
|
||||
(constructor_declaration)
|
||||
(argument_list)
|
||||
(annotation_argument_list)
|
||||
] @fold
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
; inherits: soql
|
||||
|
||||
;;; Apex + SOQL
|
||||
|
||||
; Apex + SOQL
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
@ -17,31 +16,27 @@
|
||||
":"
|
||||
"?"
|
||||
";"
|
||||
] @punctuation.delimiter
|
||||
|
||||
;; Default general color defination
|
||||
] @punctuation.delimiter
|
||||
|
||||
; Default general color definition
|
||||
(identifier) @variable
|
||||
|
||||
(type_identifier) @type
|
||||
|
||||
;; Methods
|
||||
|
||||
; Methods
|
||||
(method_declaration
|
||||
name: (identifier) @method)
|
||||
name: (identifier) @function.method)
|
||||
|
||||
(method_invocation
|
||||
name: (identifier) @method.call)
|
||||
name: (identifier) @function.method.call)
|
||||
|
||||
(super) @function.builtin
|
||||
|
||||
;; Annotations
|
||||
|
||||
; Annotations
|
||||
(annotation
|
||||
name: (identifier) @attribute)
|
||||
|
||||
;; Types
|
||||
|
||||
; Types
|
||||
(interface_declaration
|
||||
name: (identifier) @type)
|
||||
|
||||
@ -49,7 +44,7 @@
|
||||
name: (identifier) @type)
|
||||
|
||||
(class_declaration
|
||||
(superclass) @type)
|
||||
(superclass) @type)
|
||||
|
||||
(enum_declaration
|
||||
name: (identifier) @type)
|
||||
@ -57,27 +52,30 @@
|
||||
(enum_constant
|
||||
name: (identifier) @constant)
|
||||
|
||||
(type_arguments "<" @punctuation.delimiter)
|
||||
(type_arguments ">" @punctuation.delimiter)
|
||||
(type_arguments
|
||||
"<" @punctuation.delimiter)
|
||||
|
||||
((field_access
|
||||
object: (identifier) @type))
|
||||
(type_arguments
|
||||
">" @punctuation.delimiter)
|
||||
|
||||
(field_access
|
||||
object: (identifier) @type)
|
||||
|
||||
(field_access
|
||||
field: (identifier) @property)
|
||||
|
||||
((scoped_identifier
|
||||
scope: (identifier) @type)
|
||||
(#match? @type "^[A-Z]"))
|
||||
(#match? @type "^[A-Z]"))
|
||||
|
||||
((method_invocation
|
||||
object: (identifier) @type)
|
||||
(#match? @type "^[A-Z]"))
|
||||
(#match? @type "^[A-Z]"))
|
||||
|
||||
(method_declaration
|
||||
(formal_parameters
|
||||
(formal_parameter
|
||||
name: (identifier) @parameter)))
|
||||
name: (identifier) @variable.parameter)))
|
||||
|
||||
(constructor_declaration
|
||||
name: (identifier) @constructor)
|
||||
@ -86,16 +84,21 @@
|
||||
|
||||
(assignment_operator) @operator
|
||||
|
||||
(update_expression ["++" "--"] @operator)
|
||||
(update_expression
|
||||
[
|
||||
"++"
|
||||
"--"
|
||||
] @operator)
|
||||
|
||||
(trigger_declaration
|
||||
name: (identifier) @type
|
||||
object: (identifier) @type
|
||||
(trigger_event) @keyword
|
||||
("," (trigger_event) @keyword)*)
|
||||
(","
|
||||
(trigger_event) @keyword)*)
|
||||
|
||||
[
|
||||
"@"
|
||||
"@"
|
||||
"="
|
||||
"!="
|
||||
"<="
|
||||
@ -121,7 +124,8 @@
|
||||
"%"
|
||||
"<<"
|
||||
">>"
|
||||
">>>"] @operator)
|
||||
">>>"
|
||||
] @operator)
|
||||
|
||||
(unary_expression
|
||||
operator: [
|
||||
@ -131,39 +135,47 @@
|
||||
"~"
|
||||
]) @operator
|
||||
|
||||
(map_initializer "=>" @operator)
|
||||
(map_initializer
|
||||
"=>" @operator)
|
||||
|
||||
[
|
||||
(boolean_type)
|
||||
(void_type)
|
||||
] @type.builtin;;
|
||||
] @type.builtin
|
||||
|
||||
; Fields
|
||||
|
||||
(field_declaration
|
||||
declarator: (variable_declarator
|
||||
name: (identifier) @field))
|
||||
name: (identifier) @variable.member))
|
||||
|
||||
(field_access
|
||||
field: (identifier) @field)
|
||||
field: (identifier) @variable.member)
|
||||
|
||||
; Variables
|
||||
|
||||
(field_declaration
|
||||
(modifiers (modifier ["final" "static"])(modifier ["final" "static"]))
|
||||
(variable_declarator
|
||||
name: (identifier) @constant))
|
||||
|
||||
(variable_declarator
|
||||
(identifier) @property)
|
||||
|
||||
(field_declaration
|
||||
(modifiers
|
||||
(modifier
|
||||
[
|
||||
"final"
|
||||
"static"
|
||||
])
|
||||
(modifier
|
||||
[
|
||||
"final"
|
||||
"static"
|
||||
]))
|
||||
(variable_declarator
|
||||
name: (identifier) @constant))
|
||||
|
||||
((identifier) @constant
|
||||
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$")) ; SCREAM SNAKE CASE
|
||||
|
||||
(this) @variable.builtin
|
||||
|
||||
; Literals
|
||||
|
||||
[
|
||||
(int)
|
||||
(decimal)
|
||||
@ -179,56 +191,50 @@
|
||||
|
||||
(null_literal) @constant.builtin
|
||||
|
||||
;; ;; Keywords
|
||||
|
||||
; ;; Keywords
|
||||
[
|
||||
"abstract"
|
||||
"final"
|
||||
"private"
|
||||
"protected"
|
||||
"public"
|
||||
"static"
|
||||
] @type.qualifier
|
||||
"abstract"
|
||||
"final"
|
||||
"private"
|
||||
"protected"
|
||||
"public"
|
||||
"static"
|
||||
] @keyword.modifier
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
"switch"
|
||||
] @conditional
|
||||
] @keyword.conditional
|
||||
|
||||
[
|
||||
"for"
|
||||
"while"
|
||||
"do"
|
||||
"break"
|
||||
] @repeat
|
||||
] @keyword.repeat
|
||||
|
||||
"return" @keyword.return
|
||||
|
||||
[
|
||||
"return"
|
||||
] @keyword.return
|
||||
|
||||
[
|
||||
"throw"
|
||||
"finally"
|
||||
"try"
|
||||
"catch"
|
||||
] @exception
|
||||
"throw"
|
||||
"finally"
|
||||
"try"
|
||||
"catch"
|
||||
] @keyword.exception
|
||||
|
||||
"new" @keyword.operator
|
||||
|
||||
[
|
||||
"abstract"
|
||||
"class"
|
||||
"continue"
|
||||
"default"
|
||||
"enum"
|
||||
"extends"
|
||||
"final"
|
||||
"get"
|
||||
"global"
|
||||
"implements"
|
||||
"instanceof"
|
||||
"interface"
|
||||
"on"
|
||||
"private"
|
||||
"protected"
|
||||
@ -245,4 +251,10 @@
|
||||
"inherited_sharing"
|
||||
] @keyword
|
||||
|
||||
"System.runAs" @type.builtin
|
||||
[
|
||||
"interface"
|
||||
"class"
|
||||
"enum"
|
||||
] @keyword.type
|
||||
|
||||
"System.runAs" @function.builtin
|
||||
|
||||
@ -1,66 +1,70 @@
|
||||
; declarations
|
||||
(class_declaration) @local.scope
|
||||
|
||||
(class_declaration) @scope
|
||||
(method_declaration) @scope
|
||||
(constructor_declaration) @scope
|
||||
(enum_declaration) @scope
|
||||
(enhanced_for_statement) @scope
|
||||
(method_declaration) @local.scope
|
||||
|
||||
(constructor_declaration) @local.scope
|
||||
|
||||
(enum_declaration) @local.scope
|
||||
|
||||
(enhanced_for_statement) @local.scope
|
||||
|
||||
; if/else
|
||||
(if_statement) @local.scope
|
||||
|
||||
(if_statement) @scope
|
||||
(if_statement
|
||||
consequence: (_) @scope) ; if body in case there are no braces
|
||||
consequence: (_) @local.scope) ; if body in case there are no braces
|
||||
|
||||
(if_statement
|
||||
alternative: (_) @scope) ; else body in case there are no braces
|
||||
alternative: (_) @local.scope) ; else body in case there are no braces
|
||||
|
||||
; try/catch
|
||||
(try_statement) @local.scope ; covers try+catch, individual try and catch are covered by (block)
|
||||
|
||||
(try_statement) @scope ; covers try+catch, individual try and catch are covered by (block)
|
||||
(catch_clause) @scope ; needed because `Exception` variable
|
||||
(catch_clause) @local.scope ; needed because `Exception` variable
|
||||
|
||||
; loops
|
||||
(for_statement) @local.scope
|
||||
|
||||
(for_statement ; "for" body in case there are no braces
|
||||
body: (_) @local.scope)
|
||||
|
||||
(for_statement) @scope
|
||||
(for_statement ; "for" body in case there are no braces
|
||||
body: (_) @scope)
|
||||
(do_statement
|
||||
body: (_) @scope)
|
||||
body: (_) @local.scope)
|
||||
|
||||
(while_statement
|
||||
body: (_) @scope)
|
||||
body: (_) @local.scope)
|
||||
|
||||
; Functions
|
||||
(constructor_declaration) @local.scope
|
||||
|
||||
(constructor_declaration) @scope
|
||||
(method_declaration) @scope
|
||||
|
||||
;; definitions
|
||||
(method_declaration) @local.scope
|
||||
|
||||
; definitions
|
||||
(enum_declaration
|
||||
name: (identifier) @definition.enum)
|
||||
name: (identifier) @local.definition.enum)
|
||||
|
||||
(method_declaration
|
||||
name: (identifier) @definition.method)
|
||||
name: (identifier) @local.definition.method)
|
||||
|
||||
(local_variable_declaration
|
||||
declarator: (variable_declarator
|
||||
name: (identifier) @definition.var))
|
||||
name: (identifier) @local.definition.var))
|
||||
|
||||
(enhanced_for_statement
|
||||
name: (identifier) @definition.var)
|
||||
(enhanced_for_statement
|
||||
name: (identifier) @local.definition.var)
|
||||
|
||||
(formal_parameter
|
||||
name: (identifier) @definition.parameter)
|
||||
name: (identifier) @local.definition.parameter)
|
||||
|
||||
(catch_formal_parameter
|
||||
name: (identifier) @definition.parameter)
|
||||
name: (identifier) @local.definition.parameter)
|
||||
|
||||
(field_declaration
|
||||
declarator: (variable_declarator
|
||||
name: (identifier) @definition.field))
|
||||
name: (identifier) @local.definition.field))
|
||||
|
||||
;; REFERENCES
|
||||
; REFERENCES
|
||||
(identifier) @local.reference
|
||||
|
||||
(identifier) @reference
|
||||
|
||||
(type_identifier) @reference
|
||||
(type_identifier) @local.reference
|
||||
|
||||
@ -1,96 +1,38 @@
|
||||
; inherits: cpp
|
||||
|
||||
((identifier) @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
; Digital I/O
|
||||
"digitalRead"
|
||||
"digitalWrite"
|
||||
"pinMode"
|
||||
; Analog I/O
|
||||
"analogRead"
|
||||
"analogReference"
|
||||
"analogWrite"
|
||||
; Zero, Due & MKR Family
|
||||
"analogReadResolution"
|
||||
"analogWriteResolution"
|
||||
; Advanced I/O
|
||||
"noTone"
|
||||
"pulseIn"
|
||||
"pulseInLong"
|
||||
"shiftIn"
|
||||
"shiftOut"
|
||||
"tone"
|
||||
; Time
|
||||
"delay"
|
||||
"delayMicroseconds"
|
||||
"micros"
|
||||
"millis"
|
||||
; Math
|
||||
"abs"
|
||||
"constrain"
|
||||
"map"
|
||||
"max"
|
||||
"min"
|
||||
"pow"
|
||||
"sq"
|
||||
"sqrt"
|
||||
; Trigonometry
|
||||
"cos"
|
||||
"sin"
|
||||
"tan"
|
||||
; Characters
|
||||
"isAlpha"
|
||||
"isAlphaNumeric"
|
||||
"isAscii"
|
||||
"isControl"
|
||||
"isDigit"
|
||||
"isGraph"
|
||||
"isHexadecimalDigit"
|
||||
"isLowerCase"
|
||||
"isPrintable"
|
||||
"isPunct"
|
||||
"isSpace"
|
||||
"isUpperCase"
|
||||
"isWhitespace"
|
||||
; Random Numbers
|
||||
"random"
|
||||
"randomSeed"
|
||||
; Bits and Bytes
|
||||
"bit"
|
||||
"bitClear"
|
||||
"bitRead"
|
||||
"bitSet"
|
||||
"bitWrite"
|
||||
"highByte"
|
||||
"lowByte"
|
||||
; External Interrupts
|
||||
"attachInterrupt"
|
||||
"detachInterrupt"
|
||||
; Interrupts
|
||||
"interrupts"
|
||||
"noInterrupts"
|
||||
))
|
||||
(#any-of? @function.builtin
|
||||
; Digital I/O
|
||||
"digitalRead" "digitalWrite" "pinMode"
|
||||
; Analog I/O
|
||||
"analogRead" "analogReference" "analogWrite"
|
||||
; Zero, Due & MKR Family
|
||||
"analogReadResolution" "analogWriteResolution"
|
||||
; Advanced I/O
|
||||
"noTone" "pulseIn" "pulseInLong" "shiftIn" "shiftOut" "tone"
|
||||
; Time
|
||||
"delay" "delayMicroseconds" "micros" "millis"
|
||||
; Math
|
||||
"abs" "constrain" "map" "max" "min" "pow" "sq" "sqrt"
|
||||
; Trigonometry
|
||||
"cos" "sin" "tan"
|
||||
; Characters
|
||||
"isAlpha" "isAlphaNumeric" "isAscii" "isControl" "isDigit" "isGraph" "isHexadecimalDigit"
|
||||
"isLowerCase" "isPrintable" "isPunct" "isSpace" "isUpperCase" "isWhitespace"
|
||||
; Random Numbers
|
||||
"random" "randomSeed"
|
||||
; Bits and Bytes
|
||||
"bit" "bitClear" "bitRead" "bitSet" "bitWrite" "highByte" "lowByte"
|
||||
; External Interrupts
|
||||
"attachInterrupt" "detachInterrupt"
|
||||
; Interrupts
|
||||
"interrupts" "noInterrupts"))
|
||||
|
||||
((identifier) @type.builtin
|
||||
(#any-of? @type.builtin
|
||||
"Serial"
|
||||
"SPI"
|
||||
"Stream"
|
||||
"Wire"
|
||||
"Keyboard"
|
||||
"Mouse"
|
||||
"String"
|
||||
))
|
||||
(#any-of? @type.builtin "Serial" "SPI" "Stream" "Wire" "Keyboard" "Mouse" "String"))
|
||||
|
||||
((identifier) @constant.builtin
|
||||
(#any-of? @constant.builtin
|
||||
"HIGH"
|
||||
"LOW"
|
||||
"INPUT"
|
||||
"OUTPUT"
|
||||
"INPUT_PULLUP"
|
||||
"LED_BUILTIN"
|
||||
))
|
||||
(#any-of? @constant.builtin "HIGH" "LOW" "INPUT" "OUTPUT" "INPUT_PULLUP" "LED_BUILTIN"))
|
||||
|
||||
(function_definition
|
||||
(function_declarator
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
((preproc_arg) @injection.content
|
||||
(#set! injection.language "arduino"))
|
||||
(#set! injection.language "arduino"))
|
||||
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
@ -1,13 +1,21 @@
|
||||
; inherits: html
|
||||
|
||||
[ "---" ] @punctuation.delimiter
|
||||
"---" @punctuation.delimiter
|
||||
|
||||
[ "{" "}" ] @punctuation.special
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.special
|
||||
|
||||
; custom components get `@type` highlighting
|
||||
((start_tag (tag_name) @type)
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
((end_tag (tag_name) @type)
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
((erroneous_end_tag (erroneous_end_tag_name) @type)
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
((start_tag
|
||||
(tag_name) @type)
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
|
||||
((end_tag
|
||||
(tag_name) @type)
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
|
||||
((erroneous_end_tag
|
||||
(erroneous_end_tag_name) @type)
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
|
||||
@ -1,23 +1,32 @@
|
||||
; inherits: html_tags
|
||||
|
||||
(frontmatter
|
||||
(raw_text) @injection.content
|
||||
(frontmatter_js_block) @injection.content
|
||||
(#set! injection.language "typescript"))
|
||||
|
||||
(interpolation
|
||||
(raw_text) @injection.content
|
||||
(#set! injection.language "tsx"))
|
||||
(attribute_interpolation
|
||||
(attribute_js_expr) @injection.content
|
||||
(#set! injection.language "typescript"))
|
||||
|
||||
(attribute
|
||||
(attribute_backtick_string) @injection.content
|
||||
(#set! injection.language "typescript"))
|
||||
|
||||
(html_interpolation
|
||||
(permissible_text) @injection.content
|
||||
(#set! injection.language "typescript"))
|
||||
|
||||
(script_element
|
||||
(raw_text) @injection.content
|
||||
(#set! injection.language "typescript"))
|
||||
|
||||
(style_element
|
||||
(start_tag
|
||||
(attribute
|
||||
(attribute_name) @_lang_attr
|
||||
(quoted_attribute_value (attribute_value) @_lang_value)))
|
||||
(raw_text) @injection.content
|
||||
(#eq? @_lang_attr "lang")
|
||||
(#eq? @_lang_value "scss")
|
||||
(#set! injection.language "scss"))
|
||||
(start_tag
|
||||
(attribute
|
||||
(attribute_name) @_lang_attr
|
||||
(quoted_attribute_value
|
||||
(attribute_value) @_lang_value)))
|
||||
(raw_text) @injection.content
|
||||
(#eq? @_lang_attr "lang")
|
||||
(#eq? @_lang_value "scss")
|
||||
(#set! injection.language "scss"))
|
||||
|
||||
@ -11,7 +11,8 @@
|
||||
(identifier) @type))
|
||||
|
||||
; relations
|
||||
(rel_expression (identifier) @property)
|
||||
(rel_expression
|
||||
(identifier) @property)
|
||||
|
||||
(relation
|
||||
(rel_expression
|
||||
@ -20,7 +21,8 @@
|
||||
(identifier) @constant))
|
||||
|
||||
; permissions
|
||||
(perm_expression (identifier) @property)
|
||||
(perm_expression
|
||||
(identifier) @property)
|
||||
|
||||
(call_expression
|
||||
function: (selector_expression
|
||||
@ -29,7 +31,7 @@
|
||||
|
||||
(perm_expression
|
||||
(stabby) @operator
|
||||
.
|
||||
.
|
||||
(identifier) @function)
|
||||
|
||||
; misc
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
@ -1,67 +1,56 @@
|
||||
; adapted from https://github.com/Beaglefoot/tree-sitter-awk
|
||||
|
||||
[
|
||||
(identifier)
|
||||
(field_ref)
|
||||
] @variable
|
||||
(field_ref (_) @variable)
|
||||
|
||||
(field_ref
|
||||
(_) @variable)
|
||||
|
||||
; https://www.gnu.org/software/gawk/manual/html_node/Auto_002dset.html
|
||||
((identifier) @constant.builtin
|
||||
(#any-of? @constant.builtin
|
||||
"ARGC"
|
||||
"ARGV"
|
||||
"ARGIND"
|
||||
"ENVIRON"
|
||||
"ERRNO"
|
||||
"FILENAME"
|
||||
"FNR"
|
||||
"NF"
|
||||
"FUNCTAB"
|
||||
"NR"
|
||||
"PROCINFO"
|
||||
"RLENGTH"
|
||||
"RSTART"
|
||||
"RT"
|
||||
"SYMTAB"))
|
||||
(#any-of? @constant.builtin
|
||||
"ARGC" "ARGV" "ARGIND" "ENVIRON" "ERRNO" "FILENAME" "FNR" "NF" "FUNCTAB" "NR" "PROCINFO"
|
||||
"RLENGTH" "RSTART" "RT" "SYMTAB"))
|
||||
|
||||
; https://www.gnu.org/software/gawk/manual/html_node/User_002dmodified.html
|
||||
((identifier) @variable.builtin
|
||||
(#any-of? @variable.builtin
|
||||
"BINMODE"
|
||||
"CONVFMT"
|
||||
"FIELDWIDTHS"
|
||||
"FPAT"
|
||||
"FS"
|
||||
"IGNORECASE"
|
||||
"LINT"
|
||||
"OFMT"
|
||||
"OFS"
|
||||
"ORS"
|
||||
"PREC"
|
||||
"ROUNDMODE"
|
||||
"RS"
|
||||
"SUBSEP"
|
||||
"TEXTDOMAIN"))
|
||||
(#any-of? @variable.builtin
|
||||
"BINMODE" "CONVFMT" "FIELDWIDTHS" "FPAT" "FS" "IGNORECASE" "LINT" "OFMT" "OFS" "ORS" "PREC"
|
||||
"ROUNDMODE" "RS" "SUBSEP" "TEXTDOMAIN"))
|
||||
|
||||
(number) @number
|
||||
|
||||
(string) @string
|
||||
(regex) @string.regex
|
||||
|
||||
(regex) @string.regexp
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
((program . (comment) @preproc)
|
||||
(#lua-match? @preproc "^#!/"))
|
||||
((program
|
||||
.
|
||||
(comment) @keyword.directive @nospell)
|
||||
(#lua-match? @keyword.directive "^#!/"))
|
||||
|
||||
(ns_qualified_name (namespace) @namespace)
|
||||
(ns_qualified_name "::" @punctuation.delimiter)
|
||||
(ns_qualified_name
|
||||
(namespace) @module)
|
||||
|
||||
(func_def name: (_ (identifier) @function) @function)
|
||||
(func_call name: (_ (identifier) @function) @function)
|
||||
(ns_qualified_name
|
||||
"::" @punctuation.delimiter)
|
||||
|
||||
(func_def (param_list (identifier) @parameter))
|
||||
(func_def
|
||||
name: (_
|
||||
(identifier) @function) @function)
|
||||
|
||||
(func_call
|
||||
name: (_
|
||||
(identifier) @function) @function)
|
||||
|
||||
(func_def
|
||||
(param_list
|
||||
(identifier) @variable.parameter))
|
||||
|
||||
[
|
||||
"print"
|
||||
@ -92,7 +81,7 @@
|
||||
"while"
|
||||
"for"
|
||||
"in"
|
||||
] @repeat
|
||||
] @keyword.repeat
|
||||
|
||||
[
|
||||
"if"
|
||||
@ -100,90 +89,105 @@
|
||||
"switch"
|
||||
"case"
|
||||
"default"
|
||||
] @conditional
|
||||
] @keyword.conditional
|
||||
|
||||
[
|
||||
"@include"
|
||||
"@load"
|
||||
] @include
|
||||
] @keyword.import
|
||||
|
||||
"@namespace" @preproc
|
||||
"@namespace" @keyword.directive
|
||||
|
||||
[
|
||||
"BEGIN"
|
||||
"END"
|
||||
"BEGINFILE"
|
||||
"ENDFILE"
|
||||
"BEGIN"
|
||||
"END"
|
||||
"BEGINFILE"
|
||||
"ENDFILE"
|
||||
] @label
|
||||
|
||||
(binary_exp [
|
||||
"^"
|
||||
"**"
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"+"
|
||||
"-"
|
||||
"<"
|
||||
">"
|
||||
"<="
|
||||
">="
|
||||
"=="
|
||||
"!="
|
||||
"~"
|
||||
"!~"
|
||||
"in"
|
||||
"&&"
|
||||
"||"
|
||||
] @operator)
|
||||
(binary_exp
|
||||
[
|
||||
"^"
|
||||
"**"
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"+"
|
||||
"-"
|
||||
"<"
|
||||
">"
|
||||
"<="
|
||||
">="
|
||||
"=="
|
||||
"!="
|
||||
"~"
|
||||
"!~"
|
||||
"in"
|
||||
"&&"
|
||||
"||"
|
||||
] @operator)
|
||||
|
||||
(unary_exp [
|
||||
"!"
|
||||
"+"
|
||||
"-"
|
||||
] @operator)
|
||||
(unary_exp
|
||||
[
|
||||
"!"
|
||||
"+"
|
||||
"-"
|
||||
] @operator)
|
||||
|
||||
(assignment_exp [
|
||||
"="
|
||||
"+="
|
||||
"-="
|
||||
"*="
|
||||
"/="
|
||||
"%="
|
||||
"^="
|
||||
] @operator)
|
||||
(assignment_exp
|
||||
[
|
||||
"="
|
||||
"+="
|
||||
"-="
|
||||
"*="
|
||||
"/="
|
||||
"%="
|
||||
"^="
|
||||
] @operator)
|
||||
|
||||
(ternary_exp [
|
||||
"?"
|
||||
":"
|
||||
] @conditional.ternary)
|
||||
(ternary_exp
|
||||
[
|
||||
"?"
|
||||
":"
|
||||
] @keyword.conditional.ternary)
|
||||
|
||||
(update_exp [
|
||||
"++"
|
||||
"--"
|
||||
] @operator)
|
||||
(update_exp
|
||||
[
|
||||
"++"
|
||||
"--"
|
||||
] @operator)
|
||||
|
||||
(redirected_io_statement [
|
||||
">"
|
||||
">>"
|
||||
] @operator)
|
||||
(redirected_io_statement
|
||||
[
|
||||
">"
|
||||
">>"
|
||||
] @operator)
|
||||
|
||||
(piped_io_statement [
|
||||
"|"
|
||||
"|&"
|
||||
] @operator)
|
||||
(piped_io_statement
|
||||
[
|
||||
"|"
|
||||
"|&"
|
||||
] @operator)
|
||||
|
||||
(piped_io_exp [
|
||||
"|"
|
||||
"|&"
|
||||
] @operator)
|
||||
(piped_io_exp
|
||||
[
|
||||
"|"
|
||||
"|&"
|
||||
] @operator)
|
||||
|
||||
(field_ref "$" @punctuation.delimiter)
|
||||
(field_ref
|
||||
"$" @punctuation.delimiter)
|
||||
|
||||
(regex "/" @punctuation.delimiter)
|
||||
(regex_constant "@" @punctuation.delimiter)
|
||||
(regex
|
||||
"/" @punctuation.delimiter)
|
||||
|
||||
[ ";" "," ] @punctuation.delimiter
|
||||
(regex_constant
|
||||
"@" @punctuation.delimiter)
|
||||
|
||||
[
|
||||
";"
|
||||
","
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
"("
|
||||
|
||||
@ -1,5 +1,17 @@
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
((regex) @injection.content
|
||||
(#set! injection.language "regex"))
|
||||
(#set! injection.language "regex"))
|
||||
|
||||
((print_statement
|
||||
(exp_list
|
||||
.
|
||||
(string) @injection.content))
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
((printf_statement
|
||||
(exp_list
|
||||
.
|
||||
(string) @injection.content))
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
@ -1,186 +1,239 @@
|
||||
[
|
||||
"(" ")"
|
||||
"{" "}"
|
||||
"[" "]"
|
||||
"[[" "]]"
|
||||
"((" "))"
|
||||
"("
|
||||
")"
|
||||
"{"
|
||||
"}"
|
||||
"["
|
||||
"]"
|
||||
"[["
|
||||
"]]"
|
||||
"(("
|
||||
"))"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
";"
|
||||
";;"
|
||||
";&"
|
||||
";;&"
|
||||
"&"
|
||||
";"
|
||||
";;"
|
||||
";&"
|
||||
";;&"
|
||||
"&"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[
|
||||
">"
|
||||
">>"
|
||||
"<"
|
||||
"<<"
|
||||
"&&"
|
||||
"|"
|
||||
"|&"
|
||||
"||"
|
||||
"="
|
||||
"+="
|
||||
"=~"
|
||||
"=="
|
||||
"!="
|
||||
|
||||
"&>"
|
||||
"&>>"
|
||||
"<&"
|
||||
">&"
|
||||
">|"
|
||||
"<&-"
|
||||
">&-"
|
||||
|
||||
"<<-"
|
||||
"<<<"
|
||||
|
||||
".."
|
||||
">"
|
||||
">>"
|
||||
"<"
|
||||
"<<"
|
||||
"&&"
|
||||
"|"
|
||||
"|&"
|
||||
"||"
|
||||
"="
|
||||
"+="
|
||||
"=~"
|
||||
"=="
|
||||
"!="
|
||||
"&>"
|
||||
"&>>"
|
||||
"<&"
|
||||
">&"
|
||||
">|"
|
||||
"<&-"
|
||||
">&-"
|
||||
"<<-"
|
||||
"<<<"
|
||||
".."
|
||||
"!"
|
||||
] @operator
|
||||
|
||||
; Do *not* spell check strings since they typically have some sort of
|
||||
; interpolation in them, or, are typically used for things like filenames, URLs,
|
||||
; flags and file content.
|
||||
[
|
||||
(string)
|
||||
(raw_string)
|
||||
(ansi_c_string)
|
||||
(heredoc_body)
|
||||
(string)
|
||||
(raw_string)
|
||||
(ansi_c_string)
|
||||
(heredoc_body)
|
||||
] @string
|
||||
|
||||
[
|
||||
(heredoc_start)
|
||||
(heredoc_end)
|
||||
(heredoc_start)
|
||||
(heredoc_end)
|
||||
] @label
|
||||
|
||||
(variable_assignment (word) @string)
|
||||
(command argument: "$" @string) ; bare dollar
|
||||
(variable_assignment
|
||||
(word) @string)
|
||||
|
||||
(command
|
||||
argument: "$" @string) ; bare dollar
|
||||
|
||||
(concatenation
|
||||
(word) @string)
|
||||
|
||||
[
|
||||
"if"
|
||||
"then"
|
||||
"else"
|
||||
"elif"
|
||||
"fi"
|
||||
"case"
|
||||
"in"
|
||||
"esac"
|
||||
] @conditional
|
||||
"if"
|
||||
"then"
|
||||
"else"
|
||||
"elif"
|
||||
"fi"
|
||||
"case"
|
||||
"in"
|
||||
"esac"
|
||||
] @keyword.conditional
|
||||
|
||||
[
|
||||
"for"
|
||||
"do"
|
||||
"done"
|
||||
"select"
|
||||
"until"
|
||||
"while"
|
||||
] @repeat
|
||||
"for"
|
||||
"do"
|
||||
"done"
|
||||
"select"
|
||||
"until"
|
||||
"while"
|
||||
] @keyword.repeat
|
||||
|
||||
[
|
||||
"declare"
|
||||
"typeset"
|
||||
"export"
|
||||
"readonly"
|
||||
"local"
|
||||
"unset"
|
||||
"unsetenv"
|
||||
] @keyword
|
||||
|
||||
"export" @keyword.import
|
||||
|
||||
"function" @keyword.function
|
||||
|
||||
(special_variable_name) @constant
|
||||
|
||||
; trap -l
|
||||
((word) @constant.builtin
|
||||
(#match? @constant.builtin "^SIG(HUP|INT|QUIT|ILL|TRAP|ABRT|BUS|FPE|KILL|USR[12]|SEGV|PIPE|ALRM|TERM|STKFLT|CHLD|CONT|STOP|TSTP|TT(IN|OU)|URG|XCPU|XFSZ|VTALRM|PROF|WINCH|IO|PWR|SYS|RTMIN([+]([1-9]|1[0-5]))?|RTMAX(-([1-9]|1[0-4]))?)$"))
|
||||
(#any-of? @constant.builtin
|
||||
"SIGHUP" "SIGINT" "SIGQUIT" "SIGILL" "SIGTRAP" "SIGABRT" "SIGBUS" "SIGFPE" "SIGKILL" "SIGUSR1"
|
||||
"SIGSEGV" "SIGUSR2" "SIGPIPE" "SIGALRM" "SIGTERM" "SIGSTKFLT" "SIGCHLD" "SIGCONT" "SIGSTOP"
|
||||
"SIGTSTP" "SIGTTIN" "SIGTTOU" "SIGURG" "SIGXCPU" "SIGXFSZ" "SIGVTALRM" "SIGPROF" "SIGWINCH"
|
||||
"SIGIO" "SIGPWR" "SIGSYS" "SIGRTMIN" "SIGRTMIN+1" "SIGRTMIN+2" "SIGRTMIN+3" "SIGRTMIN+4"
|
||||
"SIGRTMIN+5" "SIGRTMIN+6" "SIGRTMIN+7" "SIGRTMIN+8" "SIGRTMIN+9" "SIGRTMIN+10" "SIGRTMIN+11"
|
||||
"SIGRTMIN+12" "SIGRTMIN+13" "SIGRTMIN+14" "SIGRTMIN+15" "SIGRTMAX-14" "SIGRTMAX-13"
|
||||
"SIGRTMAX-12" "SIGRTMAX-11" "SIGRTMAX-10" "SIGRTMAX-9" "SIGRTMAX-8" "SIGRTMAX-7" "SIGRTMAX-6"
|
||||
"SIGRTMAX-5" "SIGRTMAX-4" "SIGRTMAX-3" "SIGRTMAX-2" "SIGRTMAX-1" "SIGRTMAX"))
|
||||
|
||||
((word) @boolean
|
||||
(#any-of? @boolean "true" "false"))
|
||||
(#any-of? @boolean "true" "false"))
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
(test_operator) @operator
|
||||
|
||||
(command_substitution "$(" @punctuation.bracket)
|
||||
(process_substitution "<(" @punctuation.bracket)
|
||||
(command_substitution
|
||||
"$(" @punctuation.special
|
||||
")" @punctuation.special)
|
||||
|
||||
(process_substitution
|
||||
[
|
||||
"<("
|
||||
">("
|
||||
] @punctuation.special
|
||||
")" @punctuation.special)
|
||||
|
||||
(arithmetic_expansion
|
||||
[ "$((" "((" ] @punctuation.special
|
||||
[
|
||||
"$(("
|
||||
"(("
|
||||
] @punctuation.special
|
||||
"))" @punctuation.special)
|
||||
|
||||
(arithmetic_expansion "," @punctuation.delimiter)
|
||||
(arithmetic_expansion
|
||||
"," @punctuation.delimiter)
|
||||
|
||||
(ternary_expression [ "?" ":" ] @conditional.ternary)
|
||||
(ternary_expression
|
||||
[
|
||||
"?"
|
||||
":"
|
||||
] @keyword.conditional.ternary)
|
||||
|
||||
(binary_expression operator: _ @operator)
|
||||
(unary_expression operator: _ @operator)
|
||||
(postfix_expression operator: _ @operator)
|
||||
(binary_expression
|
||||
operator: _ @operator)
|
||||
|
||||
(unary_expression
|
||||
operator: _ @operator)
|
||||
|
||||
(postfix_expression
|
||||
operator: _ @operator)
|
||||
|
||||
(function_definition
|
||||
name: (word) @function)
|
||||
|
||||
(command_name (word) @function.call)
|
||||
(command_name
|
||||
(word) @function.call)
|
||||
|
||||
((command_name (word) @function.builtin)
|
||||
(#any-of? @function.builtin
|
||||
"alias" "bg" "bind" "break" "builtin" "caller" "cd"
|
||||
"command" "compgen" "complete" "compopt" "continue"
|
||||
"coproc" "dirs" "disown" "echo" "enable" "eval"
|
||||
"exec" "exit" "fc" "fg" "getopts" "hash" "help"
|
||||
"history" "jobs" "kill" "let" "logout" "mapfile"
|
||||
"popd" "printf" "pushd" "pwd" "read" "readarray"
|
||||
"return" "set" "shift" "shopt" "source" "suspend"
|
||||
"test" "time" "times" "trap" "type" "typeset"
|
||||
"ulimit" "umask" "unalias" "wait"))
|
||||
(command_name
|
||||
(word) @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
"alias" "bg" "bind" "break" "builtin" "caller" "cd" "command" "compgen" "complete" "compopt"
|
||||
"continue" "coproc" "dirs" "disown" "echo" "enable" "eval" "exec" "exit" "fc" "fg" "getopts"
|
||||
"hash" "help" "history" "jobs" "kill" "let" "logout" "mapfile" "popd" "printf" "pushd" "pwd"
|
||||
"read" "readarray" "return" "set" "shift" "shopt" "source" "suspend" "test" "time" "times"
|
||||
"trap" "type" "typeset" "ulimit" "umask" "unalias" "wait"))
|
||||
|
||||
(command
|
||||
argument: [
|
||||
(word) @parameter
|
||||
(concatenation (word) @parameter)
|
||||
])
|
||||
(word) @variable.parameter
|
||||
(concatenation
|
||||
(word) @variable.parameter)
|
||||
])
|
||||
|
||||
(declaration_command
|
||||
(word) @variable.parameter)
|
||||
|
||||
(unset_command
|
||||
(word) @variable.parameter)
|
||||
|
||||
(number) @number
|
||||
|
||||
((word) @number
|
||||
(#lua-match? @number "^[0-9]+$"))
|
||||
(#lua-match? @number "^[0-9]+$"))
|
||||
|
||||
(file_redirect
|
||||
destination: (word) @parameter)
|
||||
destination: (word) @variable.parameter)
|
||||
|
||||
(file_descriptor) @operator
|
||||
|
||||
(simple_expansion
|
||||
"$" @punctuation.special) @none
|
||||
|
||||
(expansion
|
||||
"${" @punctuation.special
|
||||
"}" @punctuation.special) @none
|
||||
|
||||
(expansion operator: _ @punctuation.special)
|
||||
(expansion "@" . operator: _ @character.special)
|
||||
(expansion
|
||||
operator: _ @punctuation.special)
|
||||
|
||||
(expansion
|
||||
"@"
|
||||
.
|
||||
operator: _ @character.special)
|
||||
|
||||
((expansion
|
||||
(subscript
|
||||
index: (word) @character.special))
|
||||
(#any-of? @character.special "@" "*"))
|
||||
(#any-of? @character.special "@" "*"))
|
||||
|
||||
"``" @punctuation.special
|
||||
|
||||
(variable_name) @variable
|
||||
|
||||
((variable_name) @constant
|
||||
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||
|
||||
(case_item
|
||||
value: (word) @parameter)
|
||||
value: (word) @variable.parameter)
|
||||
|
||||
[
|
||||
(regex)
|
||||
(extglob_pattern)
|
||||
] @string.regex
|
||||
] @string.regexp
|
||||
|
||||
((program . (comment) @preproc)
|
||||
(#lua-match? @preproc "^#!/"))
|
||||
((program
|
||||
.
|
||||
(comment) @keyword.directive @nospell)
|
||||
(#lua-match? @keyword.directive "^#!/"))
|
||||
|
||||
@ -1,10 +1,79 @@
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
((regex) @injection.content
|
||||
(#set! injection.language "regex"))
|
||||
(#set! injection.language "regex"))
|
||||
|
||||
((heredoc_redirect
|
||||
(heredoc_body) @injection.content
|
||||
(heredoc_end) @injection.language)
|
||||
(#downcase! @injection.language))
|
||||
(#downcase! @injection.language))
|
||||
|
||||
; printf 'format'
|
||||
((command
|
||||
name: (command_name) @_command
|
||||
.
|
||||
argument: [
|
||||
(string
|
||||
(string_content) @injection.content)
|
||||
(concatenation
|
||||
(string
|
||||
(string_content) @injection.content))
|
||||
(raw_string) @injection.content
|
||||
(concatenation
|
||||
(raw_string) @injection.content)
|
||||
])
|
||||
(#eq? @_command "printf")
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
; printf -v var 'format'
|
||||
((command
|
||||
name: (command_name) @_command
|
||||
argument: (word) @_arg
|
||||
.
|
||||
(_)
|
||||
.
|
||||
argument: [
|
||||
(string
|
||||
(string_content) @injection.content)
|
||||
(concatenation
|
||||
(string
|
||||
(string_content) @injection.content))
|
||||
(raw_string) @injection.content
|
||||
(concatenation
|
||||
(raw_string) @injection.content)
|
||||
])
|
||||
(#eq? @_command "printf")
|
||||
(#eq? @_arg "-v")
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
; printf -- 'format'
|
||||
((command
|
||||
name: (command_name) @_command
|
||||
argument: (word) @_arg
|
||||
.
|
||||
argument: [
|
||||
(string
|
||||
(string_content) @injection.content)
|
||||
(concatenation
|
||||
(string
|
||||
(string_content) @injection.content))
|
||||
(raw_string) @injection.content
|
||||
(concatenation
|
||||
(raw_string) @injection.content)
|
||||
])
|
||||
(#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"))
|
||||
|
||||
@ -1,13 +1,14 @@
|
||||
; Scopes
|
||||
(function_definition) @scope
|
||||
(function_definition) @local.scope
|
||||
|
||||
; Definitions
|
||||
(variable_assignment
|
||||
name: (variable_name) @definition.var)
|
||||
(variable_assignment
|
||||
name: (variable_name) @local.definition.var)
|
||||
|
||||
(function_definition
|
||||
name: (word) @definition.function)
|
||||
name: (word) @local.definition.function)
|
||||
|
||||
; References
|
||||
(variable_name) @reference
|
||||
(word) @reference
|
||||
(variable_name) @local.reference
|
||||
|
||||
(word) @local.reference
|
||||
|
||||
@ -1,95 +1,115 @@
|
||||
;; Variables
|
||||
; Variables
|
||||
(list
|
||||
(symbol) @variable)
|
||||
|
||||
(list (symbol) @variable)
|
||||
(cons
|
||||
(symbol) @variable)
|
||||
|
||||
(cons (symbol) @variable)
|
||||
(scope
|
||||
(symbol) @variable)
|
||||
|
||||
(scope (symbol) @variable)
|
||||
|
||||
(symbind (symbol) @variable)
|
||||
|
||||
;; Constants
|
||||
(symbind
|
||||
(symbol) @variable)
|
||||
|
||||
; Constants
|
||||
((symbol) @constant
|
||||
(#lua-match? @constant "^_*[A-Z][A-Z0-9_]*$"))
|
||||
|
||||
;; Functions
|
||||
|
||||
(list
|
||||
. (symbol) @function)
|
||||
|
||||
;; Namespaces
|
||||
; Functions
|
||||
(list
|
||||
.
|
||||
(symbol) @function)
|
||||
|
||||
; Namespaces
|
||||
(symbind
|
||||
(symbol) @namespace
|
||||
. (keyword))
|
||||
(symbol) @module
|
||||
.
|
||||
(keyword))
|
||||
|
||||
;; Includes
|
||||
|
||||
((symbol) @include
|
||||
(#any-of? @include "use" "import" "load"))
|
||||
|
||||
;; Keywords
|
||||
; Includes
|
||||
((symbol) @keyword.import
|
||||
(#any-of? @keyword.import "use" "import" "load"))
|
||||
|
||||
; Keywords
|
||||
((symbol) @keyword
|
||||
(#any-of? @keyword "do" "doc"))
|
||||
|
||||
;; Special Functions
|
||||
|
||||
; Special Functions
|
||||
; Keywords construct a symbol
|
||||
|
||||
(keyword) @constructor
|
||||
|
||||
((list
|
||||
. (symbol) @keyword.function
|
||||
. (symbol) @function
|
||||
(symbol)? @parameter)
|
||||
.
|
||||
(symbol) @keyword.function
|
||||
.
|
||||
(symbol) @function
|
||||
(symbol)? @variable.parameter)
|
||||
(#any-of? @keyword.function "def" "defop" "defn" "fn"))
|
||||
|
||||
((cons
|
||||
. (symbol) @keyword.function
|
||||
. (symbol) @function
|
||||
(symbol)? @parameter)
|
||||
.
|
||||
(symbol) @keyword.function
|
||||
.
|
||||
(symbol) @function
|
||||
(symbol)? @variable.parameter)
|
||||
(#any-of? @keyword.function "def" "defop" "defn" "fn"))
|
||||
|
||||
((symbol) @function.builtin
|
||||
(#any-of? @function.builtin "dump" "mkfs" "json" "log" "error" "now" "cons" "wrap" "unwrap" "eval" "make-scope" "bind" "meta" "with-meta" "null?" "ignore?" "boolean?" "number?" "string?" "symbol?" "scope?" "sink?" "source?" "list?" "pair?" "applicative?" "operative?" "combiner?" "path?" "empty?" "thunk?" "+" "*" "quot" "-" "max" "min" "=" ">" ">=" "<" "<=" "list->source" "across" "emit" "next" "reduce-kv" "assoc" "symbol->string" "string->symbol" "str" "substring" "trim" "scope->list" "string->fs-path" "string->cmd-path" "string->dir" "subpath" "path-name" "path-stem" "with-image" "with-dir" "with-args" "with-cmd" "with-stdin" "with-env" "with-insecure" "with-label" "with-port" "with-tls" "with-mount" "thunk-cmd" "thunk-args" "resolve" "start" "addr" "wait" "read" "cache-dir" "binds?" "recall-memo" "store-memo" "mask" "list" "list*" "first" "rest" "length" "second" "third" "map" "map-pairs" "foldr" "foldl" "append" "filter" "conj" "list->scope" "merge" "apply" "id" "always" "vals" "keys" "memo" "succeeds?" "run" "last" "take" "take-all" "insecure!" "from" "cd" "wrap-cmd" "mkfile" "path-base" "not"))
|
||||
(#any-of? @function.builtin
|
||||
"dump" "mkfs" "json" "log" "error" "now" "cons" "wrap" "unwrap" "eval" "make-scope" "bind"
|
||||
"meta" "with-meta" "null?" "ignore?" "boolean?" "number?" "string?" "symbol?" "scope?" "sink?"
|
||||
"source?" "list?" "pair?" "applicative?" "operative?" "combiner?" "path?" "empty?" "thunk?" "+"
|
||||
"*" "quot" "-" "max" "min" "=" ">" ">=" "<" "<=" "list->source" "across" "emit" "next"
|
||||
"reduce-kv" "assoc" "symbol->string" "string->symbol" "str" "substring" "trim" "scope->list"
|
||||
"string->fs-path" "string->cmd-path" "string->dir" "subpath" "path-name" "path-stem"
|
||||
"with-image" "with-dir" "with-args" "with-cmd" "with-stdin" "with-env" "with-insecure"
|
||||
"with-label" "with-port" "with-tls" "with-mount" "thunk-cmd" "thunk-args" "resolve" "start"
|
||||
"addr" "wait" "read" "cache-dir" "binds?" "recall-memo" "store-memo" "mask" "list" "list*"
|
||||
"first" "rest" "length" "second" "third" "map" "map-pairs" "foldr" "foldl" "append" "filter"
|
||||
"conj" "list->scope" "merge" "apply" "id" "always" "vals" "keys" "memo" "succeeds?" "run" "last"
|
||||
"take" "take-all" "insecure!" "from" "cd" "wrap-cmd" "mkfile" "path-base" "not"))
|
||||
|
||||
((symbol) @function.macro
|
||||
(#any-of? @function.macro "op" "current-scope" "quote" "let" "provide" "module" "or" "and" "curryfn" "for" "$" "linux"))
|
||||
(#any-of? @function.macro
|
||||
"op" "current-scope" "quote" "let" "provide" "module" "or" "and" "curryfn" "for" "$" "linux"))
|
||||
|
||||
;; Conditionals
|
||||
; Conditionals
|
||||
((symbol) @keyword.conditional
|
||||
(#any-of? @keyword.conditional "if" "case" "cond" "when"))
|
||||
|
||||
((symbol) @conditional
|
||||
(#any-of? @conditional "if" "case" "cond" "when"))
|
||||
; Repeats
|
||||
((symbol) @keyword.repeat
|
||||
(#any-of? @keyword.repeat "each"))
|
||||
|
||||
;; Repeats
|
||||
; Operators
|
||||
((symbol) @operator
|
||||
(#any-of? @operator "&" "*" "+" "-" "<" "<=" "=" ">" ">="))
|
||||
|
||||
((symbol) @repeat
|
||||
(#any-of? @repeat "each"))
|
||||
; Punctuation
|
||||
[
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
;; Operators
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
((symbol) @operator (#any-of? @operator "&" "*" "+" "-" "<" "<=" "=" ">" ">="))
|
||||
|
||||
;; Punctuation
|
||||
|
||||
[ "(" ")" ] @punctuation.bracket
|
||||
|
||||
[ "{" "}" ] @punctuation.bracket
|
||||
|
||||
[ "[" "]" ] @punctuation.bracket
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
((symbol) @punctuation.delimiter
|
||||
(#eq? @punctuation.delimiter "->"))
|
||||
|
||||
;; Literals
|
||||
|
||||
; Literals
|
||||
(string) @string
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
(path) @text.uri @string.special
|
||||
(path) @string.special.url
|
||||
|
||||
(number) @number
|
||||
|
||||
@ -100,10 +120,7 @@
|
||||
(null)
|
||||
] @constant.builtin
|
||||
|
||||
[
|
||||
"^"
|
||||
] @character.special
|
||||
|
||||
;; Comments
|
||||
"^" @character.special
|
||||
|
||||
; Comments
|
||||
(comment) @comment @spell
|
||||
|
||||
@ -10,11 +10,20 @@
|
||||
"]"
|
||||
] @indent.end
|
||||
|
||||
[ "(" ")" ] @indent.branch
|
||||
[
|
||||
"("
|
||||
")"
|
||||
] @indent.branch
|
||||
|
||||
[ "{" "}" ] @indent.branch
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @indent.branch
|
||||
|
||||
[ "[" "]" ] @indent.branch
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
@ -1,25 +1,26 @@
|
||||
; Scopes
|
||||
|
||||
[
|
||||
(list)
|
||||
(scope)
|
||||
(cons)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
; References
|
||||
|
||||
(symbol) @reference
|
||||
(symbol) @local.reference
|
||||
|
||||
; Definitions
|
||||
|
||||
((list
|
||||
. (symbol) @_fnkw
|
||||
. (symbol) @definition.function
|
||||
(symbol)? @definition.parameter)
|
||||
.
|
||||
(symbol) @_fnkw
|
||||
.
|
||||
(symbol) @local.definition.function
|
||||
(symbol)? @local.definition.parameter)
|
||||
(#any-of? @_fnkw "def" "defop" "defn" "fn"))
|
||||
|
||||
((cons
|
||||
. (symbol) @_fnkw
|
||||
. (symbol) @definition.function
|
||||
(symbol)? @definition.parameter)
|
||||
.
|
||||
(symbol) @_fnkw
|
||||
.
|
||||
(symbol) @local.definition.function
|
||||
(symbol)? @local.definition.parameter)
|
||||
(#any-of? @_fnkw "def" "defop" "defn" "fn"))
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
[
|
||||
(transaction)
|
||||
(section)
|
||||
(transaction)
|
||||
(section)
|
||||
] @fold
|
||||
|
||||
@ -1,24 +1,57 @@
|
||||
(date) @field
|
||||
(date) @variable.member
|
||||
|
||||
(txn) @attribute
|
||||
|
||||
(account) @type
|
||||
|
||||
(amount) @number
|
||||
|
||||
(incomplete_amount) @number
|
||||
|
||||
(compound_amount) @number
|
||||
|
||||
(amount_tolerance) @number
|
||||
|
||||
(currency) @property
|
||||
|
||||
(key) @label
|
||||
|
||||
(string) @string
|
||||
|
||||
(narration) @string @spell
|
||||
|
||||
(payee) @string @spell
|
||||
|
||||
(tag) @constant
|
||||
|
||||
(link) @constant
|
||||
|
||||
[
|
||||
(minus) (plus) (slash) (asterisk)
|
||||
(minus)
|
||||
(plus)
|
||||
(slash)
|
||||
(asterisk)
|
||||
] @operator
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
[
|
||||
(balance) (open) (close) (commodity) (pad)
|
||||
(event) (price) (note) (document) (query)
|
||||
(custom) (pushtag) (poptag) (pushmeta)
|
||||
(popmeta) (option) (include) (plugin)
|
||||
(balance)
|
||||
(open)
|
||||
(close)
|
||||
(commodity)
|
||||
(pad)
|
||||
(event)
|
||||
(price)
|
||||
(note)
|
||||
(document)
|
||||
(query)
|
||||
(custom)
|
||||
(pushtag)
|
||||
(poptag)
|
||||
(pushmeta)
|
||||
(popmeta)
|
||||
(option)
|
||||
(include)
|
||||
(plugin)
|
||||
] @keyword
|
||||
|
||||
@ -1,3 +1 @@
|
||||
[
|
||||
(entry)
|
||||
] @fold
|
||||
(entry) @fold
|
||||
|
||||
@ -1,5 +1,4 @@
|
||||
; CREDITS @pfoerster (adapted from https://github.com/latex-lsp/tree-sitter-bibtex)
|
||||
|
||||
[
|
||||
(string_type)
|
||||
(preamble_type)
|
||||
@ -23,10 +22,10 @@
|
||||
(number) @number
|
||||
|
||||
(field
|
||||
name: (identifier) @field)
|
||||
name: (identifier) @variable.member)
|
||||
|
||||
(token
|
||||
(identifier) @parameter)
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
[
|
||||
(brace_word)
|
||||
@ -36,7 +35,7 @@
|
||||
[
|
||||
(key_brace)
|
||||
(key_paren)
|
||||
] @symbol
|
||||
] @string.special.symbol
|
||||
|
||||
(string
|
||||
name: (identifier) @constant)
|
||||
|
||||
@ -1,10 +1,8 @@
|
||||
[
|
||||
(entry)
|
||||
] @indent.begin
|
||||
(entry) @indent.begin
|
||||
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
"{"
|
||||
"}"
|
||||
] @indent.branch
|
||||
|
||||
(comment) @indent.ignore
|
||||
|
||||
@ -6,20 +6,14 @@
|
||||
(resource_declaration)
|
||||
(type_declaration)
|
||||
(variable_declaration)
|
||||
|
||||
(parenthesized_expression)
|
||||
|
||||
(decorators)
|
||||
(array)
|
||||
(object)
|
||||
|
||||
(if_statement)
|
||||
(for_statement)
|
||||
|
||||
(subscript_expression)
|
||||
(ternary_expression)
|
||||
|
||||
(string)
|
||||
|
||||
(comment)
|
||||
] @fold
|
||||
|
||||
@ -1,19 +1,17 @@
|
||||
; Includes
|
||||
|
||||
(import_statement
|
||||
"import" @include)
|
||||
|
||||
(import_with_statement
|
||||
"import" @include
|
||||
"with" @include)
|
||||
[
|
||||
"import"
|
||||
"provider"
|
||||
"with"
|
||||
"as"
|
||||
"from"
|
||||
] @keyword.import
|
||||
|
||||
; Namespaces
|
||||
|
||||
(module_declaration
|
||||
(identifier) @namespace)
|
||||
(identifier) @module)
|
||||
|
||||
; Builtins
|
||||
|
||||
(primitive_type) @type.builtin
|
||||
|
||||
((member_expression
|
||||
@ -21,12 +19,13 @@
|
||||
(#eq? @type.builtin "sys"))
|
||||
|
||||
; Functions
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function.call)
|
||||
|
||||
; Properties
|
||||
(user_defined_function
|
||||
name: (identifier) @function)
|
||||
|
||||
; Properties
|
||||
(object_property
|
||||
(identifier) @property
|
||||
":" @punctuation.delimiter
|
||||
@ -40,21 +39,20 @@
|
||||
(property_identifier) @property
|
||||
|
||||
; Attributes
|
||||
|
||||
(decorator
|
||||
"@" @attribute)
|
||||
|
||||
(decorator
|
||||
(call_expression (identifier) @attribute))
|
||||
(call_expression
|
||||
(identifier) @attribute))
|
||||
|
||||
(decorator
|
||||
(call_expression
|
||||
(member_expression
|
||||
object: (identifier) @attribute
|
||||
property: (property_identifier) @attribute)))
|
||||
object: (identifier) @attribute
|
||||
property: (property_identifier) @attribute)))
|
||||
|
||||
; Types
|
||||
|
||||
(type_declaration
|
||||
(identifier) @type)
|
||||
|
||||
@ -63,11 +61,6 @@
|
||||
"="
|
||||
(identifier) @type)
|
||||
|
||||
(type_declaration
|
||||
(identifier)
|
||||
"="
|
||||
(array_type (identifier) @type))
|
||||
|
||||
(type
|
||||
(identifier) @type)
|
||||
|
||||
@ -78,21 +71,26 @@
|
||||
(identifier) @type)
|
||||
|
||||
; Parameters
|
||||
|
||||
(parameter_declaration
|
||||
(identifier) @parameter
|
||||
(identifier) @variable.parameter
|
||||
(_))
|
||||
|
||||
(call_expression
|
||||
function: (_)
|
||||
(arguments (identifier) @parameter))
|
||||
function: (_)
|
||||
(arguments
|
||||
(identifier) @variable.parameter))
|
||||
|
||||
(call_expression
|
||||
function: (_)
|
||||
(arguments (member_expression object: (identifier) @parameter)))
|
||||
function: (_)
|
||||
(arguments
|
||||
(member_expression
|
||||
object: (identifier) @variable.parameter)))
|
||||
|
||||
(parameter
|
||||
.
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
; Variables
|
||||
|
||||
(variable_declaration
|
||||
(identifier) @variable
|
||||
(_))
|
||||
@ -117,22 +115,19 @@
|
||||
(loop_enumerator) @variable))
|
||||
|
||||
; Conditionals
|
||||
|
||||
"if" @conditional
|
||||
"if" @keyword.conditional
|
||||
|
||||
(ternary_expression
|
||||
"?" @conditional.ternary
|
||||
":" @conditional.ternary)
|
||||
"?" @keyword.conditional.ternary
|
||||
":" @keyword.conditional.ternary)
|
||||
|
||||
; Loops
|
||||
|
||||
(for_statement
|
||||
"for" @repeat
|
||||
"for" @keyword.repeat
|
||||
"in"
|
||||
":" @punctuation.delimiter)
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
"module"
|
||||
"metadata"
|
||||
@ -143,10 +138,15 @@
|
||||
"targetScope"
|
||||
"type"
|
||||
"var"
|
||||
"using"
|
||||
"test"
|
||||
] @keyword
|
||||
|
||||
; Operators
|
||||
"func" @keyword.function
|
||||
|
||||
"assert" @keyword.exception
|
||||
|
||||
; Operators
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
@ -167,21 +167,19 @@
|
||||
"??"
|
||||
"="
|
||||
"!"
|
||||
".?"
|
||||
] @operator
|
||||
|
||||
[
|
||||
"in"
|
||||
] @keyword.operator
|
||||
(subscript_expression
|
||||
"?" @operator)
|
||||
|
||||
(nullable_type
|
||||
"?" @operator)
|
||||
|
||||
"in" @keyword.operator
|
||||
|
||||
; Literals
|
||||
|
||||
(string) @string
|
||||
(import_string
|
||||
"'" @string
|
||||
(import_name) @namespace
|
||||
"@" @symbol
|
||||
(import_version) @string.special)
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
@ -192,27 +190,34 @@
|
||||
(null) @constant.builtin
|
||||
|
||||
; Misc
|
||||
|
||||
(compatible_identifier
|
||||
"?" @punctuation.special)
|
||||
|
||||
(nullable_return_type) @punctuation.special
|
||||
|
||||
["{" "}"] @punctuation.bracket
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
["[" "]"] @punctuation.bracket
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
["(" ")"] @punctuation.bracket
|
||||
[
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"."
|
||||
":"
|
||||
"::"
|
||||
"=>"
|
||||
] @punctuation.delimiter
|
||||
|
||||
|
||||
; Interpolation
|
||||
|
||||
(interpolation) @none
|
||||
|
||||
(interpolation
|
||||
@ -223,7 +228,6 @@
|
||||
(identifier) @variable)
|
||||
|
||||
; Comments
|
||||
|
||||
[
|
||||
(comment)
|
||||
(diagnostic_comment)
|
||||
|
||||
@ -5,11 +5,20 @@
|
||||
|
||||
"}" @indent.end
|
||||
|
||||
[ "{" "}" ] @indent.branch
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @indent.branch
|
||||
|
||||
[ "[" "]" ] @indent.branch
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
] @indent.branch
|
||||
|
||||
[ "(" ")" ] @indent.branch
|
||||
[
|
||||
"("
|
||||
")"
|
||||
] @indent.branch
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
([
|
||||
(comment)
|
||||
(diagnostic_comment)
|
||||
] @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
] @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
@ -1,74 +1,73 @@
|
||||
; Scopes
|
||||
|
||||
[
|
||||
(infrastructure)
|
||||
(call_expression)
|
||||
|
||||
(lambda_expression)
|
||||
(subscript_expression)
|
||||
|
||||
(if_statement)
|
||||
(for_statement)
|
||||
|
||||
(array)
|
||||
(object)
|
||||
(interpolation)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
; References
|
||||
|
||||
(property_identifier) @reference
|
||||
(property_identifier) @local.reference
|
||||
|
||||
(call_expression
|
||||
(identifier) @reference)
|
||||
(identifier) @local.reference)
|
||||
|
||||
(object_property
|
||||
(_)
|
||||
":"
|
||||
(identifier) @reference)
|
||||
(identifier) @local.reference)
|
||||
|
||||
(resource_expression
|
||||
(identifier) @reference)
|
||||
(identifier) @local.reference)
|
||||
|
||||
; Definitions
|
||||
|
||||
(type) @definition.associated
|
||||
(type) @local.definition.associated
|
||||
|
||||
(object_property
|
||||
(identifier) @definition.field
|
||||
(identifier) @local.definition.field
|
||||
(_))
|
||||
|
||||
(object_property
|
||||
(compatible_identifier) @definition.field
|
||||
(compatible_identifier) @local.definition.field
|
||||
(_))
|
||||
|
||||
(import_name) @definition.import
|
||||
(user_defined_function
|
||||
name: (identifier) @local.definition.function)
|
||||
|
||||
(module_declaration
|
||||
(identifier) @definition.namespace)
|
||||
(identifier) @local.definition.namespace)
|
||||
|
||||
(parameter_declaration
|
||||
(identifier) @definition.parameter
|
||||
(identifier) @local.definition.parameter
|
||||
(_))
|
||||
|
||||
(parameter
|
||||
.
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
(type_declaration
|
||||
(identifier) @definition.type
|
||||
(identifier) @local.definition.type
|
||||
(_))
|
||||
|
||||
(variable_declaration
|
||||
(identifier) @definition.var
|
||||
(identifier) @local.definition.var
|
||||
(_))
|
||||
|
||||
(metadata_declaration
|
||||
(identifier) @definition.var
|
||||
(identifier) @local.definition.var
|
||||
(_))
|
||||
|
||||
(output_declaration
|
||||
(identifier) @definition.var
|
||||
(identifier) @local.definition.var
|
||||
(_))
|
||||
|
||||
(for_statement
|
||||
"for"
|
||||
(for_loop_parameters
|
||||
(loop_variable) @definition.var
|
||||
(loop_enumerator) @definition.var))
|
||||
(loop_variable) @local.definition.var
|
||||
(loop_enumerator) @local.definition.var))
|
||||
|
||||
@ -2,28 +2,23 @@
|
||||
(function_definition)
|
||||
(anonymous_python_function)
|
||||
(python_function_definition)
|
||||
|
||||
(while_statement)
|
||||
(for_statement)
|
||||
(if_statement)
|
||||
(with_statement)
|
||||
(try_statement)
|
||||
|
||||
(import_from_statement)
|
||||
(parameters)
|
||||
(argument_list)
|
||||
|
||||
(parenthesized_expression)
|
||||
(generator_expression)
|
||||
(list_comprehension)
|
||||
(set_comprehension)
|
||||
(dictionary_comprehension)
|
||||
|
||||
(tuple)
|
||||
(list)
|
||||
(set)
|
||||
(dictionary)
|
||||
|
||||
(string)
|
||||
(python_string)
|
||||
] @fold
|
||||
|
||||
@ -1,20 +1,17 @@
|
||||
; Includes
|
||||
|
||||
[
|
||||
"inherit"
|
||||
"include"
|
||||
"require"
|
||||
"export"
|
||||
"import"
|
||||
] @include
|
||||
] @keyword.import
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
"unset"
|
||||
"EXPORT_FUNCTIONS"
|
||||
"python"
|
||||
|
||||
"assert"
|
||||
"exec"
|
||||
"global"
|
||||
@ -34,19 +31,34 @@
|
||||
"return"
|
||||
"yield"
|
||||
] @keyword.return
|
||||
(yield "from" @keyword.return)
|
||||
|
||||
(yield
|
||||
"from" @keyword.return)
|
||||
|
||||
(future_import_statement
|
||||
"from" @include
|
||||
"from" @keyword.import
|
||||
"__future__" @constant.builtin)
|
||||
(import_from_statement "from" @include)
|
||||
"import" @include
|
||||
|
||||
(aliased_import "as" @include)
|
||||
(import_from_statement
|
||||
"from" @keyword.import)
|
||||
|
||||
["if" "elif" "else"] @conditional
|
||||
"import" @keyword.import
|
||||
|
||||
["for" "while" "break" "continue"] @repeat
|
||||
(aliased_import
|
||||
"as" @keyword.import)
|
||||
|
||||
[
|
||||
"if"
|
||||
"elif"
|
||||
"else"
|
||||
] @keyword.conditional
|
||||
|
||||
[
|
||||
"for"
|
||||
"while"
|
||||
"break"
|
||||
"continue"
|
||||
] @keyword.repeat
|
||||
|
||||
[
|
||||
"try"
|
||||
@ -54,13 +66,14 @@
|
||||
"except*"
|
||||
"raise"
|
||||
"finally"
|
||||
] @exception
|
||||
] @keyword.exception
|
||||
|
||||
(raise_statement "from" @exception)
|
||||
(raise_statement
|
||||
"from" @keyword.exception)
|
||||
|
||||
(try_statement
|
||||
(else_clause
|
||||
"else" @exception))
|
||||
"else" @keyword.exception))
|
||||
|
||||
[
|
||||
"addtask"
|
||||
@ -73,16 +86,15 @@
|
||||
[
|
||||
"before"
|
||||
"after"
|
||||
] @storageclass
|
||||
] @keyword.modifier
|
||||
|
||||
[
|
||||
"append"
|
||||
"prepend"
|
||||
"remove"
|
||||
] @type.qualifier
|
||||
] @keyword.modifier
|
||||
|
||||
; Variables
|
||||
|
||||
[
|
||||
(identifier)
|
||||
(python_identifier)
|
||||
@ -99,77 +111,77 @@
|
||||
; Reset highlighting in f-string interpolations
|
||||
(interpolation) @none
|
||||
|
||||
;; Identifier naming conventions
|
||||
; Identifier naming conventions
|
||||
((python_identifier) @type
|
||||
(#lua-match? @type "^[A-Z].*[a-z]"))
|
||||
([(identifier) (python_identifier)] @constant
|
||||
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||
(#lua-match? @type "^[A-Z].*[a-z]"))
|
||||
|
||||
([
|
||||
(identifier)
|
||||
(python_identifier)
|
||||
] @constant
|
||||
(#lua-match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||
|
||||
((python_identifier) @constant.builtin
|
||||
(#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$"))
|
||||
(#lua-match? @constant.builtin "^__[a-zA-Z0-9_]*__$"))
|
||||
|
||||
((python_identifier) @constant.builtin
|
||||
(#any-of? @constant.builtin
|
||||
;; https://docs.python.org/3/library/constants.html
|
||||
"NotImplemented"
|
||||
"Ellipsis"
|
||||
"quit"
|
||||
"exit"
|
||||
"copyright"
|
||||
"credits"
|
||||
"license"))
|
||||
(#any-of? @constant.builtin
|
||||
; https://docs.python.org/3/library/constants.html
|
||||
"NotImplemented" "Ellipsis" "quit" "exit" "copyright" "credits" "license"))
|
||||
|
||||
((assignment
|
||||
left: (python_identifier) @type.definition
|
||||
(type (python_identifier) @_annotation))
|
||||
(#eq? @_annotation "TypeAlias"))
|
||||
(type
|
||||
(python_identifier) @_annotation))
|
||||
(#eq? @_annotation "TypeAlias"))
|
||||
|
||||
((assignment
|
||||
left: (python_identifier) @type.definition
|
||||
right: (call
|
||||
function: (python_identifier) @_func))
|
||||
(#any-of? @_func "TypeVar" "NewType"))
|
||||
(#any-of? @_func "TypeVar" "NewType"))
|
||||
|
||||
; Fields
|
||||
|
||||
(flag) @field
|
||||
(flag) @variable.member
|
||||
|
||||
((attribute
|
||||
attribute: (python_identifier) @field)
|
||||
(#lua-match? @field "^[%l_].*$"))
|
||||
attribute: (python_identifier) @variable.member)
|
||||
(#lua-match? @variable.member "^[%l_].*$"))
|
||||
|
||||
; Functions
|
||||
|
||||
(call
|
||||
function: (python_identifier) @function.call)
|
||||
|
||||
(call
|
||||
function: (attribute
|
||||
attribute: (python_identifier) @method.call))
|
||||
attribute: (python_identifier) @function.method.call))
|
||||
|
||||
((call
|
||||
function: (python_identifier) @constructor)
|
||||
(#lua-match? @constructor "^%u"))
|
||||
function: (python_identifier) @constructor)
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
((call
|
||||
function: (attribute
|
||||
attribute: (python_identifier) @constructor))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
attribute: (python_identifier) @constructor))
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
((call
|
||||
function: (python_identifier) @function.builtin)
|
||||
(#any-of? @function.builtin
|
||||
"abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" "bytes" "callable" "chr" "classmethod"
|
||||
"compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate" "eval" "exec" "filter" "float" "format"
|
||||
"frozenset" "getattr" "globals" "hasattr" "hash" "help" "hex" "id" "input" "int" "isinstance" "issubclass"
|
||||
"iter" "len" "list" "locals" "map" "max" "memoryview" "min" "next" "object" "oct" "open" "ord" "pow"
|
||||
"print" "property" "range" "repr" "reversed" "round" "set" "setattr" "slice" "sorted" "staticmethod" "str"
|
||||
"sum" "super" "tuple" "type" "vars" "zip" "__import__"))
|
||||
(#any-of? @function.builtin
|
||||
"abs" "all" "any" "ascii" "bin" "bool" "breakpoint" "bytearray" "bytes" "callable" "chr"
|
||||
"classmethod" "compile" "complex" "delattr" "dict" "dir" "divmod" "enumerate" "eval" "exec"
|
||||
"filter" "float" "format" "frozenset" "getattr" "globals" "hasattr" "hash" "help" "hex" "id"
|
||||
"input" "int" "isinstance" "issubclass" "iter" "len" "list" "locals" "map" "max" "memoryview"
|
||||
"min" "next" "object" "oct" "open" "ord" "pow" "print" "property" "range" "repr" "reversed"
|
||||
"round" "set" "setattr" "slice" "sorted" "staticmethod" "str" "sum" "super" "tuple" "type"
|
||||
"vars" "zip" "__import__"))
|
||||
|
||||
(python_function_definition
|
||||
name: (python_identifier) @function)
|
||||
|
||||
(type (python_identifier) @type)
|
||||
(type
|
||||
(python_identifier) @type)
|
||||
|
||||
(type
|
||||
(subscript
|
||||
(python_identifier) @type)) ; type subscript: Tuple[int]
|
||||
@ -179,70 +191,88 @@
|
||||
arguments: (argument_list
|
||||
(_)
|
||||
(python_identifier) @type))
|
||||
(#eq? @_isinstance "isinstance"))
|
||||
(#eq? @_isinstance "isinstance"))
|
||||
|
||||
(anonymous_python_function (identifier) @function)
|
||||
(anonymous_python_function
|
||||
(identifier) @function)
|
||||
|
||||
(function_definition (identifier) @function)
|
||||
(function_definition
|
||||
(identifier) @function)
|
||||
|
||||
(addtask_statement (identifier) @function)
|
||||
(addtask_statement
|
||||
(identifier) @function)
|
||||
|
||||
(deltask_statement (identifier) @function)
|
||||
(deltask_statement
|
||||
(identifier) @function)
|
||||
|
||||
(export_functions_statement (identifier) @function)
|
||||
(export_functions_statement
|
||||
(identifier) @function)
|
||||
|
||||
(addhandler_statement (identifier) @function)
|
||||
(addhandler_statement
|
||||
(identifier) @function)
|
||||
|
||||
(python_function_definition
|
||||
body:
|
||||
(block
|
||||
. (expression_statement (python_string) @string.documentation @spell)))
|
||||
body: (block
|
||||
.
|
||||
(expression_statement
|
||||
(python_string) @string.documentation @spell)))
|
||||
|
||||
; Namespace
|
||||
(inherit_path) @module
|
||||
|
||||
(inherit_path) @namespace
|
||||
|
||||
;; Normal parameters
|
||||
; Normal parameters
|
||||
(parameters
|
||||
(python_identifier) @parameter)
|
||||
;; Lambda parameters
|
||||
(python_identifier) @variable.parameter)
|
||||
|
||||
; Lambda parameters
|
||||
(lambda_parameters
|
||||
(python_identifier) @parameter)
|
||||
(python_identifier) @variable.parameter)
|
||||
|
||||
(lambda_parameters
|
||||
(tuple_pattern
|
||||
(python_identifier) @parameter))
|
||||
(python_identifier) @variable.parameter))
|
||||
|
||||
; Default parameters
|
||||
(keyword_argument
|
||||
name: (python_identifier) @parameter)
|
||||
name: (python_identifier) @variable.parameter)
|
||||
|
||||
; Naming parameters on call-site
|
||||
(default_parameter
|
||||
name: (python_identifier) @parameter)
|
||||
name: (python_identifier) @variable.parameter)
|
||||
|
||||
(typed_parameter
|
||||
(python_identifier) @parameter)
|
||||
(python_identifier) @variable.parameter)
|
||||
|
||||
(typed_default_parameter
|
||||
(python_identifier) @parameter)
|
||||
(python_identifier) @variable.parameter)
|
||||
|
||||
; Variadic parameters *args, **kwargs
|
||||
(parameters
|
||||
(list_splat_pattern ; *args
|
||||
(python_identifier) @parameter))
|
||||
(list_splat_pattern
|
||||
; *args
|
||||
(python_identifier) @variable.parameter))
|
||||
|
||||
(parameters
|
||||
(dictionary_splat_pattern ; **kwargs
|
||||
(python_identifier) @parameter))
|
||||
|
||||
;; Literals
|
||||
(dictionary_splat_pattern
|
||||
; **kwargs
|
||||
(python_identifier) @variable.parameter))
|
||||
|
||||
; Literals
|
||||
(none) @constant.builtin
|
||||
[(true) (false)] @boolean
|
||||
|
||||
[
|
||||
(true)
|
||||
(false)
|
||||
] @boolean
|
||||
|
||||
((python_identifier) @variable.builtin
|
||||
(#eq? @variable.builtin "self"))
|
||||
((python_identifier) @variable.builtin
|
||||
(#eq? @variable.builtin "cls"))
|
||||
(#any-of? @variable.builtin "self" "cls"))
|
||||
|
||||
(integer) @number
|
||||
(float) @float
|
||||
|
||||
(float) @number.float
|
||||
|
||||
; Operators
|
||||
|
||||
[
|
||||
"?="
|
||||
"??="
|
||||
@ -297,19 +327,17 @@
|
||||
"or"
|
||||
"is not"
|
||||
"not in"
|
||||
|
||||
"del"
|
||||
] @keyword.operator
|
||||
|
||||
; Literals
|
||||
|
||||
[
|
||||
(string)
|
||||
(python_string)
|
||||
"\""
|
||||
] @string
|
||||
|
||||
(include_path) @string.special
|
||||
(include_path) @string.special.path
|
||||
|
||||
[
|
||||
(escape_sequence)
|
||||
@ -317,8 +345,14 @@
|
||||
] @string.escape
|
||||
|
||||
; Punctuation
|
||||
|
||||
[ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"{"
|
||||
"}"
|
||||
"["
|
||||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
":"
|
||||
@ -329,30 +363,45 @@
|
||||
(ellipsis)
|
||||
] @punctuation.delimiter
|
||||
|
||||
(variable_expansion [ "${" "}" ] @punctuation.special)
|
||||
(inline_python [ "${@" "}" ] @punctuation.special)
|
||||
(variable_expansion
|
||||
[
|
||||
"${"
|
||||
"}"
|
||||
] @punctuation.special)
|
||||
|
||||
(inline_python
|
||||
[
|
||||
"${@"
|
||||
"}"
|
||||
] @punctuation.special)
|
||||
|
||||
(interpolation
|
||||
"{" @punctuation.special
|
||||
"}" @punctuation.special)
|
||||
|
||||
(type_conversion) @function.macro
|
||||
|
||||
([(identifier) (python_identifier)] @type.builtin
|
||||
(#any-of? @type.builtin
|
||||
;; https://docs.python.org/3/library/exceptions.html
|
||||
"BaseException" "Exception" "ArithmeticError" "BufferError" "LookupError" "AssertionError" "AttributeError"
|
||||
"EOFError" "FloatingPointError" "GeneratorExit" "ImportError" "ModuleNotFoundError" "IndexError" "KeyError"
|
||||
"KeyboardInterrupt" "MemoryError" "NameError" "NotImplementedError" "OSError" "OverflowError" "RecursionError"
|
||||
"ReferenceError" "RuntimeError" "StopIteration" "StopAsyncIteration" "SyntaxError" "IndentationError" "TabError"
|
||||
"SystemError" "SystemExit" "TypeError" "UnboundLocalError" "UnicodeError" "UnicodeEncodeError" "UnicodeDecodeError"
|
||||
"UnicodeTranslateError" "ValueError" "ZeroDivisionError" "EnvironmentError" "IOError" "WindowsError"
|
||||
"BlockingIOError" "ChildProcessError" "ConnectionError" "BrokenPipeError" "ConnectionAbortedError"
|
||||
"ConnectionRefusedError" "ConnectionResetError" "FileExistsError" "FileNotFoundError" "InterruptedError"
|
||||
"IsADirectoryError" "NotADirectoryError" "PermissionError" "ProcessLookupError" "TimeoutError" "Warning"
|
||||
"UserWarning" "DeprecationWarning" "PendingDeprecationWarning" "SyntaxWarning" "RuntimeWarning"
|
||||
"FutureWarning" "ImportWarning" "UnicodeWarning" "BytesWarning" "ResourceWarning"
|
||||
;; https://docs.python.org/3/library/stdtypes.html
|
||||
"bool" "int" "float" "complex" "list" "tuple" "range" "str"
|
||||
"bytes" "bytearray" "memoryview" "set" "frozenset" "dict" "type" "object"))
|
||||
([
|
||||
(identifier)
|
||||
(python_identifier)
|
||||
] @type.builtin
|
||||
(#any-of? @type.builtin
|
||||
; https://docs.python.org/3/library/exceptions.html
|
||||
"BaseException" "Exception" "ArithmeticError" "BufferError" "LookupError" "AssertionError"
|
||||
"AttributeError" "EOFError" "FloatingPointError" "GeneratorExit" "ImportError"
|
||||
"ModuleNotFoundError" "IndexError" "KeyError" "KeyboardInterrupt" "MemoryError" "NameError"
|
||||
"NotImplementedError" "OSError" "OverflowError" "RecursionError" "ReferenceError" "RuntimeError"
|
||||
"StopIteration" "StopAsyncIteration" "SyntaxError" "IndentationError" "TabError" "SystemError"
|
||||
"SystemExit" "TypeError" "UnboundLocalError" "UnicodeError" "UnicodeEncodeError"
|
||||
"UnicodeDecodeError" "UnicodeTranslateError" "ValueError" "ZeroDivisionError" "EnvironmentError"
|
||||
"IOError" "WindowsError" "BlockingIOError" "ChildProcessError" "ConnectionError"
|
||||
"BrokenPipeError" "ConnectionAbortedError" "ConnectionRefusedError" "ConnectionResetError"
|
||||
"FileExistsError" "FileNotFoundError" "InterruptedError" "IsADirectoryError"
|
||||
"NotADirectoryError" "PermissionError" "ProcessLookupError" "TimeoutError" "Warning"
|
||||
"UserWarning" "DeprecationWarning" "PendingDeprecationWarning" "SyntaxWarning" "RuntimeWarning"
|
||||
"FutureWarning" "ImportWarning" "UnicodeWarning" "BytesWarning" "ResourceWarning"
|
||||
; https://docs.python.org/3/library/stdtypes.html
|
||||
"bool" "int" "float" "complex" "list" "tuple" "range" "str" "bytes" "bytearray" "memoryview"
|
||||
"set" "frozenset" "dict" "type" "object"))
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
@ -1,76 +1,101 @@
|
||||
[
|
||||
(import_from_statement)
|
||||
|
||||
(parenthesized_expression)
|
||||
(generator_expression)
|
||||
(list_comprehension)
|
||||
(set_comprehension)
|
||||
(dictionary_comprehension)
|
||||
|
||||
(tuple_pattern)
|
||||
(list_pattern)
|
||||
(binary_operator)
|
||||
|
||||
(lambda)
|
||||
|
||||
(concatenated_string)
|
||||
] @indent.begin
|
||||
|
||||
((list) @indent.align
|
||||
(#set! indent.open_delimiter "[")
|
||||
(#set! indent.close_delimiter "]")
|
||||
)
|
||||
(#set! indent.open_delimiter "[")
|
||||
(#set! indent.close_delimiter "]"))
|
||||
|
||||
((dictionary) @indent.align
|
||||
(#set! indent.open_delimiter "{")
|
||||
(#set! indent.close_delimiter "}")
|
||||
)
|
||||
(#set! indent.open_delimiter "{")
|
||||
(#set! indent.close_delimiter "}"))
|
||||
|
||||
((set) @indent.align
|
||||
(#set! indent.open_delimiter "{")
|
||||
(#set! indent.close_delimiter "}")
|
||||
)
|
||||
(#set! indent.open_delimiter "{")
|
||||
(#set! indent.close_delimiter "}"))
|
||||
|
||||
((for_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
(#set! indent.immediate 1))
|
||||
|
||||
((if_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
(#set! indent.immediate 1))
|
||||
|
||||
((while_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
(#set! indent.immediate 1))
|
||||
|
||||
((try_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
(ERROR "try" ":" @indent.begin (#set! indent.immediate 1))
|
||||
(#set! indent.immediate 1))
|
||||
|
||||
(ERROR
|
||||
"try"
|
||||
":" @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
|
||||
((python_function_definition) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
(#set! indent.immediate 1))
|
||||
|
||||
(function_definition) @indent.begin
|
||||
|
||||
(anonymous_python_function) @indent.begin
|
||||
|
||||
((with_statement) @indent.begin
|
||||
(#set! indent.immediate 1))
|
||||
(#set! indent.immediate 1))
|
||||
|
||||
(if_statement
|
||||
condition: (parenthesized_expression) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")")
|
||||
(#set! indent.avoid_last_matching_next 1))
|
||||
|
||||
(while_statement
|
||||
condition: (parenthesized_expression) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")")
|
||||
(#set! indent.avoid_last_matching_next 1))
|
||||
|
||||
(ERROR "(" @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")") . (_))
|
||||
(ERROR
|
||||
"(" @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")")
|
||||
.
|
||||
(_))
|
||||
|
||||
((argument_list) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
((parameters) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")")
|
||||
(#set! indent.avoid_last_matching_next 1))
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")")
|
||||
(#set! indent.avoid_last_matching_next 1))
|
||||
|
||||
((tuple) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
(ERROR "[" @indent.align (#set! indent.open_delimiter "[") (#set! indent.close_delimiter "]") . (_))
|
||||
(ERROR
|
||||
"[" @indent.align
|
||||
(#set! indent.open_delimiter "[")
|
||||
(#set! indent.close_delimiter "]")
|
||||
.
|
||||
(_))
|
||||
|
||||
(ERROR "{" @indent.align (#set! indent.open_delimiter "{") (#set! indent.close_delimiter "}") . (_))
|
||||
(ERROR
|
||||
"{" @indent.align
|
||||
(#set! indent.open_delimiter "{")
|
||||
(#set! indent.close_delimiter "}")
|
||||
.
|
||||
(_))
|
||||
|
||||
[
|
||||
(break_statement)
|
||||
@ -78,24 +103,43 @@
|
||||
] @indent.dedent
|
||||
|
||||
(ERROR
|
||||
(_) @indent.branch ":" .
|
||||
(_) @indent.branch
|
||||
":"
|
||||
.
|
||||
(#lua-match? @indent.branch "^else"))
|
||||
|
||||
(ERROR
|
||||
(_) @indent.branch @indent.dedent ":" .
|
||||
(_) @indent.branch @indent.dedent
|
||||
":"
|
||||
.
|
||||
(#lua-match? @indent.branch "^elif"))
|
||||
|
||||
(parenthesized_expression ")" @indent.end)
|
||||
(generator_expression ")" @indent.end)
|
||||
(list_comprehension "]" @indent.end)
|
||||
(set_comprehension "}" @indent.end)
|
||||
(dictionary_comprehension "}" @indent.end)
|
||||
(parenthesized_expression
|
||||
")" @indent.end)
|
||||
|
||||
(tuple_pattern ")" @indent.end)
|
||||
(list_pattern "]" @indent.end)
|
||||
(generator_expression
|
||||
")" @indent.end)
|
||||
|
||||
(function_definition "}" @indent.end)
|
||||
(anonymous_python_function "}" @indent.end)
|
||||
(list_comprehension
|
||||
"]" @indent.end)
|
||||
|
||||
(set_comprehension
|
||||
"}" @indent.end)
|
||||
|
||||
(dictionary_comprehension
|
||||
"}" @indent.end)
|
||||
|
||||
(tuple_pattern
|
||||
")" @indent.end)
|
||||
|
||||
(list_pattern
|
||||
"]" @indent.end)
|
||||
|
||||
(function_definition
|
||||
"}" @indent.end)
|
||||
|
||||
(anonymous_python_function
|
||||
"}" @indent.end)
|
||||
|
||||
(return_statement
|
||||
[
|
||||
@ -107,10 +151,11 @@
|
||||
"}"
|
||||
"]"
|
||||
] @indent.end .)
|
||||
(attribute
|
||||
(attribute
|
||||
attribute: (_) @indent.end)
|
||||
(call
|
||||
arguments: (_ ")" @indent.end))
|
||||
arguments: (_
|
||||
")" @indent.end))
|
||||
"return" @indent.end
|
||||
] .)
|
||||
|
||||
|
||||
@ -1,8 +1,9 @@
|
||||
(call
|
||||
function: (attribute
|
||||
object: (python_identifier) @_re)
|
||||
arguments: (argument_list (python_string
|
||||
(string_content) @injection.content) @_string)
|
||||
object: (python_identifier) @_re)
|
||||
arguments: (argument_list
|
||||
(python_string
|
||||
(string_content) @injection.content) @_string)
|
||||
(#eq? @_re "re")
|
||||
(#lua-match? @_string "^r.*")
|
||||
(#set! injection.language "regex"))
|
||||
@ -11,4 +12,4 @@
|
||||
(#set! injection.language "bash"))
|
||||
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
@ -2,98 +2,116 @@
|
||||
[
|
||||
(python_identifier)
|
||||
(identifier)
|
||||
] @reference
|
||||
] @local.reference
|
||||
|
||||
; Imports
|
||||
(aliased_import
|
||||
alias: (python_identifier) @definition.import)
|
||||
alias: (python_identifier) @local.definition.import)
|
||||
|
||||
(import_statement
|
||||
name: (dotted_name ((python_identifier) @definition.import)))
|
||||
name: (dotted_name
|
||||
(python_identifier) @local.definition.import))
|
||||
|
||||
(import_from_statement
|
||||
name: (dotted_name ((python_identifier) @definition.import)))
|
||||
name: (dotted_name
|
||||
(python_identifier) @local.definition.import))
|
||||
|
||||
; Function with parameters, defines parameters
|
||||
(parameters
|
||||
(python_identifier) @definition.parameter)
|
||||
(python_identifier) @local.definition.parameter)
|
||||
|
||||
(default_parameter
|
||||
(python_identifier) @definition.parameter)
|
||||
(python_identifier) @local.definition.parameter)
|
||||
|
||||
(typed_parameter
|
||||
(python_identifier) @definition.parameter)
|
||||
(python_identifier) @local.definition.parameter)
|
||||
|
||||
(typed_default_parameter
|
||||
(python_identifier) @definition.parameter)
|
||||
(python_identifier) @local.definition.parameter)
|
||||
|
||||
; *args parameter
|
||||
(parameters
|
||||
(list_splat_pattern
|
||||
(python_identifier) @definition.parameter))
|
||||
(python_identifier) @local.definition.parameter))
|
||||
|
||||
; **kwargs parameter
|
||||
(parameters
|
||||
(dictionary_splat_pattern
|
||||
(python_identifier) @definition.parameter))
|
||||
(python_identifier) @local.definition.parameter))
|
||||
|
||||
; Function defines function and scope
|
||||
((python_function_definition
|
||||
name: (python_identifier) @definition.function) @scope
|
||||
(#set! definition.function.scope "parent"))
|
||||
name: (python_identifier) @local.definition.function) @local.scope
|
||||
(#set! definition.function.scope "parent"))
|
||||
|
||||
(function_definition (identifier) @definition.function)
|
||||
(function_definition
|
||||
(identifier) @local.definition.function)
|
||||
|
||||
(anonymous_python_function (identifier) @definition.function)
|
||||
(anonymous_python_function
|
||||
(identifier) @local.definition.function)
|
||||
|
||||
;;; Loops
|
||||
; Loops
|
||||
; not a scope!
|
||||
(for_statement
|
||||
left: (pattern_list
|
||||
(python_identifier) @definition.var))
|
||||
(python_identifier) @local.definition.var))
|
||||
|
||||
(for_statement
|
||||
left: (tuple_pattern
|
||||
(python_identifier) @definition.var))
|
||||
(python_identifier) @local.definition.var))
|
||||
|
||||
(for_statement
|
||||
left: (python_identifier) @definition.var)
|
||||
left: (python_identifier) @local.definition.var)
|
||||
|
||||
; not a scope!
|
||||
;(while_statement) @scope
|
||||
|
||||
;(while_statement) @local.scope
|
||||
; for in list comprehension
|
||||
(for_in_clause
|
||||
left: (python_identifier) @definition.var)
|
||||
left: (python_identifier) @local.definition.var)
|
||||
|
||||
(for_in_clause
|
||||
left: (tuple_pattern
|
||||
(python_identifier) @definition.var))
|
||||
(python_identifier) @local.definition.var))
|
||||
|
||||
(for_in_clause
|
||||
left: (pattern_list
|
||||
(python_identifier) @definition.var))
|
||||
(python_identifier) @local.definition.var))
|
||||
|
||||
(dictionary_comprehension) @scope
|
||||
(list_comprehension) @scope
|
||||
(set_comprehension) @scope
|
||||
(dictionary_comprehension) @local.scope
|
||||
|
||||
;;; Assignments
|
||||
(list_comprehension) @local.scope
|
||||
|
||||
(set_comprehension) @local.scope
|
||||
|
||||
; Assignments
|
||||
(assignment
|
||||
left: (python_identifier) @local.definition.var)
|
||||
|
||||
(assignment
|
||||
left: (python_identifier) @definition.var)
|
||||
left: (pattern_list
|
||||
(python_identifier) @local.definition.var))
|
||||
|
||||
(assignment
|
||||
left: (pattern_list
|
||||
(python_identifier) @definition.var))
|
||||
(assignment
|
||||
left: (tuple_pattern
|
||||
(python_identifier) @definition.var))
|
||||
left: (tuple_pattern
|
||||
(python_identifier) @local.definition.var))
|
||||
|
||||
(assignment
|
||||
left: (attribute
|
||||
(python_identifier)
|
||||
(python_identifier) @definition.field))
|
||||
left: (attribute
|
||||
(python_identifier)
|
||||
(python_identifier) @local.definition.field))
|
||||
|
||||
(variable_assignment (identifier) operator: [ "=" "?=" "??=" ":=" ] @definition.var)
|
||||
(variable_assignment
|
||||
(identifier)
|
||||
operator: [
|
||||
"="
|
||||
"?="
|
||||
"??="
|
||||
":="
|
||||
] @local.definition.var)
|
||||
|
||||
; Walrus operator x := 1
|
||||
(named_expression
|
||||
(python_identifier) @definition.var)
|
||||
(python_identifier) @local.definition.var)
|
||||
|
||||
(as_pattern
|
||||
alias: (as_pattern_target) @definition.var)
|
||||
alias: (as_pattern_target) @local.definition.var)
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
(object_id) @variable
|
||||
|
||||
(string) @string
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
(comment) @comment @spell
|
||||
@ -9,36 +10,53 @@
|
||||
|
||||
(boolean) @boolean
|
||||
|
||||
(using) @include
|
||||
(using) @keyword.import
|
||||
|
||||
(template) @keyword
|
||||
|
||||
(decorator) @attribute
|
||||
|
||||
(property_definition (property_name) @property)
|
||||
(property_definition
|
||||
(property_name) @property)
|
||||
|
||||
(object) @type
|
||||
|
||||
(signal_binding (signal_name) @function.builtin)
|
||||
(signal_binding (function (identifier)) @function)
|
||||
(signal_binding "swapped" @keyword)
|
||||
(signal_binding
|
||||
(signal_name) @function.builtin)
|
||||
|
||||
(styles_list "styles" @function.macro)
|
||||
(layout_definition "layout" @function.macro)
|
||||
(signal_binding
|
||||
(function
|
||||
(identifier)) @function)
|
||||
|
||||
(gettext_string "_" @function.builtin)
|
||||
(signal_binding
|
||||
"swapped" @keyword)
|
||||
|
||||
(menu_definition "menu" @keyword)
|
||||
(menu_section "section" @keyword)
|
||||
(menu_item "item" @function.macro)
|
||||
(styles_list
|
||||
"styles" @function.macro)
|
||||
|
||||
(template_definition (template_name_qualifier) @type.qualifier)
|
||||
(layout_definition
|
||||
"layout" @function.macro)
|
||||
|
||||
(import_statement (gobject_library) @namespace)
|
||||
(gettext_string
|
||||
"_" @function.builtin)
|
||||
|
||||
(import_statement (version_number) @float)
|
||||
(menu_definition
|
||||
"menu" @keyword)
|
||||
|
||||
(menu_section
|
||||
"section" @keyword)
|
||||
|
||||
(menu_item
|
||||
"item" @function.macro)
|
||||
|
||||
(import_statement
|
||||
(gobject_library) @module)
|
||||
|
||||
(import_statement
|
||||
(version_number) @number.float)
|
||||
|
||||
(float) @number.float
|
||||
|
||||
(float) @float
|
||||
(number) @number
|
||||
|
||||
[
|
||||
|
||||
@ -1,21 +1,22 @@
|
||||
[
|
||||
(for_statement)
|
||||
(if_statement)
|
||||
(while_statement)
|
||||
(do_statement)
|
||||
(switch_statement)
|
||||
(case_statement)
|
||||
(function_definition)
|
||||
(struct_specifier)
|
||||
(enum_specifier)
|
||||
(comment)
|
||||
(preproc_if)
|
||||
(preproc_elif)
|
||||
(preproc_else)
|
||||
(preproc_ifdef)
|
||||
(preproc_function_def)
|
||||
(initializer_list)
|
||||
(gnu_asm_expression)
|
||||
(for_statement)
|
||||
(if_statement)
|
||||
(while_statement)
|
||||
(do_statement)
|
||||
(switch_statement)
|
||||
(case_statement)
|
||||
(function_definition)
|
||||
(struct_specifier)
|
||||
(enum_specifier)
|
||||
(comment)
|
||||
(preproc_if)
|
||||
(preproc_elif)
|
||||
(preproc_else)
|
||||
(preproc_ifdef)
|
||||
(preproc_function_def)
|
||||
(initializer_list)
|
||||
(gnu_asm_expression)
|
||||
(preproc_include)+
|
||||
] @fold
|
||||
|
||||
(compound_statement
|
||||
|
||||
@ -1,23 +1,32 @@
|
||||
; Lower priority to prefer @parameter when identifier appears in parameter_declaration.
|
||||
((identifier) @variable (#set! "priority" 95))
|
||||
(preproc_def (preproc_arg) @variable)
|
||||
; Lower priority to prefer @variable.parameter when identifier appears in parameter_declaration.
|
||||
((identifier) @variable
|
||||
(#set! "priority" 95))
|
||||
|
||||
(preproc_def
|
||||
(preproc_arg) @variable)
|
||||
|
||||
[
|
||||
"default"
|
||||
"enum"
|
||||
"struct"
|
||||
"typedef"
|
||||
"union"
|
||||
"goto"
|
||||
"asm"
|
||||
"__asm__"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"enum"
|
||||
"struct"
|
||||
"union"
|
||||
"typedef"
|
||||
] @keyword.type
|
||||
|
||||
[
|
||||
"sizeof"
|
||||
"offsetof"
|
||||
] @keyword.operator
|
||||
(alignof_expression . _ @keyword.operator)
|
||||
|
||||
(alignof_expression
|
||||
.
|
||||
_ @keyword.operator)
|
||||
|
||||
"return" @keyword.return
|
||||
|
||||
@ -27,14 +36,14 @@
|
||||
"do"
|
||||
"continue"
|
||||
"break"
|
||||
] @repeat
|
||||
] @keyword.repeat
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
"case"
|
||||
"switch"
|
||||
] @conditional
|
||||
"if"
|
||||
"else"
|
||||
"case"
|
||||
"switch"
|
||||
] @keyword.conditional
|
||||
|
||||
[
|
||||
"#if"
|
||||
@ -46,48 +55,54 @@
|
||||
"#elifdef"
|
||||
"#elifndef"
|
||||
(preproc_directive)
|
||||
] @preproc
|
||||
] @keyword.directive
|
||||
|
||||
"#define" @define
|
||||
"#define" @keyword.directive.define
|
||||
|
||||
"#include" @include
|
||||
"#include" @keyword.import
|
||||
|
||||
[ ";" ":" "," "::" ] @punctuation.delimiter
|
||||
[
|
||||
";"
|
||||
":"
|
||||
","
|
||||
"::"
|
||||
] @punctuation.delimiter
|
||||
|
||||
"..." @punctuation.special
|
||||
|
||||
[ "(" ")" "[" "]" "{" "}"] @punctuation.bracket
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"="
|
||||
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"+"
|
||||
"%"
|
||||
|
||||
"~"
|
||||
"|"
|
||||
"&"
|
||||
"^"
|
||||
"<<"
|
||||
">>"
|
||||
|
||||
"->"
|
||||
"."
|
||||
|
||||
"<"
|
||||
"<="
|
||||
">="
|
||||
">"
|
||||
"=="
|
||||
"!="
|
||||
|
||||
"!"
|
||||
"&&"
|
||||
"||"
|
||||
|
||||
"-="
|
||||
"+="
|
||||
"*="
|
||||
@ -102,72 +117,93 @@
|
||||
"++"
|
||||
] @operator
|
||||
|
||||
;; Make sure the comma operator is given a highlight group after the comma
|
||||
;; punctuator so the operator is highlighted properly.
|
||||
(comma_expression [ "," ] @operator)
|
||||
; Make sure the comma operator is given a highlight group after the comma
|
||||
; punctuator so the operator is highlighted properly.
|
||||
(comma_expression
|
||||
"," @operator)
|
||||
|
||||
[
|
||||
(true)
|
||||
(false)
|
||||
] @boolean
|
||||
|
||||
(conditional_expression [ "?" ":" ] @conditional.ternary)
|
||||
(conditional_expression
|
||||
[
|
||||
"?"
|
||||
":"
|
||||
] @keyword.conditional.ternary)
|
||||
|
||||
(string_literal) @string
|
||||
|
||||
(system_lib_string) @string
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
(null) @constant.builtin
|
||||
|
||||
(number_literal) @number
|
||||
|
||||
(char_literal) @character
|
||||
|
||||
((preproc_arg) @function.macro (#set! "priority" 90))
|
||||
(preproc_defined) @function.macro
|
||||
|
||||
(((field_expression
|
||||
(field_identifier) @property)) @_parent
|
||||
(#not-has-parent? @_parent template_method function_declarator call_expression))
|
||||
((field_expression
|
||||
(field_identifier) @property) @_parent
|
||||
(#not-has-parent? @_parent template_method function_declarator call_expression))
|
||||
|
||||
(field_designator) @property
|
||||
(((field_identifier) @property)
|
||||
(#has-ancestor? @property field_declaration)
|
||||
(#not-has-ancestor? @property function_declarator))
|
||||
|
||||
((field_identifier) @property
|
||||
(#has-ancestor? @property field_declaration)
|
||||
(#not-has-ancestor? @property function_declarator))
|
||||
|
||||
(statement_identifier) @label
|
||||
|
||||
(declaration
|
||||
type: (type_identifier) @_type
|
||||
declarator: (identifier) @label
|
||||
(#eq? @_type "__label__"))
|
||||
|
||||
[
|
||||
(type_identifier)
|
||||
(type_descriptor)
|
||||
(type_identifier)
|
||||
(type_descriptor)
|
||||
] @type
|
||||
|
||||
(storage_class_specifier) @storageclass
|
||||
(storage_class_specifier) @keyword.modifier
|
||||
|
||||
[
|
||||
(type_qualifier)
|
||||
(gnu_asm_qualifier)
|
||||
"__extension__"
|
||||
] @type.qualifier
|
||||
] @keyword.modifier
|
||||
|
||||
(linkage_specification
|
||||
"extern" @storageclass)
|
||||
"extern" @keyword.modifier)
|
||||
|
||||
(type_definition
|
||||
declarator: (type_identifier) @type.definition)
|
||||
|
||||
(primitive_type) @type.builtin
|
||||
|
||||
(sized_type_specifier _ @type.builtin type: _?)
|
||||
(sized_type_specifier
|
||||
_ @type.builtin
|
||||
type: _?)
|
||||
|
||||
((identifier) @constant
|
||||
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
|
||||
(preproc_def (preproc_arg) @constant
|
||||
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
|
||||
|
||||
(preproc_def
|
||||
(preproc_arg) @constant
|
||||
(#lua-match? @constant "^[A-Z][A-Z0-9_]+$"))
|
||||
|
||||
(enumerator
|
||||
name: (identifier) @constant)
|
||||
|
||||
(case_statement
|
||||
value: (identifier) @constant)
|
||||
|
||||
((identifier) @constant.builtin
|
||||
; format-ignore
|
||||
(#any-of? @constant.builtin
|
||||
"stderr" "stdin" "stdout"
|
||||
"__FILE__" "__LINE__" "__DATE__" "__TIME__"
|
||||
@ -180,7 +216,10 @@
|
||||
"__clang_wide_literal_encoding__"
|
||||
"__FUNCTION__" "__func__" "__PRETTY_FUNCTION__"
|
||||
"__VA_ARGS__" "__VA_OPT__"))
|
||||
(preproc_def (preproc_arg) @constant.builtin
|
||||
|
||||
(preproc_def
|
||||
(preproc_arg) @constant.builtin
|
||||
; format-ignore
|
||||
(#any-of? @constant.builtin
|
||||
"stderr" "stdin" "stdout"
|
||||
"__FILE__" "__LINE__" "__DATE__" "__TIME__"
|
||||
@ -195,21 +234,26 @@
|
||||
"__VA_ARGS__" "__VA_OPT__"))
|
||||
|
||||
(attribute_specifier
|
||||
(argument_list (identifier) @variable.builtin))
|
||||
((attribute_specifier
|
||||
(argument_list (call_expression
|
||||
function: (identifier) @variable.builtin))))
|
||||
(argument_list
|
||||
(identifier) @variable.builtin))
|
||||
|
||||
(attribute_specifier
|
||||
(argument_list
|
||||
(call_expression
|
||||
function: (identifier) @variable.builtin)))
|
||||
|
||||
((call_expression
|
||||
function: (identifier) @function.builtin)
|
||||
(#lua-match? @function.builtin "^__builtin_"))
|
||||
|
||||
((call_expression
|
||||
function: (identifier) @function.builtin)
|
||||
function: (identifier) @function.builtin)
|
||||
(#has-ancestor? @function.builtin attribute_specifier))
|
||||
|
||||
;; Preproc def / undef
|
||||
; Preproc def / undef
|
||||
(preproc_def
|
||||
name: (_) @constant)
|
||||
|
||||
(preproc_call
|
||||
directive: (preproc_directive) @_u
|
||||
argument: (_) @constant
|
||||
@ -217,15 +261,19 @@
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function.call)
|
||||
|
||||
(call_expression
|
||||
function: (field_expression
|
||||
field: (field_identifier) @function.call))
|
||||
|
||||
(function_declarator
|
||||
declarator: (identifier) @function)
|
||||
|
||||
(function_declarator
|
||||
declarator: (parenthesized_declarator
|
||||
(pointer_declarator
|
||||
declarator: (field_identifier) @function)))
|
||||
(pointer_declarator
|
||||
declarator: (field_identifier) @function)))
|
||||
|
||||
(preproc_function_def
|
||||
name: (identifier) @function.macro)
|
||||
|
||||
@ -234,15 +282,15 @@
|
||||
((comment) @comment.documentation
|
||||
(#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$"))
|
||||
|
||||
;; Parameters
|
||||
; Parameters
|
||||
(parameter_declaration
|
||||
declarator: (identifier) @parameter)
|
||||
declarator: (identifier) @variable.parameter)
|
||||
|
||||
(parameter_declaration
|
||||
declarator: (array_declarator) @parameter)
|
||||
declarator: (array_declarator) @variable.parameter)
|
||||
|
||||
(parameter_declaration
|
||||
declarator: (pointer_declarator) @parameter)
|
||||
declarator: (pointer_declarator) @variable.parameter)
|
||||
|
||||
; K&R functions
|
||||
; To enable support for K&R functions,
|
||||
@ -250,24 +298,24 @@
|
||||
; They are commented out as they'll conflict with C++
|
||||
; Note that you'll need to have `; extends` at the top of your query file.
|
||||
;
|
||||
; (parameter_list (identifier) @parameter)
|
||||
; (parameter_list (identifier) @variable.parameter)
|
||||
;
|
||||
; (function_definition
|
||||
; declarator: _
|
||||
; (declaration
|
||||
; declarator: (identifier) @parameter))
|
||||
; declarator: (identifier) @variable.parameter))
|
||||
;
|
||||
; (function_definition
|
||||
; declarator: _
|
||||
; (declaration
|
||||
; declarator: (array_declarator) @parameter))
|
||||
; declarator: (array_declarator) @variable.parameter))
|
||||
;
|
||||
; (function_definition
|
||||
; declarator: _
|
||||
; (declaration
|
||||
; declarator: (pointer_declarator) @parameter))
|
||||
|
||||
(preproc_params (identifier) @parameter)
|
||||
; declarator: (pointer_declarator) @variable.parameter))
|
||||
(preproc_params
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
[
|
||||
"__attribute__"
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
[
|
||||
(compound_statement)
|
||||
(compound_statement)
|
||||
(field_declaration_list)
|
||||
(case_statement)
|
||||
(enumerator_list)
|
||||
@ -10,53 +10,58 @@
|
||||
|
||||
; With current indent logic, if we capture expression_statement with @indent.begin
|
||||
; It will be affected by _parent_ node with error subnodes deep down the tree
|
||||
; So narrow indent capture to check for error inside expression statement only,
|
||||
; So narrow indent capture to check for error inside expression statement only,
|
||||
(expression_statement
|
||||
(_) @indent.begin
|
||||
";" @indent.end)
|
||||
|
||||
(ERROR
|
||||
"for" "(" @indent.begin ";" ";" ")" @indent.end)
|
||||
"for"
|
||||
"(" @indent.begin
|
||||
";"
|
||||
";"
|
||||
")" @indent.end)
|
||||
|
||||
((for_statement
|
||||
body: (_) @_body) @indent.begin
|
||||
(#not-has-type? @_body compound_statement))
|
||||
body: (_) @_body) @indent.begin
|
||||
(#not-kind-eq? @_body "compound_statement"))
|
||||
|
||||
(while_statement
|
||||
condition: (_) @indent.begin)
|
||||
|
||||
((while_statement
|
||||
body: (_) @_body) @indent.begin
|
||||
(#not-has-type? @_body compound_statement))
|
||||
body: (_) @_body) @indent.begin
|
||||
(#not-kind-eq? @_body "compound_statement"))
|
||||
|
||||
(
|
||||
(if_statement)
|
||||
((if_statement)
|
||||
.
|
||||
(ERROR "else" @indent.begin))
|
||||
(ERROR
|
||||
"else" @indent.begin))
|
||||
|
||||
(if_statement
|
||||
condition: (_) @indent.begin)
|
||||
|
||||
;; Supports if without braces (but not both if-else without braces)
|
||||
((if_statement
|
||||
consequence:
|
||||
(_ ";" @indent.end) @_consequence
|
||||
(#not-has-type? @_consequence compound_statement)
|
||||
alternative:
|
||||
(else_clause
|
||||
"else" @indent.branch
|
||||
[
|
||||
(if_statement (compound_statement) @indent.dedent)? @indent.dedent
|
||||
(compound_statement)? @indent.dedent
|
||||
(_)? @indent.dedent
|
||||
]
|
||||
)?
|
||||
) @indent.begin)
|
||||
; Supports if without braces (but not both if-else without braces)
|
||||
(if_statement
|
||||
consequence: (_
|
||||
";" @indent.end) @_consequence
|
||||
(#not-kind-eq? @_consequence "compound_statement")
|
||||
alternative: (else_clause
|
||||
"else" @indent.branch
|
||||
[
|
||||
(if_statement
|
||||
(compound_statement) @indent.dedent)? @indent.dedent
|
||||
(compound_statement)? @indent.dedent
|
||||
(_)? @indent.dedent
|
||||
])?) @indent.begin
|
||||
|
||||
(else_clause (_ . "{" @indent.branch))
|
||||
(else_clause
|
||||
(_
|
||||
.
|
||||
"{" @indent.branch))
|
||||
|
||||
|
||||
(compound_statement "}" @indent.end)
|
||||
(compound_statement
|
||||
"}" @indent.end)
|
||||
|
||||
[
|
||||
")"
|
||||
@ -79,12 +84,16 @@
|
||||
(string_literal)
|
||||
] @indent.ignore
|
||||
|
||||
((ERROR (parameter_declaration)) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
([(argument_list) (parameter_list)] @indent.align
|
||||
((ERROR
|
||||
(parameter_declaration)) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
([
|
||||
(argument_list)
|
||||
(parameter_list)
|
||||
] @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
(comment) @indent.auto
|
||||
|
||||
|
||||
@ -1,17 +1,126 @@
|
||||
((preproc_arg) @injection.content
|
||||
(#set! injection.language "c"))
|
||||
(#set! injection.language "c"))
|
||||
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
((comment) @injection.content
|
||||
(#match? @injection.content "/\\*!([a-zA-Z]+:)?re2c")
|
||||
(#set! injection.language "re2c"))
|
||||
|
||||
((comment) @injection.content
|
||||
(#lua-match? @injection.content "/[*][!<*][^a-zA-Z]")
|
||||
(#lua-match? @injection.content "/[*\/][!*\/]<?[^a-zA-Z]")
|
||||
(#set! injection.language "doxygen"))
|
||||
|
||||
((call_expression
|
||||
function: (identifier) @_function
|
||||
arguments: (argument_list
|
||||
.
|
||||
[
|
||||
(string_literal
|
||||
(string_content) @injection.content)
|
||||
(concatenated_string
|
||||
(string_literal
|
||||
(string_content) @injection.content))
|
||||
]))
|
||||
; format-ignore
|
||||
(#any-of? @_function
|
||||
"printf" "printf_s"
|
||||
"vprintf" "vprintf_s"
|
||||
"scanf" "scanf_s"
|
||||
"vscanf" "vscanf_s"
|
||||
"wprintf" "wprintf_s"
|
||||
"vwprintf" "vwprintf_s"
|
||||
"wscanf" "wscanf_s"
|
||||
"vwscanf" "vwscanf_s"
|
||||
"cscanf" "_cscanf"
|
||||
"printw"
|
||||
"scanw")
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
((call_expression
|
||||
function: (identifier) @_function
|
||||
arguments: (argument_list
|
||||
(_)
|
||||
.
|
||||
[
|
||||
(string_literal
|
||||
(string_content) @injection.content)
|
||||
(concatenated_string
|
||||
(string_literal
|
||||
(string_content) @injection.content))
|
||||
]))
|
||||
; format-ignore
|
||||
(#any-of? @_function
|
||||
"fprintf" "fprintf_s"
|
||||
"sprintf"
|
||||
"dprintf"
|
||||
"fscanf" "fscanf_s"
|
||||
"sscanf" "sscanf_s"
|
||||
"vsscanf" "vsscanf_s"
|
||||
"vfprintf" "vfprintf_s"
|
||||
"vsprintf"
|
||||
"vdprintf"
|
||||
"fwprintf" "fwprintf_s"
|
||||
"vfwprintf" "vfwprintf_s"
|
||||
"fwscanf" "fwscanf_s"
|
||||
"swscanf" "swscanf_s"
|
||||
"vswscanf" "vswscanf_s"
|
||||
"vfscanf" "vfscanf_s"
|
||||
"vfwscanf" "vfwscanf_s"
|
||||
"wprintw"
|
||||
"vw_printw" "vwprintw"
|
||||
"wscanw"
|
||||
"vw_scanw" "vwscanw")
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
((call_expression
|
||||
function: (identifier) @_function
|
||||
arguments: (argument_list
|
||||
(_)
|
||||
.
|
||||
(_)
|
||||
.
|
||||
[
|
||||
(string_literal
|
||||
(string_content) @injection.content)
|
||||
(concatenated_string
|
||||
(string_literal
|
||||
(string_content) @injection.content))
|
||||
]))
|
||||
; format-ignore
|
||||
(#any-of? @_function
|
||||
"sprintf_s"
|
||||
"snprintf" "snprintf_s"
|
||||
"vsprintf_s"
|
||||
"vsnprintf" "vsnprintf_s"
|
||||
"swprintf" "swprintf_s"
|
||||
"snwprintf_s"
|
||||
"vswprintf" "vswprintf_s"
|
||||
"vsnwprintf_s"
|
||||
"mvprintw"
|
||||
"mvscanw")
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
((call_expression
|
||||
function: (identifier) @_function
|
||||
arguments: (argument_list
|
||||
(_)
|
||||
.
|
||||
(_)
|
||||
.
|
||||
(_)
|
||||
.
|
||||
[
|
||||
(string_literal
|
||||
(string_content) @injection.content)
|
||||
(concatenated_string
|
||||
(string_literal
|
||||
(string_content) @injection.content))
|
||||
]))
|
||||
(#any-of? @_function "mvwprintw" "mvwscanw")
|
||||
(#set! injection.language "printf"))
|
||||
|
||||
; TODO: add when asm is added
|
||||
; (gnu_asm_expression assembly_code: (string_literal) @injection.content
|
||||
; (#set! injection.language "asm"))
|
||||
|
||||
@ -1,53 +1,67 @@
|
||||
;; Functions definitions
|
||||
; Functions definitions
|
||||
(function_declarator
|
||||
declarator: (identifier) @definition.function)
|
||||
declarator: (identifier) @local.definition.function)
|
||||
|
||||
(preproc_function_def
|
||||
name: (identifier) @definition.macro) @scope
|
||||
name: (identifier) @local.definition.macro) @local.scope
|
||||
|
||||
(preproc_def
|
||||
name: (identifier) @definition.macro)
|
||||
name: (identifier) @local.definition.macro)
|
||||
|
||||
(pointer_declarator
|
||||
declarator: (identifier) @definition.var)
|
||||
declarator: (identifier) @local.definition.var)
|
||||
|
||||
(parameter_declaration
|
||||
declarator: (identifier) @definition.parameter)
|
||||
declarator: (identifier) @local.definition.parameter)
|
||||
|
||||
(init_declarator
|
||||
declarator: (identifier) @definition.var)
|
||||
declarator: (identifier) @local.definition.var)
|
||||
|
||||
(array_declarator
|
||||
declarator: (identifier) @definition.var)
|
||||
declarator: (identifier) @local.definition.var)
|
||||
|
||||
(declaration
|
||||
declarator: (identifier) @definition.var)
|
||||
declarator: (identifier) @local.definition.var)
|
||||
|
||||
(enum_specifier
|
||||
name: (_) @definition.type
|
||||
name: (_) @local.definition.type
|
||||
(enumerator_list
|
||||
(enumerator name: (identifier) @definition.var)))
|
||||
(enumerator
|
||||
name: (identifier) @local.definition.var)))
|
||||
|
||||
;; Type / Struct / Enum
|
||||
; Type / Struct / Enum
|
||||
(field_declaration
|
||||
declarator: (field_identifier) @definition.field)
|
||||
declarator: (field_identifier) @local.definition.field)
|
||||
|
||||
(type_definition
|
||||
declarator: (type_identifier) @definition.type)
|
||||
declarator: (type_identifier) @local.definition.type)
|
||||
|
||||
(struct_specifier
|
||||
name: (type_identifier) @definition.type)
|
||||
name: (type_identifier) @local.definition.type)
|
||||
|
||||
;; goto
|
||||
(labeled_statement (statement_identifier) @definition)
|
||||
; goto
|
||||
(labeled_statement
|
||||
(statement_identifier) @local.definition)
|
||||
|
||||
;; References
|
||||
(identifier) @reference
|
||||
((field_identifier) @reference
|
||||
(#set! reference.kind "field"))
|
||||
((type_identifier) @reference
|
||||
(#set! reference.kind "type"))
|
||||
; References
|
||||
(identifier) @local.reference
|
||||
|
||||
(goto_statement (statement_identifier) @reference)
|
||||
((field_identifier) @local.reference
|
||||
(#set! reference.kind "field"))
|
||||
|
||||
;; Scope
|
||||
((type_identifier) @local.reference
|
||||
(#set! reference.kind "type"))
|
||||
|
||||
(goto_statement
|
||||
(statement_identifier) @local.reference)
|
||||
|
||||
; Scope
|
||||
[
|
||||
(for_statement)
|
||||
(if_statement)
|
||||
(while_statement)
|
||||
(translation_unit)
|
||||
(function_definition)
|
||||
(compound_statement) ; a block in curly braces
|
||||
(struct_specifier)
|
||||
] @scope
|
||||
(for_statement)
|
||||
(if_statement)
|
||||
(while_statement)
|
||||
(translation_unit)
|
||||
(function_definition)
|
||||
(compound_statement) ; a block in curly braces
|
||||
(struct_specifier)
|
||||
] @local.scope
|
||||
|
||||
@ -4,12 +4,14 @@ body: [
|
||||
(enum_member_declaration_list)
|
||||
] @fold
|
||||
|
||||
accessors: [
|
||||
(accessor_list)
|
||||
] @fold
|
||||
accessors: (accessor_list) @fold
|
||||
|
||||
initializer: [
|
||||
(initializer_expression)
|
||||
] @fold
|
||||
initializer: (initializer_expression) @fold
|
||||
|
||||
(block) @fold
|
||||
[
|
||||
(block)
|
||||
(preproc_if)
|
||||
(preproc_elif)
|
||||
(preproc_else)
|
||||
(using_directive)+
|
||||
] @fold
|
||||
|
||||
@ -1,16 +1,40 @@
|
||||
(identifier) @variable
|
||||
[
|
||||
(identifier)
|
||||
(preproc_arg)
|
||||
] @variable
|
||||
|
||||
((preproc_arg) @constant.macro
|
||||
(#lua-match? @constant.macro "^[_A-Z][_A-Z0-9]*$"))
|
||||
|
||||
((identifier) @keyword
|
||||
(#eq? @keyword "value")
|
||||
(#has-ancestor? @keyword accessor_declaration))
|
||||
|
||||
(method_declaration
|
||||
name: (identifier) @method)
|
||||
name: (identifier) @function.method)
|
||||
|
||||
(local_function_statement
|
||||
name: (identifier) @method)
|
||||
name: (identifier) @function.method)
|
||||
|
||||
(method_declaration
|
||||
returns: [
|
||||
(identifier) @type
|
||||
(generic_name
|
||||
(identifier) @type)
|
||||
])
|
||||
|
||||
(event_declaration
|
||||
type: (identifier) @type)
|
||||
|
||||
(event_declaration
|
||||
name: (identifier) @variable.member)
|
||||
|
||||
(event_field_declaration
|
||||
(variable_declaration
|
||||
(variable_declarator
|
||||
name: (identifier) @variable.member)))
|
||||
|
||||
(declaration_pattern
|
||||
type: (identifier) @type)
|
||||
|
||||
(local_function_statement
|
||||
@ -18,58 +42,98 @@
|
||||
|
||||
(interpolation) @none
|
||||
|
||||
(member_access_expression
|
||||
name: (identifier) @variable.member)
|
||||
|
||||
(invocation_expression
|
||||
(member_access_expression
|
||||
name: (identifier) @method.call))
|
||||
name: (identifier) @function.method.call))
|
||||
|
||||
(invocation_expression
|
||||
function: (conditional_access_expression
|
||||
(member_binding_expression
|
||||
name: (identifier) @method.call)))
|
||||
name: (identifier) @function.method.call)))
|
||||
|
||||
(namespace_declaration
|
||||
name: [(qualified_name) (identifier)] @namespace)
|
||||
name: [
|
||||
(qualified_name)
|
||||
(identifier)
|
||||
] @module)
|
||||
|
||||
(qualified_name
|
||||
(identifier) @type)
|
||||
|
||||
(namespace_declaration
|
||||
name: (identifier) @module)
|
||||
|
||||
(file_scoped_namespace_declaration
|
||||
name: (identifier) @module)
|
||||
|
||||
(qualified_name
|
||||
(identifier) @module
|
||||
(#not-has-ancestor? @module method_declaration)
|
||||
(#not-has-ancestor? @module record_declaration)
|
||||
(#has-ancestor? @module namespace_declaration file_scoped_namespace_declaration))
|
||||
|
||||
(invocation_expression
|
||||
(identifier) @method.call)
|
||||
(identifier) @function.method.call)
|
||||
|
||||
(field_declaration
|
||||
(variable_declaration
|
||||
(variable_declarator
|
||||
(identifier) @field)))
|
||||
(identifier) @variable.member)))
|
||||
|
||||
(initializer_expression
|
||||
(assignment_expression
|
||||
left: (identifier) @field))
|
||||
left: (identifier) @variable.member))
|
||||
|
||||
(parameter
|
||||
name: (identifier) @variable.parameter)
|
||||
|
||||
(parameter_list
|
||||
name: (identifier) @variable.parameter)
|
||||
|
||||
(bracketed_parameter_list
|
||||
name: (identifier) @variable.parameter)
|
||||
|
||||
(implicit_parameter) @variable.parameter
|
||||
|
||||
(parameter_list
|
||||
(parameter
|
||||
name: (identifier) @parameter))
|
||||
|
||||
(parameter_list
|
||||
(parameter
|
||||
type: (identifier) @type))
|
||||
type: (identifier) @type))
|
||||
|
||||
(integer_literal) @number
|
||||
(real_literal) @float
|
||||
|
||||
(real_literal) @number.float
|
||||
|
||||
(null_literal) @constant.builtin
|
||||
|
||||
(calling_convention
|
||||
[
|
||||
(identifier)
|
||||
"Cdecl"
|
||||
"Stdcall"
|
||||
"Thiscall"
|
||||
"Fastcall"
|
||||
] @attribute.builtin)
|
||||
|
||||
(character_literal) @character
|
||||
|
||||
[
|
||||
(string_literal)
|
||||
(verbatim_string_literal)
|
||||
(interpolated_string_expression)
|
||||
(string_literal)
|
||||
(raw_string_literal)
|
||||
(verbatim_string_literal)
|
||||
(interpolated_string_expression)
|
||||
] @string
|
||||
|
||||
(boolean_literal) @boolean
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
[
|
||||
(predefined_type)
|
||||
] @type.builtin
|
||||
"true"
|
||||
"false"
|
||||
] @boolean
|
||||
|
||||
(predefined_type) @type.builtin
|
||||
|
||||
(implicit_type) @keyword
|
||||
|
||||
@ -80,6 +144,7 @@
|
||||
|
||||
((comment) @comment.documentation
|
||||
(#lua-match? @comment.documentation "^///[^/]"))
|
||||
|
||||
((comment) @comment.documentation
|
||||
(#lua-match? @comment.documentation "^///$"))
|
||||
|
||||
@ -87,7 +152,7 @@
|
||||
(identifier) @type)
|
||||
|
||||
(using_directive
|
||||
(name_equals (identifier) @type.definition))
|
||||
(type) @type.definition)
|
||||
|
||||
(property_declaration
|
||||
name: (identifier) @property)
|
||||
@ -96,32 +161,82 @@
|
||||
type: (identifier) @type)
|
||||
|
||||
(nullable_type
|
||||
(identifier) @type)
|
||||
type: (identifier) @type)
|
||||
|
||||
(array_type
|
||||
type: (identifier) @type)
|
||||
|
||||
(ref_type
|
||||
type: (identifier) @type)
|
||||
|
||||
(pointer_type
|
||||
type: (identifier) @type)
|
||||
|
||||
(catch_declaration
|
||||
type: (identifier) @type)
|
||||
|
||||
(interface_declaration
|
||||
name: (identifier) @type)
|
||||
|
||||
(class_declaration
|
||||
name: (identifier) @type)
|
||||
|
||||
(record_declaration
|
||||
name: (identifier) @type)
|
||||
|
||||
(struct_declaration
|
||||
name: (identifier) @type)
|
||||
|
||||
(enum_declaration
|
||||
name: (identifier) @type)
|
||||
|
||||
(enum_member_declaration
|
||||
name: (identifier) @variable.member)
|
||||
|
||||
(operator_declaration
|
||||
type: (identifier) @type)
|
||||
|
||||
(conversion_operator_declaration
|
||||
type: (identifier) @type)
|
||||
|
||||
(explicit_interface_specifier
|
||||
[
|
||||
(identifier) @type
|
||||
(generic_name
|
||||
(identifier) @type)
|
||||
])
|
||||
|
||||
(explicit_interface_specifier
|
||||
(identifier) @type)
|
||||
|
||||
(primary_constructor_base_type
|
||||
type: (identifier) @type)
|
||||
|
||||
[
|
||||
"assembly"
|
||||
"module"
|
||||
"this"
|
||||
"base"
|
||||
(discard)
|
||||
] @variable.builtin
|
||||
|
||||
(constructor_declaration
|
||||
name: (identifier) @constructor)
|
||||
(constructor_initializer [
|
||||
"base" @constructor
|
||||
])
|
||||
|
||||
(destructor_declaration
|
||||
name: (identifier) @constructor)
|
||||
|
||||
(constructor_initializer
|
||||
"base" @constructor)
|
||||
|
||||
(variable_declaration
|
||||
(identifier) @type)
|
||||
|
||||
(object_creation_expression
|
||||
(identifier) @type)
|
||||
|
||||
; Generic Types.
|
||||
(type_of_expression
|
||||
(typeof_expression
|
||||
(generic_name
|
||||
(identifier) @type))
|
||||
|
||||
@ -133,13 +248,17 @@
|
||||
(generic_name
|
||||
(identifier) @type))
|
||||
|
||||
(type_constraint
|
||||
(generic_name
|
||||
(identifier) @type))
|
||||
(type_parameter_constraint
|
||||
[
|
||||
(identifier) @type
|
||||
(type
|
||||
(generic_name
|
||||
(identifier) @type))
|
||||
])
|
||||
|
||||
(object_creation_expression
|
||||
(generic_name
|
||||
(identifier) @type))
|
||||
(identifier) @type))
|
||||
|
||||
(property_declaration
|
||||
(generic_name
|
||||
@ -147,35 +266,48 @@
|
||||
|
||||
(_
|
||||
type: (generic_name
|
||||
(identifier) @type))
|
||||
(identifier) @type))
|
||||
|
||||
; Generic Method invocation with generic type
|
||||
(invocation_expression
|
||||
function: (generic_name
|
||||
. (identifier) @method.call))
|
||||
.
|
||||
(identifier) @function.method.call))
|
||||
|
||||
(invocation_expression
|
||||
(member_access_expression
|
||||
(generic_name
|
||||
(identifier) @method)))
|
||||
(identifier) @function.method)))
|
||||
|
||||
(base_list
|
||||
(identifier) @type)
|
||||
|
||||
(type_argument_list
|
||||
(identifier) @type)
|
||||
(identifier) @type)
|
||||
|
||||
(type_parameter_list
|
||||
(type_parameter) @type)
|
||||
|
||||
(type_parameter
|
||||
name: (identifier) @type)
|
||||
|
||||
(type_parameter_constraints_clause
|
||||
target: (identifier) @type)
|
||||
"where"
|
||||
.
|
||||
(identifier) @type)
|
||||
|
||||
(attribute
|
||||
name: (identifier) @attribute)
|
||||
name: (identifier) @attribute)
|
||||
|
||||
(for_each_statement
|
||||
(foreach_statement
|
||||
type: (identifier) @type)
|
||||
|
||||
(goto_statement
|
||||
(identifier) @label)
|
||||
|
||||
(labeled_statement
|
||||
(identifier) @label)
|
||||
|
||||
(tuple_element
|
||||
type: (identifier) @type)
|
||||
|
||||
@ -184,231 +316,262 @@
|
||||
(declaration_expression
|
||||
type: (identifier) @type)))
|
||||
|
||||
(cast_expression
|
||||
type: (identifier) @type)
|
||||
|
||||
(lambda_expression
|
||||
type: (identifier) @type)
|
||||
|
||||
(as_expression
|
||||
right: (identifier) @type)
|
||||
|
||||
(type_of_expression
|
||||
(typeof_expression
|
||||
(identifier) @type)
|
||||
|
||||
(name_colon
|
||||
(identifier) @parameter)
|
||||
|
||||
(warning_directive) @text.warning
|
||||
(error_directive) @exception
|
||||
|
||||
(define_directive
|
||||
(identifier) @constant) @constant.macro
|
||||
(undef_directive
|
||||
(identifier) @constant) @constant.macro
|
||||
|
||||
(line_directive) @constant.macro
|
||||
(line_directive
|
||||
(preproc_integer_literal) @constant
|
||||
(preproc_string_literal)? @string)
|
||||
|
||||
(pragma_directive
|
||||
(identifier) @constant) @constant.macro
|
||||
(pragma_directive
|
||||
(preproc_string_literal) @string) @constant.macro
|
||||
(preproc_error) @keyword.exception
|
||||
|
||||
[
|
||||
(nullable_directive)
|
||||
(region_directive)
|
||||
(endregion_directive)
|
||||
"#define"
|
||||
"#undef"
|
||||
] @keyword.directive.define
|
||||
|
||||
[
|
||||
"#if"
|
||||
"#elif"
|
||||
"#else"
|
||||
"#endif"
|
||||
"#region"
|
||||
"#endregion"
|
||||
"#line"
|
||||
"#pragma"
|
||||
"#nullable"
|
||||
"#error"
|
||||
(shebang_directive)
|
||||
] @keyword.directive
|
||||
|
||||
[
|
||||
(preproc_line)
|
||||
(preproc_pragma)
|
||||
(preproc_nullable)
|
||||
] @constant.macro
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
"switch"
|
||||
"break"
|
||||
"case"
|
||||
"when"
|
||||
(if_directive)
|
||||
(elif_directive)
|
||||
(else_directive)
|
||||
(endif_directive)
|
||||
] @conditional
|
||||
|
||||
(if_directive
|
||||
(identifier) @constant)
|
||||
(elif_directive
|
||||
(preproc_pragma
|
||||
(identifier) @constant)
|
||||
|
||||
[
|
||||
"while"
|
||||
"for"
|
||||
"do"
|
||||
"continue"
|
||||
"goto"
|
||||
"foreach"
|
||||
] @repeat
|
||||
"if"
|
||||
"else"
|
||||
"switch"
|
||||
"break"
|
||||
"case"
|
||||
"when"
|
||||
] @keyword.conditional
|
||||
|
||||
(preproc_pragma
|
||||
(identifier) @constant)
|
||||
|
||||
(preproc_if
|
||||
(identifier) @constant)
|
||||
|
||||
(preproc_if
|
||||
(identifier) @constant)
|
||||
|
||||
[
|
||||
"try"
|
||||
"catch"
|
||||
"throw"
|
||||
"finally"
|
||||
] @exception
|
||||
"while"
|
||||
"for"
|
||||
"do"
|
||||
"continue"
|
||||
"goto"
|
||||
"foreach"
|
||||
] @keyword.repeat
|
||||
|
||||
[
|
||||
"+"
|
||||
"?"
|
||||
":"
|
||||
"++"
|
||||
"-"
|
||||
"--"
|
||||
"&"
|
||||
"&&"
|
||||
"|"
|
||||
"||"
|
||||
"!"
|
||||
"!="
|
||||
"=="
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"<"
|
||||
"<="
|
||||
">"
|
||||
">="
|
||||
"="
|
||||
"-="
|
||||
"+="
|
||||
"*="
|
||||
"/="
|
||||
"%="
|
||||
"^"
|
||||
"^="
|
||||
"&="
|
||||
"|="
|
||||
"~"
|
||||
">>"
|
||||
">>>"
|
||||
"<<"
|
||||
"<<="
|
||||
">>="
|
||||
">>>="
|
||||
"=>"
|
||||
"??"
|
||||
"??="
|
||||
"try"
|
||||
"catch"
|
||||
"throw"
|
||||
"finally"
|
||||
] @keyword.exception
|
||||
|
||||
[
|
||||
"+"
|
||||
"?"
|
||||
":"
|
||||
"++"
|
||||
"-"
|
||||
"--"
|
||||
"&"
|
||||
"&&"
|
||||
"|"
|
||||
"||"
|
||||
"!"
|
||||
"!="
|
||||
"=="
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"<"
|
||||
"<="
|
||||
">"
|
||||
">="
|
||||
"="
|
||||
"-="
|
||||
"+="
|
||||
"*="
|
||||
"/="
|
||||
"%="
|
||||
"^"
|
||||
"^="
|
||||
"&="
|
||||
"|="
|
||||
"~"
|
||||
">>"
|
||||
">>>"
|
||||
"<<"
|
||||
"<<="
|
||||
">>="
|
||||
">>>="
|
||||
"=>"
|
||||
"??"
|
||||
"??="
|
||||
".."
|
||||
] @operator
|
||||
|
||||
[
|
||||
";"
|
||||
"."
|
||||
","
|
||||
":"
|
||||
";"
|
||||
"."
|
||||
","
|
||||
":"
|
||||
] @punctuation.delimiter
|
||||
|
||||
(conditional_expression ["?" ":"] @conditional.ternary)
|
||||
(conditional_expression
|
||||
[
|
||||
"?"
|
||||
":"
|
||||
] @keyword.conditional.ternary)
|
||||
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
(type_argument_list ["<" ">"] @punctuation.bracket)
|
||||
(interpolation_brace) @punctuation.special
|
||||
|
||||
(type_argument_list
|
||||
[
|
||||
"<"
|
||||
">"
|
||||
] @punctuation.bracket)
|
||||
|
||||
[
|
||||
(this_expression)
|
||||
(base_expression)
|
||||
] @variable.builtin
|
||||
|
||||
[
|
||||
"using"
|
||||
"as"
|
||||
] @include
|
||||
"using"
|
||||
"as"
|
||||
] @keyword.import
|
||||
|
||||
(alias_qualified_name
|
||||
(identifier "global") @include)
|
||||
(identifier
|
||||
"global") @keyword.import)
|
||||
|
||||
[
|
||||
"with"
|
||||
"new"
|
||||
"typeof"
|
||||
"sizeof"
|
||||
"is"
|
||||
"and"
|
||||
"or"
|
||||
"not"
|
||||
"stackalloc"
|
||||
"in"
|
||||
"out"
|
||||
"ref"
|
||||
"with"
|
||||
"new"
|
||||
"typeof"
|
||||
"sizeof"
|
||||
"is"
|
||||
"and"
|
||||
"or"
|
||||
"not"
|
||||
"stackalloc"
|
||||
"__makeref"
|
||||
"__reftype"
|
||||
"__refvalue"
|
||||
"in"
|
||||
"out"
|
||||
"ref"
|
||||
] @keyword.operator
|
||||
|
||||
[
|
||||
"lock"
|
||||
"params"
|
||||
"operator"
|
||||
"default"
|
||||
"implicit"
|
||||
"explicit"
|
||||
"override"
|
||||
"class"
|
||||
"delegate"
|
||||
"enum"
|
||||
"interface"
|
||||
"namespace"
|
||||
"struct"
|
||||
"get"
|
||||
"set"
|
||||
"init"
|
||||
"where"
|
||||
"record"
|
||||
"event"
|
||||
"add"
|
||||
"remove"
|
||||
"checked"
|
||||
"unchecked"
|
||||
"fixed"
|
||||
"alias"
|
||||
"lock"
|
||||
"params"
|
||||
"operator"
|
||||
"default"
|
||||
"implicit"
|
||||
"explicit"
|
||||
"override"
|
||||
"get"
|
||||
"set"
|
||||
"init"
|
||||
"where"
|
||||
"add"
|
||||
"remove"
|
||||
"checked"
|
||||
"unchecked"
|
||||
"fixed"
|
||||
"alias"
|
||||
"file"
|
||||
"unsafe"
|
||||
] @keyword
|
||||
|
||||
(attribute_target_specifier
|
||||
.
|
||||
_ @keyword)
|
||||
|
||||
[
|
||||
"enum"
|
||||
"record"
|
||||
"class"
|
||||
"struct"
|
||||
"interface"
|
||||
"namespace"
|
||||
"event"
|
||||
"delegate"
|
||||
] @keyword.type
|
||||
|
||||
[
|
||||
"async"
|
||||
"await"
|
||||
] @keyword.coroutine
|
||||
|
||||
[
|
||||
"const"
|
||||
"extern"
|
||||
"readonly"
|
||||
"static"
|
||||
"volatile"
|
||||
"required"
|
||||
] @storageclass
|
||||
"const"
|
||||
"extern"
|
||||
"readonly"
|
||||
"static"
|
||||
"volatile"
|
||||
"required"
|
||||
"managed"
|
||||
"unmanaged"
|
||||
"notnull"
|
||||
"abstract"
|
||||
"private"
|
||||
"protected"
|
||||
"internal"
|
||||
"public"
|
||||
"partial"
|
||||
"sealed"
|
||||
"virtual"
|
||||
"global"
|
||||
] @keyword.modifier
|
||||
|
||||
[
|
||||
"abstract"
|
||||
"private"
|
||||
"protected"
|
||||
"internal"
|
||||
"public"
|
||||
"partial"
|
||||
"sealed"
|
||||
"virtual"
|
||||
] @type.qualifier
|
||||
|
||||
(parameter_modifier) @operator
|
||||
(scoped_type
|
||||
"scoped" @keyword.modifier)
|
||||
|
||||
(query_expression
|
||||
(_ [
|
||||
"from"
|
||||
"orderby"
|
||||
"select"
|
||||
"group"
|
||||
"by"
|
||||
"ascending"
|
||||
"descending"
|
||||
"equals"
|
||||
"let"
|
||||
] @keyword))
|
||||
(_
|
||||
[
|
||||
"from"
|
||||
"orderby"
|
||||
"select"
|
||||
"group"
|
||||
"by"
|
||||
"ascending"
|
||||
"descending"
|
||||
"equals"
|
||||
"let"
|
||||
] @keyword))
|
||||
|
||||
[
|
||||
"return"
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
@ -1,41 +1,42 @@
|
||||
;; Definitions
|
||||
; Definitions
|
||||
(variable_declarator
|
||||
. (identifier) @definition.var)
|
||||
.
|
||||
(identifier) @local.definition.var)
|
||||
|
||||
(variable_declarator
|
||||
(tuple_pattern
|
||||
(identifier) @definition.var))
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(declaration_expression
|
||||
name: (identifier) @definition.var)
|
||||
name: (identifier) @local.definition.var)
|
||||
|
||||
(for_each_statement
|
||||
left: (identifier) @definition.var)
|
||||
(foreach_statement
|
||||
left: (identifier) @local.definition.var)
|
||||
|
||||
(for_each_statement
|
||||
(foreach_statement
|
||||
left: (tuple_pattern
|
||||
(identifier) @definition.var))
|
||||
(identifier) @local.definition.var))
|
||||
|
||||
(parameter
|
||||
(identifier) @definition.parameter)
|
||||
(identifier) @local.definition.parameter)
|
||||
|
||||
(method_declaration
|
||||
name: (identifier) @definition.method)
|
||||
name: (identifier) @local.definition.method)
|
||||
|
||||
(local_function_statement
|
||||
name: (identifier) @definition.method)
|
||||
name: (identifier) @local.definition.method)
|
||||
|
||||
(property_declaration
|
||||
name: (identifier) @definition)
|
||||
name: (identifier) @local.definition)
|
||||
|
||||
(type_parameter
|
||||
(identifier) @definition.type)
|
||||
(identifier) @local.definition.type)
|
||||
|
||||
(class_declaration
|
||||
name: (identifier) @definition)
|
||||
name: (identifier) @local.definition)
|
||||
|
||||
;; References
|
||||
(identifier) @reference
|
||||
; References
|
||||
(identifier) @local.reference
|
||||
|
||||
;; Scope
|
||||
(block) @scope
|
||||
; Scope
|
||||
(block) @local.scope
|
||||
|
||||
@ -5,20 +5,16 @@
|
||||
(enum_item)
|
||||
(impl_item)
|
||||
(type_item)
|
||||
|
||||
(use_declaration)
|
||||
(let_declaration)
|
||||
(namespace_definition)
|
||||
|
||||
(arguments)
|
||||
(implicit_arguments)
|
||||
(tuple_type)
|
||||
|
||||
(import_statement)
|
||||
(attribute_statement)
|
||||
(with_statement)
|
||||
(if_statement)
|
||||
|
||||
(function_definition)
|
||||
(struct_definition)
|
||||
(loop_expression)
|
||||
@ -26,6 +22,5 @@
|
||||
(match_expression)
|
||||
(call_expression)
|
||||
(tuple_expression)
|
||||
|
||||
(attribute_item)
|
||||
] @fold
|
||||
|
||||
@ -1,56 +1,61 @@
|
||||
; Preproc
|
||||
|
||||
[
|
||||
"%builtins"
|
||||
"%lang"
|
||||
] @preproc
|
||||
] @keyword.directive
|
||||
|
||||
; Includes
|
||||
|
||||
(import_statement [ "from" "import" ] @include module_name: (dotted_name (identifier) @namespace . ))
|
||||
(import_statement
|
||||
[
|
||||
"from"
|
||||
"import"
|
||||
] @keyword.import
|
||||
module_name: (dotted_name
|
||||
(identifier) @module .))
|
||||
|
||||
[
|
||||
"as"
|
||||
"use"
|
||||
"mod"
|
||||
] @include
|
||||
] @keyword.import
|
||||
|
||||
; Variables
|
||||
|
||||
(identifier) @variable
|
||||
|
||||
; Namespaces
|
||||
|
||||
(namespace_definition (identifier) @namespace)
|
||||
(namespace_definition
|
||||
(identifier) @module)
|
||||
|
||||
(mod_item
|
||||
name: (identifier) @namespace)
|
||||
name: (identifier) @module)
|
||||
|
||||
(use_list (self) @namespace)
|
||||
(use_list
|
||||
(self) @module)
|
||||
|
||||
(scoped_use_list (self) @namespace)
|
||||
(scoped_use_list
|
||||
(self) @module)
|
||||
|
||||
(scoped_identifier
|
||||
path: (identifier) @namespace)
|
||||
path: (identifier) @module)
|
||||
|
||||
(scoped_identifier
|
||||
(scoped_identifier
|
||||
name: (identifier) @namespace))
|
||||
(scoped_identifier
|
||||
name: (identifier) @module))
|
||||
|
||||
(scoped_type_identifier
|
||||
path: (identifier) @namespace)
|
||||
path: (identifier) @module)
|
||||
|
||||
((scoped_identifier
|
||||
path: (identifier) @type)
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
|
||||
((scoped_identifier
|
||||
name: (identifier) @type)
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
name: (identifier) @type)
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
|
||||
((scoped_identifier
|
||||
name: (identifier) @constant)
|
||||
(#lua-match? @constant "^[A-Z][A-Z%d_]*$"))
|
||||
name: (identifier) @constant)
|
||||
(#lua-match? @constant "^[A-Z][A-Z%d_]*$"))
|
||||
|
||||
((scoped_identifier
|
||||
path: (identifier) @type
|
||||
@ -65,25 +70,30 @@
|
||||
(#lua-match? @constant "^[A-Z]"))
|
||||
|
||||
(scoped_use_list
|
||||
path: (identifier) @namespace)
|
||||
path: (identifier) @module)
|
||||
|
||||
(scoped_use_list
|
||||
path: (scoped_identifier
|
||||
(identifier) @namespace))
|
||||
(identifier) @module))
|
||||
|
||||
(use_list (scoped_identifier (identifier) @namespace . (_)))
|
||||
(use_list
|
||||
(scoped_identifier
|
||||
(identifier) @module
|
||||
.
|
||||
(_)))
|
||||
|
||||
(use_list (identifier) @type (#lua-match? @type "^[A-Z]"))
|
||||
(use_list
|
||||
(identifier) @type
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
|
||||
(use_as_clause alias: (identifier) @type (#lua-match? @type "^[A-Z]"))
|
||||
(use_as_clause
|
||||
alias: (identifier) @type
|
||||
(#lua-match? @type "^[A-Z]"))
|
||||
|
||||
; Keywords
|
||||
|
||||
[
|
||||
; 0.x
|
||||
"using"
|
||||
"namespace"
|
||||
"struct"
|
||||
"let"
|
||||
"const"
|
||||
"local"
|
||||
@ -96,18 +106,22 @@
|
||||
"with"
|
||||
"call"
|
||||
"nondet"
|
||||
|
||||
; 1.0
|
||||
"type"
|
||||
"impl"
|
||||
"implicits"
|
||||
"of"
|
||||
"ref"
|
||||
"mut"
|
||||
"trait"
|
||||
"enum"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"struct"
|
||||
"enum"
|
||||
"namespace"
|
||||
"type"
|
||||
"trait"
|
||||
] @keyword.type
|
||||
|
||||
[
|
||||
"func"
|
||||
"fn"
|
||||
@ -125,52 +139,69 @@
|
||||
[
|
||||
"tempvar"
|
||||
"extern"
|
||||
] @storageclass
|
||||
] @keyword.modifier
|
||||
|
||||
[
|
||||
"if"
|
||||
"else"
|
||||
"match"
|
||||
] @conditional
|
||||
] @keyword.conditional
|
||||
|
||||
[
|
||||
"loop"
|
||||
] @repeat
|
||||
"loop" @keyword.repeat
|
||||
|
||||
[
|
||||
"assert"
|
||||
"static_assert"
|
||||
"nopanic"
|
||||
] @exception
|
||||
] @keyword.exception
|
||||
|
||||
; Fields
|
||||
(implicit_arguments
|
||||
(typed_identifier
|
||||
(identifier) @variable.member))
|
||||
|
||||
(implicit_arguments (typed_identifier (identifier) @field))
|
||||
(member_expression
|
||||
"."
|
||||
(identifier) @variable.member)
|
||||
|
||||
(member_expression "." (identifier) @field)
|
||||
(call_expression
|
||||
(assignment_expression
|
||||
left: (identifier) @variable.member))
|
||||
|
||||
(call_expression (assignment_expression left: (identifier) @field))
|
||||
(tuple_expression
|
||||
(assignment_expression
|
||||
left: (identifier) @variable.member))
|
||||
|
||||
(tuple_expression (assignment_expression left: (identifier) @field))
|
||||
(field_identifier) @variable.member
|
||||
|
||||
(field_identifier) @field
|
||||
|
||||
(shorthand_field_initializer (identifier) @field)
|
||||
(shorthand_field_initializer
|
||||
(identifier) @variable.member)
|
||||
|
||||
; Parameters
|
||||
(arguments
|
||||
(typed_identifier
|
||||
(identifier) @variable.parameter))
|
||||
|
||||
(arguments (typed_identifier (identifier) @parameter))
|
||||
(call_expression
|
||||
(tuple_expression
|
||||
(assignment_expression
|
||||
left: (identifier) @variable.parameter)))
|
||||
|
||||
(call_expression (tuple_expression (assignment_expression left: (identifier) @parameter)))
|
||||
(return_type
|
||||
(tuple_type
|
||||
(named_type
|
||||
.
|
||||
(identifier) @variable.parameter)))
|
||||
|
||||
(return_type (tuple_type (named_type . (identifier) @parameter)))
|
||||
|
||||
(parameter (identifier) @parameter)
|
||||
(parameter
|
||||
(identifier) @variable.parameter)
|
||||
|
||||
; Builtins
|
||||
(builtin_directive
|
||||
(identifier) @variable.builtin)
|
||||
|
||||
(builtin_directive (identifier) @variable.builtin)
|
||||
(lang_directive (identifier) @variable.builtin)
|
||||
(lang_directive
|
||||
(identifier) @variable.builtin)
|
||||
|
||||
[
|
||||
"ap"
|
||||
@ -179,32 +210,43 @@
|
||||
] @variable.builtin
|
||||
|
||||
; Functions
|
||||
(function_definition
|
||||
"func"
|
||||
(identifier) @function)
|
||||
|
||||
(function_definition "func" (identifier) @function)
|
||||
(function_definition "fn" (identifier) @function)
|
||||
(function_signature "fn" (identifier) @function)
|
||||
(extern_function_statement (identifier) @function)
|
||||
(function_definition
|
||||
"fn"
|
||||
(identifier) @function)
|
||||
|
||||
(function_signature
|
||||
"fn"
|
||||
(identifier) @function)
|
||||
|
||||
(extern_function_statement
|
||||
(identifier) @function)
|
||||
|
||||
(call_expression
|
||||
function: (identifier) @function.call)
|
||||
|
||||
(call_expression
|
||||
function: (scoped_identifier
|
||||
(identifier) @function.call .))
|
||||
(identifier) @function.call .))
|
||||
|
||||
(call_expression
|
||||
function: (field_expression
|
||||
field: (field_identifier) @function.call))
|
||||
|
||||
[
|
||||
"jmp"
|
||||
] @function.builtin
|
||||
"jmp" @function.builtin
|
||||
|
||||
; Types
|
||||
(struct_definition
|
||||
.
|
||||
(identifier) @type
|
||||
(typed_identifier
|
||||
(identifier) @variable.member)?)
|
||||
|
||||
(struct_definition . (identifier) @type (typed_identifier (identifier) @field)?)
|
||||
|
||||
(named_type (identifier) @type .)
|
||||
(named_type
|
||||
(identifier) @type .)
|
||||
|
||||
[
|
||||
(builtin_type)
|
||||
@ -217,7 +259,6 @@
|
||||
(type_identifier) @type
|
||||
|
||||
; Constants
|
||||
|
||||
((identifier) @constant
|
||||
(#lua-match? @constant "^[A-Z_][A-Z0-9_]*$"))
|
||||
|
||||
@ -231,43 +272,59 @@
|
||||
(#lua-match? @constant "^[A-Z]"))
|
||||
|
||||
((match_arm
|
||||
pattern: (match_pattern (identifier) @constant))
|
||||
(#lua-match? @constant "^[A-Z]"))
|
||||
pattern: (match_pattern
|
||||
(identifier) @constant))
|
||||
(#lua-match? @constant "^[A-Z]"))
|
||||
|
||||
((match_arm
|
||||
pattern: (match_pattern
|
||||
(scoped_identifier
|
||||
name: (identifier) @constant)))
|
||||
(#lua-match? @constant "^[A-Z]"))
|
||||
pattern: (match_pattern
|
||||
(scoped_identifier
|
||||
name: (identifier) @constant)))
|
||||
(#lua-match? @constant "^[A-Z]"))
|
||||
|
||||
((identifier) @constant.builtin
|
||||
(#any-of? @constant.builtin "Some" "None" "Ok" "Err"))
|
||||
(#any-of? @constant.builtin "Some" "None" "Ok" "Err"))
|
||||
|
||||
; Constructors
|
||||
(unary_expression
|
||||
"new"
|
||||
(call_expression
|
||||
.
|
||||
(identifier) @constructor))
|
||||
|
||||
(unary_expression "new" (call_expression . (identifier) @constructor))
|
||||
|
||||
((call_expression . (identifier) @constructor)
|
||||
((call_expression
|
||||
.
|
||||
(identifier) @constructor)
|
||||
(#lua-match? @constructor "^%u"))
|
||||
|
||||
; Attributes
|
||||
(decorator
|
||||
"@" @attribute
|
||||
(identifier) @attribute)
|
||||
|
||||
(decorator "@" @attribute (identifier) @attribute)
|
||||
(attribute_item
|
||||
(identifier) @function.macro)
|
||||
|
||||
(attribute_item (identifier) @function.macro)
|
||||
|
||||
(attribute_item (scoped_identifier (identifier) @function.macro .))
|
||||
(attribute_item
|
||||
(scoped_identifier
|
||||
(identifier) @function.macro .))
|
||||
|
||||
; Labels
|
||||
(label
|
||||
.
|
||||
(identifier) @label)
|
||||
|
||||
(label . (identifier) @label)
|
||||
(inst_jmp_to_label
|
||||
"jmp"
|
||||
.
|
||||
(identifier) @label)
|
||||
|
||||
(inst_jmp_to_label "jmp" . (identifier) @label)
|
||||
|
||||
(inst_jnz_to_label "jmp" . (identifier) @label)
|
||||
(inst_jnz_to_label
|
||||
"jmp"
|
||||
.
|
||||
(identifier) @label)
|
||||
|
||||
; Operators
|
||||
|
||||
[
|
||||
"+"
|
||||
"-"
|
||||
@ -307,7 +364,6 @@
|
||||
] @operator
|
||||
|
||||
; Literals
|
||||
|
||||
(number) @number
|
||||
|
||||
(boolean) @boolean
|
||||
@ -318,17 +374,41 @@
|
||||
] @string
|
||||
|
||||
; Punctuation
|
||||
(attribute_item
|
||||
"#" @punctuation.special)
|
||||
|
||||
(attribute_item "#" @punctuation.special)
|
||||
[
|
||||
"."
|
||||
","
|
||||
":"
|
||||
";"
|
||||
"->"
|
||||
"=>"
|
||||
"::"
|
||||
] @punctuation.delimiter
|
||||
|
||||
[ "." "," ":" ";" "->" "=>" "::" ] @punctuation.delimiter
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"%{"
|
||||
"%}"
|
||||
] @punctuation.bracket
|
||||
|
||||
[ "{" "}" "(" ")" "[" "]" "%{" "%}" ] @punctuation.bracket
|
||||
(type_parameters
|
||||
[
|
||||
"<"
|
||||
">"
|
||||
] @punctuation.bracket)
|
||||
|
||||
(type_parameters [ "<" ">" ] @punctuation.bracket)
|
||||
|
||||
(type_arguments [ "<" ">" ] @punctuation.bracket)
|
||||
(type_arguments
|
||||
[
|
||||
"<"
|
||||
">"
|
||||
] @punctuation.bracket)
|
||||
|
||||
; Comment
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
@ -18,19 +18,31 @@
|
||||
(tuple_pattern)
|
||||
] @indent.begin
|
||||
|
||||
(import_statement "(") @indent.begin
|
||||
(import_statement
|
||||
"(") @indent.begin
|
||||
|
||||
(block
|
||||
"}" @indent.end)
|
||||
|
||||
(block "}" @indent.end)
|
||||
(enum_item
|
||||
body: (enum_variant_list "}" @indent.end))
|
||||
body: (enum_variant_list
|
||||
"}" @indent.end))
|
||||
|
||||
(match_expression
|
||||
body: (match_block "}" @indent.end))
|
||||
body: (match_block
|
||||
"}" @indent.end))
|
||||
|
||||
(mod_item
|
||||
body: (declaration_list "}" @indent.end))
|
||||
body: (declaration_list
|
||||
"}" @indent.end))
|
||||
|
||||
(struct_item
|
||||
body: (field_declaration_list "}" @indent.end))
|
||||
body: (field_declaration_list
|
||||
"}" @indent.end))
|
||||
|
||||
(trait_item
|
||||
body: (declaration_list "}" @indent.end))
|
||||
body: (declaration_list
|
||||
"}" @indent.end))
|
||||
|
||||
[
|
||||
")"
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
(python_code) @python
|
||||
((python_code) @injection.content
|
||||
(#set! injection.language "python"))
|
||||
|
||||
(comment) @comment
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
@ -1,13 +1,13 @@
|
||||
; References
|
||||
(identifier) @local.reference
|
||||
|
||||
(identifier) @reference
|
||||
((type_identifier) @reference
|
||||
((type_identifier) @local.reference
|
||||
(#set! reference.kind "type"))
|
||||
((field_identifier) @reference
|
||||
|
||||
((field_identifier) @local.reference
|
||||
(#set! reference.kind "field"))
|
||||
|
||||
; Scopes
|
||||
|
||||
[
|
||||
(program)
|
||||
(block)
|
||||
@ -16,53 +16,51 @@
|
||||
(if_expression)
|
||||
(match_expression)
|
||||
(match_arm)
|
||||
|
||||
(struct_item)
|
||||
(enum_item)
|
||||
(impl_item)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
(use_declaration
|
||||
argument: (scoped_identifier
|
||||
name: (identifier) @definition.import))
|
||||
(use_declaration
|
||||
argument: (scoped_identifier
|
||||
name: (identifier) @local.definition.import))
|
||||
|
||||
(use_as_clause
|
||||
alias: (identifier) @definition.import)
|
||||
(use_as_clause
|
||||
alias: (identifier) @local.definition.import)
|
||||
|
||||
(use_list
|
||||
(identifier) @definition.import) ; use std::process::{Child, Command, Stdio};
|
||||
(identifier) @local.definition.import) ; use std::process::{Child, Command, Stdio};
|
||||
|
||||
; Functions
|
||||
(function_definition
|
||||
(identifier) @local.definition.function)
|
||||
|
||||
(function_definition
|
||||
(identifier) @definition.function)
|
||||
|
||||
(function_definition
|
||||
(identifier) @definition.method
|
||||
(parameter (self)))
|
||||
(identifier) @local.definition.method
|
||||
(parameter
|
||||
(self)))
|
||||
|
||||
; Function with parameters, defines parameters
|
||||
|
||||
(parameter
|
||||
[ (identifier) (self) ] @definition.parameter)
|
||||
[
|
||||
(identifier)
|
||||
(self)
|
||||
] @local.definition.parameter)
|
||||
|
||||
; Types
|
||||
|
||||
(struct_item
|
||||
name: (type_identifier) @definition.type)
|
||||
name: (type_identifier) @local.definition.type)
|
||||
|
||||
(constrained_type_parameter
|
||||
left: (type_identifier) @definition.type) ; the P in remove_file<P: AsRef<Path>>(path: P)
|
||||
(constrained_type_parameter
|
||||
left: (type_identifier) @local.definition.type) ; the P in remove_file<P: AsRef<Path>>(path: P)
|
||||
|
||||
(enum_item
|
||||
name: (type_identifier) @definition.type)
|
||||
name: (type_identifier) @local.definition.type)
|
||||
|
||||
; Module
|
||||
|
||||
(mod_item
|
||||
name: (identifier) @definition.namespace)
|
||||
(mod_item
|
||||
name: (identifier) @local.definition.namespace)
|
||||
|
||||
; Variables
|
||||
|
||||
(assignment_expression
|
||||
left: (identifier) @definition.var)
|
||||
left: (identifier) @local.definition.var)
|
||||
|
||||
@ -1,39 +1,34 @@
|
||||
; Preproc
|
||||
|
||||
[
|
||||
(unique_id)
|
||||
(top_level_annotation_body)
|
||||
] @preproc
|
||||
] @keyword.directive
|
||||
|
||||
; Includes
|
||||
|
||||
[
|
||||
"import"
|
||||
"$import"
|
||||
"embed"
|
||||
"using"
|
||||
] @include
|
||||
] @keyword.import
|
||||
|
||||
(import_path) @string @text.uri
|
||||
(import_path) @string.special.path
|
||||
|
||||
; Keywords
|
||||
"extends" @keyword
|
||||
|
||||
[
|
||||
"annotation"
|
||||
"enum"
|
||||
"group"
|
||||
"interface"
|
||||
"struct"
|
||||
"interface"
|
||||
"union"
|
||||
"extends"
|
||||
"enum"
|
||||
"annotation"
|
||||
"group"
|
||||
"namespace"
|
||||
] @keyword
|
||||
] @keyword.type
|
||||
|
||||
; Builtins
|
||||
|
||||
[
|
||||
"const"
|
||||
] @type.qualifier
|
||||
"const" @keyword.modifier
|
||||
|
||||
[
|
||||
(primitive_type)
|
||||
@ -41,39 +36,32 @@
|
||||
] @type.builtin
|
||||
|
||||
; Typedefs
|
||||
|
||||
(type_definition) @type.definition
|
||||
|
||||
; Labels (@number, @number!)
|
||||
|
||||
(field_version) @label
|
||||
|
||||
; Methods
|
||||
|
||||
[
|
||||
(annotation_definition_identifier)
|
||||
(method_identifier)
|
||||
] @method
|
||||
] @function.method
|
||||
|
||||
; Fields
|
||||
|
||||
(field_identifier) @field
|
||||
(field_identifier) @variable.member
|
||||
|
||||
; Properties
|
||||
|
||||
(property) @property
|
||||
|
||||
; Parameters
|
||||
|
||||
[
|
||||
(param_identifier)
|
||||
(return_identifier)
|
||||
] @parameter
|
||||
] @variable.parameter
|
||||
|
||||
(annotation_target) @parameter.builtin
|
||||
(annotation_target) @variable.parameter.builtin
|
||||
|
||||
; Constants
|
||||
|
||||
[
|
||||
(const_identifier)
|
||||
(local_const)
|
||||
@ -83,7 +71,6 @@
|
||||
(void) @constant.builtin
|
||||
|
||||
; Types
|
||||
|
||||
[
|
||||
(enum_identifier)
|
||||
(extend_type)
|
||||
@ -91,18 +78,15 @@
|
||||
] @type
|
||||
|
||||
; Attributes
|
||||
|
||||
[
|
||||
(annotation_identifier)
|
||||
(attribute)
|
||||
] @attribute
|
||||
|
||||
; Operators
|
||||
|
||||
"=" @operator
|
||||
|
||||
; Literals
|
||||
|
||||
[
|
||||
(string)
|
||||
(concatenated_string)
|
||||
@ -110,7 +94,7 @@
|
||||
(namespace)
|
||||
] @string
|
||||
|
||||
(namespace) @text.underline
|
||||
(namespace) @string.special
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
@ -118,25 +102,33 @@
|
||||
|
||||
(number) @number
|
||||
|
||||
(float) @float
|
||||
(float) @number.float
|
||||
|
||||
(boolean) @boolean
|
||||
|
||||
(data_hex) @symbol
|
||||
(data_hex) @string.special.symbol
|
||||
|
||||
; Punctuation
|
||||
|
||||
[
|
||||
"*"
|
||||
"$"
|
||||
":"
|
||||
] @punctuation.special
|
||||
|
||||
["{" "}"] @punctuation.bracket
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
["(" ")"] @punctuation.bracket
|
||||
[
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
["[" "]"] @punctuation.bracket
|
||||
[
|
||||
"["
|
||||
"]"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
"."
|
||||
@ -146,5 +138,4 @@
|
||||
] @punctuation.delimiter
|
||||
|
||||
; Comments
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
@ -13,14 +13,17 @@
|
||||
(field)
|
||||
] @indent.begin
|
||||
|
||||
((struct_shorthand (property)) @indent.align
|
||||
((struct_shorthand
|
||||
(property)) @indent.align
|
||||
(#set! indent.open_delimiter "(")
|
||||
(#set! indent.close_delimiter ")"))
|
||||
|
||||
((method (field_version)) @indent.align
|
||||
((method
|
||||
(field_version)) @indent.align
|
||||
(#set! indent.open_delimiter field_version))
|
||||
|
||||
((const_list (const_value)) @indent.align
|
||||
((const_list
|
||||
(const_value)) @indent.align
|
||||
(#set! indent.open_delimiter "[")
|
||||
(#set! indent.close_delimiter "]"))
|
||||
|
||||
@ -31,7 +34,6 @@
|
||||
")"
|
||||
] @indent.end @indent.branch
|
||||
|
||||
|
||||
[
|
||||
(ERROR)
|
||||
(comment)
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
@ -12,79 +12,86 @@
|
||||
(struct)
|
||||
(struct_shorthand)
|
||||
(union)
|
||||
] @scope
|
||||
] @local.scope
|
||||
|
||||
[
|
||||
(extend_type)
|
||||
(field_type)
|
||||
] @reference
|
||||
(custom_type (type_identifier) @reference)
|
||||
] @local.reference
|
||||
|
||||
(custom_type
|
||||
(type_identifier) @local.reference)
|
||||
|
||||
(custom_type
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @reference)))
|
||||
(generic_parameters
|
||||
(generic_identifier) @local.reference)))
|
||||
|
||||
(annotation_definition_identifier) @definition
|
||||
(annotation_definition_identifier) @local.definition
|
||||
|
||||
(const_identifier) @definition.constant
|
||||
(const_identifier) @local.definition.constant
|
||||
|
||||
(enum (enum_identifier) @definition.enum)
|
||||
(enum
|
||||
(enum_identifier) @local.definition.enum)
|
||||
|
||||
[
|
||||
(enum_member)
|
||||
(field_identifier)
|
||||
] @definition.field
|
||||
] @local.definition.field
|
||||
|
||||
(method_identifier) @definition.method
|
||||
(method_identifier) @local.definition.method
|
||||
|
||||
(namespace) @definition.namespace
|
||||
(namespace) @local.definition.namespace
|
||||
|
||||
[
|
||||
(param_identifier)
|
||||
(return_identifier)
|
||||
] @definition.parameter
|
||||
] @local.definition.parameter
|
||||
|
||||
(group (type_identifier) @definition.type)
|
||||
(group
|
||||
(type_identifier) @local.definition.type)
|
||||
|
||||
(struct (type_identifier) @definition.type)
|
||||
(struct
|
||||
(type_identifier) @local.definition.type)
|
||||
|
||||
(union (type_identifier) @definition.type)
|
||||
(union
|
||||
(type_identifier) @local.definition.type)
|
||||
|
||||
(interface (type_identifier) @definition.type)
|
||||
(interface
|
||||
(type_identifier) @local.definition.type)
|
||||
|
||||
; Generics Related (don't know how to combine these)
|
||||
|
||||
(struct
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @definition.parameter)))
|
||||
(generic_identifier) @local.definition.parameter)))
|
||||
|
||||
(interface
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @definition.parameter)))
|
||||
(generic_identifier) @local.definition.parameter)))
|
||||
|
||||
(method
|
||||
(implicit_generics
|
||||
(implicit_generic_parameters
|
||||
(generic_identifier) @definition.parameter)))
|
||||
(generic_identifier) @local.definition.parameter)))
|
||||
|
||||
(method
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @definition.parameter)))
|
||||
(generic_identifier) @local.definition.parameter)))
|
||||
|
||||
(annotation
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @definition.type)))
|
||||
(generic_identifier) @local.definition.type)))
|
||||
|
||||
(replace_using
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @definition.type)))
|
||||
(generic_identifier) @local.definition.type)))
|
||||
|
||||
(return_type
|
||||
(generics
|
||||
(generic_parameters
|
||||
(generic_identifier) @definition.type)))
|
||||
(generic_identifier) @local.definition.type)))
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
[
|
||||
(intent_def)
|
||||
(slot_def)
|
||||
(alias_def)
|
||||
(intent_def)
|
||||
(slot_def)
|
||||
(alias_def)
|
||||
] @fold
|
||||
|
||||
@ -1,50 +1,54 @@
|
||||
;; Punctuation
|
||||
|
||||
; Punctuation
|
||||
[
|
||||
"%["
|
||||
"@["
|
||||
"~["
|
||||
"*["
|
||||
"]"
|
||||
"("
|
||||
")"
|
||||
"%["
|
||||
"@["
|
||||
"~["
|
||||
"*["
|
||||
"]"
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
[":" ","] @punctuation.delimiter
|
||||
"," @punctuation.delimiter
|
||||
|
||||
(["\"" "'"] @punctuation.special @conceal
|
||||
(#set! conceal ""))
|
||||
(eq) @operator
|
||||
|
||||
["%" "?" "#"] @character.special
|
||||
([
|
||||
"\""
|
||||
"'"
|
||||
] @punctuation.special
|
||||
(#set! conceal ""))
|
||||
|
||||
;; Entities
|
||||
[
|
||||
"%"
|
||||
"?"
|
||||
"#"
|
||||
] @character.special
|
||||
|
||||
(intent) @namespace
|
||||
; Entities
|
||||
(intent) @module
|
||||
|
||||
(slot) @type
|
||||
|
||||
(variation) @type.qualifier
|
||||
(variation) @attribute
|
||||
|
||||
(alias) @property
|
||||
(alias) @keyword.directive
|
||||
|
||||
(number) @number
|
||||
|
||||
(argument
|
||||
key: (string) @label
|
||||
key: (string) @property
|
||||
value: (string) @string)
|
||||
|
||||
(escape) @string.escape
|
||||
|
||||
;; Import
|
||||
; Import
|
||||
"import" @keyword.import
|
||||
|
||||
"import" @include
|
||||
(file) @string.special.path
|
||||
|
||||
(file) @string.special
|
||||
|
||||
;; Text
|
||||
|
||||
(word) @text @spell
|
||||
|
||||
;; Comment
|
||||
; Text
|
||||
(word) @spell
|
||||
|
||||
; Comment
|
||||
(comment) @comment @spell
|
||||
|
||||
@ -1,7 +1,8 @@
|
||||
[
|
||||
(intent_def)
|
||||
(slot_def)
|
||||
(alias_def)
|
||||
(intent_def)
|
||||
(slot_def)
|
||||
(alias_def)
|
||||
] @indent.begin
|
||||
|
||||
(ERROR "]") @indent.begin
|
||||
(ERROR
|
||||
"]") @indent.begin
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
@ -1,10 +1,16 @@
|
||||
;; Definitions
|
||||
; Definitions
|
||||
(intent_def
|
||||
(intent) @local.definition)
|
||||
|
||||
(intent_def (intent) @definition)
|
||||
(slot_def (slot) @definition)
|
||||
(alias_def (alias) @definition)
|
||||
(slot_def
|
||||
(slot) @local.definition)
|
||||
|
||||
;; References
|
||||
(alias_def
|
||||
(alias) @local.definition)
|
||||
|
||||
(slot_ref (slot) @reference)
|
||||
(alias_ref (alias) @reference)
|
||||
; References
|
||||
(slot_ref
|
||||
(slot) @local.reference)
|
||||
|
||||
(alias_ref
|
||||
(alias) @local.reference)
|
||||
|
||||
@ -1 +1,2 @@
|
||||
(source (list_lit) @fold)
|
||||
(source
|
||||
(list_lit) @fold)
|
||||
|
||||
@ -1,381 +1,347 @@
|
||||
;; >> Explanation
|
||||
;; Parsers for lisps are a bit weird in that they just return the raw forms.
|
||||
;; This means we have to do a bit of extra work in the queries to get things
|
||||
;; highlighted as they should be.
|
||||
;;
|
||||
;; For the most part this means that some things have to be assigned multiple
|
||||
;; groups.
|
||||
;; By doing this we can add a basic capture and then later refine it with more
|
||||
;; specialized captures.
|
||||
;; This can mean that sometimes things are highlighted weirdly because they
|
||||
;; have multiple highlight groups applied to them.
|
||||
; >> Explanation
|
||||
; Parsers for lisps are a bit weird in that they just return the raw forms.
|
||||
; This means we have to do a bit of extra work in the queries to get things
|
||||
; highlighted as they should be.
|
||||
;
|
||||
; For the most part this means that some things have to be assigned multiple
|
||||
; groups.
|
||||
; By doing this we can add a basic capture and then later refine it with more
|
||||
; specialized captures.
|
||||
; This can mean that sometimes things are highlighted weirdly because they
|
||||
; have multiple highlight groups applied to them.
|
||||
; >> Literals
|
||||
((dis_expr) @comment
|
||||
(#set! "priority" 105)
|
||||
; Higher priority to mark the whole sexpr as a comment
|
||||
)
|
||||
|
||||
(kwd_lit) @string.special.symbol
|
||||
|
||||
;; >> Literals
|
||||
|
||||
(
|
||||
(dis_expr) @comment
|
||||
(#set! "priority" 105) ; Higher priority to mark the whole sexpr as a comment
|
||||
)
|
||||
(kwd_lit) @symbol
|
||||
(str_lit) @string
|
||||
|
||||
(num_lit) @number
|
||||
|
||||
(char_lit) @character
|
||||
|
||||
(bool_lit) @boolean
|
||||
|
||||
(nil_lit) @constant.builtin
|
||||
|
||||
(comment) @comment @spell
|
||||
(regex_lit) @string.regex
|
||||
|
||||
["'" "`"] @string.escape
|
||||
(regex_lit) @string.regexp
|
||||
|
||||
["~" "~@" "#"] @punctuation.special
|
||||
[
|
||||
"'"
|
||||
"`"
|
||||
] @string.escape
|
||||
|
||||
["{" "}" "[" "]" "(" ")"] @punctuation.bracket
|
||||
[
|
||||
"~"
|
||||
"~@"
|
||||
"#"
|
||||
] @punctuation.special
|
||||
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
"["
|
||||
"]"
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
|
||||
;; >> Symbols
|
||||
|
||||
; >> Symbols
|
||||
; General symbol highlighting
|
||||
(sym_lit) @variable
|
||||
|
||||
; General function calls
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @function.call)
|
||||
.
|
||||
(sym_lit) @function.call)
|
||||
|
||||
(anon_fn_lit
|
||||
.
|
||||
(sym_lit) @function.call)
|
||||
.
|
||||
(sym_lit) @function.call)
|
||||
|
||||
; Quoted symbols
|
||||
(quoting_lit
|
||||
(sym_lit) @symbol)
|
||||
(sym_lit) @string.special.symbol)
|
||||
|
||||
(syn_quoting_lit
|
||||
(sym_lit) @symbol)
|
||||
(sym_lit) @string.special.symbol)
|
||||
|
||||
; Used in destructure pattern
|
||||
((sym_lit) @parameter
|
||||
(#lua-match? @parameter "^[&]"))
|
||||
((sym_lit) @variable.parameter
|
||||
(#lua-match? @variable.parameter "^[&]"))
|
||||
|
||||
; Inline function variables
|
||||
((sym_lit) @variable.builtin
|
||||
(#lua-match? @variable.builtin "^%%"))
|
||||
(#lua-match? @variable.builtin "^%%%d*$"))
|
||||
|
||||
((sym_lit) @variable.builtin
|
||||
(#eq? @variable.builtin "%&"))
|
||||
|
||||
; Constructor
|
||||
((sym_lit) @constructor
|
||||
(#lua-match? @constructor "^-%>[^>].*"))
|
||||
(#lua-match? @constructor "^-%>[^>].*"))
|
||||
|
||||
; Builtin dynamic variables
|
||||
((sym_lit) @variable.builtin
|
||||
(#any-of? @variable.builtin
|
||||
"*agent*" "*allow-unresolved-vars*" "*assert*"
|
||||
"*clojure-version*" "*command-line-args*"
|
||||
"*compile-files*" "*compile-path*" "*compiler-options*"
|
||||
"*data-readers*" "*default-data-reader-fn*"
|
||||
"*err*" "*file*" "*flush-on-newline*" "*fn-loader*"
|
||||
"*in*" "*math-context*" "*ns*" "*out*"
|
||||
"*print-dup*" "*print-length*" "*print-level*"
|
||||
"*print-meta*" "*print-namespace-maps*" "*print-readably*"
|
||||
"*read-eval*" "*reader-resolver*"
|
||||
"*source-path*" "*suppress-read*"
|
||||
"*unchecked-math*" "*use-context-classloader*"
|
||||
"*verbose-defrecords*" "*warn-on-reflection*"))
|
||||
(#any-of? @variable.builtin
|
||||
"*agent*" "*allow-unresolved-vars*" "*assert*" "*clojure-version*" "*command-line-args*"
|
||||
"*compile-files*" "*compile-path*" "*compiler-options*" "*data-readers*"
|
||||
"*default-data-reader-fn*" "*err*" "*file*" "*flush-on-newline*" "*fn-loader*" "*in*"
|
||||
"*math-context*" "*ns*" "*out*" "*print-dup*" "*print-length*" "*print-level*" "*print-meta*"
|
||||
"*print-namespace-maps*" "*print-readably*" "*read-eval*" "*reader-resolver*" "*source-path*"
|
||||
"*suppress-read*" "*unchecked-math*" "*use-context-classloader*" "*verbose-defrecords*"
|
||||
"*warn-on-reflection*"))
|
||||
|
||||
; Builtin repl variables
|
||||
((sym_lit) @variable.builtin
|
||||
(#any-of? @variable.builtin
|
||||
"*1" "*2" "*3" "*e"))
|
||||
|
||||
; Gensym
|
||||
;; Might not be needed
|
||||
((sym_lit) @variable
|
||||
(#lua-match? @variable "^.*#$"))
|
||||
(#any-of? @variable.builtin "*1" "*2" "*3" "*e"))
|
||||
|
||||
; Types
|
||||
;; TODO: improve?
|
||||
((sym_lit) @type
|
||||
(#lua-match? @type "^[%u][^/]*$"))
|
||||
;; Symbols with `.` but not `/`
|
||||
((sym_lit) @type
|
||||
(#lua-match? @type "^[^/]+[.][^/]*$"))
|
||||
(sym_lit
|
||||
name: (sym_name) @_name
|
||||
(#lua-match? @_name "^[%u][^/%s]*$")) @type
|
||||
|
||||
; Symbols with `.` but not `/`
|
||||
(sym_lit
|
||||
!namespace
|
||||
name: (sym_name) @_name
|
||||
(#lua-match? @_name "^[^.]+[.]")) @type
|
||||
|
||||
; Interop
|
||||
; (.instanceMember instance args*)
|
||||
; (.instanceMember Classname args*)
|
||||
((sym_lit) @method
|
||||
(#lua-match? @method "^%.[^-]"))
|
||||
((sym_lit
|
||||
name: (sym_name) @_name) @function.method
|
||||
(#lua-match? @_name "^%.[^-]"))
|
||||
|
||||
; (.-instanceField instance)
|
||||
((sym_lit) @field
|
||||
(#lua-match? @field "^%.%-.*"))
|
||||
((sym_name) @variable.member
|
||||
(#lua-match? @variable.member "^%.%-%S*"))
|
||||
|
||||
; Classname/staticField
|
||||
((sym_lit) @field
|
||||
(#lua-match? @field "^[%u].*/.+"))
|
||||
(sym_lit
|
||||
namespace: (sym_ns) @_namespace
|
||||
(#lua-match? @_namespace "^[%u]%S*$")) @variable.member
|
||||
|
||||
; (Classname/staticMethod args*)
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @method
|
||||
(#lua-match? @method "^[%u].*/.+"))
|
||||
;; TODO: Special casing for the `.` macro
|
||||
.
|
||||
(sym_lit
|
||||
namespace: (sym_ns) @_namespace
|
||||
(#lua-match? @_namespace "^%u")) @function.method)
|
||||
|
||||
; TODO: Special casing for the `.` macro
|
||||
; Operators
|
||||
((sym_lit) @operator
|
||||
(#any-of? @operator
|
||||
"*" "*'" "+" "+'" "-" "-'" "/"
|
||||
"<" "<=" ">" ">=" "=" "=="))
|
||||
(#any-of? @operator "*" "*'" "+" "+'" "-" "-'" "/" "<" "<=" ">" ">=" "=" "=="))
|
||||
|
||||
((sym_lit) @keyword.operator
|
||||
(#any-of? @keyword.operator
|
||||
"not" "not=" "and" "or"))
|
||||
(#any-of? @keyword.operator "not" "not=" "and" "or"))
|
||||
|
||||
; Definition functions
|
||||
((sym_lit) @keyword
|
||||
(#any-of? @keyword
|
||||
"def" "defonce" "defrecord" "defmacro" "definline" "definterface"
|
||||
"defmulti" "defmethod" "defstruct" "defprotocol"
|
||||
"deftype"))
|
||||
(#any-of? @keyword
|
||||
"def" "defonce" "defrecord" "defmacro" "definline" "definterface" "defmulti" "defmethod"
|
||||
"defstruct" "defprotocol" "deftype"))
|
||||
|
||||
((sym_lit) @keyword
|
||||
(#eq? @keyword "declare"))
|
||||
(#eq? @keyword "declare"))
|
||||
|
||||
((sym_name) @keyword.coroutine
|
||||
(#any-of? @keyword.coroutine
|
||||
"alts!" "alts!!" "await" "await-for" "await1" "chan" "close!" "future" "go" "sync" "thread" "timeout" "<!" "<!!" ">!" ">!!"))
|
||||
((sym_lit) @keyword.function
|
||||
(#any-of? @keyword.function "defn" "defn-" "fn" "fn*"))
|
||||
(#any-of? @keyword.coroutine
|
||||
"alts!" "alts!!" "await" "await-for" "await1" "chan" "close!" "future" "go" "sync" "thread"
|
||||
"timeout" "<!" "<!!" ">!" ">!!"))
|
||||
|
||||
((sym_lit
|
||||
name: (sym_name) @_keyword.function.name) @keyword.function
|
||||
(#any-of? @_keyword.function.name "defn" "defn-" "fn" "fn*"))
|
||||
|
||||
; Comment
|
||||
((sym_lit) @comment
|
||||
(#any-of? @comment "comment"))
|
||||
(#eq? @comment "comment"))
|
||||
|
||||
; Conditionals
|
||||
((sym_lit) @conditional
|
||||
(#any-of? @conditional
|
||||
"case" "cond" "cond->" "cond->>" "condp"))
|
||||
((sym_lit) @conditional
|
||||
(#any-of? @conditional
|
||||
"if" "if-let" "if-not" "if-some"))
|
||||
((sym_lit) @conditional
|
||||
(#any-of? @conditional
|
||||
"when" "when-first" "when-let" "when-not" "when-some"))
|
||||
((sym_lit) @keyword.conditional
|
||||
(#any-of? @keyword.conditional "case" "cond" "cond->" "cond->>" "condp"))
|
||||
|
||||
((sym_lit) @keyword.conditional
|
||||
(#any-of? @keyword.conditional "if" "if-let" "if-not" "if-some"))
|
||||
|
||||
((sym_lit) @keyword.conditional
|
||||
(#any-of? @keyword.conditional "when" "when-first" "when-let" "when-not" "when-some"))
|
||||
|
||||
; Repeats
|
||||
((sym_lit) @repeat
|
||||
(#any-of? @repeat
|
||||
"doseq" "dotimes" "for" "loop" "recur" "while"))
|
||||
((sym_lit) @keyword.repeat
|
||||
(#any-of? @keyword.repeat "doseq" "dotimes" "for" "loop" "recur" "while"))
|
||||
|
||||
; Exception
|
||||
((sym_lit) @exception
|
||||
(#any-of? @exception
|
||||
"throw" "try" "catch" "finally"))
|
||||
((sym_lit) @keyword.exception
|
||||
(#any-of? @keyword.exception "throw" "try" "catch" "finally"))
|
||||
|
||||
; Includes
|
||||
((sym_lit) @include
|
||||
(#any-of? @include "ns" "import" "require" "use"))
|
||||
((sym_lit) @keyword.import
|
||||
(#any-of? @keyword.import "ns" "import" "require" "use"))
|
||||
|
||||
; Builtin macros
|
||||
;; TODO: Do all these items belong here?
|
||||
((sym_lit) @function.macro
|
||||
(#any-of? @function.macro
|
||||
"." ".." "->" "->>" "amap" "areduce" "as->" "assert"
|
||||
"binding" "bound-fn" "delay" "do" "dosync"
|
||||
"doto" "extend-protocol" "extend-type"
|
||||
"gen-class" "gen-interface" "io!" "lazy-cat"
|
||||
"lazy-seq" "let" "letfn" "locking" "memfn" "monitor-enter"
|
||||
"monitor-exit" "proxy" "proxy-super" "pvalues"
|
||||
"refer-clojure" "reify" "set!" "some->" "some->>"
|
||||
"time" "unquote" "unquote-splicing" "var" "vswap!"
|
||||
"with-bindings" "with-in-str" "with-loading-context" "with-local-vars"
|
||||
"with-open" "with-out-str" "with-precision" "with-redefs"))
|
||||
; TODO: Do all these items belong here?
|
||||
((sym_lit
|
||||
name: (sym_name) @function.macro)
|
||||
(#any-of? @function.macro
|
||||
"." ".." "->" "->>" "amap" "areduce" "as->" "assert" "binding" "bound-fn" "delay" "do" "dosync"
|
||||
"doto" "extend-protocol" "extend-type" "gen-class" "gen-interface" "io!" "lazy-cat" "lazy-seq"
|
||||
"let" "letfn" "locking" "memfn" "monitor-enter" "monitor-exit" "proxy" "proxy-super" "pvalues"
|
||||
"refer-clojure" "reify" "set!" "some->" "some->>" "time" "unquote" "unquote-splicing" "var"
|
||||
"vswap!" "with-bindings" "with-in-str" "with-loading-context" "with-local-vars" "with-open"
|
||||
"with-out-str" "with-precision" "with-redefs"))
|
||||
|
||||
; All builtin functions
|
||||
; (->> (ns-publics *ns*)
|
||||
; (keep (fn [[s v]] (when-not (:macro (meta v)) s)))
|
||||
; sort
|
||||
; clojure.pprint/pprint))
|
||||
;; ...and then lots of manual filtering...
|
||||
((sym_lit) @function.builtin
|
||||
(#any-of? @function.builtin
|
||||
"->ArrayChunk" "->Eduction" "->Vec" "->VecNode" "->VecSeq"
|
||||
"-cache-protocol-fn" "-reset-methods" "PrintWriter-on"
|
||||
"StackTraceElement->vec" "Throwable->map" "accessor"
|
||||
"aclone" "add-classpath" "add-tap" "add-watch" "agent"
|
||||
"agent-error" "agent-errors" "aget" "alength" "alias"
|
||||
"all-ns" "alter" "alter-meta!" "alter-var-root" "ancestors"
|
||||
"any?" "apply" "array-map" "aset" "aset-boolean" "aset-byte"
|
||||
"aset-char" "aset-double" "aset-float" "aset-int"
|
||||
"aset-long" "aset-short" "assoc" "assoc!" "assoc-in"
|
||||
"associative?" "atom" "bases" "bean" "bigdec" "bigint" "biginteger"
|
||||
"bit-and" "bit-and-not" "bit-clear" "bit-flip" "bit-not" "bit-or"
|
||||
"bit-set" "bit-shift-left" "bit-shift-right" "bit-test"
|
||||
"bit-xor" "boolean" "boolean-array" "boolean?"
|
||||
"booleans" "bound-fn*" "bound?" "bounded-count"
|
||||
"butlast" "byte" "byte-array" "bytes" "bytes?"
|
||||
"cast" "cat" "char" "char-array" "char-escape-string"
|
||||
"char-name-string" "char?" "chars" "chunk" "chunk-append"
|
||||
"chunk-buffer" "chunk-cons" "chunk-first" "chunk-next"
|
||||
"chunk-rest" "chunked-seq?" "class" "class?"
|
||||
"clear-agent-errors" "clojure-version" "coll?"
|
||||
"commute" "comp" "comparator" "compare" "compare-and-set!"
|
||||
"compile" "complement" "completing" "concat" "conj"
|
||||
"conj!" "cons" "constantly" "construct-proxy" "contains?"
|
||||
"count" "counted?" "create-ns" "create-struct" "cycle"
|
||||
"dec" "dec'" "decimal?" "dedupe" "default-data-readers"
|
||||
"delay?" "deliver" "denominator" "deref" "derive"
|
||||
"descendants" "destructure" "disj" "disj!" "dissoc"
|
||||
"dissoc!" "distinct" "distinct?" "doall" "dorun" "double"
|
||||
"double-array" "eduction" "empty" "empty?" "ensure" "ensure-reduced"
|
||||
"enumeration-seq" "error-handler" "error-mode" "eval"
|
||||
"even?" "every-pred" "every?" "extend" "extenders" "extends?"
|
||||
"false?" "ffirst" "file-seq" "filter" "filterv" "find"
|
||||
"find-keyword" "find-ns" "find-protocol-impl"
|
||||
"find-protocol-method" "find-var" "first" "flatten"
|
||||
"float" "float-array" "float?" "floats" "flush" "fn?"
|
||||
"fnext" "fnil" "force" "format" "frequencies"
|
||||
"future-call" "future-cancel" "future-cancelled?"
|
||||
"future-done?" "future?" "gensym" "get" "get-in"
|
||||
"get-method" "get-proxy-class" "get-thread-bindings"
|
||||
"get-validator" "group-by" "halt-when" "hash"
|
||||
"hash-combine" "hash-map" "hash-ordered-coll" "hash-set"
|
||||
"hash-unordered-coll" "ident?" "identical?" "identity"
|
||||
"ifn?" "in-ns" "inc" "inc'" "indexed?" "init-proxy"
|
||||
"inst-ms" "inst-ms*" "inst?" "instance?" "int" "int-array"
|
||||
"int?" "integer?" "interleave" "intern" "interpose" "into"
|
||||
"into-array" "ints" "isa?" "iterate" "iterator-seq" "juxt"
|
||||
"keep" "keep-indexed" "key" "keys" "keyword" "keyword?"
|
||||
"last" "line-seq" "list" "list*" "list?" "load" "load-file"
|
||||
"load-reader" "load-string" "loaded-libs" "long" "long-array"
|
||||
"longs" "macroexpand" "macroexpand-1" "make-array" "make-hierarchy"
|
||||
"map" "map-entry?" "map-indexed" "map?" "mapcat" "mapv"
|
||||
"max" "max-key" "memoize" "merge" "merge-with" "meta"
|
||||
"method-sig" "methods" "min" "min-key" "mix-collection-hash"
|
||||
"mod" "munge" "name" "namespace" "namespace-munge" "nat-int?"
|
||||
"neg-int?" "neg?" "newline" "next" "nfirst" "nil?" "nnext"
|
||||
"not-any?" "not-empty" "not-every?" "ns-aliases"
|
||||
"ns-imports" "ns-interns" "ns-map" "ns-name" "ns-publics"
|
||||
"ns-refers" "ns-resolve" "ns-unalias" "ns-unmap" "nth"
|
||||
"nthnext" "nthrest" "num" "number?" "numerator" "object-array"
|
||||
"odd?" "parents" "partial" "partition" "partition-all"
|
||||
"partition-by" "pcalls" "peek" "persistent!" "pmap" "pop"
|
||||
"pop!" "pop-thread-bindings" "pos-int?" "pos?" "pr"
|
||||
"pr-str" "prefer-method" "prefers" "primitives-classnames"
|
||||
"print" "print-ctor" "print-dup" "print-method" "print-simple"
|
||||
"print-str" "printf" "println" "println-str" "prn" "prn-str"
|
||||
"promise" "proxy-call-with-super" "proxy-mappings" "proxy-name"
|
||||
"push-thread-bindings" "qualified-ident?" "qualified-keyword?"
|
||||
"qualified-symbol?" "quot" "rand" "rand-int" "rand-nth" "random-sample"
|
||||
"range" "ratio?" "rational?" "rationalize" "re-find" "re-groups"
|
||||
"re-matcher" "re-matches" "re-pattern" "re-seq" "read"
|
||||
"read+string" "read-line" "read-string" "reader-conditional"
|
||||
"reader-conditional?" "realized?" "record?" "reduce"
|
||||
"reduce-kv" "reduced" "reduced?" "reductions" "ref" "ref-history-count"
|
||||
"ref-max-history" "ref-min-history" "ref-set" "refer"
|
||||
"release-pending-sends" "rem" "remove" "remove-all-methods"
|
||||
"remove-method" "remove-ns" "remove-tap" "remove-watch"
|
||||
"repeat" "repeatedly" "replace" "replicate"
|
||||
"requiring-resolve" "reset!" "reset-meta!" "reset-vals!"
|
||||
"resolve" "rest" "restart-agent" "resultset-seq" "reverse"
|
||||
"reversible?" "rseq" "rsubseq" "run!" "satisfies?"
|
||||
"second" "select-keys" "send" "send-off" "send-via"
|
||||
"seq" "seq?" "seqable?" "seque" "sequence" "sequential?"
|
||||
"set" "set-agent-send-executor!" "set-agent-send-off-executor!"
|
||||
"set-error-handler!" "set-error-mode!" "set-validator!"
|
||||
"set?" "short" "short-array" "shorts" "shuffle"
|
||||
"shutdown-agents" "simple-ident?" "simple-keyword?"
|
||||
"simple-symbol?" "slurp" "some" "some-fn" "some?"
|
||||
"sort" "sort-by" "sorted-map" "sorted-map-by"
|
||||
"sorted-set" "sorted-set-by" "sorted?" "special-symbol?"
|
||||
"spit" "split-at" "split-with" "str" "string?"
|
||||
"struct" "struct-map" "subs" "subseq" "subvec" "supers"
|
||||
"swap!" "swap-vals!" "symbol" "symbol?" "tagged-literal"
|
||||
"tagged-literal?" "take" "take-last" "take-nth" "take-while"
|
||||
"tap>" "test" "the-ns" "thread-bound?" "to-array"
|
||||
"to-array-2d" "trampoline" "transduce" "transient"
|
||||
"tree-seq" "true?" "type" "unchecked-add" "unchecked-add-int"
|
||||
"unchecked-byte" "unchecked-char" "unchecked-dec"
|
||||
"unchecked-dec-int" "unchecked-divide-int" "unchecked-double"
|
||||
"unchecked-float" "unchecked-inc" "unchecked-inc-int"
|
||||
"unchecked-int" "unchecked-long" "unchecked-multiply"
|
||||
"unchecked-multiply-int" "unchecked-negate" "unchecked-negate-int"
|
||||
"unchecked-remainder-int" "unchecked-short" "unchecked-subtract"
|
||||
"unchecked-subtract-int" "underive" "unquote"
|
||||
"unquote-splicing" "unreduced" "unsigned-bit-shift-right"
|
||||
"update" "update-in" "update-proxy" "uri?" "uuid?"
|
||||
"val" "vals" "var-get" "var-set" "var?" "vary-meta" "vec"
|
||||
"vector" "vector-of" "vector?" "volatile!" "volatile?"
|
||||
"vreset!" "with-bindings*" "with-meta" "with-redefs-fn" "xml-seq"
|
||||
"zero?" "zipmap"
|
||||
;; earlier
|
||||
"drop" "drop-last" "drop-while"
|
||||
"double?" "doubles"
|
||||
"ex-data" "ex-info"
|
||||
;; 1.10
|
||||
"ex-cause" "ex-message"
|
||||
;; 1.11
|
||||
"NaN?" "abs" "infinite?" "iteration" "random-uuid"
|
||||
"parse-boolean" "parse-double" "parse-long" "parse-uuid"
|
||||
"seq-to-map-for-destructuring" "update-keys" "update-vals"
|
||||
;; 1.12
|
||||
"partitionv" "partitionv-all" "splitv-at"))
|
||||
; ...and then lots of manual filtering...
|
||||
((sym_lit
|
||||
name: (sym_name) @function.builtin)
|
||||
(#any-of? @function.builtin
|
||||
"->ArrayChunk" "->Eduction" "->Vec" "->VecNode" "->VecSeq" "-cache-protocol-fn" "-reset-methods"
|
||||
"PrintWriter-on" "StackTraceElement->vec" "Throwable->map" "accessor" "aclone" "add-classpath"
|
||||
"add-tap" "add-watch" "agent" "agent-error" "agent-errors" "aget" "alength" "alias" "all-ns"
|
||||
"alter" "alter-meta!" "alter-var-root" "ancestors" "any?" "apply" "array-map" "aset"
|
||||
"aset-boolean" "aset-byte" "aset-char" "aset-double" "aset-float" "aset-int" "aset-long"
|
||||
"aset-short" "assoc" "assoc!" "assoc-in" "associative?" "atom" "bases" "bean" "bigdec" "bigint"
|
||||
"biginteger" "bit-and" "bit-and-not" "bit-clear" "bit-flip" "bit-not" "bit-or" "bit-set"
|
||||
"bit-shift-left" "bit-shift-right" "bit-test" "bit-xor" "boolean" "boolean-array" "boolean?"
|
||||
"booleans" "bound-fn*" "bound?" "bounded-count" "butlast" "byte" "byte-array" "bytes" "bytes?"
|
||||
"cast" "cat" "char" "char-array" "char-escape-string" "char-name-string" "char?" "chars" "chunk"
|
||||
"chunk-append" "chunk-buffer" "chunk-cons" "chunk-first" "chunk-next" "chunk-rest"
|
||||
"chunked-seq?" "class" "class?" "clear-agent-errors" "clojure-version" "coll?" "commute" "comp"
|
||||
"comparator" "compare" "compare-and-set!" "compile" "complement" "completing" "concat" "conj"
|
||||
"conj!" "cons" "constantly" "construct-proxy" "contains?" "count" "counted?" "create-ns"
|
||||
"create-struct" "cycle" "dec" "dec'" "decimal?" "dedupe" "default-data-readers" "delay?"
|
||||
"deliver" "denominator" "deref" "derive" "descendants" "destructure" "disj" "disj!" "dissoc"
|
||||
"dissoc!" "distinct" "distinct?" "doall" "dorun" "double" "double-array" "eduction" "empty"
|
||||
"empty?" "ensure" "ensure-reduced" "enumeration-seq" "error-handler" "error-mode" "eval" "even?"
|
||||
"every-pred" "every?" "extend" "extenders" "extends?" "false?" "ffirst" "file-seq" "filter"
|
||||
"filterv" "find" "find-keyword" "find-ns" "find-protocol-impl" "find-protocol-method" "find-var"
|
||||
"first" "flatten" "float" "float-array" "float?" "floats" "flush" "fn?" "fnext" "fnil" "force"
|
||||
"format" "frequencies" "future-call" "future-cancel" "future-cancelled?" "future-done?"
|
||||
"future?" "gensym" "get" "get-in" "get-method" "get-proxy-class" "get-thread-bindings"
|
||||
"get-validator" "group-by" "halt-when" "hash" "hash-combine" "hash-map" "hash-ordered-coll"
|
||||
"hash-set" "hash-unordered-coll" "ident?" "identical?" "identity" "ifn?" "in-ns" "inc" "inc'"
|
||||
"indexed?" "init-proxy" "inst-ms" "inst-ms*" "inst?" "instance?" "int" "int-array" "int?"
|
||||
"integer?" "interleave" "intern" "interpose" "into" "into-array" "ints" "isa?" "iterate"
|
||||
"iterator-seq" "juxt" "keep" "keep-indexed" "key" "keys" "keyword" "keyword?" "last" "line-seq"
|
||||
"list" "list*" "list?" "load" "load-file" "load-reader" "load-string" "loaded-libs" "long"
|
||||
"long-array" "longs" "macroexpand" "macroexpand-1" "make-array" "make-hierarchy" "map"
|
||||
"map-entry?" "map-indexed" "map?" "mapcat" "mapv" "max" "max-key" "memoize" "merge" "merge-with"
|
||||
"meta" "method-sig" "methods" "min" "min-key" "mix-collection-hash" "mod" "munge" "name"
|
||||
"namespace" "namespace-munge" "nat-int?" "neg-int?" "neg?" "newline" "next" "nfirst" "nil?"
|
||||
"nnext" "not-any?" "not-empty" "not-every?" "ns-aliases" "ns-imports" "ns-interns" "ns-map"
|
||||
"ns-name" "ns-publics" "ns-refers" "ns-resolve" "ns-unalias" "ns-unmap" "nth" "nthnext"
|
||||
"nthrest" "num" "number?" "numerator" "object-array" "odd?" "parents" "partial" "partition"
|
||||
"partition-all" "partition-by" "pcalls" "peek" "persistent!" "pmap" "pop" "pop!"
|
||||
"pop-thread-bindings" "pos-int?" "pos?" "pr" "pr-str" "prefer-method" "prefers"
|
||||
"primitives-classnames" "print" "print-ctor" "print-dup" "print-method" "print-simple"
|
||||
"print-str" "printf" "println" "println-str" "prn" "prn-str" "promise" "proxy-call-with-super"
|
||||
"proxy-mappings" "proxy-name" "push-thread-bindings" "qualified-ident?" "qualified-keyword?"
|
||||
"qualified-symbol?" "quot" "rand" "rand-int" "rand-nth" "random-sample" "range" "ratio?"
|
||||
"rational?" "rationalize" "re-find" "re-groups" "re-matcher" "re-matches" "re-pattern" "re-seq"
|
||||
"read" "read+string" "read-line" "read-string" "reader-conditional" "reader-conditional?"
|
||||
"realized?" "record?" "reduce" "reduce-kv" "reduced" "reduced?" "reductions" "ref"
|
||||
"ref-history-count" "ref-max-history" "ref-min-history" "ref-set" "refer"
|
||||
"release-pending-sends" "rem" "remove" "remove-all-methods" "remove-method" "remove-ns"
|
||||
"remove-tap" "remove-watch" "repeat" "repeatedly" "replace" "replicate" "requiring-resolve"
|
||||
"reset!" "reset-meta!" "reset-vals!" "resolve" "rest" "restart-agent" "resultset-seq" "reverse"
|
||||
"reversible?" "rseq" "rsubseq" "run!" "satisfies?" "second" "select-keys" "send" "send-off"
|
||||
"send-via" "seq" "seq?" "seqable?" "seque" "sequence" "sequential?" "set"
|
||||
"set-agent-send-executor!" "set-agent-send-off-executor!" "set-error-handler!" "set-error-mode!"
|
||||
"set-validator!" "set?" "short" "short-array" "shorts" "shuffle" "shutdown-agents"
|
||||
"simple-ident?" "simple-keyword?" "simple-symbol?" "slurp" "some" "some-fn" "some?" "sort"
|
||||
"sort-by" "sorted-map" "sorted-map-by" "sorted-set" "sorted-set-by" "sorted?" "special-symbol?"
|
||||
"spit" "split-at" "split-with" "str" "string?" "struct" "struct-map" "subs" "subseq" "subvec"
|
||||
"supers" "swap!" "swap-vals!" "symbol" "symbol?" "tagged-literal" "tagged-literal?" "take"
|
||||
"take-last" "take-nth" "take-while" "tap>" "test" "the-ns" "thread-bound?" "to-array"
|
||||
"to-array-2d" "trampoline" "transduce" "transient" "tree-seq" "true?" "type" "unchecked-add"
|
||||
"unchecked-add-int" "unchecked-byte" "unchecked-char" "unchecked-dec" "unchecked-dec-int"
|
||||
"unchecked-divide-int" "unchecked-double" "unchecked-float" "unchecked-inc" "unchecked-inc-int"
|
||||
"unchecked-int" "unchecked-long" "unchecked-multiply" "unchecked-multiply-int"
|
||||
"unchecked-negate" "unchecked-negate-int" "unchecked-remainder-int" "unchecked-short"
|
||||
"unchecked-subtract" "unchecked-subtract-int" "underive" "unquote" "unquote-splicing"
|
||||
"unreduced" "unsigned-bit-shift-right" "update" "update-in" "update-proxy" "uri?" "uuid?" "val"
|
||||
"vals" "var-get" "var-set" "var?" "vary-meta" "vec" "vector" "vector-of" "vector?" "volatile!"
|
||||
"volatile?" "vreset!" "with-bindings*" "with-meta" "with-redefs-fn" "xml-seq" "zero?" "zipmap"
|
||||
; earlier
|
||||
"drop" "drop-last" "drop-while" "double?" "doubles" "ex-data" "ex-info"
|
||||
; 1.10
|
||||
"ex-cause" "ex-message"
|
||||
; 1.11
|
||||
"NaN?" "abs" "infinite?" "iteration" "random-uuid" "parse-boolean" "parse-double" "parse-long"
|
||||
"parse-uuid" "seq-to-map-for-destructuring" "update-keys" "update-vals"
|
||||
; 1.12
|
||||
"partitionv" "partitionv-all" "splitv-at"))
|
||||
|
||||
|
||||
|
||||
;; >> Context based highlighting
|
||||
|
||||
;; def-likes
|
||||
;; Correctly highlight docstrings
|
||||
; >> Context based highlighting
|
||||
; def-likes
|
||||
; Correctly highlight docstrings
|
||||
;(list_lit
|
||||
;.
|
||||
;(sym_lit) @_keyword ; Don't really want to highlight twice
|
||||
;(#any-of? @_keyword
|
||||
;"def" "defonce" "defrecord" "defmacro" "definline"
|
||||
;"defmulti" "defmethod" "defstruct" "defprotocol"
|
||||
;"deftype")
|
||||
;.
|
||||
;(sym_lit)
|
||||
;.
|
||||
;;; TODO: Add @comment highlight
|
||||
;(str_lit)?
|
||||
;.
|
||||
;(_))
|
||||
|
||||
;.
|
||||
;(sym_lit) @_keyword ; Don't really want to highlight twice
|
||||
;(#any-of? @_keyword
|
||||
;"def" "defonce" "defrecord" "defmacro" "definline"
|
||||
;"defmulti" "defmethod" "defstruct" "defprotocol"
|
||||
;"deftype")
|
||||
;.
|
||||
;(sym_lit)
|
||||
;.
|
||||
; TODO: Add @comment highlight
|
||||
;(str_lit)?
|
||||
;.
|
||||
;(_))
|
||||
; Function definitions
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @_keyword.function
|
||||
(#any-of? @_keyword.function "fn" "fn*" "defn" "defn-")
|
||||
.
|
||||
(sym_lit)? @function
|
||||
.
|
||||
;; TODO: Add @comment highlight
|
||||
(str_lit)?)
|
||||
;; TODO: Fix parameter highlighting
|
||||
;; I think there's a bug here in nvim-treesitter
|
||||
;; TODO: Reproduce bug and file ticket
|
||||
;.
|
||||
;[(vec_lit
|
||||
; (sym_lit)* @parameter)
|
||||
; (list_lit
|
||||
; (vec_lit
|
||||
; (sym_lit)* @parameter))])
|
||||
|
||||
.
|
||||
((sym_lit
|
||||
name: (sym_name) @_keyword.function.name)
|
||||
(#any-of? @_keyword.function.name "defn" "defn-" "fn" "fn*"))
|
||||
.
|
||||
(sym_lit)? @function
|
||||
.
|
||||
; TODO: Add @comment highlight
|
||||
(str_lit)?)
|
||||
|
||||
; TODO: Fix parameter highlighting
|
||||
; I think there's a bug here in nvim-treesitter
|
||||
; TODO: Reproduce bug and file ticket
|
||||
;.
|
||||
;[(vec_lit
|
||||
; (sym_lit)* @variable.parameter)
|
||||
; (list_lit
|
||||
; (vec_lit
|
||||
; (sym_lit)* @variable.parameter))])
|
||||
;[((list_lit
|
||||
; (vec_lit
|
||||
; (sym_lit) @parameter)
|
||||
; (sym_lit) @variable.parameter)
|
||||
; (_)
|
||||
; +
|
||||
; ((vec_lit
|
||||
; (sym_lit) @parameter)
|
||||
; (sym_lit) @variable.parameter)
|
||||
; (_)))
|
||||
|
||||
|
||||
; Meta punctuation
|
||||
;; NOTE: When the above `Function definitions` query captures the
|
||||
;; the @function it also captures the child meta_lit
|
||||
;; We capture the meta_lit symbol (^) after so that the later
|
||||
;; highlighting overrides the former
|
||||
; NOTE: When the above `Function definitions` query captures the
|
||||
; the @function it also captures the child meta_lit
|
||||
; We capture the meta_lit symbol (^) after so that the later
|
||||
; highlighting overrides the former
|
||||
"^" @punctuation.special
|
||||
|
||||
;; namespaces
|
||||
; namespaces
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @_include
|
||||
(#eq? @_include "ns")
|
||||
.
|
||||
(sym_lit) @namespace)
|
||||
.
|
||||
(sym_lit) @_include
|
||||
(#eq? @_include "ns")
|
||||
.
|
||||
(sym_lit) @module)
|
||||
|
||||
@ -1,2 +1,2 @@
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
[
|
||||
(if_condition)
|
||||
(foreach_loop)
|
||||
(while_loop)
|
||||
(function_def)
|
||||
(macro_def)
|
||||
(block_def)
|
||||
(if_condition)
|
||||
(foreach_loop)
|
||||
(while_loop)
|
||||
(function_def)
|
||||
(macro_def)
|
||||
(block_def)
|
||||
] @fold
|
||||
|
||||
@ -1,217 +1,221 @@
|
||||
(normal_command
|
||||
(identifier)
|
||||
(argument_list
|
||||
(argument (unquoted_argument)) @constant
|
||||
)
|
||||
(#lua-match? @constant "^[%u@][%u%d_]+$")
|
||||
)
|
||||
(argument
|
||||
(unquoted_argument)) @constant)
|
||||
(#lua-match? @constant "^[%u@][%u%d_]+$"))
|
||||
|
||||
[
|
||||
(quoted_argument)
|
||||
(bracket_argument)
|
||||
(quoted_argument)
|
||||
(bracket_argument)
|
||||
] @string
|
||||
|
||||
(variable_ref) @none
|
||||
|
||||
(variable) @variable
|
||||
|
||||
[
|
||||
(bracket_comment)
|
||||
(line_comment)
|
||||
(bracket_comment)
|
||||
(line_comment)
|
||||
] @comment @spell
|
||||
|
||||
(normal_command (identifier) @function)
|
||||
|
||||
["ENV" "CACHE"] @storageclass
|
||||
["$" "{" "}" "<" ">"] @punctuation.special
|
||||
["(" ")"] @punctuation.bracket
|
||||
(normal_command
|
||||
(identifier) @function)
|
||||
|
||||
[
|
||||
(function)
|
||||
(endfunction)
|
||||
(macro)
|
||||
(endmacro)
|
||||
"ENV"
|
||||
"CACHE"
|
||||
] @module
|
||||
|
||||
[
|
||||
"$"
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.special
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
(function)
|
||||
(endfunction)
|
||||
(macro)
|
||||
(endmacro)
|
||||
] @keyword.function
|
||||
|
||||
[
|
||||
(if)
|
||||
(elseif)
|
||||
(else)
|
||||
(endif)
|
||||
] @conditional
|
||||
(if)
|
||||
(elseif)
|
||||
(else)
|
||||
(endif)
|
||||
] @keyword.conditional
|
||||
|
||||
[
|
||||
(foreach)
|
||||
(endforeach)
|
||||
(while)
|
||||
(endwhile)
|
||||
] @repeat
|
||||
(foreach)
|
||||
(endforeach)
|
||||
(while)
|
||||
(endwhile)
|
||||
] @keyword.repeat
|
||||
|
||||
(normal_command
|
||||
(identifier) @repeat
|
||||
(#match? @repeat "\\c^(continue|break)$")
|
||||
)
|
||||
(identifier) @keyword.repeat
|
||||
(#match? @keyword.repeat "\\c^(continue|break)$"))
|
||||
|
||||
(normal_command
|
||||
(identifier) @keyword.return
|
||||
(#match? @keyword.return "\\c^return$")
|
||||
)
|
||||
(#match? @keyword.return "\\c^return$"))
|
||||
|
||||
(function_command
|
||||
(function)
|
||||
(argument_list
|
||||
. (argument) @function
|
||||
(argument)* @parameter
|
||||
)
|
||||
)
|
||||
.
|
||||
(argument) @function
|
||||
(argument)* @variable.parameter))
|
||||
|
||||
(macro_command
|
||||
(macro)
|
||||
(argument_list
|
||||
. (argument) @function.macro
|
||||
(argument)* @parameter
|
||||
)
|
||||
)
|
||||
.
|
||||
(argument) @function.macro
|
||||
(argument)* @variable.parameter))
|
||||
|
||||
(block_def
|
||||
(block_command
|
||||
(block) @function.builtin
|
||||
(argument_list
|
||||
(argument (unquoted_argument) @constant)
|
||||
)
|
||||
(#any-of? @constant "SCOPE_FOR" "POLICIES" "VARIABLES" "PROPAGATE")
|
||||
)
|
||||
(endblock_command (endblock) @function.builtin)
|
||||
)
|
||||
(argument
|
||||
(unquoted_argument) @constant))
|
||||
(#any-of? @constant "SCOPE_FOR" "POLICIES" "VARIABLES" "PROPAGATE"))
|
||||
(endblock_command
|
||||
(endblock) @function.builtin))
|
||||
|
||||
;
|
||||
((argument) @boolean
|
||||
(#match? @boolean "\\c^(1|on|yes|true|y|0|off|no|false|n|ignore|notfound|.*-notfound)$")
|
||||
)
|
||||
(#match? @boolean "\\c^(1|on|yes|true|y|0|off|no|false|n|ignore|notfound|.*-notfound)$"))
|
||||
|
||||
;
|
||||
(if_command
|
||||
(if)
|
||||
(argument_list
|
||||
(argument) @keyword.operator
|
||||
)
|
||||
(#any-of? @keyword.operator "NOT" "AND" "OR"
|
||||
"COMMAND" "POLICY" "TARGET" "TEST" "DEFINED" "IN_LIST"
|
||||
"EXISTS" "IS_NEWER_THAN" "IS_DIRECTORY" "IS_SYMLINK" "IS_ABSOLUTE"
|
||||
"MATCHES"
|
||||
"LESS" "GREATER" "EQUAL" "LESS_EQUAL" "GREATER_EQUAL"
|
||||
"STRLESS" "STRGREATER" "STREQUAL" "STRLESS_EQUAL" "STRGREATER_EQUAL"
|
||||
"VERSION_LESS" "VERSION_GREATER" "VERSION_EQUAL" "VERSION_LESS_EQUAL" "VERSION_GREATER_EQUAL"
|
||||
)
|
||||
)
|
||||
(argument) @keyword.operator)
|
||||
(#any-of? @keyword.operator
|
||||
"NOT" "AND" "OR" "COMMAND" "POLICY" "TARGET" "TEST" "DEFINED" "IN_LIST" "EXISTS" "IS_NEWER_THAN"
|
||||
"IS_DIRECTORY" "IS_SYMLINK" "IS_ABSOLUTE" "MATCHES" "LESS" "GREATER" "EQUAL" "LESS_EQUAL"
|
||||
"GREATER_EQUAL" "STRLESS" "STRGREATER" "STREQUAL" "STRLESS_EQUAL" "STRGREATER_EQUAL"
|
||||
"VERSION_LESS" "VERSION_GREATER" "VERSION_EQUAL" "VERSION_LESS_EQUAL" "VERSION_GREATER_EQUAL"))
|
||||
|
||||
(elseif_command
|
||||
(elseif)
|
||||
(argument_list
|
||||
(argument) @keyword.operator
|
||||
)
|
||||
(#any-of? @keyword.operator "NOT" "AND" "OR"
|
||||
"COMMAND" "POLICY" "TARGET" "TEST" "DEFINED" "IN_LIST"
|
||||
"EXISTS" "IS_NEWER_THAN" "IS_DIRECTORY" "IS_SYMLINK" "IS_ABSOLUTE"
|
||||
"MATCHES"
|
||||
"LESS" "GREATER" "EQUAL" "LESS_EQUAL" "GREATER_EQUAL"
|
||||
"STRLESS" "STRGREATER" "STREQUAL" "STRLESS_EQUAL" "STRGREATER_EQUAL"
|
||||
"VERSION_LESS" "VERSION_GREATER" "VERSION_EQUAL" "VERSION_LESS_EQUAL" "VERSION_GREATER_EQUAL"
|
||||
)
|
||||
)
|
||||
(argument) @keyword.operator)
|
||||
(#any-of? @keyword.operator
|
||||
"NOT" "AND" "OR" "COMMAND" "POLICY" "TARGET" "TEST" "DEFINED" "IN_LIST" "EXISTS" "IS_NEWER_THAN"
|
||||
"IS_DIRECTORY" "IS_SYMLINK" "IS_ABSOLUTE" "MATCHES" "LESS" "GREATER" "EQUAL" "LESS_EQUAL"
|
||||
"GREATER_EQUAL" "STRLESS" "STRGREATER" "STREQUAL" "STRLESS_EQUAL" "STRGREATER_EQUAL"
|
||||
"VERSION_LESS" "VERSION_GREATER" "VERSION_EQUAL" "VERSION_LESS_EQUAL" "VERSION_GREATER_EQUAL"))
|
||||
|
||||
(normal_command
|
||||
(identifier) @function.builtin
|
||||
(#match? @function.builtin "\\c^(cmake_host_system_information|cmake_language|cmake_minimum_required|cmake_parse_arguments|cmake_path|cmake_policy|configure_file|execute_process|file|find_file|find_library|find_package|find_path|find_program|foreach|get_cmake_property|get_directory_property|get_filename_component|get_property|include|include_guard|list|macro|mark_as_advanced|math|message|option|separate_arguments|set|set_directory_properties|set_property|site_name|string|unset|variable_watch|add_compile_definitions|add_compile_options|add_custom_command|add_custom_target|add_definitions|add_dependencies|add_executable|add_library|add_link_options|add_subdirectory|add_test|aux_source_directory|build_command|create_test_sourcelist|define_property|enable_language|enable_testing|export|fltk_wrap_ui|get_source_file_property|get_target_property|get_test_property|include_directories|include_external_msproject|include_regular_expression|install|link_directories|link_libraries|load_cache|project|remove_definitions|set_source_files_properties|set_target_properties|set_tests_properties|source_group|target_compile_definitions|target_compile_features|target_compile_options|target_include_directories|target_link_directories|target_link_libraries|target_link_options|target_precompile_headers|target_sources|try_compile|try_run|ctest_build|ctest_configure|ctest_coverage|ctest_empty_binary_directory|ctest_memcheck|ctest_read_custom_files|ctest_run_script|ctest_sleep|ctest_start|ctest_submit|ctest_test|ctest_update|ctest_upload)$")
|
||||
)
|
||||
(#match? @function.builtin
|
||||
"\\c^(cmake_host_system_information|cmake_language|cmake_minimum_required|cmake_parse_arguments|cmake_path|cmake_policy|configure_file|execute_process|file|find_file|find_library|find_package|find_path|find_program|foreach|get_cmake_property|get_directory_property|get_filename_component|get_property|include|include_guard|list|macro|mark_as_advanced|math|message|option|separate_arguments|set|set_directory_properties|set_property|site_name|string|unset|variable_watch|add_compile_definitions|add_compile_options|add_custom_command|add_custom_target|add_definitions|add_dependencies|add_executable|add_library|add_link_options|add_subdirectory|add_test|aux_source_directory|build_command|create_test_sourcelist|define_property|enable_language|enable_testing|export|fltk_wrap_ui|get_source_file_property|get_target_property|get_test_property|include_directories|include_external_msproject|include_regular_expression|install|link_directories|link_libraries|load_cache|project|remove_definitions|set_source_files_properties|set_target_properties|set_tests_properties|source_group|target_compile_definitions|target_compile_features|target_compile_options|target_include_directories|target_link_directories|target_link_libraries|target_link_options|target_precompile_headers|target_sources|try_compile|try_run|ctest_build|ctest_configure|ctest_coverage|ctest_empty_binary_directory|ctest_memcheck|ctest_read_custom_files|ctest_run_script|ctest_sleep|ctest_start|ctest_submit|ctest_test|ctest_update|ctest_upload)$"))
|
||||
|
||||
(normal_command
|
||||
(identifier) @_function
|
||||
(argument_list
|
||||
. (argument) @variable
|
||||
)
|
||||
(#match? @_function "\\c^set$")
|
||||
)
|
||||
|
||||
(normal_command
|
||||
(identifier) @_function
|
||||
(#match? @_function "\\c^set$")
|
||||
(argument_list
|
||||
. (argument)
|
||||
(
|
||||
(argument) @_cache @storageclass
|
||||
.
|
||||
(argument) @_type @type
|
||||
(#any-of? @_cache "CACHE")
|
||||
(#any-of? @_type "BOOL" "FILEPATH" "PATH" "STRING" "INTERNAL")
|
||||
)
|
||||
)
|
||||
)
|
||||
(argument) @variable)
|
||||
(#match? @_function "\\c^set$"))
|
||||
|
||||
(normal_command
|
||||
(identifier) @_function
|
||||
(#match? @_function "\\c^set$")
|
||||
(argument_list
|
||||
.
|
||||
(argument)
|
||||
((argument) @_cache @keyword.modifier
|
||||
.
|
||||
(argument) @_type @type
|
||||
(#any-of? @_cache "CACHE")
|
||||
(#any-of? @_type "BOOL" "FILEPATH" "PATH" "STRING" "INTERNAL"))))
|
||||
|
||||
(normal_command
|
||||
(identifier) @_function
|
||||
(#match? @_function "\\c^unset$")
|
||||
(argument_list
|
||||
. (argument)
|
||||
(argument) @storageclass
|
||||
(#any-of? @storageclass "CACHE" "PARENT_SCOPE")
|
||||
)
|
||||
)
|
||||
.
|
||||
(argument)
|
||||
(argument) @keyword.modifier
|
||||
(#any-of? @keyword.modifier "CACHE" "PARENT_SCOPE")))
|
||||
|
||||
(normal_command
|
||||
(identifier) @_function
|
||||
(#match? @_function "\\c^list$")
|
||||
(argument_list
|
||||
. (argument) @constant
|
||||
.
|
||||
(argument) @constant
|
||||
(#any-of? @constant "LENGTH" "GET" "JOIN" "SUBLIST" "FIND")
|
||||
. (argument) @variable
|
||||
(argument) @variable .
|
||||
)
|
||||
)
|
||||
.
|
||||
(argument) @variable
|
||||
(argument) @variable .))
|
||||
|
||||
(normal_command
|
||||
(identifier) @_function
|
||||
(#match? @_function "\\c^list$")
|
||||
(argument_list
|
||||
. (argument) @constant
|
||||
. (argument) @variable
|
||||
(#any-of? @constant "APPEND" "FILTER" "INSERT"
|
||||
"POP_BACK" "POP_FRONT" "PREPEND"
|
||||
"REMOVE_ITEM" "REMOVE_AT" "REMOVE_DUPLICATES"
|
||||
"REVERSE" "SORT")
|
||||
)
|
||||
)
|
||||
.
|
||||
(argument) @constant
|
||||
.
|
||||
(argument) @variable
|
||||
(#any-of? @constant
|
||||
"APPEND" "FILTER" "INSERT" "POP_BACK" "POP_FRONT" "PREPEND" "REMOVE_ITEM" "REMOVE_AT"
|
||||
"REMOVE_DUPLICATES" "REVERSE" "SORT")))
|
||||
|
||||
(normal_command
|
||||
(identifier) @_function
|
||||
(#match? @_function "\\c^list$")
|
||||
(argument_list
|
||||
. (argument) @_transform @constant
|
||||
. (argument) @variable
|
||||
. (argument) @_action @constant
|
||||
.
|
||||
(argument) @_transform @constant
|
||||
.
|
||||
(argument) @variable
|
||||
.
|
||||
(argument) @_action @constant
|
||||
(#eq? @_transform "TRANSFORM")
|
||||
(#any-of? @_action "APPEND" "PREPEND" "TOUPPER" "TOLOWER" "STRIP" "GENEX_STRIP" "REPLACE")))
|
||||
|
||||
(normal_command
|
||||
(identifier) @_function
|
||||
(#match? @_function "\\c^list$")
|
||||
(argument_list
|
||||
.
|
||||
(argument) @_transform @constant
|
||||
.
|
||||
(argument) @variable
|
||||
.
|
||||
(argument) @_action @constant
|
||||
.
|
||||
(argument)? @_selector @constant
|
||||
(#eq? @_transform "TRANSFORM")
|
||||
(#any-of? @_action "APPEND" "PREPEND" "TOUPPER" "TOLOWER" "STRIP" "GENEX_STRIP" "REPLACE")
|
||||
)
|
||||
)
|
||||
(#any-of? @_selector "AT" "FOR" "REGEX")))
|
||||
|
||||
(normal_command
|
||||
(identifier) @_function
|
||||
(#match? @_function "\\c^list$")
|
||||
(argument_list
|
||||
. (argument) @_transform @constant
|
||||
. (argument) @variable
|
||||
. (argument) @_action @constant
|
||||
. (argument)? @_selector @constant
|
||||
(#eq? @_transform "TRANSFORM")
|
||||
(#any-of? @_action "APPEND" "PREPEND" "TOUPPER" "TOLOWER" "STRIP" "GENEX_STRIP" "REPLACE")
|
||||
(#any-of? @_selector "AT" "FOR" "REGEX")
|
||||
)
|
||||
)
|
||||
(normal_command
|
||||
(identifier) @_function
|
||||
(#match? @_function "\\c^list$")
|
||||
(argument_list
|
||||
. (argument) @_transform @constant
|
||||
(argument) @constant .
|
||||
.
|
||||
(argument) @_transform @constant
|
||||
(argument) @constant
|
||||
.
|
||||
(argument) @variable
|
||||
(#eq? @_transform "TRANSFORM")
|
||||
(#eq? @constant "OUTPUT_VARIABLE")
|
||||
)
|
||||
)
|
||||
(#eq? @constant "OUTPUT_VARIABLE")))
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
((source_file . (line_comment) @preproc)
|
||||
(#lua-match? @preproc "^#!/"))
|
||||
((source_file
|
||||
.
|
||||
(line_comment) @keyword.directive @nospell)
|
||||
(#lua-match? @keyword.directive "^#!/"))
|
||||
|
||||
@ -9,17 +9,18 @@
|
||||
] @indent.begin
|
||||
|
||||
[
|
||||
(elseif_command)
|
||||
(else_command)
|
||||
(endif_command)
|
||||
(endforeach_command)
|
||||
(endwhile_command)
|
||||
(endfunction_command)
|
||||
(endmacro_command)
|
||||
(endblock_command)
|
||||
(elseif_command)
|
||||
(else_command)
|
||||
(endif_command)
|
||||
(endforeach_command)
|
||||
(endwhile_command)
|
||||
(endfunction_command)
|
||||
(endmacro_command)
|
||||
(endblock_command)
|
||||
] @indent.branch
|
||||
|
||||
(")" @indent.branch)
|
||||
(")" @indent.end)
|
||||
")" @indent.branch
|
||||
|
||||
")" @indent.end
|
||||
|
||||
(argument_list) @indent.auto
|
||||
|
||||
@ -1,41 +1,49 @@
|
||||
((tag
|
||||
(name) @text.todo @nospell
|
||||
("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)?
|
||||
(name) @comment.todo @nospell
|
||||
("(" @punctuation.bracket
|
||||
(user) @constant
|
||||
")" @punctuation.bracket)?
|
||||
":" @punctuation.delimiter)
|
||||
(#any-of? @text.todo "TODO" "WIP"))
|
||||
(#any-of? @comment.todo "TODO" "WIP"))
|
||||
|
||||
("text" @text.todo @nospell
|
||||
(#any-of? @text.todo "TODO" "WIP"))
|
||||
("text" @comment.todo @nospell
|
||||
(#any-of? @comment.todo "TODO" "WIP"))
|
||||
|
||||
((tag
|
||||
(name) @text.note @nospell
|
||||
("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)?
|
||||
(name) @comment.note @nospell
|
||||
("(" @punctuation.bracket
|
||||
(user) @constant
|
||||
")" @punctuation.bracket)?
|
||||
":" @punctuation.delimiter)
|
||||
(#any-of? @text.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST"))
|
||||
(#any-of? @comment.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST"))
|
||||
|
||||
("text" @text.note @nospell
|
||||
(#any-of? @text.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST"))
|
||||
("text" @comment.note @nospell
|
||||
(#any-of? @comment.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST"))
|
||||
|
||||
((tag
|
||||
(name) @text.warning @nospell
|
||||
("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)?
|
||||
(name) @comment.warning @nospell
|
||||
("(" @punctuation.bracket
|
||||
(user) @constant
|
||||
")" @punctuation.bracket)?
|
||||
":" @punctuation.delimiter)
|
||||
(#any-of? @text.warning "HACK" "WARNING" "WARN" "FIX"))
|
||||
(#any-of? @comment.warning "HACK" "WARNING" "WARN" "FIX"))
|
||||
|
||||
("text" @text.warning @nospell
|
||||
(#any-of? @text.warning "HACK" "WARNING" "WARN" "FIX"))
|
||||
("text" @comment.warning @nospell
|
||||
(#any-of? @comment.warning "HACK" "WARNING" "WARN" "FIX"))
|
||||
|
||||
((tag
|
||||
(name) @text.danger @nospell
|
||||
("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)?
|
||||
(name) @comment.error @nospell
|
||||
("(" @punctuation.bracket
|
||||
(user) @constant
|
||||
")" @punctuation.bracket)?
|
||||
":" @punctuation.delimiter)
|
||||
(#any-of? @text.danger "FIXME" "BUG" "ERROR"))
|
||||
(#any-of? @comment.error "FIXME" "BUG" "ERROR"))
|
||||
|
||||
("text" @text.danger @nospell
|
||||
(#any-of? @text.danger "FIXME" "BUG" "ERROR"))
|
||||
("text" @comment.error @nospell
|
||||
(#any-of? @comment.error "FIXME" "BUG" "ERROR"))
|
||||
|
||||
; Issue number (#123)
|
||||
("text" @number
|
||||
(#lua-match? @number "^#[0-9]+$"))
|
||||
(#lua-match? @number "^#[0-9]+$"))
|
||||
|
||||
((uri) @text.uri @nospell)
|
||||
(uri) @string.special.url @nospell
|
||||
|
||||
@ -1 +1,2 @@
|
||||
(source (list_lit) @fold)
|
||||
(source
|
||||
(list_lit) @fold)
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1,72 +1,109 @@
|
||||
(defun_header
|
||||
function_name: (sym_lit) @local.definition.function
|
||||
(#set! definition.function.scope "parent"))
|
||||
|
||||
(defun_header
|
||||
function_name: (sym_lit) @definition.function (#set! definition.function.scope "parent"))
|
||||
(defun_header
|
||||
lambda_list: (list_lit (sym_lit) @definition.parameter))
|
||||
lambda_list: (list_lit
|
||||
(sym_lit) @local.definition.parameter))
|
||||
|
||||
(defun_header
|
||||
keyword: (defun_keyword "defmethod")
|
||||
lambda_list: (list_lit (list_lit . (sym_lit) . (sym_lit) @definition.type)))
|
||||
keyword: (defun_keyword
|
||||
"defmethod")
|
||||
lambda_list: (list_lit
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit)
|
||||
.
|
||||
(sym_lit) @local.definition.type)))
|
||||
|
||||
(defun_header
|
||||
lambda_list: (list_lit (list_lit . (sym_lit) @definition.parameter . (_))))
|
||||
lambda_list: (list_lit
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @local.definition.parameter
|
||||
.
|
||||
(_))))
|
||||
|
||||
(sym_lit) @reference
|
||||
(sym_lit) @local.reference
|
||||
|
||||
(defun) @scope
|
||||
(defun) @local.scope
|
||||
|
||||
((list_lit . (sym_lit) @_defvar . (sym_lit) @definition.var)
|
||||
(#match? @_defvar "^(cl:)?(defvar|defparameter)$"))
|
||||
((list_lit
|
||||
.
|
||||
(sym_lit) @_defvar
|
||||
.
|
||||
(sym_lit) @local.definition.var)
|
||||
(#match? @_defvar "^(cl:)?(defvar|defparameter)$"))
|
||||
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @_deftest
|
||||
.
|
||||
(sym_lit) @definition.function
|
||||
(#eq? @_deftest "deftest")) @scope
|
||||
.
|
||||
(sym_lit) @_deftest
|
||||
.
|
||||
(sym_lit) @local.definition.function
|
||||
(#eq? @_deftest "deftest")) @local.scope
|
||||
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @_deftest
|
||||
.
|
||||
(sym_lit) @definition.function
|
||||
(#eq? @_deftest "deftest")) @scope
|
||||
.
|
||||
(sym_lit) @_deftest
|
||||
.
|
||||
(sym_lit) @local.definition.function
|
||||
(#eq? @_deftest "deftest")) @local.scope
|
||||
|
||||
(for_clause . (sym_lit) @definition.var)
|
||||
(with_clause . (sym_lit) @definition.var)
|
||||
(loop_macro) @scope
|
||||
(for_clause
|
||||
.
|
||||
(sym_lit) @local.definition.var)
|
||||
|
||||
(with_clause
|
||||
.
|
||||
(sym_lit) @local.definition.var)
|
||||
|
||||
(loop_macro) @local.scope
|
||||
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @_let (#match? @_let "(cl:|cffi:)?(with-accessors|with-foreign-objects|let[*]?)")
|
||||
.
|
||||
(list_lit (list_lit . (sym_lit) @definition.var))) @scope
|
||||
.
|
||||
(sym_lit) @_let
|
||||
(#match? @_let "(cl:|cffi:)?(with-accessors|with-foreign-objects|let[*]?)")
|
||||
.
|
||||
(list_lit
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @local.definition.var))) @local.scope
|
||||
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @_let (#match? @_let "(cl:|alexandria:)?(with-gensyms|dotimes|with-foreign-object)")
|
||||
.
|
||||
(list_lit . (sym_lit) @definition.var)) @scope
|
||||
.
|
||||
(sym_lit) @_let
|
||||
(#match? @_let "(cl:|alexandria:)?(with-gensyms|dotimes|with-foreign-object)")
|
||||
.
|
||||
(list_lit
|
||||
.
|
||||
(sym_lit) @local.definition.var)) @local.scope
|
||||
|
||||
(list_lit
|
||||
.
|
||||
(kwd_lit) @_import_from (#eq? @_import_from ":import-from")
|
||||
.
|
||||
(_)
|
||||
(kwd_lit (kwd_symbol) @definition.import))
|
||||
.
|
||||
(kwd_lit) @_import_from
|
||||
(#eq? @_import_from ":import-from")
|
||||
.
|
||||
(_)
|
||||
(kwd_lit
|
||||
(kwd_symbol) @local.definition.import))
|
||||
|
||||
(list_lit
|
||||
.
|
||||
(kwd_lit) @_import_from (#eq? @_import_from ":import-from")
|
||||
.
|
||||
(_)
|
||||
(sym_lit) @definition.import)
|
||||
.
|
||||
(kwd_lit) @_import_from
|
||||
(#eq? @_import_from ":import-from")
|
||||
.
|
||||
(_)
|
||||
(sym_lit) @local.definition.import)
|
||||
|
||||
(list_lit
|
||||
.
|
||||
(kwd_lit) @_use (#eq? @_use ":use")
|
||||
(kwd_lit (kwd_symbol) @definition.import))
|
||||
.
|
||||
(kwd_lit) @_use
|
||||
(#eq? @_use ":use")
|
||||
(kwd_lit
|
||||
(kwd_symbol) @local.definition.import))
|
||||
|
||||
(list_lit
|
||||
.
|
||||
(kwd_lit) @_use (#eq? @_use ":use")
|
||||
(sym_lit) @definition.import)
|
||||
.
|
||||
(kwd_lit) @_use
|
||||
(#eq? @_use ":use")
|
||||
(sym_lit) @local.definition.import)
|
||||
|
||||
@ -1,22 +1,31 @@
|
||||
(metadata) @comment
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
[
|
||||
"{"
|
||||
"}"
|
||||
] @punctuation.bracket
|
||||
|
||||
"%" @punctuation.special
|
||||
|
||||
(ingredient
|
||||
"@" @tag
|
||||
(name)? @text.title
|
||||
(amount
|
||||
(quantity)? @number
|
||||
(units)? @tag.attribute)?)
|
||||
"@" @punctuation.delimiter
|
||||
(name)? @string.special.symbol
|
||||
(amount
|
||||
(quantity)? @number
|
||||
(units)? @constant)?)
|
||||
|
||||
(timer
|
||||
"~" @tag
|
||||
(name)? @text.title
|
||||
(amount
|
||||
(quantity)? @number
|
||||
(units)? @tag.attribute)?)
|
||||
"~" @punctuation.delimiter
|
||||
(name)? @string.special.symbol
|
||||
(amount
|
||||
(quantity)? @number
|
||||
(units)? @constant)?)
|
||||
|
||||
(cookware
|
||||
"#" @tag
|
||||
(name)? @text.title
|
||||
(amount
|
||||
(quantity)? @number
|
||||
(units)? @tag.attribute)?)
|
||||
"#" @punctuation.delimiter
|
||||
(name)? @string.special.symbol
|
||||
(amount
|
||||
(quantity)? @number
|
||||
(units)? @constant)?)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
[
|
||||
(object)
|
||||
(array)
|
||||
(assign_block)
|
||||
(object)
|
||||
(array)
|
||||
(assign_block)
|
||||
] @fold
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
"let" @keyword
|
||||
"in" @keyword
|
||||
[
|
||||
"let"
|
||||
"in"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"{"
|
||||
@ -10,11 +12,26 @@
|
||||
|
||||
"." @punctuation.delimiter
|
||||
|
||||
[
|
||||
".."
|
||||
"="
|
||||
] @operator
|
||||
|
||||
(input) @constant
|
||||
|
||||
(null) @constant.builtin
|
||||
|
||||
(comment) @comment @spell
|
||||
|
||||
(string) @string
|
||||
|
||||
(integer) @number
|
||||
(float) @float
|
||||
|
||||
(float) @number.float
|
||||
|
||||
(float
|
||||
"." @number.float)
|
||||
|
||||
(boolean) @boolean
|
||||
(null) @keyword
|
||||
|
||||
(path_seg) @property
|
||||
|
||||
@ -1,14 +1,24 @@
|
||||
[
|
||||
(assign_block "{")
|
||||
(object)
|
||||
(array)
|
||||
(assign_block
|
||||
"{")
|
||||
(object)
|
||||
(array)
|
||||
] @indent.begin
|
||||
|
||||
(assign_block "}" @indent.branch)
|
||||
(assign_block "}" @indent.end)
|
||||
(assign_block
|
||||
"}" @indent.branch)
|
||||
|
||||
(object "}" @indent.branch)
|
||||
(object "}" @indent.end)
|
||||
(assign_block
|
||||
"}" @indent.end)
|
||||
|
||||
(array "]" @indent.branch)
|
||||
(array "]" @indent.end)
|
||||
(object
|
||||
"}" @indent.branch)
|
||||
|
||||
(object
|
||||
"}" @indent.end)
|
||||
|
||||
(array
|
||||
"]" @indent.branch)
|
||||
|
||||
(array
|
||||
"]" @indent.end)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user