dissolve app/ into repo root (D-056)

Single Flutter package at the repo root. All code, tests, assets,
and platform directories moved from app/ to root. Package renamed
from clide_app to clide — all imports rewritten. Merged pubspec
combines core (ffi) and app (flutter, yaml, xterm) dependencies.
Makefile simplified: no APP_PRESENT conditionals, no cd, no daemon
lifecycle. 317 tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-23 00:37:20 +02:00
co-authored by Claude Opus 4.6
parent a526c5b9b7
commit 46329700d5
394 changed files with 978 additions and 1090 deletions
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2026 Jeroen Schweitzer
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Binary file not shown.
Binary file not shown.
+93
View File
@@ -0,0 +1,93 @@
Copyright 2020 The JetBrains Mono Project Authors (https://github.com/JetBrains/JetBrainsMono)
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://scripts.sil.org/OFL
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
+93
View File
@@ -0,0 +1,93 @@
Copyright 2010 The Josefin Sans Project Authors (https://github.com/ThomasJockin/JosefinSansFont-master), with Reserved Font Name "Josefin Sans".
This Font Software is licensed under the SIL Open Font License, Version 1.1.
This license is copied below, and is also available with a FAQ at:
https://openfontlicense.org
-----------------------------------------------------------
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
-----------------------------------------------------------
PREAMBLE
The goals of the Open Font License (OFL) are to stimulate worldwide
development of collaborative font projects, to support the font creation
efforts of academic and linguistic communities, and to provide a free and
open framework in which fonts may be shared and improved in partnership
with others.
The OFL allows the licensed fonts to be used, studied, modified and
redistributed freely as long as they are not sold by themselves. The
fonts, including any derivative works, can be bundled, embedded,
redistributed and/or sold with any software provided that any reserved
names are not used by derivative works. The fonts and derivatives,
however, cannot be released under any other type of license. The
requirement for fonts to remain under this license does not apply
to any document created using the fonts or their derivatives.
DEFINITIONS
"Font Software" refers to the set of files released by the Copyright
Holder(s) under this license and clearly marked as such. This may
include source files, build scripts and documentation.
"Reserved Font Name" refers to any names specified as such after the
copyright statement(s).
"Original Version" refers to the collection of Font Software components as
distributed by the Copyright Holder(s).
"Modified Version" refers to any derivative made by adding to, deleting,
or substituting -- in part or in whole -- any of the components of the
Original Version, by changing formats or by porting the Font Software to a
new environment.
"Author" refers to any designer, engineer, programmer, technical
writer or other person who contributed to the Font Software.
PERMISSION & CONDITIONS
Permission is hereby granted, free of charge, to any person obtaining
a copy of the Font Software, to use, study, copy, merge, embed, modify,
redistribute, and sell modified and unmodified copies of the Font
Software, subject to the following conditions:
1) Neither the Font Software nor any of its individual components,
in Original or Modified Versions, may be sold by itself.
2) Original or Modified Versions of the Font Software may be bundled,
redistributed and/or sold with any software, provided that each copy
contains the above copyright notice and this license. These can be
included either as stand-alone text files, human-readable headers or
in the appropriate machine-readable metadata fields within text or
binary files as long as those fields can be easily viewed by the user.
3) No Modified Version of the Font Software may use the Reserved Font
Name(s) unless explicit written permission is granted by the corresponding
Copyright Holder. This restriction only applies to the primary font name as
presented to the users.
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
Software shall not be used to promote, endorse or advertise any
Modified Version, except to acknowledge the contribution(s) of the
Copyright Holder(s) and the Author(s) or with their explicit written
permission.
5) The Font Software, modified or unmodified, in part or in whole,
must be distributed entirely under this license, and must not be
distributed under any other license. The requirement for fonts to
remain under this license does not apply to any document created
using the Font Software.
TERMINATION
This license becomes null and void if any of the above conditions are
not met.
DISCLAIMER
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
OTHER DEALINGS IN THE FONT SOFTWARE.
+21
View File
@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2023 Phosphor Icons
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
BIN
View File
Binary file not shown.
+190
View File
@@ -0,0 +1,190 @@
# clide — licensing manifest.
#
# Three sections:
# - `self:` — clide's own license (MIT). Rendered first in the About
# screen so the user knows what they're running before they see
# the list of things it depends on.
# - `dependencies:` — third-party artefacts that SHIP in the clide
# binary: fonts, runtime Dart packages, native supporter tools,
# bundled data. The About screen renders these verbatim.
# - `dev_dependencies:` — build-time-only tooling: test runners,
# mocks, lints, golden-test harness. These never enter the shipped
# binary, so the About screen does not render them, but they're
# tracked here for audit completeness alongside the real list.
#
# Adding a new runtime dependency is a two-step commit:
# 1. Add the dependency itself (font file, `pubspec.yaml` entry, etc.)
# 2. Add the entry under `dependencies:` below in the same commit, so
# the About screen stays accurate and the prefer-zero-deps
# guardrail is enforced by the obvious visible consequence: an
# extra row in the list.
#
# Adding a new dev-only dependency is the same two-step commit, just
# under `dev_dependencies:` instead. The guardrail still applies —
# dev deps are supply-chain risk too — but they don't pollute the
# user-facing About screen.
#
# See CLAUDE.md "Dependencies & supply chain" for the full rule, and
# `decisions/tooling.md` for the D-record that pins it.
schema_version: 1
# clide itself. Listed first so the About screen can render "You're
# looking at clide vX, MIT-licensed" at the top of the panel before
# the bundled-dependency list underneath. The root LICENSE is the
# authoritative copy; `app/assets/LICENSE` is a mirror bundled so the
# About screen can read it at runtime.
self:
name: clide
version: "2.0.0-dev"
homepage: https://git.schweitz.net/jpmschweitzer/clide
license: MIT
license_file: assets/LICENSE
copyright: "© 2026 Jeroen Schweitzer"
# Runtime dependencies — ship in the clide binary.
dependencies:
- name: JetBrains Mono
kind: font
version: "2.304"
homepage: https://github.com/JetBrains/JetBrainsMono
license: OFL-1.1
license_file: assets/fonts/jetbrains_mono/OFL.txt
purpose: >-
Monospace face for terminal panes, diff views, code editors, and
any other monospace surface.
weights_bundled: [Regular, Italic, Bold, BoldItalic]
- name: Josefin Sans
kind: font
version: "variable"
homepage: https://fonts.google.com/specimen/Josefin+Sans
license: OFL-1.1
license_file: assets/fonts/josefin_sans/OFL.txt
purpose: >-
Application UI face. Default weight Light (300); full 100-700
range available via the variable-font weight axis.
weights_bundled: [VariableFont, Italic-VariableFont]
- name: Phosphor Icons
kind: font
version: "2.0.8"
homepage: https://phosphoricons.com
license: MIT
license_file: assets/fonts/phosphor/LICENSE
purpose: >-
Icon font for UI glyphs throughout the IDE — sidebar sections,
context panel, toolbar, and editor chrome. Regular, Bold, and
Fill weights bundled.
weights_bundled: [Regular, Bold, Fill]
- name: yaml
kind: dart-package
version: "3.1.3"
homepage: https://pub.dev/packages/yaml
license: MIT
purpose: >-
YAML parser for theme files and extension manifests. Justified
exception to prefer-zero-deps; Dart-team maintained.
- name: xterm
kind: dart-package
version: "4.0.0"
homepage: https://pub.dev/packages/xterm
license: MIT
purpose: >-
Flutter-native terminal emulator (ANSI / xterm / truecolor
parser + renderer). Powers every pane that renders a PTY —
general terminal, Claude, diff views running shell commands.
Writing a vt100 / ANSI parser is weeks of work for no fidelity
gain.
- name: ffi
kind: dart-package
version: "2.1.3"
homepage: https://pub.dev/packages/ffi
license: BSD-3-Clause
purpose: >-
Allocator (`calloc`) and type helpers on top of dart:ffi. Used by
the core PTY wrapper for libc bindings (socketpair, recvmsg with
SCM_RIGHTS, ioctl). Dart-team maintained; zero transitive deps.
- name: tree-sitter
kind: native-shared-lib
version: "0.26.8"
homepage: https://github.com/tree-sitter/tree-sitter
license: MIT
purpose: >-
Incremental parsing library with embedded WASM grammar engine.
Vendored as libtree-sitter.so (wasmtime statically linked) in
app/native/. Called via dart:ffi. Loads grammar .wasm files
through its built-in WASM store API.
- name: wasmtime
kind: native-static-lib
version: "44.0.0"
homepage: https://github.com/bytecodealliance/wasmtime
license: Apache-2.0 with LLVM exception
license_file: native/linux-x64/WASMTIME-LICENSE
purpose: >-
WebAssembly runtime. Statically linked into libtree-sitter.so to
provide grammar WASM loading. Not called directly — tree-sitter's
C API wraps it.
- name: tree-sitter grammars
kind: wasm-assets
version: various
homepage: https://github.com/tree-sitter
license: MIT (most); Apache-2.0 (elixir, erlang, hcl, just)
purpose: >-
Language parsers for syntax highlighting. 47 grammars compiled to
WASM via wasi-sdk, loaded at runtime by tree-sitter's embedded
wasmtime engine. Source repos are tree-sitter/tree-sitter-<lang>
on GitHub; sqlite is dhcmrlchtdj/tree-sitter-sqlite (MIT).
# Build-time-only dependencies — test runners, mocks, lints. Tracked
# here for audit completeness; NOT rendered in the About screen.
dev_dependencies:
- name: mocktail
kind: dart-package
version: "1.0.4"
homepage: https://pub.dev/packages/mocktail
license: MIT
purpose: >-
Mocks at IO / IPC boundaries. ChangeNotifier facades use
hand-rolled fakes instead of mocks (D-025).
- name: alchemist
kind: dart-package
version: "0.12.1"
homepage: https://pub.dev/packages/alchemist
license: MIT
purpose: >-
Golden-test framework; Ahem-font rendering for cross-platform
pixel stability on widget primitives (D-024).
- name: flutter_lints
kind: dart-package
version: "6.0.0"
homepage: https://pub.dev/packages/flutter_lints
license: BSD-3-Clause
purpose: Flutter-team-recommended analyzer lint set (app/).
- name: lints
kind: dart-package
version: "5.0.0"
homepage: https://pub.dev/packages/lints
license: BSD-3-Clause
purpose: >-
Dart-team-recommended analyzer lint set for the Flutter-free
core package at the repo root.
- name: test
kind: dart-package
version: "1.25.8"
homepage: https://pub.dev/packages/test
license: BSD-3-Clause
purpose: >-
Dart test runner for the core package (Flutter-free; the app
uses flutter_test from the Flutter SDK for widget + golden
coverage).
Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 950 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

+7
View File
@@ -0,0 +1,7 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 160" width="200" height="160">
<g fill="none" stroke-linecap="round" stroke-linejoin="round">
<polyline points="89,55 66,80 89,105" stroke="#5691a1" stroke-width="8"/>
<polyline points="111,55 134,80 111,105" stroke="#33404c" stroke-width="8"/>
<line x1="100" y1="118" x2="134" y2="118" stroke="#d97757" stroke-width="5"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 408 B

+56
View File
@@ -0,0 +1,56 @@
[
(string)
(raw_string)
(heredoc_body)
(heredoc_start)
] @string
(command_name) @function
(variable_name) @property
[
"case"
"do"
"done"
"elif"
"else"
"esac"
"export"
"fi"
"for"
"function"
"if"
"in"
"select"
"then"
"unset"
"until"
"while"
] @keyword
(comment) @comment
(function_definition name: (word) @function)
(file_descriptor) @number
[
(command_substitution)
(process_substitution)
(expansion)
]@embedded
[
"$"
"&&"
">"
">>"
"<"
"|"
] @operator
(
(command (_) @constant)
(#match? @constant "^-")
)
+213
View File
@@ -0,0 +1,213 @@
(identifier) @variable
;; Methods
(method_declaration name: (identifier) @function)
(local_function_statement name: (identifier) @function)
;; Types
(interface_declaration name: (identifier) @type)
(class_declaration name: (identifier) @type)
(enum_declaration name: (identifier) @type)
(struct_declaration (identifier) @type)
(record_declaration (identifier) @type)
(namespace_declaration name: (identifier) @module)
(generic_name (identifier) @type)
(type_parameter (identifier) @property.definition)
(parameter type: (identifier) @type)
(type_argument_list (identifier) @type)
(as_expression right: (identifier) @type)
(is_expression right: (identifier) @type)
(constructor_declaration name: (identifier) @constructor)
(destructor_declaration name: (identifier) @constructor)
(_ type: (identifier) @type)
(base_list (identifier) @type)
(predefined_type) @type.builtin
;; Enum
(enum_member_declaration (identifier) @property.definition)
;; Literals
[
(real_literal)
(integer_literal)
] @number
[
(character_literal)
(string_literal)
(raw_string_literal)
(verbatim_string_literal)
(interpolated_string_expression)
(interpolation_start)
(interpolation_quote)
] @string
(escape_sequence) @string.escape
[
(boolean_literal)
(null_literal)
] @constant.builtin
;; Comments
(comment) @comment
;; Tokens
[
";"
"."
","
] @punctuation.delimiter
[
"--"
"-"
"-="
"&"
"&="
"&&"
"+"
"++"
"+="
"<"
"<="
"<<"
"<<="
"="
"=="
"!"
"!="
"=>"
">"
">="
">>"
">>="
">>>"
">>>="
"|"
"|="
"||"
"?"
"??"
"??="
"^"
"^="
"~"
"*"
"*="
"/"
"/="
"%"
"%="
":"
".."
] @operator
[
"("
")"
"["
"]"
"{"
"}"
(interpolation_brace)
] @punctuation.bracket
;; Keywords
[
(modifier)
"this"
(implicit_type)
] @keyword
[
"add"
"alias"
"as"
"base"
"break"
"case"
"catch"
"checked"
"class"
"continue"
"default"
"delegate"
"do"
"else"
"enum"
"event"
"explicit"
"extern"
"finally"
"for"
"foreach"
"global"
"goto"
"if"
"implicit"
"interface"
"is"
"lock"
"namespace"
"notnull"
"operator"
"params"
"return"
"remove"
"sizeof"
"stackalloc"
"static"
"struct"
"switch"
"throw"
"try"
"typeof"
"unchecked"
"using"
"while"
"new"
"await"
"in"
"yield"
"get"
"set"
"when"
"out"
"ref"
"from"
"where"
"select"
"record"
"init"
"with"
"let"
] @keyword
;; Attribute
(attribute name: (identifier) @attribute)
;; Parameters
(parameter
name: (identifier) @variable.parameter)
;; Type constraints
(type_parameter_constraints_clause (identifier) @property.definition)
;; Method calls
(invocation_expression (member_access_expression name: (identifier) @function))
+81
View File
@@ -0,0 +1,81 @@
(identifier) @variable
((identifier) @constant
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
"break" @keyword
"case" @keyword
"const" @keyword
"continue" @keyword
"default" @keyword
"do" @keyword
"else" @keyword
"enum" @keyword
"extern" @keyword
"for" @keyword
"if" @keyword
"inline" @keyword
"return" @keyword
"sizeof" @keyword
"static" @keyword
"struct" @keyword
"switch" @keyword
"typedef" @keyword
"union" @keyword
"volatile" @keyword
"while" @keyword
"#define" @keyword
"#elif" @keyword
"#else" @keyword
"#endif" @keyword
"#if" @keyword
"#ifdef" @keyword
"#ifndef" @keyword
"#include" @keyword
(preproc_directive) @keyword
"--" @operator
"-" @operator
"-=" @operator
"->" @operator
"=" @operator
"!=" @operator
"*" @operator
"&" @operator
"&&" @operator
"+" @operator
"++" @operator
"+=" @operator
"<" @operator
"==" @operator
">" @operator
"||" @operator
"." @delimiter
";" @delimiter
(string_literal) @string
(system_lib_string) @string
(null) @constant
(number_literal) @number
(char_literal) @number
(field_identifier) @property
(statement_identifier) @label
(type_identifier) @type
(primitive_type) @type
(sized_type_specifier) @type
(call_expression
function: (identifier) @function)
(call_expression
function: (field_expression
field: (field_identifier) @function))
(function_declarator
declarator: (identifier) @function)
(preproc_function_def
name: (identifier) @function.special)
(comment) @comment
+4
View File
@@ -0,0 +1,4 @@
(tag) @keyword
(name) @constant
(user) @string
(uri) @text.uri
+77
View File
@@ -0,0 +1,77 @@
; Functions
(call_expression
function: (qualified_identifier
name: (identifier) @function))
(template_function
name: (identifier) @function)
(template_method
name: (field_identifier) @function)
(template_function
name: (identifier) @function)
(function_declarator
declarator: (qualified_identifier
name: (identifier) @function))
(function_declarator
declarator: (field_identifier) @function)
; Types
((namespace_identifier) @type
(#match? @type "^[A-Z]"))
(auto) @type
; Constants
(this) @variable.builtin
(null "nullptr" @constant)
; Modules
(module_name
(identifier) @module)
; Keywords
[
"catch"
"class"
"co_await"
"co_return"
"co_yield"
"constexpr"
"constinit"
"consteval"
"delete"
"explicit"
"final"
"friend"
"mutable"
"namespace"
"noexcept"
"new"
"override"
"private"
"protected"
"public"
"template"
"throw"
"try"
"typename"
"using"
"concept"
"requires"
"virtual"
"import"
"export"
"module"
] @keyword
; Strings
(raw_string_literal) @string
+76
View File
@@ -0,0 +1,76 @@
(comment) @comment
(tag_name) @tag
(nesting_selector) @tag
(universal_selector) @tag
"~" @operator
">" @operator
"+" @operator
"-" @operator
"*" @operator
"/" @operator
"=" @operator
"^=" @operator
"|=" @operator
"~=" @operator
"$=" @operator
"*=" @operator
"and" @operator
"or" @operator
"not" @operator
"only" @operator
(attribute_selector (plain_value) @string)
((property_name) @variable
(#match? @variable "^--"))
((plain_value) @variable
(#match? @variable "^--"))
(class_name) @property
(id_name) @property
(namespace_name) @property
(property_name) @property
(feature_name) @property
(pseudo_element_selector (tag_name) @attribute)
(pseudo_class_selector (class_name) @attribute)
(attribute_name) @attribute
(function_name) @function
"@media" @keyword
"@import" @keyword
"@charset" @keyword
"@namespace" @keyword
"@supports" @keyword
"@keyframes" @keyword
(at_keyword) @keyword
(to) @keyword
(from) @keyword
(important) @keyword
(string_value) @string
(color_value) @string.special
(integer_value) @number
(float_value) @number
(unit) @type
[
"#"
","
"."
":"
"::"
";"
] @punctuation.delimiter
[
"{"
")"
"("
"}"
] @punctuation.bracket
+246
View File
@@ -0,0 +1,246 @@
; Variable
(identifier) @variable
; Keywords
; --------------------
[
(assert_builtin)
(break_builtin)
(const_builtin)
(part_of_builtin)
(rethrow_builtin)
(void_type)
"abstract"
"as"
"async"
"async*"
"await"
"base"
"case"
"catch"
"class"
"continue"
"covariant"
"default"
"deferred"
"do"
"else"
"enum"
"export"
"extends"
"extension"
"external"
"factory"
"final"
"finally"
"for"
"Function"
"hide"
"if"
"implements"
"import"
"in"
"interface"
"is"
"late"
"library"
"mixin"
"new"
"on"
"operator"
"part"
"required"
"return"
"sealed"
"show"
"static"
"super"
"switch"
"sync*"
"throw"
"try"
"typedef"
"var"
"when"
"while"
"with"
"yield"
] @keyword
; Methods
; --------------------
; NOTE: This query is a bit of a work around for the fact that the dart grammar doesn't
; specifically identify a node as a function call
(((identifier) @function (#match? @function "^_?[a-z]"))
. (selector . (argument_part))) @function
; Operators and Tokens
; --------------------
(template_substitution
"$" @punctuation.special
"{" @punctuation.special
"}" @punctuation.special
) @none
(template_substitution
"$" @punctuation.special
(identifier_dollar_escaped) @variable
) @none
(escape_sequence) @string.escape
[
"@"
"=>"
".."
"??"
"=="
"?"
":"
"&&"
"%"
"<"
">"
"="
">="
"<="
"||"
"~/"
(increment_operator)
(is_operator)
(prefix_operator)
(equality_operator)
(additive_operator)
] @operator
(type_arguments
"<" @punctuation.bracket
">" @punctuation.bracket)
(type_parameters
"<" @punctuation.bracket
">" @punctuation.bracket)
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
; Delimiters
; --------------------
[
";"
"."
","
] @punctuation.delimiter
; Types
; --------------------
(type_identifier) @type
((type_identifier) @type.builtin
(#match? @type.builtin "^(int|double|String|bool|List|Set|Map|Runes|Symbol)$"))
(class_definition
name: (identifier) @type)
(constructor_signature
name: (identifier) @type)
(scoped_identifier
scope: (identifier) @type)
(function_signature
name: (identifier) @function)
(getter_signature
"get" @keyword
(identifier) @function)
(setter_signature
"set" @keyword
name: (identifier) @function)
((scoped_identifier
scope: (identifier) @type
name: (identifier) @type)
(#match? @type "^[a-zA-Z]"))
; Enums
; -------------------
(enum_declaration
name: (identifier) @type)
(enum_constant
name: (identifier) @identifier.constant)
; Variables
; --------------------
; var keyword
(inferred_type) @keyword
((identifier) @type
(#match? @type "^_?[A-Z].*[a-z]"))
("Function" @type)
(this) @variable.builtin
; properties
(unconditional_assignable_selector
(identifier) @property)
(conditional_assignable_selector
(identifier) @property)
(cascade_section
(cascade_selector
(identifier) @property))
((selector
(unconditional_assignable_selector (identifier) @function))
(selector (argument_part (arguments)))
)
(cascade_section
(cascade_selector (identifier) @function)
(argument_part (arguments))
)
; assignments
(assignment_expression
left: (assignable_expression) @variable)
(this) @variable.builtin
; Parameters
; --------------------
(formal_parameter
name: (identifier) @identifier.parameter)
(named_argument
(label (identifier) @identifier.parameter))
; Literals
; --------------------
[
(hex_integer_literal)
(decimal_integer_literal)
(decimal_floating_point_literal)
; TODO: inaccessbile nodes
; (octal_integer_literal)
; (hex_floating_point_literal)
] @number
(string_literal) @string
(symbol_literal (identifier) @constant) @constant
(true) @boolean
(false) @boolean
(null_literal) @constant.null
(documentation_comment) @comment
(comment) @comment
; Annotations
; --------------------
(annotation
"@" @attribute
name: (identifier) @attribute)
+49
View File
@@ -0,0 +1,49 @@
(comment) @comment @spell
[
(addition)
(new_file)
] @diff.plus
[
(deletion)
(old_file)
] @diff.minus
(commit) @constant
(location) @attribute
(command
"diff" @function
(argument) @variable.parameter)
(filename) @string.special.path
(mode) @number
([
".."
"+"
"++"
"+++"
"++++"
"-"
"--"
"---"
"----"
] @punctuation.special
(#set! priority 95))
[
(binary_change)
(similarity)
(file_change)
] @label
(index
"index" @keyword)
(similarity
(score) @number
"%" @number)
+58
View File
@@ -0,0 +1,58 @@
[
"FROM"
"AS"
"RUN"
"CMD"
"LABEL"
"EXPOSE"
"ENV"
"ADD"
"COPY"
"ENTRYPOINT"
"VOLUME"
"USER"
"WORKDIR"
"ARG"
"ONBUILD"
"STOPSIGNAL"
"HEALTHCHECK"
"SHELL"
"MAINTAINER"
"CROSS_BUILD"
(heredoc_marker)
(heredoc_end)
] @keyword
[
":"
"@"
] @operator
(comment) @comment
(image_spec
(image_tag
":" @punctuation.special)
(image_digest
"@" @punctuation.special))
[
(double_quoted_string)
(single_quoted_string)
(json_string)
(heredoc_line)
] @string
(expansion
[
"$"
"{"
"}"
] @punctuation.special
) @none
((variable) @constant
(#match? @constant "^[A-Z][A-Z_0-9]*$"))
+223
View File
@@ -0,0 +1,223 @@
; Punctuation
[
"%"
] @punctuation
[
","
";"
] @punctuation.delimiter
[
"("
")"
"["
"]"
"{"
"}"
"<<"
">>"
] @punctuation.bracket
; Literals
[
(boolean)
(nil)
] @constant
[
(integer)
(float)
] @number
(char) @constant
; Identifiers
; * regular
(identifier) @variable
; * unused
(
(identifier) @comment.unused
(#match? @comment.unused "^_")
)
; * special
(
(identifier) @constant.builtin
(#any-of? @constant.builtin "__MODULE__" "__DIR__" "__ENV__" "__CALLER__" "__STACKTRACE__")
)
; Comment
(comment) @comment
; Quoted content
(interpolation "#{" @punctuation.special "}" @punctuation.special) @embedded
(escape_sequence) @string.escape
[
(string)
(charlist)
] @string
[
(atom)
(quoted_atom)
(keyword)
(quoted_keyword)
] @string.special.symbol
; Note that we explicitly target sigil quoted start/end, so they are not overridden by delimiters
(sigil
(sigil_name) @__name__
quoted_start: _ @string.special
quoted_end: _ @string.special) @string.special
(sigil
(sigil_name) @__name__
quoted_start: _ @string
quoted_end: _ @string
(#match? @__name__ "^[sS]$")) @string
(sigil
(sigil_name) @__name__
quoted_start: _ @string.regex
quoted_end: _ @string.regex
(#match? @__name__ "^[rR]$")) @string.regex
; Calls
; * local function call
(call
target: (identifier) @function)
; * remote function call
(call
target: (dot
right: (identifier) @function))
; * field without parentheses or block
(call
target: (dot
right: (identifier) @property)
.)
; * remote call without parentheses or block (overrides above)
(call
target: (dot
left: [
(alias)
(atom)
]
right: (identifier) @function)
.)
; * definition keyword
(call
target: (identifier) @keyword
(#any-of? @keyword "def" "defdelegate" "defexception" "defguard" "defguardp" "defimpl" "defmacro" "defmacrop" "defmodule" "defn" "defnp" "defoverridable" "defp" "defprotocol" "defstruct"))
; * kernel or special forms keyword
(call
target: (identifier) @keyword
(#any-of? @keyword "alias" "case" "cond" "for" "if" "import" "quote" "raise" "receive" "require" "reraise" "super" "throw" "try" "unless" "unquote" "unquote_splicing" "use" "with"))
; * just identifier in function definition
(call
target: (identifier) @keyword
(arguments
[
(identifier) @function
(binary_operator
left: (identifier) @function
operator: "when")
])
(#any-of? @keyword "def" "defdelegate" "defguard" "defguardp" "defmacro" "defmacrop" "defn" "defnp" "defp"))
; * pipe into identifier (function call)
(binary_operator
operator: "|>"
right: (identifier) @function)
; * pipe into identifier (definition)
(call
target: (identifier) @keyword
(arguments
(binary_operator
operator: "|>"
right: (identifier) @variable))
(#any-of? @keyword "def" "defdelegate" "defguard" "defguardp" "defmacro" "defmacrop" "defn" "defnp" "defp"))
; * pipe into field without parentheses (function call)
(binary_operator
operator: "|>"
right: (call
target: (dot
right: (identifier) @function)))
; Operators
; * capture operand
(unary_operator
operator: "&"
operand: (integer) @operator)
(operator_identifier) @operator
(unary_operator
operator: _ @operator)
(binary_operator
operator: _ @operator)
(dot
operator: _ @operator)
(stab_clause
operator: _ @operator)
; * module attribute
(unary_operator
operator: "@" @attribute
operand: [
(identifier) @attribute
(call
target: (identifier) @attribute)
(boolean) @attribute
(nil) @attribute
])
; * doc string
(unary_operator
operator: "@" @comment.doc
operand: (call
target: (identifier) @comment.doc.__attribute__
(arguments
[
(string) @comment.doc
(charlist) @comment.doc
(sigil
quoted_start: _ @comment.doc
quoted_end: _ @comment.doc) @comment.doc
(boolean) @comment.doc
]))
(#any-of? @comment.doc.__attribute__ "moduledoc" "typedoc" "doc"))
; Module
(alias) @module
(call
target: (dot
left: (atom) @module))
; Reserved keywords
["when" "and" "or" "not" "in" "not in" "fn" "do" "end" "catch" "rescue" "after" "else"] @keyword
+46
View File
@@ -0,0 +1,46 @@
[
"fun" "end"
"if" "case" "of" "when"
"receive" "after"
"try" "catch" "throw"
"begin"
"module" "export" "import"
"record" "spec" "type" "opaque" "callback"
"define" "include" "include_lib"
"ifdef" "ifndef" "else" "endif" "undef"
"not" "and" "or" "andalso" "orelse"
"band" "bor" "bxor" "bnot" "bsl" "bsr"
"div" "rem"
] @keyword
(atom) @string
(string) @string
(char) @string
(integer) @number
(float) @number
(comment) @comment
(function_clause (atom) @function)
(call (atom) @function)
(attribute (atom) @attribute)
(variable) @variable
(macro) @constant
[
"(" ")" "[" "]" "{" "}" "<<" ">>"
] @punctuation.bracket
[
"," "." ";" ":" "|" "->" "=>" "::"
] @punctuation.delimiter
[
"=" "==" "=:=" "=/=" "/="
"+" "-" "*" "/"
"<" ">" "=<" ">="
"++" "--"
"!" "#"
] @operator
+59
View File
@@ -0,0 +1,59 @@
[
"if" "elif" "else"
"for" "while"
"match"
"break" "continue" "pass"
"return"
"class" "class_name" "extends"
"func" "static" "const" "var" "onready"
"signal" "export" "enum"
"await" "yield"
"in" "is" "as" "not" "and" "or"
"true" "false" "null"
"self"
"breakpoint"
"preload" "load"
] @keyword
(function_definition (name) @function)
(constructor_definition (name) @function)
(call (name) @function)
(attribute_call (name) @function)
(class_definition (name) @type)
(type) @type
(class_name_statement (name) @type)
(string) @string
(node_path) @string
(string_name) @string
(escape_sequence) @string.special
(integer) @number
(float) @number
(true) @boolean
(false) @boolean
(null) @constant.builtin
(comment) @comment
(identifier) @variable
(attribute) @property
(annotation) @attribute
[
"(" ")" "[" "]" "{" "}"
] @punctuation.bracket
[
"," "." ":" "->" ";"
] @punctuation.delimiter
[
"=" "+=" "-=" "*=" "/=" "%="
"+" "-" "*" "/" "%"
"==" "!=" "<" ">" "<=" ">="
"&&" "||" "!"
"&" "|" "^" "~" "<<" ">>"
] @operator
+28
View File
@@ -0,0 +1,28 @@
(section_name) @tag
((section_name) @function.builtin
(#eq? @function.builtin "include"))
((section_header
(section_name) @function.builtin
(subsection_name))
(#eq? @function.builtin "includeIf"))
(variable (name) @property)
[(true) (false)] @constant.builtin
(integer) @number
[(string) (subsection_name)] @string
((string) @string.special.path
(#match? @string.special.path "^(~|./|/)"))
[
"["
"]"
"\""
] @punctuation.bracket
"=" @punctuation.delimiter
(comment) @comment
+4
View File
@@ -0,0 +1,4 @@
(pattern) @string
(negation) @operator
(comment) @comment
(directory_separator) @punctuation.delimiter
+115
View File
@@ -0,0 +1,115 @@
"break" @keyword
"case" @keyword
"const" @keyword
"continue" @keyword
"default" @keyword
"do" @keyword
"else" @keyword
"enum" @keyword
"extern" @keyword
"for" @keyword
"if" @keyword
"inline" @keyword
"return" @keyword
"sizeof" @keyword
"static" @keyword
"struct" @keyword
"switch" @keyword
"typedef" @keyword
"union" @keyword
"volatile" @keyword
"while" @keyword
"#define" @keyword
"#elif" @keyword
"#else" @keyword
"#endif" @keyword
"#if" @keyword
"#ifdef" @keyword
"#ifndef" @keyword
"#include" @keyword
(preproc_directive) @keyword
"--" @operator
"-" @operator
"-=" @operator
"->" @operator
"=" @operator
"!=" @operator
"*" @operator
"&" @operator
"&&" @operator
"+" @operator
"++" @operator
"+=" @operator
"<" @operator
"==" @operator
">" @operator
"||" @operator
"." @delimiter
";" @delimiter
(string_literal) @string
(system_lib_string) @string
(null) @constant
(number_literal) @number
(char_literal) @number
(call_expression
function: (identifier) @function)
(call_expression
function: (field_expression
field: (field_identifier) @function))
(function_declarator
declarator: (identifier) @function)
(preproc_function_def
name: (identifier) @function.special)
(field_identifier) @property
(statement_identifier) @label
(type_identifier) @type
(primitive_type) @type
(sized_type_specifier) @type
((identifier) @constant
(#match? @constant "^[A-Z][A-Z\\d_]*$"))
(identifier) @variable
(comment) @comment
; inherits: c
[
"in"
"out"
"inout"
"uniform"
"shared"
"layout"
"attribute"
"varying"
"buffer"
"coherent"
"readonly"
"writeonly"
"precision"
"highp"
"mediump"
"lowp"
"centroid"
"sample"
"patch"
"smooth"
"flat"
"noperspective"
"invariant"
"precise"
] @type.qualifier
"subroutine" @keyword.function
(extension_storage_class) @keyword.storage
((identifier) @variable.builtin
(#lua-match? @variable.builtin "^gl_"))
+123
View File
@@ -0,0 +1,123 @@
; Function calls
(call_expression
function: (identifier) @function)
(call_expression
function: (identifier) @function.builtin
(#match? @function.builtin "^(append|cap|close|complex|copy|delete|imag|len|make|new|panic|print|println|real|recover)$"))
(call_expression
function: (selector_expression
field: (field_identifier) @function.method))
; Function definitions
(function_declaration
name: (identifier) @function)
(method_declaration
name: (field_identifier) @function.method)
; Identifiers
(type_identifier) @type
(field_identifier) @property
(identifier) @variable
; Operators
[
"--"
"-"
"-="
":="
"!"
"!="
"..."
"*"
"*"
"*="
"/"
"/="
"&"
"&&"
"&="
"%"
"%="
"^"
"^="
"+"
"++"
"+="
"<-"
"<"
"<<"
"<<="
"<="
"="
"=="
">"
">="
">>"
">>="
"|"
"|="
"||"
"~"
] @operator
; Keywords
[
"break"
"case"
"chan"
"const"
"continue"
"default"
"defer"
"else"
"fallthrough"
"for"
"func"
"go"
"goto"
"if"
"import"
"interface"
"map"
"package"
"range"
"return"
"select"
"struct"
"switch"
"type"
"var"
] @keyword
; Literals
[
(interpreted_string_literal)
(raw_string_literal)
(rune_literal)
] @string
(escape_sequence) @escape
[
(int_literal)
(float_literal)
(imaginary_literal)
] @number
[
(true)
(false)
(nil)
(iota)
] @constant.builtin
(comment) @comment
+443
View File
@@ -0,0 +1,443 @@
; ----------------------------------------------------------------------------
; Parameters and variables
; NOTE: These are at the top, so that they have low priority,
; and don't override destructured parameters
(variable) @variable
(pattern/wildcard) @variable
(decl/function
patterns: (patterns
(_) @variable.parameter))
(expression/lambda
(_)+ @variable.parameter
"->")
(decl/function
(infix
(pattern) @variable.parameter))
; ----------------------------------------------------------------------------
; Literals and comments
(integer) @number
(negation) @number
(expression/literal
(float)) @number.float
(char) @character
(string) @string
(unit) @string.special.symbol ; unit, as in ()
(comment) @comment
((haddock) @comment.documentation)
; ----------------------------------------------------------------------------
; Punctuation
[
"("
")"
"{"
"}"
"["
"]"
] @punctuation.bracket
[
","
";"
] @punctuation.delimiter
; ----------------------------------------------------------------------------
; Keywords, operators, includes
[
"forall"
; "∀" ; utf-8 is not cross-platform safe
] @keyword.repeat
(pragma) @keyword.directive
[
"if"
"then"
"else"
"case"
"of"
] @keyword.conditional
[
"import"
"qualified"
"module"
] @keyword.import
[
(operator)
(constructor_operator)
(all_names)
(wildcard)
"."
".."
"="
"|"
"::"
"=>"
"->"
"<-"
"\\"
"`"
"@"
] @operator
; TODO broken, also huh?
; ((qualified_module
; (module) @constructor)
; .
; (module))
(module
(module_id) @module)
[
"where"
"let"
"in"
"class"
"instance"
"pattern"
"data"
"newtype"
"family"
"type"
"as"
"hiding"
"deriving"
"via"
"stock"
"anyclass"
"do"
"mdo"
"rec"
"infix"
"infixl"
"infixr"
] @keyword
; ----------------------------------------------------------------------------
; Functions and variables
(decl
[
name: (variable) @function
names: (binding_list (variable) @function)
])
(decl/bind
name: (variable) @variable)
; Consider signatures (and accompanying functions)
; with only one value on the rhs as variables
(decl/signature
name: (variable) @variable
type: (type))
((decl/signature
name: (variable) @_name
type: (type))
.
(decl
name: (variable) @variable)
match: (_)
(#eq? @_name @variable))
; but consider a type that involves 'IO' a decl/function
(decl/signature
name: (variable) @function
type: (type/apply
constructor: (name) @_type)
(#eq? @_type "IO"))
((decl/signature
name: (variable) @_name
type: (type/apply
constructor: (name) @_type)
(#eq? @_type "IO"))
.
(decl
name: (variable) @function)
match: (_)
(#eq? @_name @function))
((decl/signature) @function
.
(decl/function
name: (variable) @function))
(decl/bind
name: (variable) @function
(match
expression: (expression/lambda)))
; view patterns
(view_pattern
[
(expression/variable) @function.call
(expression/qualified
(variable) @function.call)
])
; consider infix functions as operators
(infix_id
[
(variable) @operator
(qualified
(variable) @operator)
])
; decl/function calls with an infix operator
; e.g. func <$> a <*> b
(infix
[
(variable) @function.call
(qualified
((module) @module
(variable) @function.call))
]
.
(operator))
; infix operators applied to variables
((expression/variable) @variable
.
(operator))
((operator)
.
[
(expression/variable) @variable
(expression/qualified
(variable) @variable)
])
; decl/function calls with infix operators
([
(expression/variable) @function.call
(expression/qualified
(variable) @function.call)
]
.
(operator) @_op
(#any-of? @_op "$" "<$>" ">>=" "=<<"))
; right hand side of infix operator
((infix
[
(operator)
(infix_id (variable))
] ; infix or `func`
.
[
(variable) @function.call
(qualified
(variable) @function.call)
])
.
(operator) @_op
(#any-of? @_op "$" "<$>" "=<<"))
; decl/function composition, arrows, monadic composition (lhs)
(
[
(expression/variable) @function
(expression/qualified
(variable) @function)
]
.
(operator) @_op
(#any-of? @_op "." ">>>" "***" ">=>" "<=<"))
; right hand side of infix operator
((infix
[
(operator)
(infix_id (variable))
] ; infix or `func`
.
[
(variable) @function
(qualified
(variable) @function)
])
.
(operator) @_op
(#any-of? @_op "." ">>>" "***" ">=>" "<=<"))
; function composition, arrows, monadic composition (rhs)
((operator) @_op
.
[
(expression/variable) @function
(expression/qualified
(variable) @function)
]
(#any-of? @_op "." ">>>" "***" ">=>" "<=<"))
; function defined in terms of a function composition
(decl/function
name: (variable) @function
(match
expression: (infix
operator: (operator) @_op
(#any-of? @_op "." ">>>" "***" ">=>" "<=<"))))
(apply
[
(expression/variable) @function.call
(expression/qualified
(variable) @function.call)
])
; function compositions, in parentheses, applied
; lhs
(apply
.
(expression/parens
(infix
[
(variable) @function.call
(qualified
(variable) @function.call)
]
.
(operator))))
; rhs
(apply
.
(expression/parens
(infix
(operator)
.
[
(variable) @function.call
(qualified
(variable) @function.call)
])))
; variables being passed to a function call
(apply
(_)
.
[
(expression/variable) @variable
(expression/qualified
(variable) @variable)
])
; main is always a function
; (this prevents `main = undefined` from being highlighted as a variable)
(decl/bind
name: (variable) @function
(#eq? @function "main"))
; scoped function types (func :: a -> b)
(signature
pattern: (pattern/variable) @function
type: (quantified_type))
; signatures that have a function type
; + binds that follow them
(decl/signature
name: (variable) @function
type: (quantified_type))
((decl/signature
name: (variable) @_name
type: (quantified_type))
.
(decl/bind
(variable) @function)
(#eq? @function @_name))
; ----------------------------------------------------------------------------
; Types
(name) @type
(type/star) @type
(variable) @type
(constructor) @constructor
; True or False
((constructor) @boolean
(#any-of? @boolean "True" "False"))
; otherwise (= True)
((variable) @boolean
(#eq? @boolean "otherwise"))
; ----------------------------------------------------------------------------
; Quasi-quotes
(quoter) @function.call
(quasiquote
[
(quoter) @_name
(_
(variable) @_name)
]
(#eq? @_name "qq")
(quasiquote_body) @string)
(quasiquote
(_
(variable) @_name)
(#eq? @_name "qq")
(quasiquote_body) @string)
; namespaced quasi-quoter
(quasiquote
(_
(module) @module
.
(variable) @function.call))
; Highlighting of quasiquote_body for other languages is handled by injections.scm
; ----------------------------------------------------------------------------
; Exceptions/error handling
((variable) @keyword.exception
(#any-of? @keyword.exception
"error" "undefined" "try" "tryJust" "tryAny" "catch" "catches" "catchJust" "handle" "handleJust"
"throw" "throwIO" "throwTo" "throwError" "ioError" "mask" "mask_" "uninterruptibleMask"
"uninterruptibleMask_" "bracket" "bracket_" "bracketOnErrorSource" "finally" "fail"
"onException" "expectationFailure"))
; ----------------------------------------------------------------------------
; Debugging
((variable) @keyword.debug
(#any-of? @keyword.debug
"trace" "traceId" "traceShow" "traceShowId" "traceWith" "traceShowWith" "traceStack" "traceIO"
"traceM" "traceShowM" "traceEvent" "traceEventWith" "traceEventIO" "flushEventLog" "traceMarker"
"traceMarkerIO"))
; ----------------------------------------------------------------------------
; Fields
(field_name
(variable) @variable.member)
(import_name
(name)
.
(children
(variable) @variable.member))
; ----------------------------------------------------------------------------
; Spell checking
(comment) @spell
+39
View File
@@ -0,0 +1,39 @@
[
"true" "false" "null"
"if" "else" "endif"
"for" "in" "endfor"
] @keyword
(block (identifier) @keyword)
(block (body (block (identifier) @type)))
(string_lit) @string
(template_literal) @string
(heredoc_template) @string
(template_interpolation) @string.special
(numeric_lit) @number
(comment) @comment
(function_call (identifier) @function)
(identifier) @variable
(variable_expr) @variable
(attribute (identifier) @property)
[
"(" ")" "[" "]" "{" "}"
] @punctuation.bracket
[
"." "," ":" "=>"
] @punctuation.delimiter
[
"=" "==" "!=" "<" ">" "<=" ">="
"+" "-" "*" "/" "%"
"&&" "||" "!"
"?" ":"
] @operator
+47
View File
@@ -0,0 +1,47 @@
[
"if" "else"
"for" "while" "do"
"switch" "case" "default" "break" "continue"
"return" "discard"
"struct" "typedef" "cbuffer" "tbuffer"
"register" "packoffset"
"in" "out" "inout"
"static" "const" "extern" "volatile"
"inline"
"true" "false"
] @keyword
(type_identifier) @type
(primitive_type) @type.builtin
(function_declarator (identifier) @function)
(call_expression (identifier) @function)
(string_literal) @string
(number_literal) @number
(comment) @comment
(identifier) @variable
(field_expression (identifier) @property)
(preproc_directive) @keyword
(preproc_include) @keyword
[
"(" ")" "[" "]" "{" "}"
] @punctuation.bracket
[
"," "." ";" ":"
] @punctuation.delimiter
[
"=" "+=" "-=" "*=" "/=" "%="
"+" "-" "*" "/" "%"
"==" "!=" "<" ">" "<=" ">="
"&&" "||" "!"
"&" "|" "^" "~" "<<" ">>"
"?" ":"
] @operator
+13
View File
@@ -0,0 +1,13 @@
(tag_name) @tag
(erroneous_end_tag_name) @tag.error
(doctype) @constant
(attribute_name) @attribute
(attribute_value) @string
(comment) @comment
[
"<"
">"
"</"
"/>"
] @punctuation.bracket
+149
View File
@@ -0,0 +1,149 @@
; Variables
(identifier) @variable
; Methods
(method_declaration
name: (identifier) @function.method)
(method_invocation
name: (identifier) @function.method)
(super) @function.builtin
; Annotations
(annotation
name: (identifier) @attribute)
(marker_annotation
name: (identifier) @attribute)
"@" @operator
; Types
(type_identifier) @type
(interface_declaration
name: (identifier) @type)
(class_declaration
name: (identifier) @type)
(enum_declaration
name: (identifier) @type)
((field_access
object: (identifier) @type)
(#match? @type "^[A-Z]"))
((scoped_identifier
scope: (identifier) @type)
(#match? @type "^[A-Z]"))
((method_invocation
object: (identifier) @type)
(#match? @type "^[A-Z]"))
((method_reference
. (identifier) @type)
(#match? @type "^[A-Z]"))
(constructor_declaration
name: (identifier) @type)
[
(boolean_type)
(integral_type)
(floating_point_type)
(floating_point_type)
(void_type)
] @type.builtin
; Constants
((identifier) @constant
(#match? @constant "^_*[A-Z][A-Z\\d_]+$"))
; Builtins
(this) @variable.builtin
; Literals
[
(hex_integer_literal)
(decimal_integer_literal)
(octal_integer_literal)
(decimal_floating_point_literal)
(hex_floating_point_literal)
] @number
[
(character_literal)
(string_literal)
] @string
(escape_sequence) @string.escape
[
(true)
(false)
(null_literal)
] @constant.builtin
[
(line_comment)
(block_comment)
] @comment
; Keywords
[
"abstract"
"assert"
"break"
"case"
"catch"
"class"
"continue"
"default"
"do"
"else"
"enum"
"exports"
"extends"
"final"
"finally"
"for"
"if"
"implements"
"import"
"instanceof"
"interface"
"module"
"native"
"new"
"non-sealed"
"open"
"opens"
"package"
"permits"
"private"
"protected"
"provides"
"public"
"requires"
"record"
"return"
"sealed"
"static"
"strictfp"
"switch"
"synchronized"
"throw"
"throws"
"to"
"transient"
"transitive"
"try"
"uses"
"volatile"
"when"
"while"
"with"
"yield"
] @keyword
+204
View File
@@ -0,0 +1,204 @@
; Variables
;----------
(identifier) @variable
; Properties
;-----------
(property_identifier) @property
; Function and method definitions
;--------------------------------
(function_expression
name: (identifier) @function)
(function_declaration
name: (identifier) @function)
(method_definition
name: (property_identifier) @function.method)
(pair
key: (property_identifier) @function.method
value: [(function_expression) (arrow_function)])
(assignment_expression
left: (member_expression
property: (property_identifier) @function.method)
right: [(function_expression) (arrow_function)])
(variable_declarator
name: (identifier) @function
value: [(function_expression) (arrow_function)])
(assignment_expression
left: (identifier) @function
right: [(function_expression) (arrow_function)])
; Function and method calls
;--------------------------
(call_expression
function: (identifier) @function)
(call_expression
function: (member_expression
property: (property_identifier) @function.method))
; Special identifiers
;--------------------
((identifier) @constructor
(#match? @constructor "^[A-Z]"))
([
(identifier)
(shorthand_property_identifier)
(shorthand_property_identifier_pattern)
] @constant
(#match? @constant "^[A-Z_][A-Z\\d_]+$"))
((identifier) @variable.builtin
(#match? @variable.builtin "^(arguments|module|console|window|document)$")
(#is-not? local))
((identifier) @function.builtin
(#eq? @function.builtin "require")
(#is-not? local))
; Literals
;---------
(this) @variable.builtin
(super) @variable.builtin
[
(true)
(false)
(null)
(undefined)
] @constant.builtin
(comment) @comment
[
(string)
(template_string)
] @string
(regex) @string.special
(number) @number
; Tokens
;-------
[
";"
(optional_chain)
"."
","
] @punctuation.delimiter
[
"-"
"--"
"-="
"+"
"++"
"+="
"*"
"*="
"**"
"**="
"/"
"/="
"%"
"%="
"<"
"<="
"<<"
"<<="
"="
"=="
"==="
"!"
"!="
"!=="
"=>"
">"
">="
">>"
">>="
">>>"
">>>="
"~"
"^"
"&"
"|"
"^="
"&="
"|="
"&&"
"||"
"??"
"&&="
"||="
"??="
] @operator
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
(template_substitution
"${" @punctuation.special
"}" @punctuation.special) @embedded
[
"as"
"async"
"await"
"break"
"case"
"catch"
"class"
"const"
"continue"
"debugger"
"default"
"delete"
"do"
"else"
"export"
"extends"
"finally"
"for"
"from"
"function"
"get"
"if"
"import"
"in"
"instanceof"
"let"
"new"
"of"
"return"
"set"
"static"
"switch"
"target"
"throw"
"try"
"typeof"
"var"
"void"
"while"
"with"
"yield"
] @keyword
+16
View File
@@ -0,0 +1,16 @@
(pair
key: (_) @string.special.key)
(string) @string
(number) @number
[
(null)
(true)
(false)
] @constant.builtin
(escape_sequence) @escape
(comment) @comment
+375
View File
@@ -0,0 +1,375 @@
; Identifiers
(identifier) @variable
(field_expression
(identifier) @variable.member .)
; Symbols
(quote_expression
":" @string.special.symbol
[
(identifier)
(operator)
] @string.special.symbol)
; Function calls
(call_expression
(identifier) @function.call)
(call_expression
(field_expression
(identifier) @function.call .))
(broadcast_call_expression
(identifier) @function.call)
(broadcast_call_expression
(field_expression
(identifier) @function.call .))
(binary_expression
(_)
(operator) @_pipe
(identifier) @function.call
(#any-of? @_pipe "|>" ".|>"))
; Macros
(macro_identifier
"@" @function.macro
(identifier) @function.macro)
(macro_definition
(signature
(call_expression
.
(identifier) @function.macro)))
; Built-in functions
; print.("\"", filter(name -> getglobal(Core, name) isa Core.Builtin, names(Core)), "\" ")
((identifier) @function.builtin
(#any-of? @function.builtin
"applicable" "fieldtype" "getfield" "getglobal" "invoke" "isa" "isdefined" "isdefinedglobal"
"modifyfield!" "modifyglobal!" "nfields" "replacefield!" "replaceglobal!" "setfield!"
"setfieldonce!" "setglobal!" "setglobalonce!" "swapfield!" "swapglobal!" "throw" "tuple"
"typeassert" "typeof"))
; Type definitions
(type_head
(_) @type.definition)
; Type annotations
(parametrized_type_expression
[
(identifier) @type
(field_expression
(identifier) @type .)
]
(curly_expression
(_) @type))
(typed_expression
(identifier) @type .)
(unary_typed_expression
(identifier) @type .)
(where_expression
[
(curly_expression
(_) @type)
(_) @type
] .)
(unary_expression
(operator) @operator
(_) @type
(#any-of? @operator "<:" ">:"))
(binary_expression
(_) @type
(operator) @operator
(_) @type
(#any-of? @operator "<:" ">:"))
; Built-in types
; print.("\"", filter(name -> typeof(Base.eval(Core, name)) in [DataType, UnionAll], names(Core)), "\" ")
((identifier) @type.builtin
(#any-of? @type.builtin
"AbstractArray" "AbstractChar" "AbstractFloat" "AbstractString" "Any" "ArgumentError" "Array"
"AssertionError" "AtomicMemory" "AtomicMemoryRef" "Bool" "BoundsError" "Char"
"ConcurrencyViolationError" "Cvoid" "DataType" "DenseArray" "DivideError" "DomainError"
"ErrorException" "Exception" "Expr" "FieldError" "Float16" "Float32" "Float64" "Function"
"GenericMemory" "GenericMemoryRef" "GlobalRef" "IO" "InexactError" "InitError" "Int" "Int128"
"Int16" "Int32" "Int64" "Int8" "Integer" "InterruptException" "LineNumberNode" "LoadError"
"Memory" "MemoryRef" "Method" "MethodError" "Module" "NTuple" "NamedTuple" "Nothing" "Number"
"OutOfMemoryError" "OverflowError" "Pair" "Ptr" "QuoteNode" "ReadOnlyMemoryError" "Real" "Ref"
"SegmentationFault" "Signed" "StackOverflowError" "String" "Symbol" "Task" "Tuple" "Type"
"TypeError" "TypeVar" "UInt" "UInt128" "UInt16" "UInt32" "UInt64" "UInt8" "UndefInitializer"
"UndefKeywordError" "UndefRefError" "UndefVarError" "Union" "UnionAll" "Unsigned" "VecElement"
"WeakRef"))
; Keywords
[
"global"
"local"
] @keyword
(compound_statement
[
"begin"
"end"
] @keyword)
(quote_statement
[
"quote"
"end"
] @keyword)
(let_statement
[
"let"
"end"
] @keyword)
(if_statement
[
"if"
"end"
] @keyword.conditional)
(elseif_clause
"elseif" @keyword.conditional)
(else_clause
"else" @keyword.conditional)
(ternary_expression
[
"?"
":"
] @keyword.conditional.ternary)
(try_statement
[
"try"
"end"
] @keyword.exception)
(catch_clause
"catch" @keyword.exception)
(finally_clause
"finally" @keyword.exception)
(for_statement
[
"for"
"end"
] @keyword.repeat)
(for_binding
"outer" @keyword.repeat)
; comprehensions
(for_clause
"for" @keyword.repeat)
(if_clause
"if" @keyword.conditional)
(while_statement
[
"while"
"end"
] @keyword.repeat)
[
(break_statement)
(continue_statement)
] @keyword.repeat
[
"const"
"mutable"
] @keyword.modifier
(function_definition
[
"function"
"end"
] @keyword.function)
(do_clause
[
"do"
"end"
] @keyword.function)
(macro_definition
[
"macro"
"end"
] @keyword)
(return_statement
"return" @keyword.return)
(module_definition
[
"module"
"baremodule"
"end"
] @keyword.import)
(export_statement
"export" @keyword.import)
(public_statement
"public" @keyword.import)
(import_statement
"import" @keyword.import)
(using_statement
"using" @keyword.import)
(import_alias
"as" @keyword.import)
(selected_import
":" @punctuation.delimiter)
(struct_definition
[
"mutable"
"struct"
"end"
] @keyword.type)
(abstract_definition
[
"abstract"
"type"
"end"
] @keyword.type)
(primitive_definition
[
"primitive"
"type"
"end"
] @keyword.type)
; Operators & Punctuation
(operator) @operator
(adjoint_expression
"'" @operator)
(range_expression
":" @operator)
(arrow_function_expression
"->" @operator)
[
"."
"..."
] @punctuation.special
[
","
";"
"::"
] @punctuation.delimiter
; Treat `::` as operator in type contexts, see
; https://github.com/nvim-treesitter/nvim-treesitter/pull/7392
(typed_expression
"::" @operator)
(unary_typed_expression
"::" @operator)
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
; Interpolation
(string_interpolation
.
"$" @punctuation.special)
(interpolation_expression
.
"$" @punctuation.special)
; Keyword operators
((operator) @keyword.operator
(#any-of? @keyword.operator "in" "isa"))
(where_expression
"where" @keyword.operator)
; Built-in constants
((identifier) @constant.builtin
(#any-of? @constant.builtin "nothing" "missing"))
((identifier) @variable.builtin
(#any-of? @variable.builtin "begin" "end")
(#has-ancestor? @variable.builtin index_expression))
; Literals
(boolean_literal) @boolean
(integer_literal) @number
(float_literal) @number.float
((identifier) @number.float
(#any-of? @number.float "NaN" "NaN16" "NaN32" "Inf" "Inf16" "Inf32"))
(character_literal) @character
(escape_sequence) @string.escape
(string_literal) @string
(prefixed_string_literal
prefix: (identifier) @function.macro) @string
(command_literal) @string.special
(prefixed_command_literal
prefix: (identifier) @function.macro) @string.special
((string_literal) @string.documentation
.
[
(abstract_definition)
(assignment)
(const_statement)
(function_definition)
(macro_definition)
(module_definition)
(struct_definition)
])
(source_file
(string_literal) @string.documentation
.
[
(identifier)
(call_expression)
])
[
(line_comment)
(block_comment)
] @comment
+158
View File
@@ -0,0 +1,158 @@
; File autogenerated by build-flavored-queries.py; do not edit
; This file specifies how matched syntax patterns should be highlighted
[
"export"
"import"
] @keyword.import
"mod" @module
[
"alias"
"set"
"shell"
] @keyword
[
"if"
"else"
] @keyword.conditional
; Variables
(value
(identifier) @variable)
(alias
left: (identifier) @variable)
(assignment
left: (identifier) @variable)
; Functions
(recipe_header
name: (identifier) @function)
(dependency
name: (identifier) @function.call)
(dependency_expression
name: (identifier) @function.call)
(function_call
name: (identifier) @function.call)
; Parameters
(parameter
name: (identifier) @variable.parameter)
; Namespaces
(module
name: (identifier) @module)
; Operators
[
":="
"?"
"=="
"!="
"=~"
"@"
"="
"$"
"*"
"+"
"&&"
"@-"
"-@"
"-"
"/"
":"
] @operator
; Punctuation
"," @punctuation.delimiter
[
"{"
"}"
"["
"]"
"("
")"
"{{"
"}}"
] @punctuation.bracket
[ "`" "```" ] @punctuation.special
; Literals
(boolean) @boolean
[
(string)
(external_command)
] @string
(escape_sequence) @string.escape
; Comments
(comment) @spell @comment
(shebang) @keyword.directive
; highlight known settings (filtering does not always work)
(setting
left: (identifier) @keyword
(#any-of? @keyword
"allow-duplicate-recipes"
"allow-duplicate-variables"
"dotenv-filename"
"dotenv-load"
"dotenv-path"
"dotenv-required"
"export"
"fallback"
"ignore-comments"
"positional-arguments"
"shell"
"shell-interpreter"
"tempdir"
"windows-powershell"
"windows-shell"
"working-directory"))
; highlight known attributes (filtering does not always work)
(attribute
(identifier) @attribute
(#any-of? @attribute
"confirm"
"doc"
"extension"
"group"
"linux"
"macos"
"metadata"
"no-cd"
"no-exit-message"
"no-quiet"
"openbsd"
"parallel"
"positional-arguments"
"private"
"script"
"unix"
"windows"
"working-directory"))
; Numbers are part of the syntax tree, even if disallowed
(numeric_error) @error
+376
View File
@@ -0,0 +1,376 @@
;; Based on the nvim-treesitter highlighting, which is under the Apache license.
;; See https://github.com/nvim-treesitter/nvim-treesitter/blob/f8ab59861eed4a1c168505e3433462ed800f2bae/queries/kotlin/highlights.scm
;;
;; The only difference in this file is that queries using #lua-match?
;; have been removed.
;;; Identifiers
(simple_identifier) @variable
; `it` keyword inside lambdas
; FIXME: This will highlight the keyword outside of lambdas since tree-sitter
; does not allow us to check for arbitrary nestation
((simple_identifier) @variable.builtin
(#eq? @variable.builtin "it"))
; `field` keyword inside property getter/setter
; FIXME: This will highlight the keyword outside of getters and setters
; since tree-sitter does not allow us to check for arbitrary nestation
((simple_identifier) @variable.builtin
(#eq? @variable.builtin "field"))
; `this` this keyword inside classes
(this_expression) @variable.builtin
; `super` keyword inside classes
(super_expression) @variable.builtin
(class_parameter
(simple_identifier) @property)
(class_body
(property_declaration
(variable_declaration
(simple_identifier) @property)))
; id_1.id_2.id_3: `id_2` and `id_3` are assumed as object properties
(_
(navigation_suffix
(simple_identifier) @property))
(enum_entry
(simple_identifier) @constant)
(type_identifier) @type
((type_identifier) @type.builtin
(#any-of? @type.builtin
"Byte"
"Short"
"Int"
"Long"
"UByte"
"UShort"
"UInt"
"ULong"
"Float"
"Double"
"Boolean"
"Char"
"String"
"Array"
"ByteArray"
"ShortArray"
"IntArray"
"LongArray"
"UByteArray"
"UShortArray"
"UIntArray"
"ULongArray"
"FloatArray"
"DoubleArray"
"BooleanArray"
"CharArray"
"Map"
"Set"
"List"
"EmptyMap"
"EmptySet"
"EmptyList"
"MutableMap"
"MutableSet"
"MutableList"
))
(package_header
. (identifier)) @namespace
(import_header
"import" @include)
; TODO: Seperate labeled returns/breaks/continue/super/this
; Must be implemented in the parser first
(label) @label
;;; Function definitions
(function_declaration
. (simple_identifier) @function)
(getter
("get") @function.builtin)
(setter
("set") @function.builtin)
(primary_constructor) @constructor
(secondary_constructor
("constructor") @constructor)
(constructor_invocation
(user_type
(type_identifier) @constructor))
(anonymous_initializer
("init") @constructor)
(parameter
(simple_identifier) @parameter)
(parameter_with_optional_type
(simple_identifier) @parameter)
; lambda parameters
(lambda_literal
(lambda_parameters
(variable_declaration
(simple_identifier) @parameter)))
;;; Function calls
; function()
(call_expression
. (simple_identifier) @function)
; object.function() or object.property.function()
(call_expression
(navigation_expression
(navigation_suffix
(simple_identifier) @function) . ))
(call_expression
. (simple_identifier) @function.builtin
(#any-of? @function.builtin
"arrayOf"
"arrayOfNulls"
"byteArrayOf"
"shortArrayOf"
"intArrayOf"
"longArrayOf"
"ubyteArrayOf"
"ushortArrayOf"
"uintArrayOf"
"ulongArrayOf"
"floatArrayOf"
"doubleArrayOf"
"booleanArrayOf"
"charArrayOf"
"emptyArray"
"mapOf"
"setOf"
"listOf"
"emptyMap"
"emptySet"
"emptyList"
"mutableMapOf"
"mutableSetOf"
"mutableListOf"
"print"
"println"
"error"
"TODO"
"run"
"runCatching"
"repeat"
"lazy"
"lazyOf"
"enumValues"
"enumValueOf"
"assert"
"check"
"checkNotNull"
"require"
"requireNotNull"
"with"
"synchronized"
))
;;; Literals
[
(line_comment)
(multiline_comment)
(shebang_line)
] @comment
(real_literal) @float
[
(integer_literal)
(long_literal)
(hex_literal)
(bin_literal)
(unsigned_literal)
] @number
[
(null_literal) ; should be highlighted the same as booleans
(boolean_literal)
] @boolean
(character_literal) @character
(string_literal) @string
(character_escape_seq) @string.escape
; There are 3 ways to define a regex
; - "[abc]?".toRegex()
(call_expression
(navigation_expression
((string_literal) @string.regex)
(navigation_suffix
((simple_identifier) @_function
(#eq? @_function "toRegex")))))
; - Regex("[abc]?")
(call_expression
((simple_identifier) @_function
(#eq? @_function "Regex"))
(call_suffix
(value_arguments
(value_argument
(string_literal) @string.regex))))
; - Regex.fromLiteral("[abc]?")
(call_expression
(navigation_expression
((simple_identifier) @_class
(#eq? @_class "Regex"))
(navigation_suffix
((simple_identifier) @_function
(#eq? @_function "fromLiteral"))))
(call_suffix
(value_arguments
(value_argument
(string_literal) @string.regex))))
;;; Keywords
(type_alias "typealias" @keyword)
[
(class_modifier)
(member_modifier)
(function_modifier)
(property_modifier)
(platform_modifier)
(variance_modifier)
(parameter_modifier)
(visibility_modifier)
(reification_modifier)
(inheritance_modifier)
]@keyword
[
"val"
"var"
"enum"
"class"
"object"
"interface"
; "typeof" ; NOTE: It is reserved for future use
] @keyword
("fun") @keyword.function
(jump_expression) @keyword.return
[
"if"
"else"
"when"
] @conditional
[
"for"
"do"
"while"
] @repeat
[
"try"
"catch"
"throw"
"finally"
] @exception
(annotation
"@" @attribute (use_site_target)? @attribute)
(annotation
(user_type
(type_identifier) @attribute))
(annotation
(constructor_invocation
(user_type
(type_identifier) @attribute)))
(file_annotation
"@" @attribute "file" @attribute ":" @attribute)
(file_annotation
(user_type
(type_identifier) @attribute))
(file_annotation
(constructor_invocation
(user_type
(type_identifier) @attribute)))
;;; Operators & Punctuation
[
"!"
"!="
"!=="
"="
"=="
"==="
">"
">="
"<"
"<="
"||"
"&&"
"+"
"++"
"+="
"-"
"--"
"-="
"*"
"*="
"/"
"/="
"%"
"%="
"?."
"?:"
"!!"
"is"
"in"
"as"
"as?"
".."
"..<"
"->"
] @operator
[
"(" ")"
"[" "]"
"{" "}"
] @punctuation.bracket
[
"."
","
";"
":"
"::"
] @punctuation.delimiter
; NOTE: `interpolated_identifier`s can be highlighted in any way
(string_literal
(interpolated_identifier) @none)
(string_literal
(interpolated_expression) @none
"}" @punctuation.special)
+204
View File
@@ -0,0 +1,204 @@
; Keywords
"return" @keyword.return
[
"goto"
"in"
"local"
"global"
] @keyword
(label_statement) @label
(break_statement) @keyword
(do_statement
[
"do"
"end"
] @keyword)
(while_statement
[
"while"
"do"
"end"
] @repeat)
(repeat_statement
[
"repeat"
"until"
] @repeat)
(if_statement
[
"if"
"elseif"
"else"
"then"
"end"
] @conditional)
(elseif_statement
[
"elseif"
"then"
"end"
] @conditional)
(else_statement
[
"else"
"end"
] @conditional)
(for_statement
[
"for"
"do"
"end"
] @repeat)
(function_declaration
[
"function"
"end"
] @keyword.function)
(function_definition
[
"function"
"end"
] @keyword.function)
; Operators
(binary_expression
operator: _ @operator)
(unary_expression
operator: _ @operator)
"=" @operator
[
"and"
"not"
"or"
] @keyword.operator
; Punctuations
[
";"
":"
","
"."
] @punctuation.delimiter
; Brackets
[
"("
")"
"["
"]"
"{"
"}"
] @punctuation.bracket
; Variables
(identifier) @variable
((identifier) @variable.builtin
(#eq? @variable.builtin "self"))
(variable_list
(attribute
"<" @punctuation.bracket
(identifier) @attribute
">" @punctuation.bracket))
; Constants
((identifier) @constant
(#match? @constant "^[A-Z][A-Z_0-9]*$"))
(vararg_expression) @constant
(nil) @constant.builtin
[
(false)
(true)
] @boolean
; Tables
(field
name: (identifier) @field)
(dot_index_expression
field: (identifier) @field)
(table_constructor
[
"{"
"}"
] @constructor)
; Functions
(parameters
(identifier) @parameter)
(function_declaration
name: [
(identifier) @function
(dot_index_expression
field: (identifier) @function)
])
(function_declaration
name: (method_index_expression
method: (identifier) @method))
(assignment_statement
(variable_list
.
name: [
(identifier) @function
(dot_index_expression
field: (identifier) @function)
])
(expression_list
.
value: (function_definition)))
(table_constructor
(field
name: (identifier) @function
value: (function_definition)))
(function_call
name: [
(identifier) @function.call
(dot_index_expression
field: (identifier) @function.call)
(method_index_expression
method: (identifier) @method.call)
])
(function_call
(identifier) @function.builtin
(#any-of? @function.builtin
; built-in functions in Lua 5.1
"assert" "collectgarbage" "dofile" "error" "getfenv" "getmetatable" "ipairs" "load" "loadfile"
"loadstring" "module" "next" "pairs" "pcall" "print" "rawequal" "rawget" "rawset" "require"
"select" "setfenv" "setmetatable" "tonumber" "tostring" "type" "unpack" "xpcall"))
; Others
(comment) @comment
(hash_bang_line) @preproc
(number) @number
(string) @string
(escape_sequence) @string.escape
+171
View File
@@ -0,0 +1,171 @@
[
"("
")"
"{"
"}"
] @punctuation.bracket
[
":"
"&:"
"::"
"|"
";"
"\""
"'"
","
] @punctuation.delimiter
[
"$"
"$$"
] @punctuation.special
(automatic_variable
[ "@" "%" "<" "?" "^" "+" "/" "*" "D" "F"] @punctuation.special)
(automatic_variable
"/" @error . ["D" "F"])
[
"="
":="
"::="
"?="
"+="
"!="
"@"
"-"
"+"
] @operator
[
(text)
(string)
(raw_text)
] @string
(variable_assignment (word) @string)
[
"ifeq"
"ifneq"
"ifdef"
"ifndef"
"else"
"endif"
"if"
"or" ; boolean functions are conditional in make grammar
"and"
] @conditional
"foreach" @repeat
[
"define"
"endef"
"vpath"
"undefine"
"export"
"unexport"
"override"
"private"
; "load"
] @keyword
[
"include"
"sinclude"
"-include"
] @include
[
"subst"
"patsubst"
"strip"
"findstring"
"filter"
"filter-out"
"sort"
"word"
"words"
"wordlist"
"firstword"
"lastword"
"dir"
"notdir"
"suffix"
"basename"
"addsuffix"
"addprefix"
"join"
"wildcard"
"realpath"
"abspath"
"call"
"eval"
"file"
"value"
"shell"
] @keyword.function
[
"error"
"warning"
"info"
] @exception
;; Variable
(variable_assignment
name: (word) @constant)
(variable_reference
(word) @constant)
(comment) @comment
((word) @clean @string.regex
(#match? @clean "[%\*\?]"))
(function_call
function: "error"
(arguments (text) @text.danger))
(function_call
function: "warning"
(arguments (text) @text.warning))
(function_call
function: "info"
(arguments (text) @text.note))
;; Install Command Categories
;; Others special variables
;; Variables Used by Implicit Rules
[
"VPATH"
".RECIPEPREFIX"
] @constant.builtin
(variable_assignment
name: (word) @clean @constant.builtin
(#match? @clean "^(AR|AS|CC|CXX|CPP|FC|M2C|PC|CO|GET|LEX|YACC|LINT|MAKEINFO|TEX|TEXI2DVI|WEAVE|CWEAVE|TANGLE|CTANGLE|RM|ARFLAGS|ASFLAGS|CFLAGS|CXXFLAGS|COFLAGS|CPPFLAGS|FFLAGS|GFLAGS|LDFLAGS|LDLIBS|LFLAGS|YFLAGS|PFLAGS|RFLAGS|LINTFLAGS|PRE_INSTALL|POST_INSTALL|NORMAL_INSTALL|PRE_UNINSTALL|POST_UNINSTALL|NORMAL_UNINSTALL|MAKEFILE_LIST|MAKE_RESTARTS|MAKE_TERMOUT|MAKE_TERMERR|\.DEFAULT_GOAL|\.RECIPEPREFIX|\.EXTRA_PREREQS)$"))
(variable_reference
(word) @clean @constant.builtin
(#match? @clean "^(AR|AS|CC|CXX|CPP|FC|M2C|PC|CO|GET|LEX|YACC|LINT|MAKEINFO|TEX|TEXI2DVI|WEAVE|CWEAVE|TANGLE|CTANGLE|RM|ARFLAGS|ASFLAGS|CFLAGS|CXXFLAGS|COFLAGS|CPPFLAGS|FFLAGS|GFLAGS|LDFLAGS|LDLIBS|LFLAGS|YFLAGS|PFLAGS|RFLAGS|LINTFLAGS|PRE_INSTALL|POST_INSTALL|NORMAL_INSTALL|PRE_UNINSTALL|POST_UNINSTALL|NORMAL_UNINSTALL|MAKEFILE_LIST|MAKE_RESTARTS|MAKE_TERMOUT|MAKE_TERMERR|\.DEFAULT_GOAL|\.RECIPEPREFIX|\.EXTRA_PREREQS\.VARIABLES|\.FEATURES|\.INCLUDE_DIRS|\.LOADED)$"))
;; Standart targets
(targets
(word) @constant.macro
(#match? @constant.macro "^(all|install|install-html|install-dvi|install-pdf|install-ps|uninstall|install-strip|clean|distclean|mostlyclean|maintainer-clean|TAGS|info|dvi|html|pdf|ps|dist|check|installcheck|installdirs)$"))
(targets
(word) @constant.macro
(#match? @constant.macro "^(all|install|install-html|install-dvi|install-pdf|install-ps|uninstall|install-strip|clean|distclean|mostlyclean|maintainer-clean|TAGS|info|dvi|html|pdf|ps|dist|check|installcheck|installdirs)$"))
;; Builtin targets
(targets
(word) @constant.macro
(#match? @constant.macro "^\.(PHONY|SUFFIXES|DEFAULT|PRECIOUS|INTERMEDIATE|SECONDARY|SECONDEXPANSION|DELETE_ON_ERROR|IGNORE|LOW_RESOLUTION_TIME|SILENT|EXPORT_ALL_VARIABLES|NOTPARALLEL|ONESHELL|POSIX)$"))
+47
View File
@@ -0,0 +1,47 @@
;From nvim-treesitter/nvim-treesitter
(atx_heading
(inline) @text.title)
(setext_heading
(paragraph) @text.title)
[
(atx_h1_marker)
(atx_h2_marker)
(atx_h3_marker)
(atx_h4_marker)
(atx_h5_marker)
(atx_h6_marker)
(setext_h1_underline)
(setext_h2_underline)
] @punctuation.special
[
(link_title)
(indented_code_block)
(fenced_code_block)
] @text.literal
(fenced_code_block_delimiter) @punctuation.delimiter
(code_fence_content) @none
(link_destination) @text.uri
(link_label) @text.reference
[
(list_marker_plus)
(list_marker_minus)
(list_marker_star)
(list_marker_dot)
(list_marker_parenthesis)
(thematic_break)
] @punctuation.special
[
(block_continuation)
(block_quote_marker)
] @punctuation.special
(backslash_escape) @string.escape
+106
View File
@@ -0,0 +1,106 @@
(comment) @comment @spell
(annot_atom doc: (static_string) @spell)
[
"forall"
"in"
"let"
"default"
"doc"
"rec"
"optional"
"priority"
"force"
"not_exported"
] @keyword
"fun" @keyword.function
"import" @include
[ "if" "then" "else" ] @keyword.conditional
"match" @keyword.conditional
(types) @type
"Array" @type.builtin
; BUILTIN Constants
(bool) @boolean
"null" @constant.builtin
(enum_tag) @constant
(num_literal) @number
[
(infix_op)
"|>"
"="
"&"
"=="
"/"
"!="
"<"
">"
] @operator
(type_atom) @type
(chunk_literal_single) @string
(chunk_literal_multi) @string
(str_esc_char) @string.escape
[
"{" "}"
"(" ")"
"[|" "|]"
"[" "]"
] @punctuation.bracket
[
","
"."
":"
"|"
"->"
"+"
"-"
"*"
] @punctuation.delimiter
(multstr_start) @punctuation.bracket
(multstr_end) @punctuation.bracket
(interpolation_start) @punctuation.special
(interpolation_end) @punctuation.special
(builtin) @function.builtin
(fun_expr
(pattern_fun
(ident) @parameter
)
)
; application where the head terms is an identifier: function arg1 arg2 arg3
(applicative t1:
(applicative . (record_operand (atom (ident))) @function)
)
; application where the head terms is a record field path: foo.bar.function arg1 arg2 arg3
(applicative t1:
(applicative . (record_operand (record_operation_chain)) @function)
)
(str_chunks) @string
(_
(interpolation_start)
(term) @string.special
)
(field_path_elem) @property
(infix_expr
op: (infix_b_op_6)
t2: (infix_expr (applicative . (record_operand (record_operation_chain) @function )))
)

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