From 57a8acf0c4ed5e7f6dda83c3f9b073f8a99a70f9 Mon Sep 17 00:00:00 2001 From: Pham Huy Hoang Date: Sat, 6 Jan 2024 15:05:50 +0900 Subject: chore: query formatting --- queries/ada/folds.scm | 23 +- queries/ada/highlights.scm | 402 +++++++++------ queries/ada/locals.scm | 106 +++- queries/agda/folds.scm | 4 +- queries/agda/highlights.scm | 57 ++- queries/angular/highlights.scm | 43 +- queries/apex/folds.scm | 8 +- queries/apex/highlights.scm | 149 +++--- queries/apex/locals.scm | 36 +- queries/arduino/highlights.scm | 20 +- queries/arduino/injections.scm | 6 +- queries/astro/highlights.scm | 25 +- queries/astro/injections.scm | 18 +- queries/authzed/highlights.scm | 15 +- queries/authzed/injections.scm | 2 +- queries/awk/highlights.scm | 226 +++++---- queries/awk/injections.scm | 16 +- queries/bash/highlights.scm | 196 ++++--- queries/bash/injections.scm | 47 +- queries/bash/locals.scm | 3 +- queries/bass/highlights.scm | 94 ++-- queries/bass/indents.scm | 15 +- queries/bass/injections.scm | 4 +- queries/bass/locals.scm | 15 +- queries/beancount/folds.scm | 4 +- queries/beancount/highlights.scm | 43 +- queries/bibtex/folds.scm | 4 +- queries/bibtex/highlights.scm | 1 - queries/bibtex/indents.scm | 8 +- queries/bicep/folds.scm | 6 - queries/bicep/highlights.scm | 60 +-- queries/bicep/indents.scm | 15 +- queries/bicep/injections.scm | 4 +- queries/bicep/locals.scm | 6 - queries/bitbake/folds.scm | 5 - queries/bitbake/highlights.scm | 190 ++++--- queries/bitbake/indents.scm | 132 +++-- queries/bitbake/injections.scm | 13 +- queries/bitbake/locals.scm | 80 ++- queries/blueprint/highlights.scm | 47 +- queries/c/folds.scm | 34 +- queries/c/highlights.scm | 129 +++-- queries/c/indents.scm | 64 ++- queries/c/injections.scm | 52 +- queries/c/locals.scm | 48 +- queries/c_sharp/folds.scm | 21 +- queries/c_sharp/highlights.scm | 363 +++++++------ queries/c_sharp/injections.scm | 4 +- queries/c_sharp/locals.scm | 14 +- queries/cairo/folds.scm | 5 - queries/cairo/highlights.scm | 254 ++++++---- queries/cairo/indents.scm | 31 +- queries/cairo/injections.scm | 6 +- queries/cairo/locals.scm | 37 +- queries/capnp/highlights.scm | 36 +- queries/capnp/indents.scm | 10 +- queries/capnp/injections.scm | 4 +- queries/capnp/locals.scm | 23 +- queries/chatito/folds.scm | 6 +- queries/chatito/highlights.scm | 47 +- queries/chatito/indents.scm | 9 +- queries/chatito/injections.scm | 4 +- queries/chatito/locals.scm | 20 +- queries/clojure/folds.scm | 3 +- queries/clojure/highlights.scm | 270 +++++----- queries/clojure/injections.scm | 4 +- queries/cmake/folds.scm | 12 +- queries/cmake/highlights.scm | 215 ++++---- queries/cmake/indents.scm | 17 +- queries/comment/highlights.scm | 20 +- queries/commonlisp/folds.scm | 3 +- queries/commonlisp/highlights.scm | 128 +++-- queries/commonlisp/locals.scm | 131 +++-- queries/cooklang/highlights.scm | 18 +- queries/corn/folds.scm | 6 +- queries/corn/highlights.scm | 6 + queries/corn/indents.scm | 28 +- queries/corn/locals.scm | 11 +- queries/cpon/highlights.scm | 24 +- queries/cpon/injections.scm | 4 +- queries/cpon/locals.scm | 3 +- queries/cpp/folds.scm | 21 +- queries/cpp/highlights.scm | 168 +++--- queries/cpp/indents.scm | 6 +- queries/cpp/injections.scm | 5 +- queries/cpp/locals.scm | 41 +- queries/css/folds.scm | 4 +- queries/css/highlights.scm | 125 ++--- queries/css/indents.scm | 4 +- queries/css/injections.scm | 4 +- queries/csv/highlights.scm | 1 - queries/cuda/highlights.scm | 6 +- queries/cuda/injections.scm | 6 +- queries/cue/highlights.scm | 85 ++-- queries/cue/indents.scm | 15 +- queries/cue/injections.scm | 4 +- queries/cue/locals.scm | 5 +- queries/d/highlights.scm | 79 ++- queries/d/indents.scm | 9 +- queries/d/injections.scm | 6 +- queries/dart/folds.scm | 3 - queries/dart/highlights.scm | 222 ++++---- queries/dart/indents.scm | 17 +- queries/dart/injections.scm | 4 +- queries/dart/locals.scm | 24 +- queries/devicetree/highlights.scm | 40 +- queries/devicetree/indents.scm | 4 +- queries/devicetree/injections.scm | 4 +- queries/devicetree/locals.scm | 2 +- queries/dhall/folds.scm | 4 - queries/dhall/highlights.scm | 188 ++++--- queries/dhall/injections.scm | 4 +- queries/diff/highlights.scm | 13 +- queries/dockerfile/highlights.scm | 10 +- queries/dockerfile/injections.scm | 10 +- queries/dot/highlights.scm | 19 +- queries/dot/injections.scm | 6 +- queries/doxygen/highlights.scm | 14 +- queries/doxygen/injections.scm | 5 +- queries/dtd/folds.scm | 4 +- queries/dtd/highlights.scm | 124 +++-- queries/dtd/locals.scm | 10 +- queries/ebnf/highlights.scm | 35 +- queries/ecma/highlights.scm | 207 ++++---- queries/ecma/indents.scm | 52 +- queries/ecma/injections.scm | 155 +++--- queries/ecma/locals.scm | 15 +- queries/eds/highlights.scm | 67 +-- queries/eex/highlights.scm | 1 - queries/eex/injections.scm | 8 +- queries/elixir/highlights.scm | 182 +++---- queries/elixir/indents.scm | 4 +- queries/elixir/injections.scm | 49 +- queries/elixir/locals.scm | 2 +- queries/elm/highlights.scm | 104 ++-- queries/elm/injections.scm | 8 +- queries/elsa/highlights.scm | 13 +- queries/elsa/injections.scm | 4 +- queries/elvish/highlights.scm | 157 ++++-- queries/elvish/injections.scm | 4 +- queries/embedded_template/injections.scm | 8 +- queries/erlang/highlights.scm | 138 +++-- queries/facility/highlights.scm | 4 +- queries/facility/indents.scm | 7 +- queries/facility/injections.scm | 5 +- queries/fennel/folds.scm | 12 +- queries/fennel/highlights.scm | 82 +-- queries/fennel/injections.scm | 4 +- queries/fennel/locals.scm | 38 +- queries/firrtl/folds.scm | 8 +- queries/firrtl/highlights.scm | 86 ++-- queries/firrtl/indents.scm | 10 +- queries/firrtl/injections.scm | 4 +- queries/firrtl/locals.scm | 37 +- queries/fish/folds.scm | 12 +- queries/fish/highlights.scm | 219 ++++---- queries/fish/indents.scm | 18 +- queries/fish/injections.scm | 4 +- queries/fish/locals.scm | 7 +- queries/foam/folds.scm | 9 +- queries/foam/highlights.scm | 43 +- queries/foam/indents.scm | 10 +- queries/foam/injections.scm | 22 +- queries/foam/locals.scm | 12 +- queries/fortran/folds.scm | 18 +- queries/fortran/highlights.scm | 60 +-- queries/fsh/highlights.scm | 10 +- queries/func/highlights.scm | 40 +- queries/fusion/highlights.scm | 88 ++-- queries/fusion/indents.scm | 19 +- queries/fusion/locals.scm | 12 +- queries/gdscript/folds.scm | 8 +- queries/gdscript/highlights.scm | 165 ++++-- queries/gdscript/indents.scm | 71 ++- queries/gdscript/injections.scm | 4 +- queries/gdscript/locals.scm | 117 +++-- queries/git_config/folds.scm | 1 + queries/git_config/highlights.scm | 30 +- queries/git_rebase/highlights.scm | 1 - queries/git_rebase/injections.scm | 9 +- queries/gitattributes/highlights.scm | 9 +- queries/gitattributes/injections.scm | 4 +- queries/gitattributes/locals.scm | 10 +- queries/gitcommit/highlights.scm | 44 +- queries/gitcommit/injections.scm | 6 +- queries/gitignore/highlights.scm | 6 +- queries/gleam/folds.scm | 2 +- queries/gleam/highlights.scm | 104 ++-- queries/gleam/indents.scm | 4 +- queries/gleam/injections.scm | 8 +- queries/gleam/locals.scm | 19 +- queries/glimmer/folds.scm | 5 +- queries/glimmer/highlights.scm | 92 ++-- queries/glimmer/indents.scm | 36 +- queries/glimmer/locals.scm | 8 +- queries/glsl/highlights.scm | 3 +- queries/glsl/injections.scm | 6 +- queries/gn/highlights.scm | 32 +- queries/go/folds.scm | 35 +- queries/go/highlights.scm | 153 +++--- queries/go/indents.scm | 22 +- queries/go/injections.scm | 45 +- queries/go/locals.scm | 90 ++-- queries/godot_resource/folds.scm | 4 +- queries/godot_resource/highlights.scm | 14 +- queries/godot_resource/locals.scm | 4 +- queries/gomod/highlights.scm | 5 +- queries/gomod/injections.scm | 2 +- queries/gosum/highlights.scm | 9 +- queries/gowork/highlights.scm | 4 +- queries/gowork/injections.scm | 2 +- queries/gpg/highlights.scm | 31 +- queries/gpg/injections.scm | 2 +- queries/graphql/highlights.scm | 25 +- queries/graphql/injections.scm | 2 +- queries/groovy/highlights.scm | 53 +- queries/groovy/injections.scm | 8 +- queries/gstlaunch/highlights.scm | 21 +- queries/hack/highlights.scm | 177 ++++--- queries/hare/folds.scm | 3 - queries/hare/highlights.scm | 114 +++-- queries/hare/indents.scm | 20 +- queries/hare/injections.scm | 18 +- queries/hare/locals.scm | 44 +- queries/haskell/folds.scm | 6 +- queries/haskell/highlights.scm | 717 ++++++++++++++++---------- queries/haskell/injections.scm | 77 ++- queries/haskell_persistent/folds.scm | 4 +- queries/haskell_persistent/highlights.scm | 28 +- queries/hcl/folds.scm | 8 +- queries/hcl/highlights.scm | 36 +- queries/hcl/indents.scm | 1 + queries/hcl/injections.scm | 2 +- queries/heex/highlights.scm | 17 +- queries/heex/injections.scm | 2 +- queries/hjson/highlights.scm | 19 +- queries/hjson/indents.scm | 1 - queries/hjson/injections.scm | 2 +- queries/hlsl/highlights.scm | 14 +- queries/hlsl/injections.scm | 4 +- queries/hocon/highlights.scm | 62 ++- queries/hocon/injections.scm | 2 +- queries/hoon/folds.scm | 10 +- queries/hoon/highlights.scm | 6 +- queries/hoon/locals.scm | 2 +- queries/html/highlights.scm | 1 - queries/html/injections.scm | 7 +- queries/html_tags/highlights.scm | 135 +++-- queries/html_tags/indents.scm | 37 +- queries/html_tags/injections.scm | 85 ++-- queries/htmldjango/highlights.scm | 40 +- queries/htmldjango/indents.scm | 2 + queries/htmldjango/injections.scm | 4 +- queries/http/highlights.scm | 26 +- queries/http/injections.scm | 10 +- queries/hurl/folds.scm | 1 - queries/hurl/highlights.scm | 26 +- queries/hurl/indents.scm | 2 +- queries/hurl/injections.scm | 4 +- queries/ini/highlights.scm | 13 +- queries/ispc/folds.scm | 1 - queries/ispc/highlights.scm | 76 ++- queries/ispc/indents.scm | 11 +- queries/ispc/locals.scm | 8 +- queries/janet_simple/folds.scm | 3 +- queries/janet_simple/highlights.scm | 94 ++-- queries/janet_simple/injections.scm | 2 +- queries/java/highlights.scm | 102 ++-- queries/java/indents.scm | 8 +- queries/java/injections.scm | 16 +- queries/java/locals.scm | 54 +- queries/javascript/highlights.scm | 24 +- queries/javascript/locals.scm | 29 +- queries/jq/highlights.scm | 48 +- queries/jq/injections.scm | 40 +- queries/jq/locals.scm | 9 +- queries/jsdoc/highlights.scm | 1 + queries/json/highlights.scm | 32 +- queries/json5/highlights.scm | 2 +- queries/json5/injections.scm | 2 +- queries/jsonc/highlights.scm | 1 - queries/jsonc/indents.scm | 1 - queries/jsonc/injections.scm | 2 +- queries/jsonnet/folds.scm | 16 +- queries/jsonnet/highlights.scm | 41 +- queries/jsonnet/locals.scm | 19 +- queries/jsx/highlights.scm | 56 +- queries/jsx/indents.scm | 11 +- queries/jsx/injections.scm | 14 +- queries/julia/folds.scm | 3 - queries/julia/highlights.scm | 266 ++++++---- queries/julia/indents.scm | 4 - queries/julia/injections.scm | 23 +- queries/julia/locals.scm | 47 +- queries/kconfig/highlights.scm | 36 +- queries/kconfig/indents.scm | 3 +- queries/kconfig/locals.scm | 13 +- queries/kdl/folds.scm | 1 - queries/kdl/highlights.scm | 54 +- queries/kdl/indents.scm | 13 +- queries/kdl/injections.scm | 4 +- queries/kdl/locals.scm | 12 +- queries/kotlin/folds.scm | 26 +- queries/kotlin/highlights.scm | 500 +++++++++--------- queries/kotlin/injections.scm | 31 +- queries/kotlin/locals.scm | 110 ++-- queries/kusto/highlights.scm | 10 +- queries/kusto/injections.scm | 2 +- queries/lalrpop/highlights.scm | 45 +- queries/lalrpop/injections.scm | 11 +- queries/lalrpop/locals.scm | 2 +- queries/latex/folds.scm | 1 - queries/latex/highlights.scm | 308 +++++++---- queries/latex/injections.scm | 28 +- queries/ledger/folds.scm | 4 +- queries/ledger/highlights.scm | 72 +-- queries/ledger/indents.scm | 4 +- queries/ledger/injections.scm | 4 +- queries/leo/highlights.scm | 200 ++++---- queries/leo/indents.scm | 44 +- queries/leo/injections.scm | 2 +- queries/linkerscript/highlights.scm | 86 ++-- queries/linkerscript/locals.scm | 17 +- queries/liquidsoap/folds.scm | 38 +- queries/liquidsoap/highlights.scm | 40 +- queries/liquidsoap/indents.scm | 54 +- queries/liquidsoap/locals.scm | 38 +- queries/llvm/highlights.scm | 30 +- queries/lua/folds.scm | 20 +- queries/lua/highlights.scm | 231 ++++----- queries/lua/indents.scm | 1 - queries/lua/injections.scm | 143 ++++-- queries/lua/locals.scm | 29 +- queries/luadoc/highlights.scm | 95 ++-- queries/luap/highlights.scm | 13 +- queries/luau/folds.scm | 5 +- queries/luau/highlights.scm | 223 ++++---- queries/luau/indents.scm | 5 +- queries/luau/injections.scm | 36 +- queries/luau/locals.scm | 29 +- queries/m68k/highlights.scm | 30 +- queries/m68k/injections.scm | 2 +- queries/m68k/locals.scm | 9 +- queries/make/folds.scm | 12 +- queries/make/highlights.scm | 249 ++++----- queries/make/injections.scm | 7 +- queries/markdown/folds.scm | 16 +- queries/markdown/highlights.scm | 68 ++- queries/markdown/indents.scm | 4 +- queries/markdown/injections.scm | 28 +- queries/markdown_inline/highlights.scm | 37 +- queries/markdown_inline/injections.scm | 8 +- queries/matlab/folds.scm | 24 +- queries/matlab/highlights.scm | 136 +++-- queries/matlab/indents.scm | 20 +- queries/matlab/injections.scm | 2 +- queries/matlab/locals.scm | 33 +- queries/menhir/highlights.scm | 66 ++- queries/menhir/injections.scm | 2 +- queries/mermaid/highlights.scm | 340 ++++++++----- queries/meson/folds.scm | 14 +- queries/meson/highlights.scm | 15 +- queries/meson/injections.scm | 2 +- queries/mlir/highlights.scm | 22 +- queries/mlir/locals.scm | 11 +- queries/nasm/highlights.scm | 35 +- queries/nickel/highlights.scm | 39 +- queries/nickel/indents.scm | 10 +- queries/nim/folds.scm | 8 - queries/nim/highlights.scm | 817 ++++++++++++++++++------------ queries/nim/injections.scm | 43 +- queries/nim/locals.scm | 340 +++++++------ queries/nim_format_string/highlights.scm | 12 +- queries/nim_format_string/injections.scm | 4 +- queries/ninja/highlights.scm | 114 ++--- queries/ninja/indents.scm | 1 - queries/nix/highlights.scm | 87 +++- queries/nix/injections.scm | 240 +++++---- queries/nix/locals.scm | 35 +- queries/nqc/highlights.scm | 5 +- queries/objc/folds.scm | 1 - queries/objc/highlights.scm | 169 +++--- queries/objc/injections.scm | 1 - queries/objdump/highlights.scm | 41 +- queries/ocaml/highlights.scm | 265 +++++++--- queries/ocaml/indents.scm | 51 +- queries/ocaml/injections.scm | 2 +- queries/ocaml/locals.scm | 42 +- queries/ocamllex/highlights.scm | 60 ++- queries/ocamllex/injections.scm | 4 +- queries/odin/highlights.scm | 187 ++++--- queries/odin/injections.scm | 2 +- queries/odin/locals.scm | 52 +- queries/pascal/folds.scm | 6 +- queries/pascal/highlights.scm | 688 ++++++++++++++----------- queries/pascal/indents.scm | 53 +- queries/pascal/injections.scm | 3 +- queries/pascal/locals.scm | 78 ++- queries/pem/highlights.scm | 5 +- queries/pem/injections.scm | 2 +- queries/perl/folds.scm | 26 +- queries/perl/highlights.scm | 236 ++++++--- queries/perl/injections.scm | 8 +- queries/php/highlights.scm | 330 +++++++----- queries/php/indents.scm | 14 +- queries/php/injections.scm | 49 +- queries/php/locals.scm | 35 +- queries/phpdoc/highlights.scm | 54 +- queries/pioasm/highlights.scm | 91 +++- queries/pioasm/injections.scm | 14 +- queries/po/folds.scm | 1 - queries/po/highlights.scm | 17 +- queries/po/injections.scm | 2 +- queries/pod/highlights.scm | 19 +- queries/poe_filter/highlights.scm | 19 +- queries/poe_filter/injections.scm | 2 +- queries/pony/folds.scm | 8 +- queries/pony/highlights.scm | 185 ++++--- queries/pony/indents.scm | 39 +- queries/pony/injections.scm | 4 +- queries/pony/locals.scm | 15 +- queries/prisma/folds.scm | 10 +- queries/prisma/highlights.scm | 19 +- queries/promql/highlights.scm | 5 +- queries/promql/injections.scm | 4 +- queries/properties/highlights.scm | 46 +- queries/properties/injections.scm | 2 +- queries/properties/locals.scm | 6 +- queries/proto/highlights.scm | 12 +- queries/prql/highlights.scm | 26 +- queries/prql/injections.scm | 6 +- queries/psv/highlights.scm | 1 - queries/pug/highlights.scm | 81 ++- queries/pug/injections.scm | 4 +- queries/puppet/highlights.scm | 117 +++-- queries/puppet/locals.scm | 42 +- queries/purescript/highlights.scm | 288 ++++++----- queries/purescript/injections.scm | 2 +- queries/purescript/locals.scm | 15 +- queries/pymanifest/highlights.scm | 11 +- queries/pymanifest/injections.scm | 2 +- queries/python/folds.scm | 5 - queries/python/highlights.scm | 258 ++++++---- queries/python/indents.scm | 138 +++-- queries/python/injections.scm | 20 +- queries/python/locals.scm | 102 ++-- queries/ql/folds.scm | 10 +- queries/ql/highlights.scm | 38 +- queries/ql/injections.scm | 4 +- queries/ql/locals.scm | 43 +- queries/qmldir/highlights.scm | 8 +- queries/qmldir/injections.scm | 2 +- queries/qmljs/highlights.scm | 97 ++-- queries/query/highlights.scm | 80 ++- queries/query/indents.scm | 8 +- queries/query/injections.scm | 38 +- queries/query/locals.scm | 12 +- queries/r/highlights.scm | 140 ++--- queries/r/indents.scm | 14 +- queries/r/injections.scm | 2 +- queries/r/locals.scm | 15 +- queries/racket/folds.scm | 3 +- queries/racket/highlights.scm | 178 +++---- queries/racket/injections.scm | 4 +- queries/rasi/folds.scm | 2 +- queries/rasi/highlights.scm | 133 +++-- queries/rasi/indents.scm | 3 +- queries/rasi/locals.scm | 11 +- queries/rbs/highlights.scm | 107 ++-- queries/rbs/injections.scm | 2 +- queries/re2c/highlights.scm | 30 +- queries/re2c/indents.scm | 8 +- queries/re2c/injections.scm | 4 +- queries/regex/highlights.scm | 52 +- queries/rego/highlights.scm | 42 +- queries/rego/injections.scm | 2 +- queries/requirements/highlights.scm | 45 +- queries/requirements/injections.scm | 2 +- queries/rnoweb/folds.scm | 4 +- queries/rnoweb/highlights.scm | 2 +- queries/rnoweb/injections.scm | 4 +- queries/robot/highlights.scm | 44 +- queries/robot/indents.scm | 44 +- queries/ron/highlights.scm | 44 +- queries/ron/indents.scm | 15 +- queries/ron/injections.scm | 2 +- queries/ron/locals.scm | 27 +- queries/rst/highlights.scm | 58 +-- queries/rst/injections.scm | 108 ++-- queries/rst/locals.scm | 25 +- queries/ruby/highlights.scm | 339 +++++++------ queries/ruby/injections.scm | 14 +- queries/ruby/locals.scm | 90 +++- queries/rust/folds.scm | 4 - queries/rust/highlights.scm | 262 ++++++---- queries/rust/indents.scm | 50 +- queries/rust/injections.scm | 48 +- queries/rust/locals.scm | 81 +-- queries/scala/folds.scm | 27 +- queries/scala/highlights.scm | 157 +++--- queries/scala/injections.scm | 4 +- queries/scala/locals.scm | 15 +- queries/scfg/highlights.scm | 6 +- queries/scfg/injections.scm | 2 +- queries/scheme/folds.scm | 3 +- queries/scheme/highlights.scm | 146 +++--- queries/scheme/injections.scm | 2 +- queries/scss/highlights.scm | 47 +- queries/scss/indents.scm | 7 +- queries/slang/folds.scm | 11 +- queries/slang/highlights.scm | 41 +- queries/slang/indents.scm | 1 - queries/slang/injections.scm | 4 +- queries/slint/highlights.scm | 219 ++++---- queries/slint/indents.scm | 12 +- queries/smali/highlights.scm | 93 ++-- queries/smali/indents.scm | 5 +- queries/smali/injections.scm | 2 +- queries/smali/locals.scm | 3 +- queries/smithy/highlights.scm | 43 +- queries/snakemake/highlights.scm | 95 ++-- queries/snakemake/injections.scm | 4 +- queries/solidity/highlights.scm | 140 +++-- queries/soql/highlights.scm | 25 +- queries/sosl/highlights.scm | 8 +- queries/sparql/highlights.scm | 77 ++- queries/sparql/indents.scm | 1 + queries/sparql/injections.scm | 2 +- queries/sparql/locals.scm | 16 +- queries/sql/highlights.scm | 155 +++--- queries/sql/indents.scm | 32 +- queries/sql/injections.scm | 5 +- queries/squirrel/folds.scm | 4 - queries/squirrel/highlights.scm | 123 +++-- queries/squirrel/indents.scm | 25 +- queries/squirrel/injections.scm | 2 +- queries/squirrel/locals.scm | 44 +- queries/ssh_config/highlights.scm | 67 ++- queries/ssh_config/indents.scm | 8 +- queries/ssh_config/injections.scm | 25 +- queries/starlark/folds.scm | 5 - queries/starlark/highlights.scm | 194 ++++--- queries/starlark/indents.scm | 37 +- queries/starlark/locals.scm | 67 ++- queries/strace/highlights.scm | 9 +- queries/supercollider/folds.scm | 9 +- queries/supercollider/highlights.scm | 68 +-- queries/supercollider/indents.scm | 6 +- queries/supercollider/injections.scm | 4 +- queries/supercollider/locals.scm | 38 +- queries/surface/highlights.scm | 4 +- queries/surface/indents.scm | 2 +- queries/surface/injections.scm | 4 +- queries/svelte/folds.scm | 14 +- queries/svelte/highlights.scm | 1 - queries/svelte/injections.scm | 47 +- queries/swift/highlights.scm | 249 ++++++--- queries/swift/indents.scm | 38 +- queries/swift/locals.scm | 31 +- queries/sxhkdrc/folds.scm | 4 +- queries/sxhkdrc/highlights.scm | 9 + queries/sxhkdrc/injections.scm | 2 +- queries/systemtap/highlights.scm | 11 +- queries/systemtap/injections.scm | 4 +- queries/t32/highlights.scm | 68 ++- queries/t32/injections.scm | 2 +- queries/t32/locals.scm | 16 +- queries/tablegen/folds.scm | 2 +- queries/tablegen/highlights.scm | 84 +-- queries/tablegen/indents.scm | 22 +- queries/tablegen/locals.scm | 14 +- queries/teal/folds.scm | 22 +- queries/teal/highlights.scm | 245 ++++++--- queries/teal/injections.scm | 51 +- queries/teal/locals.scm | 31 +- queries/templ/highlights.scm | 4 +- queries/templ/injections.scm | 12 +- queries/terraform/highlights.scm | 38 +- queries/textproto/highlights.scm | 7 +- queries/textproto/indents.scm | 13 +- queries/thrift/folds.scm | 1 - queries/thrift/highlights.scm | 102 ++-- queries/thrift/indents.scm | 17 +- queries/thrift/injections.scm | 2 +- queries/thrift/locals.scm | 57 ++- queries/tiger/folds.scm | 3 - queries/tiger/highlights.scm | 65 ++- queries/tiger/indents.scm | 64 ++- queries/tiger/injections.scm | 3 +- queries/tiger/locals.scm | 14 +- queries/tlaplus/highlights.scm | 335 ++++++++---- queries/tlaplus/injections.scm | 4 +- queries/tlaplus/locals.scm | 149 ++++-- queries/todotxt/highlights.scm | 20 +- queries/toml/highlights.scm | 22 +- queries/toml/injections.scm | 2 +- queries/tsv/highlights.scm | 3 + queries/turtle/highlights.scm | 15 +- queries/turtle/indents.scm | 8 +- queries/turtle/injections.scm | 2 +- queries/twig/highlights.scm | 70 ++- queries/twig/injections.scm | 5 +- queries/typescript/folds.scm | 1 - queries/typescript/highlights.scm | 137 +++-- queries/typescript/indents.scm | 1 - queries/typescript/locals.scm | 13 +- queries/typoscript/highlights.scm | 13 +- queries/typoscript/indents.scm | 2 +- queries/typoscript/injections.scm | 4 +- queries/udev/highlights.scm | 48 +- queries/udev/injections.scm | 16 +- queries/udev/locals.scm | 18 +- queries/ungrammar/highlights.scm | 4 +- queries/ungrammar/injections.scm | 3 +- queries/unison/highlights.scm | 65 ++- queries/unison/injections.scm | 2 +- queries/usd/folds.scm | 4 +- queries/usd/highlights.scm | 73 +-- queries/usd/indents.scm | 31 +- queries/uxntal/folds.scm | 1 - queries/uxntal/highlights.scm | 35 +- queries/uxntal/indents.scm | 10 +- queries/uxntal/injections.scm | 4 +- queries/uxntal/locals.scm | 9 +- queries/v/folds.scm | 14 +- queries/v/highlights.scm | 272 ++-------- queries/v/indents.scm | 25 +- queries/v/injections.scm | 27 +- queries/v/locals.scm | 33 +- queries/vala/folds.scm | 1 - queries/vala/highlights.scm | 410 +++++++++------ queries/verilog/highlights.scm | 145 +++--- queries/verilog/injections.scm | 2 +- queries/verilog/locals.scm | 59 ++- queries/vhs/highlights.scm | 23 +- queries/vim/folds.scm | 4 +- queries/vim/highlights.scm | 240 +++++---- queries/vim/injections.scm | 60 +-- queries/vim/locals.scm | 16 +- queries/vimdoc/highlights.scm | 55 +- queries/vimdoc/injections.scm | 2 +- queries/vue/highlights.scm | 5 +- queries/vue/indents.scm | 9 +- queries/vue/injections.scm | 93 ++-- queries/wgsl/folds.scm | 16 +- queries/wgsl/highlights.scm | 144 +++--- queries/wgsl/indents.scm | 20 +- queries/wgsl_bevy/folds.scm | 5 +- queries/wgsl_bevy/highlights.scm | 38 +- queries/wing/highlights.scm | 38 +- queries/wing/locals.scm | 1 + queries/xcompose/highlights.scm | 38 +- queries/xcompose/injections.scm | 2 +- queries/xcompose/locals.scm | 6 +- queries/xml/highlights.scm | 74 +-- queries/xml/injections.scm | 44 +- queries/xml/locals.scm | 38 +- queries/yaml/highlights.scm | 71 ++- queries/yaml/indents.scm | 3 +- queries/yaml/injections.scm | 127 +++-- queries/yaml/locals.scm | 7 +- queries/yang/folds.scm | 4 +- queries/yang/highlights.scm | 65 ++- queries/yang/indents.scm | 19 +- queries/yang/injections.scm | 12 +- queries/yuck/highlights.scm | 93 ++-- queries/yuck/indents.scm | 27 +- queries/yuck/injections.scm | 3 +- queries/yuck/locals.scm | 2 +- queries/zig/folds.scm | 12 +- queries/zig/highlights.scm | 106 ++-- queries/zig/indents.scm | 3 +- queries/zig/injections.scm | 5 +- queries/zig/locals.scm | 1 + 674 files changed, 18508 insertions(+), 12690 deletions(-) diff --git a/queries/ada/folds.scm b/queries/ada/folds.scm index b8b5735bb..8e3defac4 100644 --- a/queries/ada/folds.scm +++ b/queries/ada/folds.scm @@ -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 diff --git a/queries/ada/highlights.scm b/queries/ada/highlights.scm index a88935b2a..c15c4d9e3 100644 --- a/queries/ada/highlights.scm +++ b/queries/ada/highlights.scm @@ -1,190 +1,288 @@ -;; 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" - "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" + "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" + "aliased" + "constant" + "renames" ] @keyword.storage + [ - "mod" - "new" - "protected" - "record" - "subtype" - "type" + "mod" + "new" + "protected" + "record" + "subtype" + "type" ] @keyword.type + [ - "with" - "use" + "with" + "use" ] @keyword.import + [ - "body" - "function" - "overriding" - "procedure" - "package" - "separate" + "body" + "function" + "overriding" + "procedure" + "package" + "separate" ] @keyword.function + [ - "and" - "in" - "not" - "or" - "xor" + "and" + "in" + "not" + "or" + "xor" ] @keyword.operator + [ - "while" - "loop" - "for" - "parallel" - "reverse" - "some" + "while" + "loop" + "for" + "parallel" + "reverse" + "some" ] @keyword.repeat + +"return" @keyword.return + [ - "return" -] @keyword.return -[ - "case" - "if" - "else" - "then" - "elsif" - "select" + "case" + "if" + "else" + "then" + "elsif" + "select" ] @keyword.conditional + [ - "exception" - "raise" + "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) - -;; Some keywords should take different categories depending on the context -(use_clause "use" @keyword.import "type" @keyword.import) -(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 +; 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) + +; Some keywords should take different categories depending on the context +(use_clause + "use" @keyword.import + "type" @keyword.import) + +(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) + +(subprogram_declaration + (aspect_specification) @attribute) -;; Highlight full subprogram specifications +; 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) diff --git a/queries/ada/locals.scm b/queries/ada/locals.scm index 2d61b3123..bdfc38be8 100644 --- a/queries/ada/locals.scm +++ b/queries/ada/locals.scm @@ -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 + (package_declaration) @local.scope + (package_body) @local.scope + (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) +(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 diff --git a/queries/agda/folds.scm b/queries/agda/folds.scm index e3258efb9..5e1051f8f 100644 --- a/queries/agda/folds.scm +++ b/queries/agda/folds.scm @@ -1,4 +1,4 @@ [ - (record) - (module) + (record) + (module) ] @fold diff --git a/queries/agda/highlights.scm b/queries/agda/highlights.scm index 6ff55d2fc..657e657f9 100644 --- a/queries/agda/highlights.scm +++ b/queries/agda/highlights.scm @@ -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)) -(field_name) @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 - -"import" @keyword.import +; Imports and Module Declarations +"import" @keyword.import (module_name) @module -;; Pragmas and comments - +; Pragmas and comments (pragma) @keyword.directive (comment) @comment @spell -;; Keywords +; Keywords [ "where" "data" @@ -62,20 +71,16 @@ "infixl" "infixr" "record" -] -@keyword - -;;;(expr -;;; f_name: (atom) @function) -;; Brackets +] @keyword +;(expr +; f_name: (atom) @function) +; Brackets [ "(" ")" "{" - "}"] -@punctuation.bracket + "}" +] @punctuation.bracket -[ - "=" -] @operator +"=" @operator diff --git a/queries/angular/highlights.scm b/queries/angular/highlights.scm index 42d69c28a..a109dc179 100644 --- a/queries/angular/highlights.scm +++ b/queries/angular/highlights.scm @@ -1,12 +1,19 @@ (identifier) @variable -(pipe_sequence "|" @operator) + +(pipe_sequence + "|" @operator) + (string) @string + (number) @number + (pipe_call name: (identifier) @function) + (pipe_call - arguments: (pipe_arguments - (identifier) @variable.parameter)) + arguments: + (pipe_arguments + (identifier) @variable.parameter)) (structural_assignment operator: (identifier) @keyword) @@ -18,32 +25,34 @@ function: (identifier) @function) (call_expression - function: ((identifier) @function.builtin - (#eq? @function.builtin "$any"))) + function: + ((identifier) @function.builtin + (#eq? @function.builtin "$any"))) [ -"let" -"as" + "let" + "as" ] @keyword [ -"(" -")" -"[" -"]" -"{" -"}" + "(" + ")" + "[" + "]" + "{" + "}" ] @punctuation.bracket [ -";" -"." -"," -"?." + ";" + "." + "," + "?." ] @punctuation.delimiter ((identifier) @boolean (#any-of? @boolean "true" "false")) + ((identifier) @variable.builtin (#any-of? @variable.builtin "this" "\$event" "null")) diff --git a/queries/apex/folds.scm b/queries/apex/folds.scm index 0ffc550e9..fdfc2a1ed 100644 --- a/queries/apex/folds.scm +++ b/queries/apex/folds.scm @@ -1,6 +1,6 @@ [ - (class_body) - (constructor_declaration) - (argument_list) - (annotation_argument_list) + (class_body) + (constructor_declaration) + (argument_list) + (annotation_argument_list) ] @fold diff --git a/queries/apex/highlights.scm b/queries/apex/highlights.scm index 692fccb1b..64ff9168c 100644 --- a/queries/apex/highlights.scm +++ b/queries/apex/highlights.scm @@ -1,7 +1,5 @@ ; inherits: soql - -;;; Apex + SOQL - +; Apex + SOQL [ "[" "]" @@ -17,16 +15,14 @@ ":" "?" ";" - ] @punctuation.delimiter - -;; Default general color defination +] @punctuation.delimiter +; Default general color defination (identifier) @variable (type_identifier) @type -;; Methods - +; Methods (method_declaration name: (identifier) @function.method) @@ -35,13 +31,11 @@ (super) @function.builtin -;; Annotations - +; Annotations (annotation name: (identifier) @attribute) -;; Types - +; Types (interface_declaration name: (identifier) @type) @@ -49,7 +43,7 @@ name: (identifier) @type) (class_declaration - (superclass) @type) + (superclass) @type) (enum_declaration name: (identifier) @type) @@ -57,8 +51,11 @@ (enum_constant name: (identifier) @constant) -(type_arguments "<" @punctuation.delimiter) -(type_arguments ">" @punctuation.delimiter) +(type_arguments + "<" @punctuation.delimiter) + +(type_arguments + ">" @punctuation.delimiter) ((field_access object: (identifier) @type)) @@ -68,11 +65,11 @@ ((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 @@ -86,16 +83,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)*) [ - "@" + "@" "=" "!=" "<=" @@ -103,35 +105,39 @@ ] @operator (binary_expression - operator: [ - ">" - "<" - "==" - "===" - "!==" - "&&" - "||" - "+" - "-" - "*" - "/" - "&" - "|" - "^" - "%" - "<<" - ">>" - ">>>"] @operator) + operator: + [ + ">" + "<" + "==" + "===" + "!==" + "&&" + "||" + "+" + "-" + "*" + "/" + "&" + "|" + "^" + "%" + "<<" + ">>" + ">>>" + ] @operator) (unary_expression - operator: [ - "+" - "-" - "!" - "~" - ]) @operator + operator: + [ + "+" + "-" + "!" + "~" + ]) @operator -(map_initializer "=>" @operator) +(map_initializer + "=>" @operator) [ (boolean_type) @@ -139,18 +145,27 @@ ] @type.builtin ; Fields - (field_declaration - declarator: (variable_declarator - name: (identifier) @variable.member)) + declarator: + (variable_declarator + name: (identifier) @variable.member)) (field_access field: (identifier) @variable.member) ; Variables - (field_declaration - (modifiers (modifier ["final" "static"])(modifier ["final" "static"])) + (modifiers + (modifier + [ + "final" + "static" + ]) + (modifier + [ + "final" + "static" + ])) (variable_declarator name: (identifier) @constant)) @@ -163,7 +178,6 @@ (this) @variable.builtin ; Literals - [ (int) (decimal) @@ -179,16 +193,15 @@ (null_literal) @constant.builtin -;; ;; Keywords - +; ;; Keywords [ - "abstract" - "final" - "private" - "protected" - "public" - "static" - ] @type.qualifier + "abstract" + "final" + "private" + "protected" + "public" + "static" +] @type.qualifier [ "if" @@ -203,16 +216,14 @@ "break" ] @keyword.repeat -[ - "return" -] @keyword.return +"return" @keyword.return [ - "throw" - "finally" - "try" - "catch" - ] @keyword.exception + "throw" + "finally" + "try" + "catch" +] @keyword.exception "new" @keyword.operator diff --git a/queries/apex/locals.scm b/queries/apex/locals.scm index 5661b911d..d3cbfa73b 100644 --- a/queries/apex/locals.scm +++ b/queries/apex/locals.scm @@ -1,41 +1,46 @@ ; declarations - (class_declaration) @local.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 consequence: (_) @local.scope) ; if body in case there are no braces + (if_statement 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) + (catch_clause) @local.scope ; needed because `Exception` variable ; loops - (for_statement) @local.scope -(for_statement ; "for" body in case there are no braces + +(for_statement ; "for" body in case there are no braces body: (_) @local.scope) + (do_statement body: (_) @local.scope) + (while_statement body: (_) @local.scope) ; Functions - (constructor_declaration) @local.scope -(method_declaration) @local.scope -;; definitions +(method_declaration) @local.scope +; definitions (enum_declaration name: (identifier) @local.definition.enum) @@ -43,10 +48,11 @@ name: (identifier) @local.definition.method) (local_variable_declaration - declarator: (variable_declarator - name: (identifier) @local.definition.var)) + declarator: + (variable_declarator + name: (identifier) @local.definition.var)) -(enhanced_for_statement +(enhanced_for_statement name: (identifier) @local.definition.var) (formal_parameter @@ -56,11 +62,11 @@ name: (identifier) @local.definition.parameter) (field_declaration - declarator: (variable_declarator - name: (identifier) @local.definition.field)) - -;; REFERENCES + declarator: + (variable_declarator + name: (identifier) @local.definition.field)) +; REFERENCES (identifier) @local.reference (type_identifier) @local.reference diff --git a/queries/arduino/highlights.scm b/queries/arduino/highlights.scm index a2e121a06..9620f1f73 100644 --- a/queries/arduino/highlights.scm +++ b/queries/arduino/highlights.scm @@ -1,5 +1,4 @@ ; inherits: cpp - ((identifier) @function.builtin ; format-ignore (#any-of? @function.builtin @@ -72,25 +71,10 @@ "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 diff --git a/queries/arduino/injections.scm b/queries/arduino/injections.scm index 6ccfef83f..b637d9b2b 100644 --- a/queries/arduino/injections.scm +++ b/queries/arduino/injections.scm @@ -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")) diff --git a/queries/astro/highlights.scm b/queries/astro/highlights.scm index 91ccbffb3..650a489e4 100644 --- a/queries/astro/highlights.scm +++ b/queries/astro/highlights.scm @@ -1,13 +1,20 @@ ; 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]")) diff --git a/queries/astro/injections.scm b/queries/astro/injections.scm index b8f1ccefc..9b1f285db 100644 --- a/queries/astro/injections.scm +++ b/queries/astro/injections.scm @@ -1,5 +1,4 @@ ; inherits: html_tags - (frontmatter (raw_text) @injection.content (#set! injection.language "typescript")) @@ -13,11 +12,12 @@ (#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")) diff --git a/queries/authzed/highlights.scm b/queries/authzed/highlights.scm index 7a4b85d1f..2009b78e3 100644 --- a/queries/authzed/highlights.scm +++ b/queries/authzed/highlights.scm @@ -11,7 +11,8 @@ (identifier) @type)) ; relations -(rel_expression (identifier) @property) +(rel_expression + (identifier) @property) (relation (rel_expression @@ -20,16 +21,18 @@ (identifier) @constant)) ; permissions -(perm_expression (identifier) @property) +(perm_expression + (identifier) @property) (call_expression - function: (selector_expression - operand: (identifier) @constant - field: (field_identifier) @function.method)) + function: + (selector_expression + operand: (identifier) @constant + field: (field_identifier) @function.method)) (perm_expression (stabby) @operator - . + . (identifier) @function) ; misc diff --git a/queries/authzed/injections.scm b/queries/authzed/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/authzed/injections.scm +++ b/queries/authzed/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/awk/highlights.scm b/queries/awk/highlights.scm index 6d3b7ff0b..90c9f3437 100644 --- a/queries/awk/highlights.scm +++ b/queries/awk/highlights.scm @@ -1,67 +1,54 @@ ; 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.regexp + (escape_sequence) @string.escape (comment) @comment @spell -((program . (comment) @keyword.directive) +((program + . + (comment) @keyword.directive) (#lua-match? @keyword.directive "^#!/")) -(ns_qualified_name (namespace) @module) -(ns_qualified_name "::" @punctuation.delimiter) +(ns_qualified_name + (namespace) @module) + +(ns_qualified_name + "::" @punctuation.delimiter) -(func_def name: (_ (identifier) @function) @function) -(func_call name: (_ (identifier) @function) @function) +(func_def + name: + (_ + (identifier) @function) @function) -(func_def (param_list (identifier) @variable.parameter)) +(func_call + name: + (_ + (identifier) @function) @function) + +(func_def + (param_list + (identifier) @variable.parameter)) [ "print" @@ -110,80 +97,95 @@ "@namespace" @keyword.directive [ - "BEGIN" - "END" - "BEGINFILE" - "ENDFILE" + "BEGIN" + "END" + "BEGINFILE" + "ENDFILE" ] @label -(binary_exp [ - "^" - "**" - "*" - "/" - "%" - "+" - "-" - "<" - ">" - "<=" - ">=" - "==" - "!=" - "~" - "!~" - "in" - "&&" - "||" -] @operator) - -(unary_exp [ - "!" - "+" - "-" -] @operator) - -(assignment_exp [ - "=" - "+=" - "-=" - "*=" - "/=" - "%=" - "^=" -] @operator) - -(ternary_exp [ - "?" - ":" -] @keyword.conditional.ternary) - -(update_exp [ - "++" - "--" -] @operator) - -(redirected_io_statement [ - ">" - ">>" -] @operator) - -(piped_io_statement [ - "|" - "|&" -] @operator) - -(piped_io_exp [ - "|" - "|&" -] @operator) - -(field_ref "$" @punctuation.delimiter) - -(regex "/" @punctuation.delimiter) -(regex_constant "@" @punctuation.delimiter) - -[ ";" "," ] @punctuation.delimiter +(binary_exp + [ + "^" + "**" + "*" + "/" + "%" + "+" + "-" + "<" + ">" + "<=" + ">=" + "==" + "!=" + "~" + "!~" + "in" + "&&" + "||" + ] @operator) + +(unary_exp + [ + "!" + "+" + "-" + ] @operator) + +(assignment_exp + [ + "=" + "+=" + "-=" + "*=" + "/=" + "%=" + "^=" + ] @operator) + +(ternary_exp + [ + "?" + ":" + ] @keyword.conditional.ternary) + +(update_exp + [ + "++" + "--" + ] @operator) + +(redirected_io_statement + [ + ">" + ">>" + ] @operator) + +(piped_io_statement + [ + "|" + "|&" + ] @operator) + +(piped_io_exp + [ + "|" + "|&" + ] @operator) + +(field_ref + "$" @punctuation.delimiter) + +(regex + "/" @punctuation.delimiter) + +(regex_constant + "@" @punctuation.delimiter) + +[ + ";" + "," +] @punctuation.delimiter [ "(" diff --git a/queries/awk/injections.scm b/queries/awk/injections.scm index 24db57d67..3e67da245 100644 --- a/queries/awk/injections.scm +++ b/queries/awk/injections.scm @@ -1,13 +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")) + (exp_list + . + (string) @injection.content)) + (#set! injection.language "printf")) ((printf_statement - (exp_list . (string) @injection.content)) - (#set! injection.language "printf")) + (exp_list + . + (string) @injection.content)) + (#set! injection.language "printf")) diff --git a/queries/bash/highlights.scm b/queries/bash/highlights.scm index 5820680ef..21346ded8 100644 --- a/queries/bash/highlights.scm +++ b/queries/bash/highlights.scm @@ -1,84 +1,89 @@ [ - "(" ")" - "{" "}" - "[" "]" - "[[" "]]" - "((" "))" + "(" + ")" + "{" + "}" + "[" + "]" + "[[" + "]]" + "((" + "))" ] @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 [ - "if" - "then" - "else" - "elif" - "fi" - "case" - "in" - "esac" + "if" + "then" + "else" + "elif" + "fi" + "case" + "in" + "esac" ] @keyword.conditional [ - "for" - "do" - "done" - "select" - "until" - "while" + "for" + "do" + "done" + "select" + "until" + "while" ] @keyword.repeat [ @@ -97,36 +102,54 @@ ; 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]))?)$")) + (#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]))?)$")) ((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.bracket) + +(process_substitution + "<(" @punctuation.bracket) (arithmetic_expansion - [ "$((" "((" ] @punctuation.special + [ + "$((" + "((" + ] @punctuation.special "))" @punctuation.special) -(arithmetic_expansion "," @punctuation.delimiter) +(arithmetic_expansion + "," @punctuation.delimiter) + +(ternary_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) + +(binary_expression + operator: _ @operator) -(ternary_expression [ "?" ":" ] @keyword.conditional.ternary) +(unary_expression + operator: _ @operator) -(binary_expression operator: _ @operator) -(unary_expression operator: _ @operator) -(postfix_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) +((command_name + (word) @function.builtin) ; format-ignore (#any-of? @function.builtin "alias" "bg" "bind" "break" "builtin" "caller" "cd" @@ -140,14 +163,17 @@ "ulimit" "umask" "unalias" "wait")) (command - argument: [ - (word) @variable.parameter - (concatenation (word) @variable.parameter) - ]) + argument: + [ + (word) @variable.parameter + (concatenation + (word) @variable.parameter) + ]) (number) @number + ((word) @number - (#lua-match? @number "^[0-9]+$")) + (#lua-match? @number "^[0-9]+$")) (file_redirect destination: (word) @variable.parameter) @@ -156,24 +182,30 @@ (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) @variable.parameter) @@ -183,5 +215,7 @@ (extglob_pattern) ] @string.regexp -((program . (comment) @keyword.directive) - (#lua-match? @keyword.directive "^#!/")) +((program + . + (comment) @keyword.directive) + (#lua-match? @keyword.directive "^#!/")) diff --git a/queries/bash/injections.scm b/queries/bash/injections.scm index 516df3b3d..83bb6359e 100644 --- a/queries/bash/injections.scm +++ b/queries/bash/injections.scm @@ -1,35 +1,52 @@ -((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) (raw_string)] @injection.content) - (#eq? @_command "printf") - (#set! injection.language "printf")) + . + argument: + [ + (string) + (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) (raw_string)] @injection.content) - (#eq? @_command "printf") - (#eq? @_arg "-v") - (#set! injection.language "printf")) + . + (_) + . + argument: + [ + (string) + (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) (raw_string)] @injection.content) - (#eq? @_command "printf") - (#eq? @_arg "--") - (#set! injection.language "printf")) + . + argument: + [ + (string) + (raw_string) + ] @injection.content) + (#eq? @_command "printf") + (#eq? @_arg "--") + (#set! injection.language "printf")) diff --git a/queries/bash/locals.scm b/queries/bash/locals.scm index 2b9cfec70..347f51fa2 100644 --- a/queries/bash/locals.scm +++ b/queries/bash/locals.scm @@ -2,7 +2,7 @@ (function_definition) @local.scope ; Definitions -(variable_assignment +(variable_assignment name: (variable_name) @local.definition.var) (function_definition @@ -10,4 +10,5 @@ ; References (variable_name) @local.reference + (word) @local.reference diff --git a/queries/bass/highlights.scm b/queries/bass/highlights.scm index 3a16cbb34..8a92a59e9 100644 --- a/queries/bass/highlights.scm +++ b/queries/bass/highlights.scm @@ -1,54 +1,56 @@ -;; 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) @module - . (keyword)) - -;; Includes + . + (keyword)) +; Includes ((symbol) @keyword.import (#any-of? @keyword.import "use" "import" "load")) -;; Keywords - +; 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) @keyword.function + . + (symbol) @function (symbol)? @variable.parameter) (#any-of? @keyword.function "def" "defop" "defn" "fn")) ((cons - . (symbol) @keyword.function - . (symbol) @function + . + (symbol) @keyword.function + . + (symbol) @function (symbol)? @variable.parameter) (#any-of? @keyword.function "def" "defop" "defn" "fn")) @@ -58,33 +60,38 @@ ((symbol) @function.macro (#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")) -;; Repeats - +; Repeats ((symbol) @keyword.repeat (#any-of? @keyword.repeat "each")) -;; Operators - -((symbol) @operator (#any-of? @operator "&" "*" "+" "-" "<" "<=" "=" ">" ">=")) - -;; Punctuation +; Operators +((symbol) @operator + (#any-of? @operator "&" "*" "+" "-" "<" "<=" "=" ">" ">=")) -[ "(" ")" ] @punctuation.bracket +; Punctuation +[ + "(" + ")" +] @punctuation.bracket -[ "{" "}" ] @punctuation.bracket +[ + "{" + "}" +] @punctuation.bracket -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket ((symbol) @punctuation.delimiter (#eq? @punctuation.delimiter "->")) -;; Literals - +; Literals (string) @string (escape_sequence) @string.escape @@ -100,10 +107,7 @@ (null) ] @constant.builtin -[ - "^" -] @character.special - -;; Comments +"^" @character.special +; Comments (comment) @comment @spell diff --git a/queries/bass/indents.scm b/queries/bass/indents.scm index 60c5df4eb..27b976f21 100644 --- a/queries/bass/indents.scm +++ b/queries/bass/indents.scm @@ -10,11 +10,20 @@ "]" ] @indent.end -[ "(" ")" ] @indent.branch +[ + "(" + ")" +] @indent.branch -[ "{" "}" ] @indent.branch +[ + "{" + "}" +] @indent.branch -[ "[" "]" ] @indent.branch +[ + "[" + "]" +] @indent.branch [ (ERROR) diff --git a/queries/bass/injections.scm b/queries/bass/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/bass/injections.scm +++ b/queries/bass/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/bass/locals.scm b/queries/bass/locals.scm index c28a78dd5..daed7e5e1 100644 --- a/queries/bass/locals.scm +++ b/queries/bass/locals.scm @@ -1,5 +1,4 @@ ; Scopes - [ (list) (scope) @@ -7,19 +6,21 @@ ] @local.scope ; References - (symbol) @local.reference ; Definitions - ((list - . (symbol) @_fnkw - . (symbol) @local.definition.function + . + (symbol) @_fnkw + . + (symbol) @local.definition.function (symbol)? @local.definition.parameter) (#any-of? @_fnkw "def" "defop" "defn" "fn")) ((cons - . (symbol) @_fnkw - . (symbol) @local.definition.function + . + (symbol) @_fnkw + . + (symbol) @local.definition.function (symbol)? @local.definition.parameter) (#any-of? @_fnkw "def" "defop" "defn" "fn")) diff --git a/queries/beancount/folds.scm b/queries/beancount/folds.scm index ffe319500..9f1b6cbed 100644 --- a/queries/beancount/folds.scm +++ b/queries/beancount/folds.scm @@ -1,4 +1,4 @@ [ - (transaction) - (section) + (transaction) + (section) ] @fold diff --git a/queries/beancount/highlights.scm b/queries/beancount/highlights.scm index 191dc519e..1e23d28f4 100644 --- a/queries/beancount/highlights.scm +++ b/queries/beancount/highlights.scm @@ -1,24 +1,57 @@ (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 diff --git a/queries/bibtex/folds.scm b/queries/bibtex/folds.scm index 3b24d5fea..321a045c9 100644 --- a/queries/bibtex/folds.scm +++ b/queries/bibtex/folds.scm @@ -1,3 +1 @@ -[ - (entry) -] @fold +(entry) @fold diff --git a/queries/bibtex/highlights.scm b/queries/bibtex/highlights.scm index 602ed5d27..a82b371ae 100644 --- a/queries/bibtex/highlights.scm +++ b/queries/bibtex/highlights.scm @@ -1,5 +1,4 @@ ; CREDITS @pfoerster (adapted from https://github.com/latex-lsp/tree-sitter-bibtex) - [ (string_type) (preamble_type) diff --git a/queries/bibtex/indents.scm b/queries/bibtex/indents.scm index 1ba3e6b47..764172a76 100644 --- a/queries/bibtex/indents.scm +++ b/queries/bibtex/indents.scm @@ -1,10 +1,8 @@ -[ - (entry) -] @indent.begin +(entry) @indent.begin [ - "{" - "}" + "{" + "}" ] @indent.branch (comment) @indent.ignore diff --git a/queries/bicep/folds.scm b/queries/bicep/folds.scm index 8ec5ba200..217a86d6a 100644 --- a/queries/bicep/folds.scm +++ b/queries/bicep/folds.scm @@ -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 diff --git a/queries/bicep/highlights.scm b/queries/bicep/highlights.scm index ae691c76b..0045f8b8c 100644 --- a/queries/bicep/highlights.scm +++ b/queries/bicep/highlights.scm @@ -1,5 +1,4 @@ ; Includes - (import_statement "import" @keyword.import) @@ -8,12 +7,10 @@ "with" @keyword.import) ; Namespaces - (module_declaration (identifier) @module) ; Builtins - (primitive_type) @type.builtin ((member_expression @@ -21,12 +18,10 @@ (#eq? @type.builtin "sys")) ; Functions - (call_expression function: (identifier) @function.call) ; Properties - (object_property (identifier) @property ":" @punctuation.delimiter @@ -40,21 +35,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) @@ -66,7 +60,8 @@ (type_declaration (identifier) "=" - (array_type (identifier) @type)) + (array_type + (identifier) @type)) (type (identifier) @type) @@ -78,21 +73,22 @@ (identifier) @type) ; Parameters - (parameter_declaration (identifier) @variable.parameter (_)) (call_expression - function: (_) - (arguments (identifier) @variable.parameter)) + function: (_) + (arguments + (identifier) @variable.parameter)) (call_expression - function: (_) - (arguments (member_expression object: (identifier) @variable.parameter))) + function: (_) + (arguments + (member_expression + object: (identifier) @variable.parameter))) ; Variables - (variable_declaration (identifier) @variable (_)) @@ -117,7 +113,6 @@ (loop_enumerator) @variable)) ; Conditionals - "if" @keyword.conditional (ternary_expression @@ -125,14 +120,12 @@ ":" @keyword.conditional.ternary) ; Loops - (for_statement "for" @keyword.repeat "in" ":" @punctuation.delimiter) ; Keywords - [ "module" "metadata" @@ -146,7 +139,6 @@ ] @keyword ; Operators - [ "+" "-" @@ -169,14 +161,11 @@ "!" ] @operator -[ - "in" -] @keyword.operator - +"in" @keyword.operator ; Literals - (string) @string + (import_string "'" @string (import_name) @module @@ -192,17 +181,25 @@ (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 [ "." @@ -210,9 +207,7 @@ "=>" ] @punctuation.delimiter - ; Interpolation - (interpolation) @none (interpolation @@ -223,7 +218,6 @@ (identifier) @variable) ; Comments - [ (comment) (diagnostic_comment) diff --git a/queries/bicep/indents.scm b/queries/bicep/indents.scm index cf2e6e1c2..055e51b23 100644 --- a/queries/bicep/indents.scm +++ b/queries/bicep/indents.scm @@ -5,11 +5,20 @@ "}" @indent.end -[ "{" "}" ] @indent.branch +[ + "{" + "}" +] @indent.branch -[ "[" "]" ] @indent.branch +[ + "[" + "]" +] @indent.branch -[ "(" ")" ] @indent.branch +[ + "(" + ")" +] @indent.branch [ (ERROR) diff --git a/queries/bicep/injections.scm b/queries/bicep/injections.scm index d3ff30b60..5c2d4a57b 100644 --- a/queries/bicep/injections.scm +++ b/queries/bicep/injections.scm @@ -1,5 +1,5 @@ ([ (comment) (diagnostic_comment) - ] @injection.content - (#set! injection.language "comment")) +] @injection.content + (#set! injection.language "comment")) diff --git a/queries/bicep/locals.scm b/queries/bicep/locals.scm index c28987051..137753ae2 100644 --- a/queries/bicep/locals.scm +++ b/queries/bicep/locals.scm @@ -1,22 +1,17 @@ ; Scopes - [ (infrastructure) (call_expression) - (lambda_expression) (subscript_expression) - (if_statement) (for_statement) - (array) (object) (interpolation) ] @local.scope ; References - (property_identifier) @local.reference (call_expression @@ -31,7 +26,6 @@ (identifier) @local.reference) ; Definitions - (type) @local.definition.associated (object_property diff --git a/queries/bitbake/folds.scm b/queries/bitbake/folds.scm index 9fc865e84..85d226348 100644 --- a/queries/bitbake/folds.scm +++ b/queries/bitbake/folds.scm @@ -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 diff --git a/queries/bitbake/highlights.scm b/queries/bitbake/highlights.scm index eafe60b4d..e555e40d7 100644 --- a/queries/bitbake/highlights.scm +++ b/queries/bitbake/highlights.scm @@ -1,5 +1,4 @@ ; Includes - [ "inherit" "include" @@ -9,12 +8,10 @@ ] @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" @keyword.import "__future__" @constant.builtin) -(import_from_statement "from" @keyword.import) + +(import_from_statement + "from" @keyword.import) + "import" @keyword.import -(aliased_import "as" @keyword.import) +(aliased_import + "as" @keyword.import) -["if" "elif" "else"] @keyword.conditional +[ + "if" + "elif" + "else" +] @keyword.conditional -["for" "while" "break" "continue"] @keyword.repeat +[ + "for" + "while" + "break" + "continue" +] @keyword.repeat [ "try" @@ -56,7 +68,8 @@ "finally" ] @keyword.exception -(raise_statement "from" @keyword.exception) +(raise_statement + "from" @keyword.exception) (try_statement (else_clause @@ -82,7 +95,6 @@ ] @type.qualifier ; Variables - [ (identifier) (python_identifier) @@ -99,14 +111,18 @@ ; 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 ; format-ignore @@ -117,128 +133,149 @@ ((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")) + right: + (call + function: (python_identifier) @_func)) + (#any-of? @_func "TypeVar" "NewType")) ; Fields - (flag) @variable.member ((attribute - attribute: (python_identifier) @variable.member) - (#lua-match? @variable.member "^[%l_].*$")) + attribute: (python_identifier) @variable.member) + (#lua-match? @variable.member "^[%l_].*$")) ; Functions - (call function: (python_identifier) @function.call) (call - function: (attribute - attribute: (python_identifier) @function.method.call)) + function: + (attribute + 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")) + function: + (attribute + 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] ((call function: (python_identifier) @_isinstance - arguments: (argument_list - (_) - (python_identifier) @type)) - (#eq? @_isinstance "isinstance")) + arguments: + (argument_list + (_) + (python_identifier) @type)) + (#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))) + . + (expression_statement + (python_string) @string.documentation @spell))) ; Namespace - (inherit_path) @module -;; Normal parameters +; Normal parameters (parameters (python_identifier) @variable.parameter) -;; Lambda parameters + +; Lambda parameters (lambda_parameters (python_identifier) @variable.parameter) + (lambda_parameters (tuple_pattern (python_identifier) @variable.parameter)) + ; Default parameters (keyword_argument name: (python_identifier) @variable.parameter) + ; Naming parameters on call-site (default_parameter name: (python_identifier) @variable.parameter) + (typed_parameter (python_identifier) @variable.parameter) + (typed_default_parameter (python_identifier) @variable.parameter) + ; Variadic parameters *args, **kwargs (parameters - (list_splat_pattern ; *args + (list_splat_pattern + ; *args (python_identifier) @variable.parameter)) + (parameters - (dictionary_splat_pattern ; **kwargs + (dictionary_splat_pattern + ; **kwargs (python_identifier) @variable.parameter)) -;; Literals - +; Literals (none) @constant.builtin -[(true) (false)] @boolean + +[ + (true) + (false) +] @boolean + ((python_identifier) @variable.builtin - (#eq? @variable.builtin "self")) + (#eq? @variable.builtin "self")) + ((python_identifier) @variable.builtin - (#eq? @variable.builtin "cls")) + (#eq? @variable.builtin "cls")) (integer) @number + (float) @number.float ; Operators - [ "?=" "??=" @@ -293,12 +330,10 @@ "or" "is not" "not in" - "del" ] @keyword.operator ; Literals - [ (string) (python_string) @@ -313,8 +348,14 @@ ] @string.escape ; Punctuation - -[ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket +[ + "(" + ")" + "{" + "}" + "[" + "]" +] @punctuation.bracket [ ":" @@ -325,15 +366,28 @@ (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 +([ + (identifier) + (python_identifier) +] @type.builtin ; format-ignore (#any-of? @type.builtin ; https://docs.python.org/3/library/exceptions.html diff --git a/queries/bitbake/indents.scm b/queries/bitbake/indents.scm index 01d8aeb3c..ee60d0fda 100644 --- a/queries/bitbake/indents.scm +++ b/queries/bitbake/indents.scm @@ -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) + +(generator_expression + ")" @indent.end) + +(list_comprehension + "]" @indent.end) + +(set_comprehension + "}" @indent.end) + +(dictionary_comprehension + "}" @indent.end) + +(tuple_pattern + ")" @indent.end) + +(list_pattern + "]" @indent.end) -(tuple_pattern ")" @indent.end) -(list_pattern "]" @indent.end) +(function_definition + "}" @indent.end) -(function_definition "}" @indent.end) -(anonymous_python_function "}" @indent.end) +(anonymous_python_function + "}" @indent.end) (return_statement [ @@ -107,10 +151,12 @@ "}" "]" ] @indent.end .) - (attribute + (attribute attribute: (_) @indent.end) (call - arguments: (_ ")" @indent.end)) + arguments: + (_ + ")" @indent.end)) "return" @indent.end ] .) diff --git a/queries/bitbake/injections.scm b/queries/bitbake/injections.scm index 819487bc5..39182e838 100644 --- a/queries/bitbake/injections.scm +++ b/queries/bitbake/injections.scm @@ -1,8 +1,11 @@ (call - function: (attribute - object: (python_identifier) @_re) - arguments: (argument_list (python_string - (string_content) @injection.content) @_string) + function: + (attribute + 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 +14,4 @@ (#set! injection.language "bash")) ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/bitbake/locals.scm b/queries/bitbake/locals.scm index 27e85f02a..0f572584b 100644 --- a/queries/bitbake/locals.scm +++ b/queries/bitbake/locals.scm @@ -7,10 +7,16 @@ ; Imports (aliased_import alias: (python_identifier) @local.definition.import) + (import_statement - name: (dotted_name ((python_identifier) @local.definition.import))) + name: + (dotted_name + ((python_identifier) @local.definition.import))) + (import_from_statement - name: (dotted_name ((python_identifier) @local.definition.import))) + name: + (dotted_name + ((python_identifier) @local.definition.import))) ; Function with parameters, defines parameters (parameters @@ -38,58 +44,80 @@ ; Function defines function and scope ((python_function_definition name: (python_identifier) @local.definition.function) @local.scope - (#set! definition.function.scope "parent")) + (#set! definition.function.scope "parent")) -(function_definition (identifier) @local.definition.function) +(function_definition + (identifier) @local.definition.function) -(anonymous_python_function (identifier) @local.definition.function) +(anonymous_python_function + (identifier) @local.definition.function) -;;; Loops +; Loops ; not a scope! (for_statement - left: (pattern_list - (python_identifier) @local.definition.var)) + left: + (pattern_list + (python_identifier) @local.definition.var)) + (for_statement - left: (tuple_pattern - (python_identifier) @local.definition.var)) + left: + (tuple_pattern + (python_identifier) @local.definition.var)) + (for_statement left: (python_identifier) @local.definition.var) ; not a scope! ;(while_statement) @local.scope - ; for in list comprehension (for_in_clause left: (python_identifier) @local.definition.var) + (for_in_clause - left: (tuple_pattern - (python_identifier) @local.definition.var)) + left: + (tuple_pattern + (python_identifier) @local.definition.var)) + (for_in_clause - left: (pattern_list - (python_identifier) @local.definition.var)) + left: + (pattern_list + (python_identifier) @local.definition.var)) (dictionary_comprehension) @local.scope + (list_comprehension) @local.scope -(set_comprehension) @local.scope -;;; Assignments +(set_comprehension) @local.scope +; Assignments (assignment - left: (python_identifier) @local.definition.var) + left: (python_identifier) @local.definition.var) (assignment - left: (pattern_list - (python_identifier) @local.definition.var)) + left: + (pattern_list + (python_identifier) @local.definition.var)) + (assignment - left: (tuple_pattern - (python_identifier) @local.definition.var)) + left: + (tuple_pattern + (python_identifier) @local.definition.var)) (assignment - left: (attribute - (python_identifier) - (python_identifier) @local.definition.field)) + left: + (attribute + (python_identifier) + (python_identifier) @local.definition.field)) -(variable_assignment (identifier) operator: [ "=" "?=" "??=" ":=" ] @local.definition.var) +(variable_assignment + (identifier) + operator: + [ + "=" + "?=" + "??=" + ":=" + ] @local.definition.var) ; Walrus operator x := 1 (named_expression diff --git a/queries/blueprint/highlights.scm b/queries/blueprint/highlights.scm index 3e3a8e4a8..faefd319d 100644 --- a/queries/blueprint/highlights.scm +++ b/queries/blueprint/highlights.scm @@ -1,6 +1,7 @@ (object_id) @variable (string) @string + (escape_sequence) @string.escape (comment) @comment @spell @@ -15,30 +16,50 @@ (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) + +(signal_binding + (function + (identifier)) @function) + +(signal_binding + "swapped" @keyword) + +(styles_list + "styles" @function.macro) -(styles_list "styles" @function.macro) -(layout_definition "layout" @function.macro) +(layout_definition + "layout" @function.macro) -(gettext_string "_" @function.builtin) +(gettext_string + "_" @function.builtin) -(menu_definition "menu" @keyword) -(menu_section "section" @keyword) -(menu_item "item" @function.macro) +(menu_definition + "menu" @keyword) -(template_definition (template_name_qualifier) @type.qualifier) +(menu_section + "section" @keyword) -(import_statement (gobject_library) @module) +(menu_item + "item" @function.macro) -(import_statement (version_number) @number.float) +(template_definition + (template_name_qualifier) @type.qualifier) + +(import_statement + (gobject_library) @module) + +(import_statement + (version_number) @number.float) (float) @number.float + (number) @number [ diff --git a/queries/c/folds.scm b/queries/c/folds.scm index 42ca3fb63..2e2a6b4d0 100644 --- a/queries/c/folds.scm +++ b/queries/c/folds.scm @@ -1,21 +1,21 @@ [ - (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) ] @fold (compound_statement diff --git a/queries/c/highlights.scm b/queries/c/highlights.scm index 0a6145e3e..c848f68dc 100644 --- a/queries/c/highlights.scm +++ b/queries/c/highlights.scm @@ -1,6 +1,9 @@ ; Lower priority to prefer @variable.parameter when identifier appears in parameter_declaration. -((identifier) @variable (#set! "priority" 95)) -(preproc_def (preproc_arg) @variable) +((identifier) @variable + (#set! "priority" 95)) + +(preproc_def + (preproc_arg) @variable) [ "default" @@ -17,7 +20,10 @@ "sizeof" "offsetof" ] @keyword.operator -(alignof_expression . _ @keyword.operator) + +(alignof_expression + . + _ @keyword.operator) "return" @keyword.return @@ -30,10 +36,10 @@ ] @keyword.repeat [ - "if" - "else" - "case" - "switch" + "if" + "else" + "case" + "switch" ] @keyword.conditional [ @@ -52,42 +58,48 @@ "#include" @keyword.import -[ ";" ":" "," "::" ] @punctuation.delimiter +[ + ";" + ":" + "," + "::" +] @punctuation.delimiter "..." @punctuation.special -[ "(" ")" "[" "]" "{" "}"] @punctuation.bracket +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket [ "=" - "-" "*" "/" "+" "%" - "~" "|" "&" "^" "<<" ">>" - "->" "." - "<" "<=" ">=" ">" "==" "!=" - "!" "&&" "||" - "-=" "+=" "*=" @@ -102,42 +114,54 @@ "++" ] @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 [ "?" ":" ] @keyword.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_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_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)) + (#has-ancestor? @property field_declaration) + (#not-has-ancestor? @property function_declarator)) (statement_identifier) @label [ - (type_identifier) - (type_descriptor) + (type_identifier) + (type_descriptor) ] @type (storage_class_specifier) @keyword.storage @@ -156,14 +180,20 @@ (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) @@ -181,7 +211,9 @@ "__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" @@ -197,21 +229,26 @@ "__VA_ARGS__" "__VA_OPT__")) (attribute_specifier - (argument_list (identifier) @variable.builtin)) + (argument_list + (identifier) @variable.builtin)) + ((attribute_specifier - (argument_list (call_expression - function: (identifier) @variable.builtin)))) + (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 @@ -219,15 +256,21 @@ (call_expression function: (identifier) @function.call) + (call_expression - function: (field_expression - field: (field_identifier) @function.call)) + function: + (field_expression + field: (field_identifier) @function.call)) + (function_declarator declarator: (identifier) @function) + (function_declarator - declarator: (parenthesized_declarator - (pointer_declarator - declarator: (field_identifier) @function))) + declarator: + (parenthesized_declarator + (pointer_declarator + declarator: (field_identifier) @function))) + (preproc_function_def name: (identifier) @function.macro) @@ -236,7 +279,7 @@ ((comment) @comment.documentation (#lua-match? @comment.documentation "^/[*][*][^*].*[*]/$")) -;; Parameters +; Parameters (parameter_declaration declarator: (identifier) @variable.parameter) @@ -268,8 +311,8 @@ ; declarator: _ ; (declaration ; declarator: (pointer_declarator) @variable.parameter)) - -(preproc_params (identifier) @variable.parameter) +(preproc_params + (identifier) @variable.parameter) [ "__attribute__" diff --git a/queries/c/indents.scm b/queries/c/indents.scm index cf4c8fa62..95d25fe1d 100644 --- a/queries/c/indents.scm +++ b/queries/c/indents.scm @@ -1,5 +1,5 @@ [ - (compound_statement) + (compound_statement) (field_declaration_list) (case_statement) (enumerator_list) @@ -7,56 +7,62 @@ (initializer_list) (init_declarator) ] @indent.begin - ; 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 + body: (_) @_body) @indent.begin (#not-has-type? @_body compound_statement)) (while_statement condition: (_) @indent.begin) ((while_statement - body: (_) @_body) @indent.begin + body: (_) @_body) @indent.begin (#not-has-type? @_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) +; Supports if without braces (but not both if-else without braces) ((if_statement - consequence: - (_ ";" @indent.end) @_consequence - (#not-has-type? @_consequence compound_statement) + consequence: + (_ + ";" @indent.end) @_consequence + (#not-has-type? @_consequence compound_statement) alternative: - (else_clause + (else_clause "else" @indent.branch - [ - (if_statement (compound_statement) @indent.dedent)? @indent.dedent + [ + (if_statement + (compound_statement) @indent.dedent)? @indent.dedent (compound_statement)? @indent.dedent (_)? @indent.dedent - ] - )? - ) @indent.begin) - -(else_clause (_ . "{" @indent.branch)) + ])?) @indent.begin) +(else_clause + (_ + . + "{" @indent.branch)) -(compound_statement "}" @indent.end) +(compound_statement + "}" @indent.end) [ ")" @@ -79,12 +85,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 ")")) -(comment) @indent.auto +([ + (argument_list) + (parameter_list) +] @indent.align + (#set! indent.open_delimiter "(") + (#set! indent.close_delimiter ")")) +(comment) @indent.auto diff --git a/queries/c/injections.scm b/queries/c/injections.scm index c025b0f07..6349fe2d1 100644 --- a/queries/c/injections.scm +++ b/queries/c/injections.scm @@ -1,8 +1,8 @@ ((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") @@ -14,8 +14,11 @@ ((call_expression function: (identifier) @_function - arguments: (argument_list - . (string_literal (string_content) @injection.content))) + arguments: + (argument_list + . + (string_literal + (string_content) @injection.content))) ; format-ignore (#any-of? @_function "printf" "printf_s" @@ -29,12 +32,16 @@ "cscanf" "_cscanf" "printw" "scanw") - (#set! injection.language "printf")) + (#set! injection.language "printf")) ((call_expression function: (identifier) @_function - arguments: (argument_list - (_) . (string_literal (string_content) @injection.content))) + arguments: + (argument_list + (_) + . + (string_literal + (string_content) @injection.content))) ; format-ignore (#any-of? @_function "fprintf" "fprintf_s" @@ -57,12 +64,18 @@ "vw_printw" "vwprintw" "wscanw" "vw_scanw" "vwscanw") - (#set! injection.language "printf")) + (#set! injection.language "printf")) ((call_expression function: (identifier) @_function - arguments: (argument_list - (_) . (_) . (string_literal (string_content) @injection.content))) + arguments: + (argument_list + (_) + . + (_) + . + (string_literal + (string_content) @injection.content))) ; format-ignore (#any-of? @_function "sprintf_s" @@ -75,15 +88,22 @@ "vsnwprintf_s" "mvprintw" "mvscanw") - (#set! injection.language "printf")) + (#set! injection.language "printf")) ((call_expression function: (identifier) @_function - arguments: (argument_list - (_) . (_) . (_) . (string_literal (string_content) @injection.content))) - (#any-of? @_function "mvwprintw" - "mvwscanw") - (#set! injection.language "printf")) + arguments: + (argument_list + (_) + . + (_) + . + (_) + . + (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 diff --git a/queries/c/locals.scm b/queries/c/locals.scm index 3756bc4a5..13a122790 100644 --- a/queries/c/locals.scm +++ b/queries/c/locals.scm @@ -1,53 +1,67 @@ -;; Functions definitions +; Functions definitions (function_declarator declarator: (identifier) @local.definition.function) + (preproc_function_def name: (identifier) @local.definition.macro) @local.scope (preproc_def name: (identifier) @local.definition.macro) + (pointer_declarator declarator: (identifier) @local.definition.var) + (parameter_declaration declarator: (identifier) @local.definition.parameter) + (init_declarator declarator: (identifier) @local.definition.var) + (array_declarator declarator: (identifier) @local.definition.var) + (declaration declarator: (identifier) @local.definition.var) + (enum_specifier name: (_) @local.definition.type (enumerator_list - (enumerator name: (identifier) @local.definition.var))) + (enumerator + name: (identifier) @local.definition.var))) -;; Type / Struct / Enum +; Type / Struct / Enum (field_declaration declarator: (field_identifier) @local.definition.field) + (type_definition declarator: (type_identifier) @local.definition.type) + (struct_specifier name: (type_identifier) @local.definition.type) -;; goto -(labeled_statement (statement_identifier) @local.definition) +; goto +(labeled_statement + (statement_identifier) @local.definition) -;; References +; References (identifier) @local.reference + ((field_identifier) @local.reference - (#set! reference.kind "field")) + (#set! reference.kind "field")) + ((type_identifier) @local.reference - (#set! reference.kind "type")) + (#set! reference.kind "type")) -(goto_statement (statement_identifier) @local.reference) +(goto_statement + (statement_identifier) @local.reference) -;; Scope +; Scope [ - (for_statement) - (if_statement) - (while_statement) - (translation_unit) - (function_definition) - (compound_statement) ; a block in curly braces - (struct_specifier) + (for_statement) + (if_statement) + (while_statement) + (translation_unit) + (function_definition) + (compound_statement) ; a block in curly braces + (struct_specifier) ] @local.scope diff --git a/queries/c_sharp/folds.scm b/queries/c_sharp/folds.scm index 4b5d94270..2b7c9773d 100644 --- a/queries/c_sharp/folds.scm +++ b/queries/c_sharp/folds.scm @@ -1,15 +1,10 @@ -body: [ - (declaration_list) - (switch_body) - (enum_member_declaration_list) -] @fold - -accessors: [ - (accessor_list) -] @fold - -initializer: [ - (initializer_expression) -] @fold +body: + [ + (declaration_list) + (switch_body) + (enum_member_declaration_list) + ] @fold +accessors: (accessor_list) @fold +initializer: (initializer_expression) @fold (block) @fold diff --git a/queries/c_sharp/highlights.scm b/queries/c_sharp/highlights.scm index 1cd566728..3671dc258 100644 --- a/queries/c_sharp/highlights.scm +++ b/queries/c_sharp/highlights.scm @@ -26,18 +26,23 @@ name: (identifier) @function.method.call)) (invocation_expression - function: (conditional_access_expression - (member_binding_expression - name: (identifier) @function.method.call))) + function: + (conditional_access_expression + (member_binding_expression + name: (identifier) @function.method.call))) (namespace_declaration - name: [(qualified_name) (identifier)] @module) + name: + [ + (qualified_name) + (identifier) + ] @module) (qualified_name (identifier) @type) (invocation_expression - (identifier) @function.method.call) + (identifier) @function.method.call) (field_declaration (variable_declaration @@ -50,29 +55,29 @@ (parameter_list (parameter - name: (identifier) @variable.parameter)) + name: (identifier) @variable.parameter)) (parameter_list (parameter - type: (identifier) @type)) + type: (identifier) @type)) (integer_literal) @number + (real_literal) @number.float (null_literal) @constant.builtin + (character_literal) @character [ - (string_literal) - (verbatim_string_literal) - (interpolated_string_expression) + (string_literal) + (verbatim_string_literal) + (interpolated_string_expression) ] @string (boolean_literal) @boolean -[ - (predefined_type) -] @type.builtin +(predefined_type) @type.builtin (implicit_type) @keyword @@ -83,6 +88,7 @@ ((comment) @comment.documentation (#lua-match? @comment.documentation "^///[^/]")) + ((comment) @comment.documentation (#lua-match? @comment.documentation "^///$")) @@ -90,7 +96,8 @@ (identifier) @type) (using_directive - (name_equals (identifier) @type.definition)) + (name_equals + (identifier) @type.definition)) (property_declaration name: (identifier) @property) @@ -106,20 +113,25 @@ (interface_declaration name: (identifier) @type) + (class_declaration name: (identifier) @type) + (record_declaration name: (identifier) @type) + (enum_declaration name: (identifier) @type) + (constructor_declaration name: (identifier) @constructor) -(constructor_initializer [ - "base" @constructor -]) + +(constructor_initializer + "base" @constructor) (variable_declaration (identifier) @type) + (object_creation_expression (identifier) @type) @@ -142,19 +154,23 @@ (object_creation_expression (generic_name - (identifier) @type)) + (identifier) @type)) (property_declaration (generic_name (identifier) @type)) (_ - type: (generic_name - (identifier) @type)) + type: + (generic_name + (identifier) @type)) + ; Generic Method invocation with generic type (invocation_expression - function: (generic_name - . (identifier) @function.method.call)) + function: + (generic_name + . + (identifier) @function.method.call)) (invocation_expression (member_access_expression @@ -165,7 +181,7 @@ (identifier) @type) (type_argument_list - (identifier) @type) + (identifier) @type) (type_parameter_list (type_parameter) @type) @@ -174,7 +190,7 @@ target: (identifier) @type) (attribute - name: (identifier) @attribute) + name: (identifier) @attribute) (for_each_statement type: (identifier) @type) @@ -197,180 +213,194 @@ (identifier) @variable.parameter) (warning_directive) @comment.warning + (error_directive) @keyword.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 [ - (nullable_directive) - (region_directive) - (endregion_directive) + (nullable_directive) + (region_directive) + (endregion_directive) ] @constant.macro [ - "if" - "else" - "switch" - "break" - "case" - "when" - (if_directive) - (elif_directive) - (else_directive) - (endif_directive) + "if" + "else" + "switch" + "break" + "case" + "when" + (if_directive) + (elif_directive) + (else_directive) + (endif_directive) ] @keyword.conditional (if_directive (identifier) @constant) + (elif_directive (identifier) @constant) [ - "while" - "for" - "do" - "continue" - "goto" - "foreach" + "while" + "for" + "do" + "continue" + "goto" + "foreach" ] @keyword.repeat [ - "try" - "catch" - "throw" - "finally" + "try" + "catch" + "throw" + "finally" ] @keyword.exception [ - "+" - "?" - ":" - "++" - "-" - "--" - "&" - "&&" - "|" - "||" - "!" - "!=" - "==" - "*" - "/" - "%" - "<" - "<=" - ">" - ">=" - "=" - "-=" - "+=" - "*=" - "/=" - "%=" - "^" - "^=" - "&=" - "|=" - "~" - ">>" - ">>>" - "<<" - "<<=" - ">>=" - ">>>=" - "=>" - "??" - "??=" + "+" + "?" + ":" + "++" + "-" + "--" + "&" + "&&" + "|" + "||" + "!" + "!=" + "==" + "*" + "/" + "%" + "<" + "<=" + ">" + ">=" + "=" + "-=" + "+=" + "*=" + "/=" + "%=" + "^" + "^=" + "&=" + "|=" + "~" + ">>" + ">>>" + "<<" + "<<=" + ">>=" + ">>>=" + "=>" + "??" + "??=" ] @operator [ - ";" - "." - "," - ":" + ";" + "." + "," + ":" ] @punctuation.delimiter -(conditional_expression ["?" ":"] @keyword.conditional.ternary) +(conditional_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) [ - "[" - "]" - "{" - "}" - "(" - ")" + "[" + "]" + "{" + "}" + "(" + ")" ] @punctuation.bracket -(type_argument_list ["<" ">"] @punctuation.bracket) +(type_argument_list + [ + "<" + ">" + ] @punctuation.bracket) [ - (this_expression) - (base_expression) + (this_expression) + (base_expression) ] @variable.builtin [ - "using" - "as" + "using" + "as" ] @keyword.import (alias_qualified_name - (identifier "global") @keyword.import) + (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" + "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" + "class" + "delegate" + "enum" + "interface" + "namespace" + "struct" + "get" + "set" + "init" + "where" + "record" + "event" + "add" + "remove" + "checked" + "unchecked" + "fixed" + "alias" ] @keyword [ @@ -379,39 +409,40 @@ ] @keyword.coroutine [ - "const" - "extern" - "readonly" - "static" - "volatile" - "required" + "const" + "extern" + "readonly" + "static" + "volatile" + "required" ] @keyword.storage [ - "abstract" - "private" - "protected" - "internal" - "public" - "partial" - "sealed" - "virtual" + "abstract" + "private" + "protected" + "internal" + "public" + "partial" + "sealed" + "virtual" ] @type.qualifier (parameter_modifier) @operator (query_expression - (_ [ - "from" - "orderby" - "select" - "group" - "by" - "ascending" - "descending" - "equals" - "let" - ] @keyword)) + (_ + [ + "from" + "orderby" + "select" + "group" + "by" + "ascending" + "descending" + "equals" + "let" + ] @keyword)) [ "return" diff --git a/queries/c_sharp/injections.scm b/queries/c_sharp/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/c_sharp/injections.scm +++ b/queries/c_sharp/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/c_sharp/locals.scm b/queries/c_sharp/locals.scm index 1d1665d9d..0476a1695 100644 --- a/queries/c_sharp/locals.scm +++ b/queries/c_sharp/locals.scm @@ -1,6 +1,7 @@ -;; Definitions +; Definitions (variable_declarator - . (identifier) @local.definition.var) + . + (identifier) @local.definition.var) (variable_declarator (tuple_pattern @@ -13,8 +14,9 @@ left: (identifier) @local.definition.var) (for_each_statement - left: (tuple_pattern - (identifier) @local.definition.var)) + left: + (tuple_pattern + (identifier) @local.definition.var)) (parameter (identifier) @local.definition.parameter) @@ -34,8 +36,8 @@ (class_declaration name: (identifier) @local.definition) -;; References +; References (identifier) @local.reference -;; Scope +; Scope (block) @local.scope diff --git a/queries/cairo/folds.scm b/queries/cairo/folds.scm index 1c7af9fcf..9937da6f1 100644 --- a/queries/cairo/folds.scm +++ b/queries/cairo/folds.scm @@ -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 diff --git a/queries/cairo/highlights.scm b/queries/cairo/highlights.scm index f8bacede9..aa25847c9 100644 --- a/queries/cairo/highlights.scm +++ b/queries/cairo/highlights.scm @@ -1,13 +1,18 @@ ; Preproc - [ "%builtins" "%lang" ] @keyword.directive ; Includes - -(import_statement [ "from" "import" ] @keyword.import module_name: (dotted_name (identifier) @module . )) +(import_statement + [ + "from" + "import" + ] @keyword.import + module_name: + (dotted_name + (identifier) @module .)) [ "as" @@ -16,41 +21,42 @@ ] @keyword.import ; Variables - (identifier) @variable ; Namespaces - -(namespace_definition (identifier) @module) +(namespace_definition + (identifier) @module) (mod_item name: (identifier) @module) -(use_list (self) @module) +(use_list + (self) @module) -(scoped_use_list (self) @module) +(scoped_use_list + (self) @module) (scoped_identifier path: (identifier) @module) (scoped_identifier - (scoped_identifier - name: (identifier) @module)) + (scoped_identifier + name: (identifier) @module)) (scoped_type_identifier 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 @@ -68,17 +74,25 @@ path: (identifier) @module) (scoped_use_list - path: (scoped_identifier - (identifier) @module)) + path: + (scoped_identifier + (identifier) @module)) -(use_list (scoped_identifier (identifier) @module . (_))) +(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" @@ -96,7 +110,6 @@ "with" "call" "nondet" - ; 1.0 "type" "impl" @@ -133,9 +146,7 @@ "match" ] @keyword.conditional -[ - "loop" -] @keyword.repeat +"loop" @keyword.repeat [ "assert" @@ -144,33 +155,52 @@ ] @keyword.exception ; Fields +(implicit_arguments + (typed_identifier + (identifier) @variable.member)) -(implicit_arguments (typed_identifier (identifier) @variable.member)) - -(member_expression "." (identifier) @variable.member) +(member_expression + "." + (identifier) @variable.member) -(call_expression (assignment_expression left: (identifier) @variable.member)) +(call_expression + (assignment_expression + left: (identifier) @variable.member)) -(tuple_expression (assignment_expression left: (identifier) @variable.member)) +(tuple_expression + (assignment_expression + left: (identifier) @variable.member)) (field_identifier) @variable.member -(shorthand_field_initializer (identifier) @variable.member) +(shorthand_field_initializer + (identifier) @variable.member) ; Parameters +(arguments + (typed_identifier + (identifier) @variable.parameter)) -(arguments (typed_identifier (identifier) @variable.parameter)) - -(call_expression (tuple_expression (assignment_expression left: (identifier) @variable.parameter))) +(call_expression + (tuple_expression + (assignment_expression + left: (identifier) @variable.parameter))) -(return_type (tuple_type (named_type . (identifier) @variable.parameter))) +(return_type + (tuple_type + (named_type + . + (identifier) @variable.parameter))) -(parameter (identifier) @variable.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 +209,45 @@ ] @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 .)) + function: + (scoped_identifier + (identifier) @function.call .)) (call_expression - function: (field_expression - field: (field_identifier) @function.call)) + 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) @variable.member)?) - -(named_type (identifier) @type .) +(named_type + (identifier) @type .) [ (builtin_type) @@ -217,7 +260,6 @@ (type_identifier) @type ; Constants - ((identifier) @constant (#lua-match? @constant "^[A-Z_][A-Z0-9_]*$")) @@ -225,49 +267,68 @@ name: (identifier) @constant) (call_expression - function: (scoped_identifier - "::" - name: (identifier) @constant) + function: + (scoped_identifier + "::" + name: (identifier) @constant) (#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 +368,6 @@ ] @operator ; Literals - (number) @number (boolean) @boolean @@ -318,17 +378,41 @@ ] @string ; Punctuation +(attribute_item + "#" @punctuation.special) -(attribute_item "#" @punctuation.special) - -[ "." "," ":" ";" "->" "=>" "::" ] @punctuation.delimiter - -[ "{" "}" "(" ")" "[" "]" "%{" "%}" ] @punctuation.bracket - -(type_parameters [ "<" ">" ] @punctuation.bracket) +[ + "." + "," + ":" + ";" + "->" + "=>" + "::" +] @punctuation.delimiter -(type_arguments [ "<" ">" ] @punctuation.bracket) +[ + "{" + "}" + "(" + ")" + "[" + "]" + "%{" + "%}" +] @punctuation.bracket + +(type_parameters + [ + "<" + ">" + ] @punctuation.bracket) + +(type_arguments + [ + "<" + ">" + ] @punctuation.bracket) ; Comment - (comment) @comment @spell diff --git a/queries/cairo/indents.scm b/queries/cairo/indents.scm index 76a22e705..a97bd24a4 100644 --- a/queries/cairo/indents.scm +++ b/queries/cairo/indents.scm @@ -18,19 +18,36 @@ (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)) [ ")" diff --git a/queries/cairo/injections.scm b/queries/cairo/injections.scm index 675a81a76..fbb66be38 100644 --- a/queries/cairo/injections.scm +++ b/queries/cairo/injections.scm @@ -1,3 +1,5 @@ -(python_code) @python +((python_code) @injection.content + (#set! injection.language "python")) -(comment) @comment +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/cairo/locals.scm b/queries/cairo/locals.scm index a92991f26..27ec73542 100644 --- a/queries/cairo/locals.scm +++ b/queries/cairo/locals.scm @@ -1,13 +1,13 @@ ; References - (identifier) @local.reference + ((type_identifier) @local.reference (#set! reference.kind "type")) + ((field_identifier) @local.reference (#set! reference.kind "field")) ; Scopes - [ (program) (block) @@ -16,53 +16,52 @@ (if_expression) (match_expression) (match_arm) - (struct_item) (enum_item) (impl_item) ] @local.scope -(use_declaration - argument: (scoped_identifier - name: (identifier) @local.definition.import)) +(use_declaration + argument: + (scoped_identifier + name: (identifier) @local.definition.import)) -(use_as_clause +(use_as_clause alias: (identifier) @local.definition.import) (use_list - (identifier) @local.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) + (identifier) @local.definition.function) (function_definition (identifier) @local.definition.method - (parameter (self))) + (parameter + (self))) ; Function with parameters, defines parameters - (parameter - [ (identifier) (self) ] @local.definition.parameter) + [ + (identifier) + (self) + ] @local.definition.parameter) ; Types - (struct_item name: (type_identifier) @local.definition.type) -(constrained_type_parameter +(constrained_type_parameter left: (type_identifier) @local.definition.type) ; the P in remove_file>(path: P) (enum_item name: (type_identifier) @local.definition.type) ; Module - -(mod_item +(mod_item name: (identifier) @local.definition.namespace) ; Variables - (assignment_expression - left: (identifier) @local.definition.var) + left: (identifier) @local.definition.var) diff --git a/queries/capnp/highlights.scm b/queries/capnp/highlights.scm index 80c8262e7..4ce923ce4 100644 --- a/queries/capnp/highlights.scm +++ b/queries/capnp/highlights.scm @@ -1,12 +1,10 @@ ; Preproc - [ (unique_id) (top_level_annotation_body) ] @keyword.directive ; Includes - [ "import" "$import" @@ -17,7 +15,6 @@ (import_path) @string.special.path ; Keywords - [ "annotation" "enum" @@ -30,10 +27,7 @@ ] @keyword ; Builtins - -[ - "const" -] @type.qualifier +"const" @type.qualifier [ (primitive_type) @@ -41,30 +35,24 @@ ] @type.builtin ; Typedefs - (type_definition) @type.definition ; Labels (@number, @number!) - (field_version) @label ; Methods - [ (annotation_definition_identifier) (method_identifier) ] @function.method ; Fields - (field_identifier) @variable.member ; Properties - (property) @property ; Parameters - [ (param_identifier) (return_identifier) @@ -73,7 +61,6 @@ (annotation_target) @variable.parameter.builtin ; Constants - [ (const_identifier) (local_const) @@ -83,7 +70,6 @@ (void) @constant.builtin ; Types - [ (enum_identifier) (extend_type) @@ -91,18 +77,15 @@ ] @type ; Attributes - [ (annotation_identifier) (attribute) ] @attribute ; Operators - "=" @operator ; Literals - [ (string) (concatenated_string) @@ -125,18 +108,26 @@ (data_hex) @string.special.symbol ; Punctuation - [ "*" "$" ":" ] @punctuation.special -["{" "}"] @punctuation.bracket +[ + "{" + "}" +] @punctuation.bracket -["(" ")"] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket -["[" "]"] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket [ "." @@ -146,5 +137,4 @@ ] @punctuation.delimiter ; Comments - (comment) @comment @spell diff --git a/queries/capnp/indents.scm b/queries/capnp/indents.scm index bc7979aea..cc2f4d756 100644 --- a/queries/capnp/indents.scm +++ b/queries/capnp/indents.scm @@ -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) diff --git a/queries/capnp/injections.scm b/queries/capnp/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/capnp/injections.scm +++ b/queries/capnp/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/capnp/locals.scm b/queries/capnp/locals.scm index d0025100e..d1f0ccacc 100644 --- a/queries/capnp/locals.scm +++ b/queries/capnp/locals.scm @@ -18,17 +18,21 @@ (extend_type) (field_type) ] @local.reference -(custom_type (type_identifier) @local.reference) + +(custom_type + (type_identifier) @local.reference) + (custom_type (generics - (generic_parameters + (generic_parameters (generic_identifier) @local.reference))) (annotation_definition_identifier) @local.definition (const_identifier) @local.definition.constant -(enum (enum_identifier) @local.definition.enum) +(enum + (enum_identifier) @local.definition.enum) [ (enum_member) @@ -44,16 +48,19 @@ (return_identifier) ] @local.definition.parameter -(group (type_identifier) @local.definition.type) +(group + (type_identifier) @local.definition.type) -(struct (type_identifier) @local.definition.type) +(struct + (type_identifier) @local.definition.type) -(union (type_identifier) @local.definition.type) +(union + (type_identifier) @local.definition.type) -(interface (type_identifier) @local.definition.type) +(interface + (type_identifier) @local.definition.type) ; Generics Related (don't know how to combine these) - (struct (generics (generic_parameters diff --git a/queries/chatito/folds.scm b/queries/chatito/folds.scm index 20cb51941..052dd2064 100644 --- a/queries/chatito/folds.scm +++ b/queries/chatito/folds.scm @@ -1,5 +1,5 @@ [ - (intent_def) - (slot_def) - (alias_def) + (intent_def) + (slot_def) + (alias_def) ] @fold diff --git a/queries/chatito/highlights.scm b/queries/chatito/highlights.scm index 913787012..0c2dd795a 100644 --- a/queries/chatito/highlights.scm +++ b/queries/chatito/highlights.scm @@ -1,24 +1,32 @@ -;; Punctuation - +; Punctuation [ - "%[" - "@[" - "~[" - "*[" - "]" - "(" - ")" + "%[" + "@[" + "~[" + "*[" + "]" + "(" + ")" ] @punctuation.bracket -[":" ","] @punctuation.delimiter - -(["\"" "'"] @punctuation.special - (#set! conceal "")) +[ + ":" + "," +] @punctuation.delimiter -["%" "?" "#"] @character.special +([ + "\"" + "'" +] @punctuation.special + (#set! conceal "")) -;; Entities +[ + "%" + "?" + "#" +] @character.special +; Entities (intent) @module (slot) @type @@ -35,16 +43,13 @@ (escape) @string.escape -;; Import - +; Import "import" @keyword.import (file) @string.special.path -;; Text - +; Text (word) @spell -;; Comment - +; Comment (comment) @comment @spell diff --git a/queries/chatito/indents.scm b/queries/chatito/indents.scm index 64b4674b7..dc9e13d78 100644 --- a/queries/chatito/indents.scm +++ b/queries/chatito/indents.scm @@ -1,7 +1,8 @@ [ - (intent_def) - (slot_def) - (alias_def) + (intent_def) + (slot_def) + (alias_def) ] @indent.begin -(ERROR "]") @indent.begin +(ERROR + "]") @indent.begin diff --git a/queries/chatito/injections.scm b/queries/chatito/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/chatito/injections.scm +++ b/queries/chatito/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/chatito/locals.scm b/queries/chatito/locals.scm index fd8bb9da0..827447f57 100644 --- a/queries/chatito/locals.scm +++ b/queries/chatito/locals.scm @@ -1,10 +1,16 @@ -;; Definitions +; Definitions +(intent_def + (intent) @local.definition) -(intent_def (intent) @local.definition) -(slot_def (slot) @local.definition) -(alias_def (alias) @local.definition) +(slot_def + (slot) @local.definition) -;; References +(alias_def + (alias) @local.definition) -(slot_ref (slot) @local.reference) -(alias_ref (alias) @local.reference) +; References +(slot_ref + (slot) @local.reference) + +(alias_ref + (alias) @local.reference) diff --git a/queries/clojure/folds.scm b/queries/clojure/folds.scm index d54daade6..eceb69712 100644 --- a/queries/clojure/folds.scm +++ b/queries/clojure/folds.scm @@ -1 +1,2 @@ -(source (list_lit) @fold) +(source + (list_lit) @fold) diff --git a/queries/clojure/highlights.scm b/queries/clojure/highlights.scm index 974a17c0a..60bc4365b 100644 --- a/queries/clojure/highlights.scm +++ b/queries/clojure/highlights.scm @@ -1,69 +1,87 @@ -;; >> 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 -) +; >> 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 + (str_lit) @string -(num_lit) @number -(char_lit) @character -(bool_lit) @boolean -(nil_lit) @constant.builtin -(comment) @comment @spell -(regex_lit) @string.regexp -["'" "`"] @string.escape +(num_lit) @number -["~" "~@" "#"] @punctuation.special +(char_lit) @character -["{" "}" "[" "]" "(" ")"] @punctuation.bracket +(bool_lit) @boolean +(nil_lit) @constant.builtin +(comment) @comment @spell -;; >> Symbols +(regex_lit) @string.regexp +[ + "'" + "`" +] @string.escape + +[ + "~" + "~@" + "#" +] @punctuation.special + +[ + "{" + "}" + "[" + "]" + "(" + ")" +] @punctuation.bracket + +; >> 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) @string.special.symbol) + (sym_lit) @string.special.symbol) + (syn_quoting_lit - (sym_lit) @string.special.symbol) + (sym_lit) @string.special.symbol) ; Used in destructure pattern ((sym_lit) @variable.parameter - (#lua-match? @variable.parameter "^[&]")) + (#lua-match? @variable.parameter "^[&]")) ; Inline function variables ((sym_lit) @variable.builtin - (#lua-match? @variable.builtin "^%%")) + (#lua-match? @variable.builtin "^%%")) ; Constructor ((sym_lit) @constructor - (#lua-match? @constructor "^-%>[^>].*")) + (#lua-match? @constructor "^-%>[^>].*")) ; Builtin dynamic variables ((sym_lit) @variable.builtin @@ -84,94 +102,91 @@ ; Builtin repl variables ((sym_lit) @variable.builtin - (#any-of? @variable.builtin - "*1" "*2" "*3" "*e")) + (#any-of? @variable.builtin "*1" "*2" "*3" "*e")) ; Gensym -;; Might not be needed +; Might not be needed ((sym_lit) @variable - (#lua-match? @variable "^.*#$")) + (#lua-match? @variable "^.*#$")) ; Types -;; TODO: improve? +; TODO: improve? ((sym_lit) @type - (#lua-match? @type "^[%u][^/]*$")) -;; Symbols with `.` but not `/` + (#lua-match? @type "^[%u][^/]*$")) + +; Symbols with `.` but not `/` ((sym_lit) @type - (#lua-match? @type "^[^/]+[.][^/]*$")) + (#lua-match? @type "^[^/]+[.][^/]*$")) ; Interop ; (.instanceMember instance args*) ; (.instanceMember Classname args*) ((sym_lit) @function.method - (#lua-match? @function.method "^%.[^-]")) + (#lua-match? @function.method "^%.[^-]")) + ; (.-instanceField instance) ((sym_lit) @variable.member - (#lua-match? @variable.member "^%.%-.*")) + (#lua-match? @variable.member "^%.%-.*")) + ; Classname/staticField ((sym_lit) @variable.member - (#lua-match? @variable.member "^[%u].*/.+")) + (#lua-match? @variable.member "^[%u].*/.+")) + ; (Classname/staticMethod args*) (list_lit - . - (sym_lit) @function.method - (#lua-match? @function.method "^[%u].*/.+")) -;; TODO: Special casing for the `.` macro + . + (sym_lit) @function.method + (#lua-match? @function.method "^[%u].*/.+")) +; 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" "!" ">!!")) + (#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.function "defn" "defn-" "fn" "fn*")) ; Comment ((sym_lit) @comment - (#any-of? @comment "comment")) + (#any-of? @comment "comment")) ; Conditionals ((sym_lit) @keyword.conditional - (#any-of? @keyword.conditional - "case" "cond" "cond->" "cond->>" "condp")) + (#any-of? @keyword.conditional "case" "cond" "cond->" "cond->>" "condp")) + ((sym_lit) @keyword.conditional - (#any-of? @keyword.conditional - "if" "if-let" "if-not" "if-some")) + (#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")) + (#any-of? @keyword.conditional "when" "when-first" "when-let" "when-not" "when-some")) ; Repeats ((sym_lit) @keyword.repeat - (#any-of? @keyword.repeat - "doseq" "dotimes" "for" "loop" "recur" "while")) + (#any-of? @keyword.repeat "doseq" "dotimes" "for" "loop" "recur" "while")) ; Exception ((sym_lit) @keyword.exception - (#any-of? @keyword.exception - "throw" "try" "catch" "finally")) + (#any-of? @keyword.exception "throw" "try" "catch" "finally")) ; Includes ((sym_lit) @keyword.import - (#any-of? @keyword.import "ns" "import" "require" "use")) + (#any-of? @keyword.import "ns" "import" "require" "use")) ; Builtin macros -;; TODO: Do all these items belong here? +; TODO: Do all these items belong here? ((sym_lit) @function.macro ; format-ignore (#any-of? @function.macro @@ -191,7 +206,7 @@ ; (keep (fn [[s v]] (when-not (:macro (meta v)) s))) ; sort ; clojure.pprint/pprint)) -;; ...and then lots of manual filtering... +; ...and then lots of manual filtering... ((sym_lit) @function.builtin ; format-ignore (#any-of? @function.builtin @@ -316,48 +331,43 @@ "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)* @variable.parameter) - ; (list_lit - ; (vec_lit - ; (sym_lit)* @variable.parameter))]) - + . + (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)* @variable.parameter) +; (list_lit +; (vec_lit +; (sym_lit)* @variable.parameter))]) ;[((list_lit ; (vec_lit ; (sym_lit) @variable.parameter) @@ -366,19 +376,17 @@ ; ((vec_lit ; (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) @module) + . + (sym_lit) @_include + (#eq? @_include "ns") + . + (sym_lit) @module) diff --git a/queries/clojure/injections.scm b/queries/clojure/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/clojure/injections.scm +++ b/queries/clojure/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/cmake/folds.scm b/queries/cmake/folds.scm index 9ac59ad4c..ef153b911 100644 --- a/queries/cmake/folds.scm +++ b/queries/cmake/folds.scm @@ -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 diff --git a/queries/cmake/highlights.scm b/queries/cmake/highlights.scm index 13544661f..714893cb1 100644 --- a/queries/cmake/highlights.scm +++ b/queries/cmake/highlights.scm @@ -1,96 +1,107 @@ (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) +(normal_command + (identifier) @function) + +[ + "ENV" + "CACHE" +] @keyword.storage -["ENV" "CACHE"] @keyword.storage -["$" "{" "}" "<" ">"] @punctuation.special -["(" ")"] @punctuation.bracket +[ + "$" + "{" + "}" + "<" + ">" +] @punctuation.special [ - (function) - (endfunction) - (macro) - (endmacro) + "(" + ")" +] @punctuation.bracket + +[ + (function) + (endfunction) + (macro) + (endmacro) ] @keyword.function [ - (if) - (elseif) - (else) - (endif) + (if) + (elseif) + (else) + (endif) ] @keyword.conditional [ - (foreach) - (endforeach) - (while) - (endwhile) + (foreach) + (endforeach) + (while) + (endwhile) ] @keyword.repeat (normal_command (identifier) @keyword.repeat - (#match? @keyword.repeat "\\c^(continue|break)$") -) + (#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)* @variable.parameter - ) -) + . + (argument) @function + (argument)* @variable.parameter)) (macro_command (macro) (argument_list - . (argument) @function.macro - (argument)* @variable.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 - ) + (argument) @keyword.operator) ; format-ignore (#any-of? @keyword.operator "NOT" "AND" "OR" @@ -100,13 +111,12 @@ "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 - ) + (argument) @keyword.operator) ; format-ignore (#any-of? @keyword.operator "NOT" "AND" "OR" @@ -116,106 +126,105 @@ "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$") -) + . + (argument) @variable) + (#match? @_function "\\c^set$")) (normal_command (identifier) @_function (#match? @_function "\\c^set$") (argument_list - . (argument) - ( - (argument) @_cache @keyword.storage . - (argument) @_type @type - (#any-of? @_cache "CACHE") - (#any-of? @_type "BOOL" "FILEPATH" "PATH" "STRING" "INTERNAL") - ) - ) -) + (argument) + ((argument) @_cache @keyword.storage + . + (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) (argument) @keyword.storage - (#any-of? @keyword.storage "CACHE" "PARENT_SCOPE") - ) -) + (#any-of? @keyword.storage "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") - ) -) + (#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 + . + (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") - ) -) + (#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) @keyword.directive) +((source_file + . + (line_comment) @keyword.directive) (#lua-match? @keyword.directive "^#!/")) diff --git a/queries/cmake/indents.scm b/queries/cmake/indents.scm index 787cc2c98..e7f326b00 100644 --- a/queries/cmake/indents.scm +++ b/queries/cmake/indents.scm @@ -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) (argument_list) @indent.auto diff --git a/queries/comment/highlights.scm b/queries/comment/highlights.scm index 41b653e93..6556ec557 100644 --- a/queries/comment/highlights.scm +++ b/queries/comment/highlights.scm @@ -11,33 +11,39 @@ ((tag (name) @comment.note @nospell - ("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)? + ("(" @punctuation.bracket + (user) @constant + ")" @punctuation.bracket)? ":" @punctuation.delimiter) (#any-of? @comment.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST")) ("text" @comment.note @nospell - (#any-of? @comment.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST")) + (#any-of? @comment.note "NOTE" "XXX" "INFO" "DOCS" "PERF" "TEST")) ((tag (name) @comment.warning @nospell - ("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)? + ("(" @punctuation.bracket + (user) @constant + ")" @punctuation.bracket)? ":" @punctuation.delimiter) (#any-of? @comment.warning "HACK" "WARNING" "WARN" "FIX")) ("text" @comment.warning @nospell - (#any-of? @comment.warning "HACK" "WARNING" "WARN" "FIX")) + (#any-of? @comment.warning "HACK" "WARNING" "WARN" "FIX")) ((tag (name) @comment.error @nospell - ("(" @punctuation.bracket (user) @constant ")" @punctuation.bracket)? + ("(" @punctuation.bracket + (user) @constant + ")" @punctuation.bracket)? ":" @punctuation.delimiter) (#any-of? @comment.error "FIXME" "BUG" "ERROR")) ("text" @comment.error @nospell - (#any-of? @comment.error "FIXME" "BUG" "ERROR")) + (#any-of? @comment.error "FIXME" "BUG" "ERROR")) ; Issue number (#123) ("text" @number - (#lua-match? @number "^#[0-9]+$")) + (#lua-match? @number "^#[0-9]+$")) ((uri) @string.special.url @nospell) diff --git a/queries/commonlisp/folds.scm b/queries/commonlisp/folds.scm index d54daade6..eceb69712 100644 --- a/queries/commonlisp/folds.scm +++ b/queries/commonlisp/folds.scm @@ -1 +1,2 @@ -(source (list_lit) @fold) +(source + (list_lit) @fold) diff --git a/queries/commonlisp/highlights.scm b/queries/commonlisp/highlights.scm index 42da34d0e..57775019b 100644 --- a/queries/commonlisp/highlights.scm +++ b/queries/commonlisp/highlights.scm @@ -1,25 +1,48 @@ (sym_lit) @variable - -;; A highlighting for functions/macros in th cl namespace is available in theHamsta/nvim-treesitter-commonlisp +; A highlighting for functions/macros in th cl namespace is available in theHamsta/nvim-treesitter-commonlisp ;(list_lit . (sym_lit) @function.builtin (#cl-standard-function? @function.builtin)) ;(list_lit . (sym_lit) @function.builtin (#cl-standard-macro? @function.macro)) - (dis_expr) @comment (defun_keyword) @function.macro + (defun_header function_name: (_) @function) + (defun_header - lambda_list: (list_lit (sym_lit) @variable.parameter)) + lambda_list: + (list_lit + (sym_lit) @variable.parameter)) + (defun_header - keyword: (defun_keyword "defmethod") - lambda_list: (list_lit (list_lit . (sym_lit) . (sym_lit) @string.special.symbol))) + keyword: + (defun_keyword + "defmethod") + lambda_list: + (list_lit + (list_lit + . + (sym_lit) + . + (sym_lit) @string.special.symbol))) + (defun_header - lambda_list: (list_lit (list_lit . (sym_lit) @variable.parameter . (_)))) + lambda_list: + (list_lit + (list_lit + . + (sym_lit) @variable.parameter + . + (_)))) + (defun_header specifier: (sym_lit) @string.special.symbol) -[":" "::" "."] @punctuation.special +[ + ":" + "::" + "." +] @punctuation.special [ (accumulation_verb) @@ -49,99 +72,126 @@ "return" "initially" ] @function.macro + "=" @operator (include_reader_macro) @string.special.symbol -["#C" "#c"] @number -[(kwd_lit) (self_referential_reader_macro)] @string.special.symbol +[ + "#C" + "#c" +] @number + +[ + (kwd_lit) + (self_referential_reader_macro) +] @string.special.symbol (package_lit package: (_) @module) + "cl" @module (str_lit) @string (num_lit) @number -((sym_lit) @boolean (#any-of? @boolean "t" "T")) +((sym_lit) @boolean + (#any-of? @boolean "t" "T")) (nil_lit) @constant.builtin (comment) @comment @spell -;; dynamic variables +; dynamic variables ((sym_lit) @variable.builtin - (#lua-match? @variable.builtin "^[*].+[*]$")) + (#lua-match? @variable.builtin "^[*].+[*]$")) -;; quote +; quote "'" @string.escape + (format_specifier) @string.escape + (quoting_lit) @string.escape -;; syntax quote +; syntax quote "`" @string.escape + "," @string.escape + ",@" @string.escape + (syn_quoting_lit) @string.escape + (unquoting_lit) @none -(unquote_splicing_lit) @none +(unquote_splicing_lit) @none -["(" ")"] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket (block_comment) @comment @spell - (with_clause type: (_) @type) + (for_clause type: (_) @type) -;; defun-like things +; defun-like things (list_lit - . - (sym_lit) @function.macro - . - (sym_lit) @function - (#eq? @function.macro "deftest")) + . + (sym_lit) @function.macro + . + (sym_lit) @function + (#eq? @function.macro "deftest")) -;;; Macros and Special Operators +; Macros and Special Operators (list_lit - . - (sym_lit) @function.macro - ;; Generated via https://github.com/theHamsta/nvim-treesitter-commonlisp/blob/22fdc9fd6ed594176cc7299cc6f68dd21c94c63b/scripts/generate-symbols.lisp#L1-L21 + . + (sym_lit) @function.macro + ; Generated via https://github.com/theHamsta/nvim-treesitter-commonlisp/blob/22fdc9fd6ed594176cc7299cc6f68dd21c94c63b/scripts/generate-symbols.lisp#L1-L21 ; format-ignore (#any-of? @function.macro "do*" "step" "handler-bind" "decf" "prog1" "destructuring-bind" "defconstant" "do" "lambda" "with-standard-io-syntax" "case" "restart-bind" "ignore-errors" "with-slots" "prog2" "defclass" "define-condition" "print-unreadable-object" "defvar" "when" "with-open-file" "prog" "incf" "declaim" "and" "loop-finish" "multiple-value-bind" "pop" "psetf" "defmacro" "with-open-stream" "define-modify-macro" "defsetf" "formatter" "call-method" "handler-case" "pushnew" "or" "with-hash-table-iterator" "ecase" "cond" "defun" "remf" "ccase" "define-compiler-macro" "dotimes" "multiple-value-list" "assert" "deftype" "with-accessors" "trace" "with-simple-restart" "do-symbols" "nth-value" "define-symbol-macro" "psetq" "rotatef" "dolist" "check-type" "multiple-value-setq" "push" "pprint-pop" "loop" "define-setf-expander" "pprint-exit-if-list-exhausted" "with-condition-restarts" "defstruct" "with-input-from-string" "with-compilation-unit" "defgeneric" "with-output-to-string" "untrace" "defparameter" "ctypecase" "do-external-symbols" "etypecase" "do-all-symbols" "with-package-iterator" "unless" "defmethod" "in-package" "defpackage" "return" "typecase" "shiftf" "setf" "pprint-logical-block" "time" "restart-case" "prog*" "define-method-combination" "optimize")) -;; constant +; constant ((sym_lit) @constant - (#lua-match? @constant "^[+].+[+]$")) + (#lua-match? @constant "^[+].+[+]$")) (var_quoting_lit marker: "#'" @string.special.symbol value: (_) @string.special.symbol) -["#" "#p" "#P"] @string.special.symbol +[ + "#" + "#p" + "#P" +] @string.special.symbol (list_lit . (sym_lit) @function.builtin - ;; Generated via https://github.com/theHamsta/nvim-treesitter-commonlisp/blob/22fdc9fd6ed594176cc7299cc6f68dd21c94c63b/scripts/generate-symbols.lisp#L1-L21 + ; Generated via https://github.com/theHamsta/nvim-treesitter-commonlisp/blob/22fdc9fd6ed594176cc7299cc6f68dd21c94c63b/scripts/generate-symbols.lisp#L1-L21 ; format-ignore (#any-of? @function.builtin - "apropos-list" "subst" "substitute" "pprint-linear" "file-namestring" "write-char" "do*" "slot-exists-p" "file-author" "macro-function" "rassoc" "make-echo-stream" "arithmetic-error-operation" "position-if-not" "list" "cdadr" "lisp-implementation-type" "vector-push" "let" "length" "string-upcase" "adjoin" "digit-char" "step" "member-if" "handler-bind" "lognot" "apply" "gcd" "slot-unbound" "stringp" "values-list" "stable-sort" "decode-float" "make-list" "rplaca" "isqrt" "export" "synonym-stream-symbol" "function-keywords" "replace" "tanh" "maphash" "code-char" "decf" "array-displacement" "string-not-lessp" "slot-value" "remove-if" "cell-error-name" "vectorp" "cdddar" "two-way-stream-output-stream" "parse-integer" "get-internal-real-time" "fourth" "make-string" "slot-missing" "byte-size" "string-trim" "nstring-downcase" "cdaddr" "<" "labels" "interactive-stream-p" "fifth" "max" "logxor" "pathname-name" "function" "realp" "eql" "logand" "short-site-name" "prog1" "user-homedir-pathname" "list-all-packages" "exp" "cadar" "read-char-no-hang" "package-error-package" "stream-external-format" "bit-andc2" "nsubstitute-if" "mapcar" "complement" "load-logical-pathname-translations" "pprint-newline" "oddp" "caaar" "destructuring-bind" "copy-alist" "acos" "go" "bit-nor" "defconstant" "fceiling" "tenth" "nreverse" "=" "nunion" "slot-boundp" "string>" "count-if" "atom" "char=" "random-state-p" "row-major-aref" "bit-andc1" "translate-pathname" "simple-vector-p" "coerce" "substitute-if-not" "zerop" "invalid-method-error" "compile" "realpart" "remove-if-not" "pprint-tab" "hash-table-rehash-threshold" "invoke-restart" "if" "count" "/=" "do" "initialize-instance" "abs" "schar" "simple-condition-format-control" "delete-package" "subst-if" "lambda" "hash-table-count" "array-has-fill-pointer-p" "bit" "with-standard-io-syntax" "parse-namestring" "proclaim" "array-in-bounds-p" "multiple-value-call" "rplacd" "some" "graphic-char-p" "read-from-string" "consp" "cadaar" "acons" "every" "make-pathname" "mask-field" "case" "set-macro-character" "bit-and" "restart-bind" "echo-stream-input-stream" "compile-file" "fill-pointer" "numberp" "acosh" "array-dimensions" "documentation" "minusp" "inspect" "copy-structure" "integer-length" "ensure-generic-function" "char>=" "quote" "lognor" "make-two-way-stream" "ignore-errors" "tailp" "with-slots" "fboundp" "logical-pathname-translations" "equal" "float-sign" "shadow" "sleep" "numerator" "prog2" "getf" "ldb-test" "round" "locally" "echo-stream-output-stream" "log" "get-macro-character" "alphanumericp" "find-method" "nintersection" "defclass" "define-condition" "print-unreadable-object" "defvar" "broadcast-stream-streams" "floatp" "subst-if-not" "integerp" "translate-logical-pathname" "subsetp" "when" "write-string" "with-open-file" "clrhash" "apropos" "intern" "min" "string-greaterp" "import" "nset-difference" "prog" "incf" "both-case-p" "multiple-value-prog1" "characterp" "streamp" "digit-char-p" "random" "string-lessp" "make-string-input-stream" "copy-symbol" "read-sequence" "logcount" "bit-not" "boundp" "encode-universal-time" "third" "declaim" "map" "cons" "set-syntax-from-char" "and" "cis" "symbol-plist" "loop-finish" "standard-char-p" "multiple-value-bind" "asin" "string" "pop" "complex" "fdefinition" "psetf" "type-error-datum" "output-stream-p" "floor" "write-line" "<=" "defmacro" "rational" "hash-table-test" "with-open-stream" "read-char" "string-capitalize" "get-properties" "y-or-n-p" "use-package" "remove" "compiler-macro-function" "read" "package-nicknames" "remove-duplicates" "make-load-form-saving-slots" "dribble" "define-modify-macro" "make-dispatch-macro-character" "close" "cosh" "open" "finish-output" "string-downcase" "car" "nstring-capitalize" "software-type" "read-preserving-whitespace" "cadr" "fround" "nsublis" "defsetf" "find-all-symbols" "char>" "no-applicable-method" "compute-restarts" "pathname" "bit-orc2" "write-sequence" "pprint-tabular" "symbol-value" "char-name" "get-decoded-time" "formatter" "bit-vector-p" "intersection" "pathname-type" "clear-input" "call-method" "princ-to-string" "symbolp" "make-load-form" "nsubst" "pprint-dispatch" "handler-case" "method-combination-error" "probe-file" "atan" "string<" "type-error-expected-type" "pushnew" "unread-char" "print" "or" "with-hash-table-iterator" "make-sequence" "ecase" "unwind-protect" "require" "sixth" "get-dispatch-macro-character" "char-not-lessp" "read-byte" "tagbody" "file-error-pathname" "catch" "rationalp" "char-downcase" "char-int" "array-rank" "cond" "last" "make-string-output-stream" "array-dimension" "host-namestring" "input-stream-p" "decode-universal-time" "defun" "eval-when" "char-code" "pathname-directory" "evenp" "subseq" "pprint" "ftruncate" "make-instance" "pathname-host" "logbitp" "remf" "1+" "copy-pprint-dispatch" "char-upcase" "error" "read-line" "second" "make-package" "directory" "special-operator-p" "open-stream-p" "rassoc-if-not" "ccase" "equalp" "substitute-if" "*" "char/=" "cdr" "sqrt" "lcm" "logical-pathname" "eval" "define-compiler-macro" "nsubstitute-if-not" "mapcon" "imagpart" "set-exclusive-or" "simple-condition-format-arguments" "expt" "concatenate" "file-position" "macrolet" "keywordp" "hash-table-rehash-size" "+" "eighth" "use-value" "char-equal" "bit-xor" "format" "byte" "dotimes" "namestring" "char-not-equal" "multiple-value-list" "assert" "append" "notany" "typep" "delete-file" "makunbound" "cdaar" "file-write-date" ">" "cdddr" "write-to-string" "funcall" "member-if-not" "deftype" "readtable-case" "with-accessors" "truename" "constantp" "rassoc-if" "caaadr" "tree-equal" "nset-exclusive-or" "nsubstitute" "make-instances-obsolete" "package-use-list" "invoke-debugger" "provide" "count-if-not" "trace" "logandc1" "nthcdr" "char<=" "functionp" "with-simple-restart" "set-dispatch-macro-character" "logorc2" "unexport" "rest" "unbound-slot-instance" "make-hash-table" "hash-table-p" "reinitialize-instance" "nth" "do-symbols" "nreconc" "macroexpand" "store-value" "float-precision" "remprop" "nth-value" "define-symbol-macro" "update-instance-for-redefined-class" "identity" "progv" "progn" "return-from" "readtablep" "rem" "symbol-name" "psetq" "wild-pathname-p" "char" "list*" "char<" "plusp" "pairlis" "cddar" "pprint-indent" "union" "compiled-function-p" "rotatef" "abort" "machine-type" "concatenated-stream-streams" "string-right-trim" "enough-namestring" "arithmetic-error-operands" "ceiling" "dolist" "delete" "make-condition" "string-left-trim" "integer-decode-float" "check-type" "notevery" "function-lambda-expression" "-" "multiple-value-setq" "name-char" "push" "pprint-pop" "compile-file-pathname" "list-length" "nstring-upcase" "eq" "find-if" "method-qualifiers" "caadr" "cddr" "string=" "let*" "remove-method" "pathname-match-p" "find-package" "truncate" "caaddr" "get-setf-expansion" "loop" "define-setf-expander" "caddr" "package-shadowing-symbols" "force-output" "slot-makunbound" "string-not-greaterp" "cdadar" "cdaadr" "logandc2" "make-array" "merge-pathnames" "sin" "1-" "machine-version" "ffloor" "packagep" "set-pprint-dispatch" "flet" "gensym" "pprint-exit-if-list-exhausted" "cos" "get" "mapl" "delete-if" "with-condition-restarts" "atanh" "copy-list" "fill" "char-not-greaterp" "bit-orc1" "mod" "package-used-by-list" "warn" "add-method" "simple-string-p" "find-restart" "describe" "pathname-version" "peek-char" "yes-or-no-p" "complexp" "aref" "not" "position-if" "string>=" "defstruct" "float-radix" "ninth" "caadar" "subtypep" "set" "butlast" "allocate-instance" "with-input-from-string" "assoc" "write" "make-random-state" "bit-eqv" "float-digits" "long-site-name" "with-compilation-unit" "delete-duplicates" "make-symbol" "room" "cdar" "pprint-fill" "defgeneric" "macroexpand-1" "scale-float" "cdaaar" "update-instance-for-different-class" "array-row-major-index" "ed" "file-string-length" "ensure-directories-exist" "copy-readtable" "string<=" "seventh" "with-output-to-string" "signum" "elt" "untrace" "null" "defparameter" "block" "prin1" "revappend" "gentemp" "ctypecase" "ash" "sxhash" "listp" "do-external-symbols" "bit-ior" "etypecase" "sort" "change-class" "find-class" "alpha-char-p" "map-into" "terpri" "do-all-symbols" "ldb" "logorc1" "search" "fmakunbound" "load" "character" "string-not-equal" "pathnamep" "make-broadcast-stream" "arrayp" "mapcan" "cerror" "invoke-restart-interactively" "assoc-if-not" "with-package-iterator" "get-internal-run-time" "read-delimited-list" "unless" "lower-case-p" "restart-name" "/" "boole" "defmethod" "float" "software-version" "vector-pop" "vector-push-extend" "caar" "ldiff" "member" "find-symbol" "reduce" "svref" "describe-object" "logior" "string-equal" "type-of" "position" "cddadr" "pathname-device" "get-output-stream-string" "symbol-package" "tan" "compute-applicable-methods" "cddddr" "nsubst-if-not" "sublis" "set-difference" "two-way-stream-input-stream" "adjustable-array-p" "machine-instance" "signal" "conjugate" "caaaar" "endp" "lisp-implementation-version" "cddaar" "package-name" "adjust-array" "bit-nand" "gethash" "in-package" "symbol-function" "make-concatenated-stream" "defpackage" "class-of" "no-next-method" "logeqv" "deposit-field" "disassemble" "unuse-package" "copy-tree" "find" "asinh" "class-name" "rename-file" "values" "print-not-readable-object" "mismatch" "cadadr" "shadowing-import" "delete-if-not" "maplist" "listen" "return" "stream-element-type" "unintern" "merge" "make-synonym-stream" "prin1-to-string" "nsubst-if" "byte-position" "phase" "muffle-warning" "remhash" "continue" "load-time-value" "hash-table-size" "upgraded-complex-part-type" "char-lessp" "sbit" "upgraded-array-element-type" "file-length" "typecase" "cadddr" "first" "rationalize" "logtest" "find-if-not" "dpb" "mapc" "sinh" "char-greaterp" "shiftf" "denominator" "get-universal-time" "nconc" "setf" "lognand" "rename-package" "pprint-logical-block" "break" "symbol-macrolet" "the" "fresh-line" "clear-output" "assoc-if" "string/=" "princ" "directory-namestring" "stream-error-stream" "array-element-type" "setq" "copy-seq" "time" "restart-case" "prog*" "shared-initialize" "array-total-size" "simple-bit-vector-p" "define-method-combination" "write-byte" "constantly" "caddar" "print-object" "vector" "throw" "reverse" ">=" "upper-case-p" "nbutlast")) + "apropos-list" "subst" "substitute" "pprint-linear" "file-namestring" "write-char" "do*" "slot-exists-p" "file-author" "macro-function" "rassoc" "make-echo-stream" "arithmetic-error-operation" "position-if-not" "list" "cdadr" "lisp-implementation-type" "vector-push" "let" "length" "string-upcase" "adjoin" "digit-char" "step" "member-if" "handler-bind" "lognot" "apply" "gcd" "slot-unbound" "stringp" "values-list" "stable-sort" "decode-float" "make-list" "rplaca" "isqrt" "export" "synonym-stream-symbol" "function-keywords" "replace" "tanh" "maphash" "code-char" "decf" "array-displacement" "string-not-lessp" "slot-value" "remove-if" "cell-error-name" "vectorp" "cdddar" "two-way-stream-output-stream" "parse-integer" "get-internal-real-time" "fourth" "make-string" "slot-missing" "byte-size" "string-trim" "nstring-downcase" "cdaddr" "<" "labels" "interactive-stream-p" "fifth" "max" "logxor" "pathname-name" "function" "realp" "eql" "logand" "short-site-name" "prog1" "user-homedir-pathname" "list-all-packages" "exp" "cadar" "read-char-no-hang" "package-error-package" "stream-external-format" "bit-andc2" "nsubstitute-if" "mapcar" "complement" "load-logical-pathname-translations" "pprint-newline" "oddp" "caaar" "destructuring-bind" "copy-alist" "acos" "go" "bit-nor" "defconstant" "fceiling" "tenth" "nreverse" "=" "nunion" "slot-boundp" "string>" "count-if" "atom" "char=" "random-state-p" "row-major-aref" "bit-andc1" "translate-pathname" "simple-vector-p" "coerce" "substitute-if-not" "zerop" "invalid-method-error" "compile" "realpart" "remove-if-not" "pprint-tab" "hash-table-rehash-threshold" "invoke-restart" "if" "count" "/=" "do" "initialize-instance" "abs" "schar" "simple-condition-format-control" "delete-package" "subst-if" "lambda" "hash-table-count" "array-has-fill-pointer-p" "bit" "with-standard-io-syntax" "parse-namestring" "proclaim" "array-in-bounds-p" "multiple-value-call" "rplacd" "some" "graphic-char-p" "read-from-string" "consp" "cadaar" "acons" "every" "make-pathname" "mask-field" "case" "set-macro-character" "bit-and" "restart-bind" "echo-stream-input-stream" "compile-file" "fill-pointer" "numberp" "acosh" "array-dimensions" "documentation" "minusp" "inspect" "copy-structure" "integer-length" "ensure-generic-function" "char>=" "quote" "lognor" "make-two-way-stream" "ignore-errors" "tailp" "with-slots" "fboundp" "logical-pathname-translations" "equal" "float-sign" "shadow" "sleep" "numerator" "prog2" "getf" "ldb-test" "round" "locally" "echo-stream-output-stream" "log" "get-macro-character" "alphanumericp" "find-method" "nintersection" "defclass" "define-condition" "print-unreadable-object" "defvar" "broadcast-stream-streams" "floatp" "subst-if-not" "integerp" "translate-logical-pathname" "subsetp" "when" "write-string" "with-open-file" "clrhash" "apropos" "intern" "min" "string-greaterp" "import" "nset-difference" "prog" "incf" "both-case-p" "multiple-value-prog1" "characterp" "streamp" "digit-char-p" "random" "string-lessp" "make-string-input-stream" "copy-symbol" "read-sequence" "logcount" "bit-not" "boundp" "encode-universal-time" "third" "declaim" "map" "cons" "set-syntax-from-char" "and" "cis" "symbol-plist" "loop-finish" "standard-char-p" "multiple-value-bind" "asin" "string" "pop" "complex" "fdefinition" "psetf" "type-error-datum" "output-stream-p" "floor" "write-line" "<=" "defmacro" "rational" "hash-table-test" "with-open-stream" "read-char" "string-capitalize" "get-properties" "y-or-n-p" "use-package" "remove" "compiler-macro-function" "read" "package-nicknames" "remove-duplicates" "make-load-form-saving-slots" "dribble" "define-modify-macro" "make-dispatch-macro-character" "close" "cosh" "open" "finish-output" "string-downcase" "car" "nstring-capitalize" "software-type" "read-preserving-whitespace" "cadr" "fround" "nsublis" "defsetf" "find-all-symbols" "char>" "no-applicable-method" "compute-restarts" "pathname" "bit-orc2" "write-sequence" "pprint-tabular" "symbol-value" "char-name" "get-decoded-time" "formatter" "bit-vector-p" "intersection" "pathname-type" "clear-input" "call-method" "princ-to-string" "symbolp" "make-load-form" "nsubst" "pprint-dispatch" "handler-case" "method-combination-error" "probe-file" "atan" "string<" "type-error-expected-type" "pushnew" "unread-char" "print" "or" "with-hash-table-iterator" "make-sequence" "ecase" "unwind-protect" "require" "sixth" "get-dispatch-macro-character" "char-not-lessp" "read-byte" "tagbody" "file-error-pathname" "catch" "rationalp" "char-downcase" "char-int" "array-rank" "cond" "last" "make-string-output-stream" "array-dimension" "host-namestring" "input-stream-p" "decode-universal-time" "defun" "eval-when" "char-code" "pathname-directory" "evenp" "subseq" "pprint" "ftruncate" "make-instance" "pathname-host" "logbitp" "remf" "1+" "copy-pprint-dispatch" "char-upcase" "error" "read-line" "second" "make-package" "directory" "special-operator-p" "open-stream-p" "rassoc-if-not" "ccase" "equalp" "substitute-if" "*" "char/=" "cdr" "sqrt" "lcm" "logical-pathname" "eval" "define-compiler-macro" "nsubstitute-if-not" "mapcon" "imagpart" "set-exclusive-or" "simple-condition-format-arguments" "expt" "concatenate" "file-position" "macrolet" "keywordp" "hash-table-rehash-size" "+" "eighth" "use-value" "char-equal" "bit-xor" "format" "byte" "dotimes" "namestring" "char-not-equal" "multiple-value-list" "assert" "append" "notany" "typep" "delete-file" "makunbound" "cdaar" "file-write-date" ">" "cdddr" "write-to-string" "funcall" "member-if-not" "deftype" "readtable-case" "with-accessors" "truename" "constantp" "rassoc-if" "caaadr" "tree-equal" "nset-exclusive-or" "nsubstitute" "make-instances-obsolete" "package-use-list" "invoke-debugger" "provide" "count-if-not" "trace" "logandc1" "nthcdr" "char<=" "functionp" "with-simple-restart" "set-dispatch-macro-character" "logorc2" "unexport" "rest" "unbound-slot-instance" "make-hash-table" "hash-table-p" "reinitialize-instance" "nth" "do-symbols" "nreconc" "macroexpand" "store-value" "float-precision" "remprop" "nth-value" "define-symbol-macro" "update-instance-for-redefined-class" "identity" "progv" "progn" "return-from" "readtablep" "rem" "symbol-name" "psetq" "wild-pathname-p" "char" "list*" "char<" "plusp" "pairlis" "cddar" "pprint-indent" "union" "compiled-function-p" "rotatef" "abort" "machine-type" "concatenated-stream-streams" "string-right-trim" "enough-namestring" "arithmetic-error-operands" "ceiling" "dolist" "delete" "make-condition" "string-left-trim" "integer-decode-float" "check-type" "notevery" "function-lambda-expression" "-" "multiple-value-setq" "name-char" "push" "pprint-pop" "compile-file-pathname" "list-length" "nstring-upcase" "eq" "find-if" "method-qualifiers" "caadr" "cddr" "string=" "let*" "remove-method" "pathname-match-p" "find-package" "truncate" "caaddr" "get-setf-expansion" "loop" "define-setf-expander" "caddr" "package-shadowing-symbols" "force-output" "slot-makunbound" "string-not-greaterp" "cdadar" "cdaadr" "logandc2" "make-array" "merge-pathnames" "sin" "1-" "machine-version" "ffloor" "packagep" "set-pprint-dispatch" "flet" "gensym" "pprint-exit-if-list-exhausted" "cos" "get" "mapl" "delete-if" "with-condition-restarts" "atanh" "copy-list" "fill" "char-not-greaterp" "bit-orc1" "mod" "package-used-by-list" "warn" "add-method" "simple-string-p" "find-restart" "describe" "pathname-version" "peek-char" "yes-or-no-p" "complexp" "aref" "not" "position-if" "string>=" "defstruct" "float-radix" "ninth" "caadar" "subtypep" "set" "butlast" "allocate-instance" "with-input-from-string" "assoc" "write" "make-random-state" "bit-eqv" "float-digits" "long-site-name" "with-compilation-unit" "delete-duplicates" "make-symbol" "room" "cdar" "pprint-fill" "defgeneric" "macroexpand-1" "scale-float" "cdaaar" "update-instance-for-different-class" "array-row-major-index" "ed" "file-string-length" "ensure-directories-exist" "copy-readtable" "string<=" "seventh" "with-output-to-string" "signum" "elt" "untrace" "null" "defparameter" "block" "prin1" "revappend" "gentemp" "ctypecase" "ash" "sxhash" "listp" "do-external-symbols" "bit-ior" "etypecase" "sort" "change-class" "find-class" "alpha-char-p" "map-into" "terpri" "do-all-symbols" "ldb" "logorc1" "search" "fmakunbound" "load" "character" "string-not-equal" "pathnamep" "make-broadcast-stream" "arrayp" "mapcan" "cerror" "invoke-restart-interactively" "assoc-if-not" "with-package-iterator" "get-internal-run-time" "read-delimited-list" "unless" "lower-case-p" "restart-name" "/" "boole" "defmethod" "float" "software-version" "vector-pop" "vector-push-extend" "caar" "ldiff" "member" "find-symbol" "reduce" "svref" "describe-object" "logior" "string-equal" "type-of" "position" "cddadr" "pathname-device" "get-output-stream-string" "symbol-package" "tan" "compute-applicable-methods" "cddddr" "nsubst-if-not" "sublis" "set-difference" "two-way-stream-input-stream" "adjustable-array-p" "machine-instance" "signal" "conjugate" "caaaar" "endp" "lisp-implementation-version" "cddaar" "package-name" "adjust-array" "bit-nand" "gethash" "in-package" "symbol-function" "make-concatenated-stream" "defpackage" "class-of" "no-next-method" "logeqv" "deposit-field" "disassemble" "unuse-package" "copy-tree" "find" "asinh" "class-name" "rename-file" "values" "print-not-readable-object" "mismatch" "cadadr" "shadowing-import" "delete-if-not" "maplist" "listen" "return" "stream-element-type" "unintern" "merge" "make-synonym-stream" "prin1-to-string" "nsubst-if" "byte-position" "phase" "muffle-warning" "remhash" "continue" "load-time-value" "hash-table-size" "upgraded-complex-part-type" "char-lessp" "sbit" "upgraded-array-element-type" "file-length" "typecase" "cadddr" "first" "rationalize" "logtest" "find-if-not" "dpb" "mapc" "sinh" "char-greaterp" "shiftf" "denominator" "get-universal-time" "nconc" "setf" "lognand" "rename-package" "pprint-logical-block" "break" "symbol-macrolet" "the" "fresh-line" "clear-output" "assoc-if" "string/=" "princ" "directory-namestring" "stream-error-stream" "array-element-type" "setq" "copy-seq" "time" "restart-case" "prog*" "shared-initialize" "array-total-size" "simple-bit-vector-p" "define-method-combination" "write-byte" "constantly" "caddar" "print-object" "vector" "throw" "reverse" ">=" "upper-case-p" "nbutlast") + ) (list_lit - . - (sym_lit) @operator - (#match? @operator "^([+*-+=<>]|<=|>=|/=)$")) - + . + (sym_lit) @operator + (#match? @operator "^([+*-+=<>]|<=|>=|/=)$")) ((sym_lit) @string.special.symbol -(#lua-match? @string.special.symbol "^[&]")) + (#lua-match? @string.special.symbol "^[&]")) -[(array_dimension) "#0A" "#0a"] @number +[ + (array_dimension) + "#0A" + "#0a" +] @number (char_lit) @character diff --git a/queries/commonlisp/locals.scm b/queries/commonlisp/locals.scm index 647d1007f..2865c1f0f 100644 --- a/queries/commonlisp/locals.scm +++ b/queries/commonlisp/locals.scm @@ -1,72 +1,113 @@ - (defun_header - function_name: (sym_lit) @local.definition.function (#set! definition.function.scope "parent")) + function_name: (sym_lit) @local.definition.function + (#set! definition.function.scope "parent")) + (defun_header - lambda_list: (list_lit (sym_lit) @local.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) @local.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) @local.definition.parameter . (_)))) + lambda_list: + (list_lit + (list_lit + . + (sym_lit) @local.definition.parameter + . + (_)))) (sym_lit) @local.reference (defun) @local.scope -((list_lit . (sym_lit) @_defvar . (sym_lit) @local.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) @local.definition.function - (#eq? @_deftest "deftest")) @local.scope + . + (sym_lit) @_deftest + . + (sym_lit) @local.definition.function + (#eq? @_deftest "deftest")) @local.scope (list_lit - . - (sym_lit) @_deftest - . - (sym_lit) @local.definition.function - (#eq? @_deftest "deftest")) @local.scope - -(for_clause . (sym_lit) @local.definition.var) -(with_clause . (sym_lit) @local.definition.var) + . + (sym_lit) @_deftest + . + (sym_lit) @local.definition.function + (#eq? @_deftest "deftest")) @local.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) @local.definition.var))) @local.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) @local.definition.var)) @local.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) @local.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) @local.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) @local.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) @local.definition.import) + . + (kwd_lit) @_use + (#eq? @_use ":use") + (sym_lit) @local.definition.import) diff --git a/queries/cooklang/highlights.scm b/queries/cooklang/highlights.scm index 2ed9f2049..cd4eedade 100644 --- a/queries/cooklang/highlights.scm +++ b/queries/cooklang/highlights.scm @@ -3,20 +3,20 @@ (ingredient "@" @tag (name)? @markup.heading - (amount - (quantity)? @number - (units)? @tag.attribute)?) + (amount + (quantity)? @number + (units)? @tag.attribute)?) (timer "~" @tag (name)? @markup.heading - (amount - (quantity)? @number - (units)? @tag.attribute)?) + (amount + (quantity)? @number + (units)? @tag.attribute)?) (cookware "#" @tag (name)? @markup.heading - (amount - (quantity)? @number - (units)? @tag.attribute)?) + (amount + (quantity)? @number + (units)? @tag.attribute)?) diff --git a/queries/corn/folds.scm b/queries/corn/folds.scm index c081ecb47..2ce5ddb31 100644 --- a/queries/corn/folds.scm +++ b/queries/corn/folds.scm @@ -1,5 +1,5 @@ [ - (object) - (array) - (assign_block) + (object) + (array) + (assign_block) ] @fold diff --git a/queries/corn/highlights.scm b/queries/corn/highlights.scm index 18672fd04..029291462 100644 --- a/queries/corn/highlights.scm +++ b/queries/corn/highlights.scm @@ -1,4 +1,5 @@ "let" @keyword + "in" @keyword [ @@ -11,10 +12,15 @@ "." @punctuation.delimiter (input) @constant + (comment) @comment @spell (string) @string + (integer) @number + (float) @number.float + (boolean) @boolean + (null) @keyword diff --git a/queries/corn/indents.scm b/queries/corn/indents.scm index 1f5a2c402..f1f5e04da 100644 --- a/queries/corn/indents.scm +++ b/queries/corn/indents.scm @@ -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) diff --git a/queries/corn/locals.scm b/queries/corn/locals.scm index 009d29202..7e78c4d23 100644 --- a/queries/corn/locals.scm +++ b/queries/corn/locals.scm @@ -1,16 +1,13 @@ ; scopes - [ (object) (array) ] @local.scope ; definitions - -(assign_block +(assign_block (assignment - (input) - @local.definition.constant)) - -(value (input) @local.reference) + (input) @local.definition.constant)) +(value + (input) @local.reference) diff --git a/queries/cpon/highlights.scm b/queries/cpon/highlights.scm index 370c48b1b..531b3961f 100644 --- a/queries/cpon/highlights.scm +++ b/queries/cpon/highlights.scm @@ -1,6 +1,6 @@ ; Literals - (string) @string + (escape_sequence) @string.escape (hex_blob @@ -15,7 +15,8 @@ "d" @character.special (_) @string.special) -(_ key: (_) @label) +(_ + key: (_) @label) (number) @number @@ -26,21 +27,28 @@ (null) @constant.builtin ; Punctuation - [ "," ":" ] @punctuation.delimiter -[ "{" "}" ] @punctuation.bracket +[ + "{" + "}" +] @punctuation.bracket -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -[ "<" ">" ] @punctuation.bracket +[ + "<" + ">" +] @punctuation.bracket (("\"" @string) - (#set! conceal "")) + (#set! conceal "")) ; Comments - (comment) @comment @spell diff --git a/queries/cpon/injections.scm b/queries/cpon/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/cpon/injections.scm +++ b/queries/cpon/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/cpon/locals.scm b/queries/cpon/locals.scm index 8341b9725..2a4ba4712 100644 --- a/queries/cpon/locals.scm +++ b/queries/cpon/locals.scm @@ -1,6 +1,5 @@ [ - (document) - + (document) (meta_map) (map) (array) diff --git a/queries/cpp/folds.scm b/queries/cpp/folds.scm index 23d623b04..26a068a55 100644 --- a/queries/cpp/folds.scm +++ b/queries/cpp/folds.scm @@ -1,14 +1,13 @@ ; inherits: c - [ - (for_range_loop) - (class_specifier) - (field_declaration - type: (enum_specifier) - default_value: (initializer_list)) - (template_declaration) - (namespace_definition) - (try_statement) - (catch_clause) - (lambda_expression) + (for_range_loop) + (class_specifier) + (field_declaration + type: (enum_specifier) + default_value: (initializer_list)) + (template_declaration) + (namespace_definition) + (try_statement) + (catch_clause) + (lambda_expression) ] @fold diff --git a/queries/cpp/highlights.scm b/queries/cpp/highlights.scm index 4919a1b3f..cb8f9c3f3 100644 --- a/queries/cpp/highlights.scm +++ b/queries/cpp/highlights.scm @@ -1,5 +1,4 @@ ; inherits: c - ((identifier) @variable.member (#lua-match? @variable.member "^m_.*$")) @@ -8,23 +7,24 @@ ; function(Foo ...foo) (variadic_parameter_declaration - declarator: (variadic_declarator - (_) @variable.parameter)) + declarator: + (variadic_declarator + (_) @variable.parameter)) + ; int foo = 0 (optional_parameter_declaration - declarator: (_) @variable.parameter) + declarator: (_) @variable.parameter) ;(field_expression) @variable.parameter ;; How to highlight this? - (((field_expression - (field_identifier) @function.method)) @_parent - (#has-parent? @_parent template_method function_declarator)) + (field_identifier) @function.method)) @_parent + (#has-parent? @_parent template_method function_declarator)) (field_declaration (field_identifier) @variable.member) (field_initializer - (field_identifier) @property) + (field_identifier) @property) (function_declarator declarator: (field_identifier) @function.method) @@ -38,13 +38,25 @@ (auto) @type.builtin (namespace_identifier) @module + ((namespace_identifier) @type (#lua-match? @type "^[%u]")) (case_statement - value: (qualified_identifier (identifier) @constant)) - -(using_declaration . "using" . "namespace" . [(qualified_identifier) (identifier)] @module) + value: + (qualified_identifier + (identifier) @constant)) + +(using_declaration + . + "using" + . + "namespace" + . + [ + (qualified_identifier) + (identifier) + ] @module) (destructor_name (identifier) @function.method) @@ -53,15 +65,18 @@ (function_declarator (qualified_identifier (identifier) @function)) + (function_declarator (qualified_identifier (qualified_identifier (identifier) @function))) + (function_declarator (qualified_identifier (qualified_identifier (qualified_identifier (identifier) @function)))) + ((qualified_identifier (qualified_identifier (qualified_identifier @@ -74,21 +89,26 @@ (identifier) @function)) (operator_name) @function + "operator" @function + "static_assert" @function.builtin (call_expression (qualified_identifier (identifier) @function.call)) + (call_expression (qualified_identifier (qualified_identifier (identifier) @function.call))) + (call_expression (qualified_identifier (qualified_identifier (qualified_identifier (identifier) @function.call)))) + ((qualified_identifier (qualified_identifier (qualified_identifier @@ -99,21 +119,25 @@ (call_expression (template_function (identifier) @function.call)) + (call_expression (qualified_identifier (template_function (identifier) @function.call))) + (call_expression (qualified_identifier (qualified_identifier (template_function (identifier) @function.call)))) + (call_expression (qualified_identifier (qualified_identifier (qualified_identifier (template_function (identifier) @function.call))))) + ((qualified_identifier (qualified_identifier (qualified_identifier @@ -126,12 +150,12 @@ (function_declarator (template_method (field_identifier) @function.method)) + (call_expression (field_expression (field_identifier) @function.method.call)) ; constructors - ((function_declarator (qualified_identifier (identifier) @constructor)) @@ -139,93 +163,91 @@ ((call_expression function: (identifier) @constructor) -(#lua-match? @constructor "^%u")) + (#lua-match? @constructor "^%u")) + ((call_expression - function: (qualified_identifier - name: (identifier) @constructor)) -(#lua-match? @constructor "^%u")) + function: + (qualified_identifier + name: (identifier) @constructor)) + (#lua-match? @constructor "^%u")) ((call_expression - function: (field_expression - field: (field_identifier) @constructor)) -(#lua-match? @constructor "^%u")) + function: + (field_expression + field: (field_identifier) @constructor)) + (#lua-match? @constructor "^%u")) -;; constructing a type in an initializer list: Constructor (): **SuperType (1)** +; constructing a type in an initializer list: Constructor (): **SuperType (1)** ((field_initializer (field_identifier) @constructor (argument_list)) - (#lua-match? @constructor "^%u")) - + (#lua-match? @constructor "^%u")) ; Constants - (this) @variable.builtin -(null "nullptr" @constant.builtin) + +(null + "nullptr" @constant.builtin) (true) @boolean + (false) @boolean ; Literals - -(raw_string_literal) @string +(raw_string_literal) @string ; Keywords - [ - "try" - "catch" - "noexcept" - "throw" + "try" + "catch" + "noexcept" + "throw" ] @keyword.exception - [ - "class" - "decltype" - "explicit" - "friend" - "namespace" - "override" - "template" - "typename" - "using" - "concept" - "requires" - "constexpr" + "class" + "decltype" + "explicit" + "friend" + "namespace" + "override" + "template" + "typename" + "using" + "concept" + "requires" + "constexpr" ] @keyword -[ - "co_await" -] @keyword.coroutine +"co_await" @keyword.coroutine [ - "co_yield" - "co_return" + "co_yield" + "co_return" ] @keyword.coroutine.return [ - "public" - "private" - "protected" - "virtual" - "final" + "public" + "private" + "protected" + "virtual" + "final" ] @type.qualifier [ - "new" - "delete" - - "xor" - "bitand" - "bitor" - "compl" - "not" - "xor_eq" - "and_eq" - "or_eq" - "not_eq" - "and" - "or" + "new" + "delete" + "xor" + "bitand" + "bitor" + "compl" + "not" + "xor_eq" + "and_eq" + "or_eq" + "not_eq" + "and" + "or" ] @keyword.operator "<=>" @operator @@ -233,9 +255,15 @@ "::" @punctuation.delimiter (template_argument_list - ["<" ">"] @punctuation.bracket) + [ + "<" + ">" + ] @punctuation.bracket) (template_parameter_list - ["<" ">"] @punctuation.bracket) + [ + "<" + ">" + ] @punctuation.bracket) (literal_suffix) @operator diff --git a/queries/cpp/indents.scm b/queries/cpp/indents.scm index 6faa6f144..be6826d6e 100644 --- a/queries/cpp/indents.scm +++ b/queries/cpp/indents.scm @@ -1,9 +1,7 @@ ; inherits: c - -[ - (condition_clause) -] @indent.begin +(condition_clause) @indent.begin ((field_initializer_list) @indent.begin (#set! indent.start_at_same_line 1)) + (access_specifier) @indent.branch diff --git a/queries/cpp/injections.scm b/queries/cpp/injections.scm index 75f851367..2038347a2 100644 --- a/queries/cpp/injections.scm +++ b/queries/cpp/injections.scm @@ -1,8 +1,5 @@ ((preproc_arg) @injection.content - (#set! injection.language "cpp")) - -((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "cpp")) ((comment) @injection.content (#lua-match? @injection.content "/[*][!<*][^a-zA-Z]") diff --git a/queries/cpp/locals.scm b/queries/cpp/locals.scm index d8bb18c05..863f9de7d 100644 --- a/queries/cpp/locals.scm +++ b/queries/cpp/locals.scm @@ -1,12 +1,14 @@ ; inherits: c - -;; Parameters +; Parameters (variadic_parameter_declaration - declarator: (variadic_declarator - (identifier) @local.definition.parameter)) + declarator: + (variadic_declarator + (identifier) @local.definition.parameter)) + (optional_parameter_declaration declarator: (identifier) @local.definition.parameter) -;; Class / struct definitions + +; Class / struct definitions (class_specifier) @local.scope (reference_declarator @@ -16,8 +18,9 @@ (identifier) @local.definition.var) (struct_specifier - name: (qualified_identifier - name: (type_identifier) @local.definition.type)) + name: + (qualified_identifier + name: (type_identifier) @local.definition.type)) (class_specifier name: (type_identifier) @local.definition.type) @@ -26,8 +29,9 @@ name: (identifier) @local.definition.type) (class_specifier - name: (qualified_identifier - name: (type_identifier) @local.definition.type)) + name: + (qualified_identifier + name: (type_identifier) @local.definition.type)) (alias_declaration name: (type_identifier) @local.definition.type) @@ -35,9 +39,10 @@ ;template (type_parameter_declaration (type_identifier) @local.definition.type) + (template_declaration) @local.scope -;; Namespaces +; Namespaces (namespace_definition name: (namespace_identifier) @local.definition.namespace body: (_) @local.scope) @@ -47,9 +52,9 @@ body: (_) @local.scope) ((namespace_identifier) @local.reference - (#set! reference.kind "namespace")) + (#set! reference.kind "namespace")) -;; Function definitions +; Function definitions (template_function name: (identifier) @local.definition.function) @local.scope @@ -57,16 +62,18 @@ name: (field_identifier) @local.definition.method) @local.scope (function_declarator - declarator: (qualified_identifier - name: (identifier) @local.definition.function)) @local.scope + declarator: + (qualified_identifier + name: (identifier) @local.definition.function)) @local.scope (field_declaration - declarator: (function_declarator - (field_identifier) @local.definition.method)) + declarator: + (function_declarator + (field_identifier) @local.definition.method)) (lambda_expression) @local.scope -;; Control structures +; Control structures (try_statement body: (_) @local.scope) diff --git a/queries/css/folds.scm b/queries/css/folds.scm index 9d2995c48..2c244d63f 100644 --- a/queries/css/folds.scm +++ b/queries/css/folds.scm @@ -1,3 +1 @@ -[ - (rule_set) -] @fold +(rule_set) @fold diff --git a/queries/css/highlights.scm b/queries/css/highlights.scm index 8beba125f..506f78251 100644 --- a/queries/css/highlights.scm +++ b/queries/css/highlights.scm @@ -1,92 +1,99 @@ [ - "@media" - "@charset" - "@namespace" - "@supports" - "@keyframes" - (at_keyword) - (to) - (from) - ] @keyword + "@media" + "@charset" + "@namespace" + "@supports" + "@keyframes" + (at_keyword) + (to) + (from) +] @keyword "@import" @keyword.import (comment) @comment @spell [ - (tag_name) - (nesting_selector) - (universal_selector) - ] @type + (tag_name) + (nesting_selector) + (universal_selector) +] @type (function_name) @function [ - "~" - ">" - "+" - "-" - "*" - "/" - "=" - "^=" - "|=" - "~=" - "$=" - "*=" - ] @operator + "~" + ">" + "+" + "-" + "*" + "/" + "=" + "^=" + "|=" + "~=" + "$=" + "*=" +] @operator [ - "and" - "or" - "not" - "only" - ] @keyword.operator + "and" + "or" + "not" + "only" +] @keyword.operator (important) @type.qualifier -(attribute_selector (plain_value) @string) -(pseudo_element_selector "::" (tag_name) @property) -(pseudo_class_selector (class_name) @property) +(attribute_selector + (plain_value) @string) + +(pseudo_element_selector + "::" + (tag_name) @property) + +(pseudo_class_selector + (class_name) @property) [ - (class_name) - (id_name) - (property_name) - (feature_name) - (attribute_name) - ] @property + (class_name) + (id_name) + (property_name) + (feature_name) + (attribute_name) +] @property (namespace_name) @module ((property_name) @type.definition (#lua-match? @type.definition "^[-][-]")) + ((plain_value) @type (#lua-match? @type "^[-][-]")) [ - (string_value) - (color_value) - (unit) - ] @string + (string_value) + (color_value) + (unit) +] @string [ - (integer_value) - (float_value) - ] @number + (integer_value) + (float_value) +] @number [ - "#" - "," - "." - ":" - "::" - ";" - ] @punctuation.delimiter + "#" + "," + "." + ":" + "::" + ";" +] @punctuation.delimiter [ - "{" - ")" - "(" - "}" - ] @punctuation.bracket + "{" + ")" + "(" + "}" +] @punctuation.bracket diff --git a/queries/css/indents.scm b/queries/css/indents.scm index cd22ed66c..8385bfc82 100644 --- a/queries/css/indents.scm +++ b/queries/css/indents.scm @@ -3,7 +3,9 @@ (declaration) ] @indent.begin -(block ("}") @indent.branch) +(block + ("}") @indent.branch) + ("}") @indent.dedent (comment) @indent.ignore diff --git a/queries/css/injections.scm b/queries/css/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/css/injections.scm +++ b/queries/css/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/csv/highlights.scm b/queries/csv/highlights.scm index de2213aa1..94abe21cc 100644 --- a/queries/csv/highlights.scm +++ b/queries/csv/highlights.scm @@ -1,3 +1,2 @@ ; inherits: tsv - "," @punctuation.delimiter diff --git a/queries/cuda/highlights.scm b/queries/cuda/highlights.scm index 0a90dbf67..0b2a13e49 100644 --- a/queries/cuda/highlights.scm +++ b/queries/cuda/highlights.scm @@ -1,6 +1,8 @@ ; inherits: cpp - -[ "<<<" ">>>" ] @punctuation.bracket +[ + "<<<" + ">>>" +] @punctuation.bracket [ "__host__" diff --git a/queries/cuda/injections.scm b/queries/cuda/injections.scm index 82aac968e..0259958c5 100644 --- a/queries/cuda/injections.scm +++ b/queries/cuda/injections.scm @@ -1,5 +1,5 @@ ((preproc_arg) @injection.content - (#set! injection.language "cuda")) + (#set! injection.language "cuda")) -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/cue/highlights.scm b/queries/cue/highlights.scm index 47fd36311..3371bc33e 100644 --- a/queries/cue/highlights.scm +++ b/queries/cue/highlights.scm @@ -1,49 +1,41 @@ ; Includes - [ "package" "import" ] @keyword.import ; Namespaces - (package_identifier) @module -(import_spec ["." "_"] @punctuation.special) +(import_spec + [ + "." + "_" + ] @punctuation.special) [ (attr_path) (package_path) -] @string.special.url ;; In attributes +] @string.special.url ; In attributes ; Attributes - (attribute) @attribute ; Conditionals - "if" @keyword.conditional ; Repeats +"for" @keyword.repeat -[ - "for" -] @keyword.repeat - -(for_clause "_" @punctuation.special) +(for_clause + "_" @punctuation.special) ; Keywords +"let" @keyword -[ - "let" -] @keyword - -[ - "in" -] @keyword.operator +"in" @keyword.operator ; Operators - [ "+" "-" @@ -66,34 +58,33 @@ ] @operator ; Fields & Properties - -(field - (label - (identifier) @variable.member)) +(field + (label + (identifier) @variable.member)) (selector_expression (_) (identifier) @property) ; Functions - (call_expression function: (identifier) @function.call) + (call_expression - function: (selector_expression - (_) - (identifier) @function.call)) + function: + (selector_expression + (_) + (identifier) @function.call)) + (call_expression function: (builtin_function) @function.call) (builtin_function) @function.builtin ; Variables - (identifier) @variable ; Types - (primitive_type) @type.builtin ((identifier) @type @@ -102,22 +93,33 @@ [ (slice_type) (pointer_type) -] @type ;; In attributes +] @type ; In attributes ; Punctuation - [ "," ":" ] @punctuation.delimiter -[ "{" "}" ] @punctuation.bracket +[ + "{" + "}" +] @punctuation.bracket -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -[ "(" ")" ] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket -[ "<" ">" ] @punctuation.bracket +[ + "<" + ">" +] @punctuation.bracket [ (ellipsis) @@ -125,7 +127,6 @@ ] @punctuation.special ; Literals - (string) @string [ @@ -150,11 +151,15 @@ ] @constant.builtin ; Interpolations +(interpolation + "\\(" @punctuation.special + (_) + ")" @punctuation.special) @none -(interpolation "\\(" @punctuation.special (_) ")" @punctuation.special) @none - -(interpolation "\\(" (identifier) @variable ")") +(interpolation + "\\(" + (identifier) @variable + ")") ; Comments - (comment) @comment @spell diff --git a/queries/cue/indents.scm b/queries/cue/indents.scm index 71a03a778..cef2345cc 100644 --- a/queries/cue/indents.scm +++ b/queries/cue/indents.scm @@ -9,11 +9,20 @@ ")" ] @indent.end -[ "{" "}" ] @indent.branch +[ + "{" + "}" +] @indent.branch -[ "[" "]" ] @indent.branch +[ + "[" + "]" +] @indent.branch -[ "(" ")" ] @indent.branch +[ + "(" + ")" +] @indent.branch [ (ERROR) diff --git a/queries/cue/injections.scm b/queries/cue/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/cue/injections.scm +++ b/queries/cue/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/cue/locals.scm b/queries/cue/locals.scm index bdc4a56a2..9c5a7378e 100644 --- a/queries/cue/locals.scm +++ b/queries/cue/locals.scm @@ -1,5 +1,4 @@ ; Scopes - [ (source_file) (field) @@ -7,17 +6,15 @@ ] @local.scope ; References - (identifier) @local.reference ; Definitions - (import_spec path: (string) @local.definition.import) (field (label - (identifier) @local.definition.field)) + (identifier) @local.definition.field)) (package_identifier) @local.definition.namespace diff --git a/queries/d/highlights.scm b/queries/d/highlights.scm index 18ced7246..2b63dd48c 100644 --- a/queries/d/highlights.scm +++ b/queries/d/highlights.scm @@ -1,5 +1,4 @@ -;; Misc - +; Misc [ (line_comment) (block_comment) @@ -8,6 +7,7 @@ ((line_comment) @comment.documentation (#lua-match? @comment.documentation "^///[^/]")) + ((line_comment) @comment.documentation (#lua-match? @comment.documentation "^///$")) @@ -18,9 +18,12 @@ (#lua-match? @comment.documentation "^/[+][+][^+].*[+]/$")) [ - "(" ")" - "[" "]" - "{" "}" + "(" + ")" + "[" + "]" + "{" + "}" ] @punctuation.bracket [ @@ -35,8 +38,7 @@ "$" ] @punctuation.special -;; Constants - +; Constants [ "__FILE_FULL_PATH__" "__FILE__" @@ -66,11 +68,9 @@ "false" ] @boolean -;; Functions - +; Functions (func_declarator - (identifier) @function -) + (identifier) @function) [ "__traits" @@ -83,29 +83,22 @@ ] @function.builtin (import_expression - "import" @function.builtin -) + "import" @function.builtin) (parameter (var_declarator - (identifier) @variable.parameter - ) -) + (identifier) @variable.parameter)) (function_literal - (identifier) @variable.parameter -) + (identifier) @variable.parameter) (constructor - "this" @constructor -) + "this" @constructor) (destructor - "this" @constructor -) - -;; Keywords + "this" @constructor) +; Keywords [ "case" "default" @@ -238,51 +231,45 @@ ] @type.qualifier (alias_assignment - . (identifier) @type.definition) + . + (identifier) @type.definition) (module_declaration - "module" @keyword.import -) + "module" @keyword.import) (import_declaration - "import" @keyword.import -) + "import" @keyword.import) (type) @type (catch_parameter - (qualified_identifier) @type -) + (qualified_identifier) @type) (var_declarations - (qualified_identifier) @type -) + (qualified_identifier) @type) (func_declaration - (qualified_identifier) @type -) + (qualified_identifier) @type) (parameter - (qualified_identifier) @type -) + (qualified_identifier) @type) (class_declaration - (identifier) @type -) + (identifier) @type) (fundamental_type) @type.builtin -(module_fully_qualified_name (packages (package_name) @module)) +(module_fully_qualified_name + (packages + (package_name) @module)) + (module_name) @module (at_attribute) @attribute (user_defined_attribute - "@" @attribute -) - -;; Variables + "@" @attribute) +; Variables (primary_expression - "this" @variable.builtin -) + "this" @variable.builtin) diff --git a/queries/d/indents.scm b/queries/d/indents.scm index 9ced7527d..81624cabd 100644 --- a/queries/d/indents.scm +++ b/queries/d/indents.scm @@ -5,9 +5,12 @@ ] @indent.begin [ - "(" ")" - "{" "}" - "[" "]" + "(" + ")" + "{" + "}" + "[" + "]" ] @indent.branch [ diff --git a/queries/d/injections.scm b/queries/d/injections.scm index 6dd8aeacf..7437b932b 100644 --- a/queries/d/injections.scm +++ b/queries/d/injections.scm @@ -2,8 +2,8 @@ (line_comment) (block_comment) (nesting_block_comment) - ] @injection.content - (#set! injection.language "comment")) +] @injection.content + (#set! injection.language "comment")) ((token_string_tokens) @injection.content - (#set! injection.language "d")) + (#set! injection.language "d")) diff --git a/queries/dart/folds.scm b/queries/dart/folds.scm index ea398a4b3..8dc4e7815 100644 --- a/queries/dart/folds.scm +++ b/queries/dart/folds.scm @@ -2,13 +2,10 @@ (class_definition) (enum_declaration) (extension_declaration) - (arguments) (function_body) - (block) (switch_block) - (list_literal) (set_or_map_literal) (string_literal) diff --git a/queries/dart/highlights.scm b/queries/dart/highlights.scm index be2824da5..de81cbc0b 100644 --- a/queries/dart/highlights.scm +++ b/queries/dart/highlights.scm @@ -1,18 +1,21 @@ (dotted_identifier_list) @string - ; Methods ; -------------------- (super) @function ; TODO: add method/call_expression to grammar and ; distinguish method call from variable access -(function_expression_body (identifier) @function) -; ((identifier)(selector (argument_part)) @function) +(function_expression_body + (identifier) @function) +; ((identifier)(selector (argument_part)) @function) ; 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 (#lua-match? @function "^_?[%l]")) - . (selector . (argument_part))) @function +(((identifier) @function + (#lua-match? @function "^_?[%l]")). +(selector + . + (argument_part))) @function ; Annotations ; -------------------- @@ -24,38 +27,36 @@ (template_substitution "$" @punctuation.special "{" @punctuation.special - "}" @punctuation.special -) @none + "}" @punctuation.special) @none (template_substitution "$" @punctuation.special - (identifier_dollar_escaped) @variable -) @none + (identifier_dollar_escaped) @variable) @none (escape_sequence) @string.escape [ - "@" - "=>" - ".." - "??" - "==" - "?" - ":" - "&&" - "%" - "<" - ">" - "=" - ">=" - "<=" - "||" - (multiplicative_operator) - (increment_operator) - (is_operator) - (prefix_operator) - (equality_operator) - (additive_operator) + "@" + "=>" + ".." + "??" + "==" + "?" + ":" + "&&" + "%" + "<" + ">" + "=" + ">=" + "<=" + "||" + (multiplicative_operator) + (increment_operator) + (is_operator) + (prefix_operator) + (equality_operator) + (additive_operator) ] @operator [ @@ -65,7 +66,7 @@ "]" "{" "}" -] @punctuation.bracket +] @punctuation.bracket ; Delimiters ; -------------------- @@ -79,26 +80,34 @@ ; -------------------- (class_definition name: (identifier) @type) + (constructor_signature name: (identifier) @type) + (scoped_identifier scope: (identifier) @type) + (function_signature name: (identifier) @function.method) + (getter_signature (identifier) @function.method) + (setter_signature name: (identifier) @function.method) + (enum_declaration name: (identifier) @type) + (enum_constant name: (identifier) @type) + (void_type) @type ((scoped_identifier scope: (identifier) @type name: (identifier) @type) - (#lua-match? @type "^[%u%l]")) + (#lua-match? @type "^[%u%l]")) (type_identifier) @type @@ -111,7 +120,7 @@ (inferred_type) @keyword ((identifier) @type - (#lua-match? @type "^_?[%u].*[%l]")) ; catch Classes or IClasses not CLASSES + (#lua-match? @type "^_?[%u].*[%l]")) ; catch Classes or IClasses not CLASSES ("Function" @type) @@ -131,29 +140,35 @@ ; Parameters ; -------------------- (formal_parameter - name: (identifier) @variable.parameter) + name: (identifier) @variable.parameter) (named_argument - (label (identifier) @variable.parameter)) + (label + (identifier) @variable.parameter)) ; Literals ; -------------------- [ - (hex_integer_literal) - (decimal_integer_literal) - (decimal_floating_point_literal) - ; TODO: inaccessible nodes - ; (octal_integer_literal) - ; (hex_floating_point_literal) + (hex_integer_literal) + (decimal_integer_literal) + (decimal_floating_point_literal) + ; TODO: inaccessible nodes + ; (octal_integer_literal) + ; (hex_floating_point_literal) ] @number (symbol_literal) @string.special.symbol + (string_literal) @string + (true) @boolean + (false) @boolean + (null_literal) @constant.builtin (comment) @comment @spell + (documentation_comment) @comment.documentation @spell ; Keywords @@ -169,47 +184,44 @@ ; Reserved words (cannot be used as identifiers) [ - ; TODO: - ; "rethrow" cannot be targeted at all and seems to be an invisible node - ; TODO: - ; the assert keyword cannot be specifically targeted - ; because the grammar selects the whole node or the content - ; of the assertion not just the keyword - ; assert - (case_builtin) - "late" - "required" - "extension" - "on" - "class" - "enum" - "extends" - "in" - "is" - "new" - "super" - "with" + ; TODO: + ; "rethrow" cannot be targeted at all and seems to be an invisible node + ; TODO: + ; the assert keyword cannot be specifically targeted + ; because the grammar selects the whole node or the content + ; of the assertion not just the keyword + ; assert + (case_builtin) + "late" + "required" + "extension" + "on" + "class" + "enum" + "extends" + "in" + "is" + "new" + "super" + "with" ] @keyword -[ - "return" -] @keyword.return - +"return" @keyword.return ; Built in identifiers: ; alone these are marked as keywords [ - "deferred" - "factory" - "get" - "implements" - "interface" - "library" - "operator" - "mixin" - "part" - "set" - "typedef" + "deferred" + "factory" + "get" + "implements" + "interface" + "library" + "operator" + "mixin" + "part" + "set" + "typedef" ] @keyword [ @@ -221,43 +233,28 @@ ] @keyword.coroutine [ - (const_builtin) - (final_builtin) - "abstract" - "covariant" - "dynamic" - "external" - "static" - "final" - "base" - "sealed" + (const_builtin) + (final_builtin) + "abstract" + "covariant" + "dynamic" + "external" + "static" + "final" + "base" + "sealed" ] @type.qualifier ; when used as an identifier: ((identifier) @variable.builtin - (#any-of? @variable.builtin - "abstract" - "as" - "covariant" - "deferred" - "dynamic" - "export" - "external" - "factory" - "Function" - "get" - "implements" - "import" - "interface" - "library" - "operator" - "mixin" - "part" - "set" - "static" - "typedef")) - -["if" "else" "switch" "default"] @keyword.conditional + (#any-of? @variable.builtin "abstract" "as" "covariant" "deferred" "dynamic" "export" "external" "factory" "Function" "get" "implements" "import" "interface" "library" "operator" "mixin" "part" "set" "static" "typedef")) + +[ + "if" + "else" + "switch" + "default" +] @keyword.conditional [ "try" @@ -267,4 +264,9 @@ (break_statement) ] @keyword.exception -["do" "while" "continue" "for"] @keyword.repeat +[ + "do" + "while" + "continue" + "for" +] @keyword.repeat diff --git a/queries/dart/indents.scm b/queries/dart/indents.scm index 87befcf6c..8da3ebb14 100644 --- a/queries/dart/indents.scm +++ b/queries/dart/indents.scm @@ -2,7 +2,8 @@ (class_body) (function_body) (function_expression_body) - (declaration (initializers)) + (declaration + (initializers)) (switch_block) (if_statement) (formal_parameter_list) @@ -32,14 +33,16 @@ "]" ] @indent.branch -[ - "}" -] @indent.end +"}" @indent.end + +(return_statement + ";" @indent.end) -(return_statement ";" @indent.end) -(break_statement ";" @indent.end) +(break_statement + ";" @indent.end) ; this one is for dedenting the else block -(if_statement (block) @indent.branch) +(if_statement + (block) @indent.branch) (comment) @indent.ignore diff --git a/queries/dart/injections.scm b/queries/dart/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/dart/injections.scm +++ b/queries/dart/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/dart/locals.scm b/queries/dart/locals.scm index f7faa26ac..3e3beb58e 100644 --- a/queries/dart/locals.scm +++ b/queries/dart/locals.scm @@ -1,5 +1,4 @@ -;; Definitions - +; Definitions (function_signature name: (identifier) @local.definition.function) @@ -15,20 +14,19 @@ (static_final_declaration (identifier) @local.definition.var) -;; References - +; References (identifier) @local.reference -;; Scopes - +; Scopes (class_definition body: (_) @local.scope) + [ - (block) - (if_statement) - (for_statement) - (while_statement) - (try_statement) - (catch_clause) - (finally_clause) + (block) + (if_statement) + (for_statement) + (while_statement) + (try_statement) + (catch_clause) + (finally_clause) ] @local.scope diff --git a/queries/devicetree/highlights.scm b/queries/devicetree/highlights.scm index 6236189bf..a81cf2c89 100644 --- a/queries/devicetree/highlights.scm +++ b/queries/devicetree/highlights.scm @@ -6,6 +6,7 @@ ] @keyword.import (preproc_def) @constant.macro + (preproc_function_def) @function.macro [ @@ -22,14 +23,39 @@ (integer_literal) @number (identifier) @variable -(node (identifier) @module) -(property (identifier) @property) -(labeled_item (identifier) @label) -(call_expression (identifier) @function.macro) + +(node + (identifier) @module) + +(property + (identifier) @property) + +(labeled_item + (identifier) @label) + +(call_expression + (identifier) @function.macro) (reference) @label ; referencing labeled_item.identifier + (unit_address) @constant -[ "=" ] @operator -[ "(" ")" "[" "]" "{" "}" "<" ">" ] @punctuation.bracket -[ ";" ":" "," "@" ] @punctuation.delimiter +"=" @operator + +[ + "(" + ")" + "[" + "]" + "{" + "}" + "<" + ">" +] @punctuation.bracket + +[ + ";" + ":" + "," + "@" +] @punctuation.delimiter diff --git a/queries/devicetree/indents.scm b/queries/devicetree/indents.scm index 6cfc81cf2..9740060ca 100644 --- a/queries/devicetree/indents.scm +++ b/queries/devicetree/indents.scm @@ -9,6 +9,4 @@ ">" ] @indent.branch -[ - (comment) -] @indent.ignore +(comment) @indent.ignore diff --git a/queries/devicetree/injections.scm b/queries/devicetree/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/devicetree/injections.scm +++ b/queries/devicetree/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/devicetree/locals.scm b/queries/devicetree/locals.scm index 88b266ec2..e33a81dfd 100644 --- a/queries/devicetree/locals.scm +++ b/queries/devicetree/locals.scm @@ -1,4 +1,4 @@ [ (node) (integer_cells) -]@local.scope +] @local.scope diff --git a/queries/dhall/folds.scm b/queries/dhall/folds.scm index 305079aa8..bc92797b4 100644 --- a/queries/dhall/folds.scm +++ b/queries/dhall/folds.scm @@ -1,14 +1,10 @@ [ (let_binding) - (application_expression) (lambda_expression) - (record_type) (union_type) - (list_literal) (record_literal) - (block_comment) ] @fold diff --git a/queries/dhall/highlights.scm b/queries/dhall/highlights.scm index 5e2a77848..efd7fedf2 100644 --- a/queries/dhall/highlights.scm +++ b/queries/dhall/highlights.scm @@ -1,7 +1,5 @@ -;; Text - -;; Imports - +; Text +; Imports (missing_import) @keyword.import (local_import) @string.special.path @@ -13,47 +11,55 @@ (import_hash) ] @string.special -[ (import_as_location) (import_as_text) ] @type - -;; Types +[ + (import_as_location) + (import_as_text) +] @type +; Types ([ - (let_binding (label) @type) - (union_type_entry (label) @type) -] (#lua-match? @type "^%u")) + (let_binding + (label) @type) + (union_type_entry + (label) @type) +] + (#lua-match? @type "^%u")) ((primitive_expression - (identifier (label) @type) - (selector (label) @type)) @variable + (identifier + (label) @type) + (selector + (label) @type)) @variable (#lua-match? @variable "^[A-Z][^.]*$")) -;; Parameters - -(lambda_expression label: (label) @variable.parameter) - -;; Variables +; Parameters +(lambda_expression + label: (label) @variable.parameter) +; Variables (label) @variable -(identifier [ - (label) @variable - (de_bruijn_index) @operator -]) +(identifier + [ + (label) @variable + (de_bruijn_index) @operator + ]) -(let_binding label: (label) @variable) +(let_binding + label: (label) @variable) ; Fields +(record_literal_entry + (label) @variable.member) -(record_literal_entry (label) @variable.member) - -(record_type_entry (label) @variable.member) +(record_type_entry + (label) @variable.member) (selector (selector_dot) (_) @variable.member) -;; Keywords - +; Keywords (env_import) @keyword [ @@ -68,8 +74,7 @@ "with" ] @keyword.operator -;; Operators - +; Operators [ (type_operator) (assign_operator) @@ -82,71 +87,88 @@ (empty_record_literal) ] @operator -;; Builtins - +; Builtins (builtin_function) @function.builtin -(builtin [ - "Natural" - "Natural/build" - "Natural/fold" - "Natural/isZero" - "Natural/even" - "Natural/odd" - "Natural/subtract" - "Natural/toInteger" - "Natural/show" - "Integer" - "Integer/toDouble" - "Integer/show" - "Integer/negate" - "Integer/clamp" - "Double" - "Double/show" - "List" - "List/build" - "List/fold" - "List/length" - "List/head" - "List/last" - "List/indexed" - "List/reverse" - "Text" - "Text/show" - "Text/replace" - "Optional" - "Date" - "Time" - "TimeZone" - "Type" - "Kind" - "Sort" -] @type.builtin) - -;; Punctuation - -[ "," "|" ] @punctuation.delimiter -(selector_dot) @punctuation.delimiter -[ "{" "}" ] @punctuation.bracket +(builtin + [ + "Natural" + "Natural/build" + "Natural/fold" + "Natural/isZero" + "Natural/even" + "Natural/odd" + "Natural/subtract" + "Natural/toInteger" + "Natural/show" + "Integer" + "Integer/toDouble" + "Integer/show" + "Integer/negate" + "Integer/clamp" + "Double" + "Double/show" + "List" + "List/build" + "List/fold" + "List/length" + "List/head" + "List/last" + "List/indexed" + "List/reverse" + "Text" + "Text/show" + "Text/replace" + "Optional" + "Date" + "Time" + "TimeZone" + "Type" + "Kind" + "Sort" + ] @type.builtin) + +; Punctuation +[ + "," + "|" +] @punctuation.delimiter -[ "[" "]" ] @punctuation.bracket +(selector_dot) @punctuation.delimiter -[ "(" ")" ] @punctuation.bracket +[ + "{" + "}" +] @punctuation.bracket -[ "<" ">" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -;; Conditionals +[ + "(" + ")" +] @punctuation.bracket +[ + "<" + ">" +] @punctuation.bracket + +; Conditionals [ "if" "then" "else" ] @keyword.conditional -;; Literals - +; Literals (text_literal) @string -(interpolation "}" @string) + +(interpolation + "}" @string) + [ (double_quote_escaped) (single_quote_escaped) @@ -161,10 +183,10 @@ (boolean_literal) @boolean -(builtin "None") @constant.builtin - -;; Comments +(builtin + "None") @constant.builtin +; Comments [ (line_comment) (block_comment) diff --git a/queries/dhall/injections.scm b/queries/dhall/injections.scm index 43ae7287b..3cd6aac8e 100644 --- a/queries/dhall/injections.scm +++ b/queries/dhall/injections.scm @@ -1,5 +1,5 @@ ([ (line_comment) (block_comment) - ] @injection.content - (#set! injection.language "comment")) +] @injection.content + (#set! injection.language "comment")) diff --git a/queries/diff/highlights.scm b/queries/diff/highlights.scm index 4288913d9..d8e600882 100644 --- a/queries/diff/highlights.scm +++ b/queries/diff/highlights.scm @@ -1,6 +1,15 @@ -[(addition) (new_file)] @diff.plus -[(deletion) (old_file)] @diff.minus +[ + (addition) + (new_file) +] @diff.plus + +[ + (deletion) + (old_file) +] @diff.minus (commit) @constant + (location) @attribute + (command) @function diff --git a/queries/dockerfile/highlights.scm b/queries/dockerfile/highlights.scm index 592e70423..762e34426 100644 --- a/queries/dockerfile/highlights.scm +++ b/queries/dockerfile/highlights.scm @@ -41,17 +41,19 @@ "$" "{" "}" - ] @punctuation.special -) + ] @punctuation.special) ((variable) @constant (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) (arg_instruction - . (unquoted_string) @property) + . + (unquoted_string) @property) (env_instruction - (env_pair . (unquoted_string) @property)) + (env_pair + . + (unquoted_string) @property)) (expose_instruction (expose_port) @number) diff --git a/queries/dockerfile/injections.scm b/queries/dockerfile/injections.scm index 0eb9ffdf2..0304f982e 100644 --- a/queries/dockerfile/injections.scm +++ b/queries/dockerfile/injections.scm @@ -1,6 +1,6 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) -((shell_command) @injection.content - (#set! injection.language "bash") - (#set! injection.include-children)) +((shell_command) @injection.content + (#set! injection.language "bash") + (#set! injection.include-children)) diff --git a/queries/dot/highlights.scm b/queries/dot/highlights.scm index f204ce44c..7919e87f5 100644 --- a/queries/dot/highlights.scm +++ b/queries/dot/highlights.scm @@ -10,6 +10,7 @@ ] @keyword (string_literal) @string + (number_literal) @number [ @@ -32,19 +33,19 @@ ] @punctuation.bracket (subgraph - id: (id - (identifier) @module) -) + id: + (id + (identifier) @module)) (attribute - name: (id - (identifier) @variable.member) -) + name: + (id + (identifier) @variable.member)) (attribute - value: (id - (identifier) @constant) -) + value: + (id + (identifier) @constant)) (comment) @comment diff --git a/queries/dot/injections.scm b/queries/dot/injections.scm index ac41393ab..4fe39a8ba 100644 --- a/queries/dot/injections.scm +++ b/queries/dot/injections.scm @@ -1,5 +1,5 @@ -((html_internal) @injection.content - (#set! injection.language "html")) +((html_internal) @injection.content + (#set! injection.language "html")) ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/doxygen/highlights.scm b/queries/doxygen/highlights.scm index fadcdfa80..e3e26881e 100644 --- a/queries/doxygen/highlights.scm +++ b/queries/doxygen/highlights.scm @@ -9,11 +9,12 @@ (identifier) @variable ((tag - (tag_name) @_param + (tag_name) @_param (identifier) @variable.parameter) (#any-of? @_param "@param" "\\param")) -(function (identifier) @function) +(function + (identifier) @function) (function_link) @function @@ -48,6 +49,13 @@ (code_block_end) ] @punctuation.delimiter -[ "(" ")" "{" "}" "[" "]" ] @punctuation.bracket +[ + "(" + ")" + "{" + "}" + "[" + "]" +] @punctuation.bracket (code_block_content) @none diff --git a/queries/doxygen/injections.scm b/queries/doxygen/injections.scm index 8353dfd7a..e0eff433a 100644 --- a/queries/doxygen/injections.scm +++ b/queries/doxygen/injections.scm @@ -1,7 +1,10 @@ ((type) @injection.content (#set! injection.parent)) -([ (function_link) (code) ] @injection.content +([ + (function_link) + (code) +] @injection.content (#set! injection.parent)) ((link) @injection.content diff --git a/queries/dtd/folds.scm b/queries/dtd/folds.scm index ba7ea121b..b1bce4ffb 100644 --- a/queries/dtd/folds.scm +++ b/queries/dtd/folds.scm @@ -1,4 +1,4 @@ [ - (conditionalSect) - (Comment) + (conditionalSect) + (Comment) ] @fold diff --git a/queries/dtd/highlights.scm b/queries/dtd/highlights.scm index fac7d923c..12a2093d1 100644 --- a/queries/dtd/highlights.scm +++ b/queries/dtd/highlights.scm @@ -1,80 +1,95 @@ -;; XML declaration +; XML declaration +(XMLDecl + "xml" @keyword.directive) -(XMLDecl "xml" @keyword.directive) +(XMLDecl + [ + "version" + "encoding" + ] @tag.attribute) -(XMLDecl [ "version" "encoding" ] @tag.attribute) +(XMLDecl + (EncName) @string.special) -(XMLDecl (EncName) @string.special) - -(XMLDecl (VersionNum) @number) - -;; Processing instructions +(XMLDecl + (VersionNum) @number) +; Processing instructions (PI) @keyword.directive -;; Element declaration - +; Element declaration (elementdecl "ELEMENT" @keyword.directive.define (Name) @tag) (contentspec - (_ (Name) @tag.attribute)) + (_ + (Name) @tag.attribute)) "#PCDATA" @type.builtin -[ "EMPTY" "ANY" ] @type.qualifier - -[ "*" "?" "+" ] @character.special +[ + "EMPTY" + "ANY" +] @type.qualifier -;; Entity declaration +[ + "*" + "?" + "+" +] @character.special +; Entity declaration (GEDecl "ENTITY" @keyword.directive.define (Name) @constant) -(GEDecl (EntityValue) @string) +(GEDecl + (EntityValue) @string) (NDataDecl "NDATA" @keyword (Name) @label) -;; Parsed entity declaration - +; Parsed entity declaration (PEDecl "ENTITY" @keyword.directive.define "%" @operator (Name) @function.macro) -(PEDecl (EntityValue) @string) - -;; Notation declaration +(PEDecl + (EntityValue) @string) +; Notation declaration (NotationDecl "NOTATION" @keyword.directive (Name) @label) ((NotationDecl (ExternalID - (SystemLiteral (URI) @string.special.url)) - (#set! "priority" 105))) - -;; Attlist declaration + (SystemLiteral + (URI) @string.special.url)) + (#set! "priority" 105))) +; Attlist declaration (AttlistDecl "ATTLIST" @keyword.directive.define (Name) @tag) -(AttDef (Name) @tag.attribute) +(AttDef + (Name) @tag.attribute) -(AttDef (Enumeration (Nmtoken) @string)) +(AttDef + (Enumeration + (Nmtoken) @string)) [ (StringType) (TokenizedType) ] @type.builtin -(NotationType "NOTATION" @type.builtin) +(NotationType + "NOTATION" @type.builtin) [ "#REQUIRED" @@ -82,38 +97,57 @@ "#FIXED" ] @attribute -;; Entities - +; Entities (EntityRef) @constant ((EntityRef) @constant.builtin - (#any-of? @constant.builtin - "&" "<" ">" """ "'")) + (#any-of? @constant.builtin "&" "<" ">" """ "'")) (CharRef) @character (PEReference) @function.macro -;; External references - -[ "PUBLIC" "SYSTEM" ] @keyword +; External references +[ + "PUBLIC" + "SYSTEM" +] @keyword (PubidLiteral) @string.special -(SystemLiteral (URI) @string.special.url) - -;; Delimiters & punctuation - -[ "" "" "]]>" ] @tag.delimiter +(SystemLiteral + (URI) @string.special.url) -[ "(" ")" "[" ] @punctuation.bracket +; Delimiters & punctuation +[ + "" + "" + "]]>" +] @tag.delimiter -[ "\"" "'" ] @punctuation.delimiter +[ + "(" + ")" + "[" +] @punctuation.bracket -[ "," "|" "=" ] @operator +[ + "\"" + "'" +] @punctuation.delimiter -;; Misc +[ + "," + "|" + "=" +] @operator -[ "INCLUDE" "IGNORE" ] @keyword.import +; Misc +[ + "INCLUDE" + "IGNORE" +] @keyword.import (Comment) @comment @spell diff --git a/queries/dtd/locals.scm b/queries/dtd/locals.scm index 6f64c6791..88246c04a 100644 --- a/queries/dtd/locals.scm +++ b/queries/dtd/locals.scm @@ -1,7 +1,11 @@ -(elementdecl (Name) @local.definition.type) +(elementdecl + (Name) @local.definition.type) (elementdecl (contentspec - (children (Name) @local.reference))) + (children + (Name) @local.reference))) -(AttlistDecl . (Name) @local.reference) +(AttlistDecl + . + (Name) @local.reference) diff --git a/queries/ebnf/highlights.scm b/queries/ebnf/highlights.scm index b0dfa2737..8715091b1 100644 --- a/queries/ebnf/highlights.scm +++ b/queries/ebnf/highlights.scm @@ -1,4 +1,4 @@ -;;;; Simple tokens ;;;; +; Simple tokens ;;;; (terminal) @string.grammar (special_sequence) @string.special.grammar @@ -7,37 +7,36 @@ (comment) @comment @spell -;;;; Identifiers ;;;; - +; Identifiers ;;;; ; Allow different highlighting for specific casings ((identifier) @type - (#lua-match? @type "^%u")) + (#lua-match? @type "^%u")) ((identifier) @string.special.symbol - (#lua-match? @string.special.symbol "^%l")) + (#lua-match? @string.special.symbol "^%l")) ((identifier) @constant - (#lua-match? @constant "^%u[%u%d_]+$")) + (#lua-match? @constant "^%u[%u%d_]+$")) -;;; Punctuation ;;;; +; Punctuation ;;;; [ - ";" - "," + ";" + "," ] @punctuation.delimiter [ - "|" - "*" - "-" + "|" + "*" + "-" ] @operator "=" @keyword.operator [ - "(" - ")" - "[" - "]" - "{" - "}" + "(" + ")" + "[" + "]" + "{" + "}" ] @punctuation.bracket diff --git a/queries/ecma/highlights.scm b/queries/ecma/highlights.scm index b6fd64668..223198410 100644 --- a/queries/ecma/highlights.scm +++ b/queries/ecma/highlights.scm @@ -1,92 +1,60 @@ ; Types - ; Javascript - ; Variables ;----------- (identifier) @variable ; Properties ;----------- - (property_identifier) @property + (shorthand_property_identifier) @property + (private_property_identifier) @property (variable_declarator - name: (object_pattern - (shorthand_property_identifier_pattern))) @variable + name: + (object_pattern + (shorthand_property_identifier_pattern))) @variable ; Special identifiers ;-------------------- - ((identifier) @type - (#lua-match? @type "^[A-Z]")) + (#lua-match? @type "^[A-Z]")) ((identifier) @constant - (#lua-match? @constant "^_*[A-Z][A-Z%d_]*$")) + (#lua-match? @constant "^_*[A-Z][A-Z%d_]*$")) ((shorthand_property_identifier) @constant - (#lua-match? @constant "^_*[A-Z][A-Z%d_]*$")) + (#lua-match? @constant "^_*[A-Z][A-Z%d_]*$")) ((identifier) @variable.builtin - (#any-of? @variable.builtin - "arguments" - "module" - "console" - "window" - "document")) + (#any-of? @variable.builtin "arguments" "module" "console" "window" "document")) ((identifier) @type.builtin - (#any-of? @type.builtin - "Object" - "Function" - "Boolean" - "Symbol" - "Number" - "Math" - "Date" - "String" - "RegExp" - "Map" - "Set" - "WeakMap" - "WeakSet" - "Promise" - "Array" - "Int8Array" - "Uint8Array" - "Uint8ClampedArray" - "Int16Array" - "Uint16Array" - "Int32Array" - "Uint32Array" - "Float32Array" - "Float64Array" - "ArrayBuffer" - "DataView" - "Error" - "EvalError" - "InternalError" - "RangeError" - "ReferenceError" - "SyntaxError" - "TypeError" - "URIError")) + (#any-of? @type.builtin "Object" "Function" "Boolean" "Symbol" "Number" "Math" "Date" "String" "RegExp" "Map" "Set" "WeakMap" "WeakSet" "Promise" "Array" "Int8Array" "Uint8Array" "Uint8ClampedArray" "Int16Array" "Uint16Array" "Int32Array" "Uint32Array" "Float32Array" "Float64Array" "ArrayBuffer" "DataView" "Error" "EvalError" "InternalError" "RangeError" "ReferenceError" "SyntaxError" "TypeError" "URIError")) ; Function and method definitions ;-------------------------------- - (function name: (identifier) @function) + (function_declaration name: (identifier) @function) + (generator_function name: (identifier) @function) + (generator_function_declaration name: (identifier) @function) + (method_definition - name: [(property_identifier) (private_property_identifier)] @function.method) + name: + [ + (property_identifier) + (private_property_identifier) + ] @function.method) + (method_definition name: (property_identifier) @constructor (#eq? @constructor "constructor")) @@ -94,22 +62,27 @@ (pair key: (property_identifier) @function.method value: (function)) + (pair key: (property_identifier) @function.method value: (arrow_function)) (assignment_expression - left: (member_expression - property: (property_identifier) @function.method) + left: + (member_expression + property: (property_identifier) @function.method) right: (arrow_function)) + (assignment_expression - left: (member_expression - property: (property_identifier) @function.method) + left: + (member_expression + property: (property_identifier) @function.method) right: (function)) (variable_declarator name: (identifier) @function value: (arrow_function)) + (variable_declarator name: (identifier) @function value: (function)) @@ -117,42 +90,35 @@ (assignment_expression left: (identifier) @function right: (arrow_function)) + (assignment_expression left: (identifier) @function right: (function)) ; Function and method calls ;-------------------------- - (call_expression function: (identifier) @function.call) (call_expression - function: (member_expression - property: [(property_identifier) (private_property_identifier)] @function.method.call)) + function: + (member_expression + property: + [ + (property_identifier) + (private_property_identifier) + ] @function.method.call)) ; Builtins ;--------- - ((identifier) @module.builtin - (#eq? @module.builtin "Intl")) + (#eq? @module.builtin "Intl")) ((identifier) @function.builtin - (#any-of? @function.builtin - "eval" - "isFinite" - "isNaN" - "parseFloat" - "parseInt" - "decodeURI" - "decodeURIComponent" - "encodeURI" - "encodeURIComponent" - "require")) + (#any-of? @function.builtin "eval" "isFinite" "isNaN" "parseFloat" "parseInt" "decodeURI" "decodeURIComponent" "encodeURI" "encodeURIComponent" "require")) ; Constructor ;------------ - (new_expression constructor: (identifier) @constructor) @@ -163,19 +129,24 @@ ; Decorators ;---------- -(decorator "@" @attribute (identifier) @attribute) -(decorator "@" @attribute (call_expression (identifier) @attribute)) +(decorator + "@" @attribute + (identifier) @attribute) + +(decorator + "@" @attribute + (call_expression + (identifier) @attribute)) ; Literals ;--------- - [ (this) (super) ] @variable.builtin ((identifier) @variable.builtin - (#eq? @variable.builtin "self")) + (#eq? @variable.builtin "self")) [ (true) @@ -195,30 +166,45 @@ (hash_bang_line) @keyword.directive ((string_fragment) @keyword.directive - (#eq? @keyword.directive "use strict")) + (#eq? @keyword.directive "use strict")) (string) @string + (template_string) @string + (escape_sequence) @string.escape + (regex_pattern) @string.regexp + (regex_flags) @character.special -(regex "/" @punctuation.bracket) ; Regex delimiters + +(regex + "/" @punctuation.bracket) ; Regex delimiters (number) @number + ((identifier) @number (#any-of? @number "NaN" "Infinity")) ; Punctuation ;------------ - ";" @punctuation.delimiter + "." @punctuation.delimiter + "," @punctuation.delimiter -(pair ":" @punctuation.delimiter) -(pair_pattern ":" @punctuation.delimiter) -(switch_case ":" @punctuation.delimiter) -(switch_default ":" @punctuation.delimiter) +(pair + ":" @punctuation.delimiter) + +(pair_pattern + ":" @punctuation.delimiter) + +(switch_case + ":" @punctuation.delimiter) + +(switch_default + ":" @punctuation.delimiter) [ "--" @@ -265,10 +251,28 @@ "..." ] @operator -(binary_expression "/" @operator) -(ternary_expression ["?" ":"] @keyword.conditional.ternary) -(unary_expression ["!" "~" "-" "+"] @operator) -(unary_expression ["delete" "void"] @keyword.operator) +(binary_expression + "/" @operator) + +(ternary_expression + [ + "?" + ":" + ] @keyword.conditional.ternary) + +(unary_expression + [ + "!" + "~" + "-" + "+" + ] @operator) + +(unary_expression + [ + "delete" + "void" + ] @keyword.operator) [ "(" @@ -279,11 +283,14 @@ "}" ] @punctuation.bracket -((template_substitution ["${" "}"] @punctuation.special) @none) +((template_substitution + [ + "${" + "}" + ] @punctuation.special) @none) ; Keywords ;---------- - [ "if" "else" @@ -296,10 +303,17 @@ "from" ] @keyword.import -(export_specifier "as" @keyword.import) -(import_specifier "as" @keyword.import) -(namespace_export "as" @keyword.import) -(namespace_import "as" @keyword.import) +(export_specifier + "as" @keyword.import) + +(import_specifier + "as" @keyword.import) + +(namespace_export + "as" @keyword.import) + +(namespace_import + "as" @keyword.import) [ "for" @@ -335,9 +349,7 @@ "yield" ] @keyword.return -[ - "function" -] @keyword.function +"function" @keyword.function [ "new" @@ -356,5 +368,6 @@ (export_statement "default" @keyword) + (switch_default "default" @keyword.conditional) diff --git a/queries/ecma/indents.scm b/queries/ecma/indents.scm index 538c5bdc7..03b10c605 100644 --- a/queries/ecma/indents.scm +++ b/queries/ecma/indents.scm @@ -18,36 +18,56 @@ (ternary_expression) ] @indent.begin -(arguments (call_expression) @indent.begin) -(binary_expression (call_expression) @indent.begin) -(expression_statement (call_expression) @indent.begin) +(arguments + (call_expression) @indent.begin) + +(binary_expression + (call_expression) @indent.begin) + +(expression_statement + (call_expression) @indent.begin) + (arrow_function body: (_) @_body - (#not-has-type? @_body statement_block) -) @indent.begin + (#not-has-type? @_body statement_block)) @indent.begin + (assignment_expression right: (_) @_right - (#not-has-type? @_right arrow_function function) -) @indent.begin + (#not-has-type? @_right arrow_function function)) @indent.begin + (variable_declarator value: (_) @_value - (#not-has-type? @_value arrow_function call_expression function) -) @indent.begin + (#not-has-type? @_value arrow_function call_expression function)) @indent.begin + +(arguments + ")" @indent.end) -(arguments ")" @indent.end) -(object "}" @indent.end) -(statement_block "}" @indent.end) +(object + "}" @indent.end) + +(statement_block + "}" @indent.end) [ - (arguments (object)) + (arguments + (object)) ")" "}" "]" ] @indent.branch -(statement_block "{" @indent.branch) -(parenthesized_expression ("(" (_) ")" @indent.end)) -["}" "]"] @indent.end +(statement_block + "{" @indent.branch) + +(parenthesized_expression + ("(" + (_) + ")" @indent.end)) + +[ + "}" + "]" +] @indent.end (template_string) @indent.ignore diff --git a/queries/ecma/injections.scm b/queries/ecma/injections.scm index 97dbbb628..9421d8113 100644 --- a/queries/ecma/injections.scm +++ b/queries/ecma/injections.scm @@ -3,98 +3,116 @@ (#set! injection.language "jsdoc")) ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) ; html(`...`), html`...`, sql(...) etc (call_expression - function: ((identifier) @injection.language) - arguments: [ - (arguments - (template_string) @injection.content) - (template_string) @injection.content - ] - (#lua-match? @injection.language "^[a-zA-Z][a-zA-Z0-9]*$") - (#offset! @injection.content 0 1 0 -1) - (#not-eq? @injection.language "svg")) + function: + ((identifier) @injection.language) + arguments: + [ + (arguments + (template_string) @injection.content) + (template_string) @injection.content + ] + (#lua-match? @injection.language "^[a-zA-Z][a-zA-Z0-9]*$") + (#offset! @injection.content 0 1 0 -1) + (#not-eq? @injection.language "svg")) ; svg`...` or svg(`...`), which uses the html parser, so is not included in the previous query (call_expression - function: ((identifier) @_name (#eq? @_name "svg")) - arguments: [ - (arguments - (template_string) @injection.content) - (template_string) @injection.content - ] - (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "html")) - + function: + ((identifier) @_name + (#eq? @_name "svg")) + arguments: + [ + (arguments + (template_string) @injection.content) + (template_string) @injection.content + ] + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "html")) (call_expression - function: ((identifier) @_name - (#eq? @_name "gql")) - arguments: ((template_string) @injection.content - (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "graphql"))) + function: + ((identifier) @_name + (#eq? @_name "gql")) + arguments: + ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "graphql"))) (call_expression - function: ((identifier) @_name - (#eq? @_name "hbs")) - arguments: ((template_string) @injection.content - (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "glimmer"))) + function: + ((identifier) @_name + (#eq? @_name "hbs")) + arguments: + ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "glimmer"))) ((glimmer_template) @injection.content - (#set! injection.language "glimmer")) + (#set! injection.language "glimmer")) ; styled.div`` (call_expression - function: (member_expression - object: (identifier) @_name - (#eq? @_name "styled")) - arguments: ((template_string) @injection.content - (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "styled"))) + function: + (member_expression + object: (identifier) @_name + (#eq? @_name "styled")) + arguments: + ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "styled"))) ; styled(Component)`` (call_expression - function: (call_expression - function: (identifier) @_name - (#eq? @_name "styled")) - arguments: ((template_string) @injection.content - (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "styled"))) + function: + (call_expression + function: (identifier) @_name + (#eq? @_name "styled")) + arguments: + ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "styled"))) ; styled.div.attrs({ prop: "foo" })`` (call_expression - function: (call_expression - function: (member_expression - object: (member_expression - object: (identifier) @_name - (#eq? @_name "styled")))) - arguments: ((template_string) @injection.content - (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "styled"))) - + function: + (call_expression + function: + (member_expression + object: + (member_expression + object: (identifier) @_name + (#eq? @_name "styled")))) + arguments: + ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "styled"))) ; styled(Component).attrs({ prop: "foo" })`` (call_expression - function: (call_expression - function: (member_expression - object: (call_expression - function: (identifier) @_name - (#eq? @_name "styled")))) - arguments: ((template_string) @injection.content - (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "styled"))) + function: + (call_expression + function: + (member_expression + object: + (call_expression + function: (identifier) @_name + (#eq? @_name "styled")))) + arguments: + ((template_string) @injection.content + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "styled"))) ((regex_pattern) @injection.content - (#set! injection.language "regex")) + (#set! injection.language "regex")) ; ((comment) @_gql_comment ; (#eq? @_gql_comment "/* GraphQL */") ; (template_string) @injection.content ; (#set! injection.language "graphql")) - ((template_string) @injection.content (#lua-match? @injection.content "^`#graphql") (#offset! @injection.content 0 1 0 -1) @@ -102,20 +120,21 @@ ; el.innerHTML = `` (assignment_expression - left: + left: (member_expression property: (property_identifier) @_prop (#any-of? @_prop "outerHTML" "innerHTML")) right: (template_string) @injection.content - (#offset! @injection.content 0 1 0 -1) - (#set! injection.language "html")) + (#offset! @injection.content 0 1 0 -1) + (#set! injection.language "html")) ; el.innerHTML = '' (assignment_expression - left: + left: (member_expression property: (property_identifier) @_prop (#any-of? @_prop "outerHTML" "innerHTML")) - right: - (string (string_fragment) @injection.content) - (#set! injection.language "html")) + right: + (string + (string_fragment) @injection.content) + (#set! injection.language "html")) diff --git a/queries/ecma/locals.scm b/queries/ecma/locals.scm index 86e565490..54da79335 100644 --- a/queries/ecma/locals.scm +++ b/queries/ecma/locals.scm @@ -1,18 +1,23 @@ ; Scopes ;------- - (statement_block) @local.scope + (function) @local.scope + (arrow_function) @local.scope + (function_declaration) @local.scope + (method_definition) @local.scope + (for_statement) @local.scope + (for_in_statement) @local.scope + (catch_clause) @local.scope ; Definitions ;------------ - (variable_declarator name: (identifier) @local.definition.var) @@ -24,14 +29,14 @@ (function_declaration ((identifier) @local.definition.function) - (#set! definition.var.scope parent)) + (#set! definition.var.scope parent)) (method_definition ((property_identifier) @local.definition.function) - (#set! definition.var.scope parent)) + (#set! definition.var.scope parent)) ; References ;------------ - (identifier) @local.reference + (shorthand_property_identifier) @local.reference diff --git a/queries/eds/highlights.scm b/queries/eds/highlights.scm index 42f408754..2ce79c048 100644 --- a/queries/eds/highlights.scm +++ b/queries/eds/highlights.scm @@ -1,49 +1,58 @@ "=" @punctuation.delimiter -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket ((section_name) @variable.builtin - (#match? @variable.builtin "\\c^(FileInfo|DeviceInfo|DummyUsage|MandatoryObjects|OptionalObjects)$")) + (#match? @variable.builtin "\\c^(FileInfo|DeviceInfo|DummyUsage|MandatoryObjects|OptionalObjects)$")) ((section_name) @variable.builtin - (#lua-match? @variable.builtin "^1")) + (#lua-match? @variable.builtin "^1")) (section - (section_name) @_name - (#match? @_name "\\c^Comments$")) @comment + (section_name) @_name + (#match? @_name "\\c^Comments$")) @comment (section - (section_name) @_name - (statement (key) @_key) @string - (#match? @_key "\\c^ParameterName$") - (#not-match? @_name "\\c^Comments$")) + (section_name) @_name + (statement + (key) @_key) @string + (#match? @_key "\\c^ParameterName$") + (#not-match? @_name "\\c^Comments$")) (section - (section_name) @_name - (statement (key) @_key) @type - (#match? @_key "\\c^ObjectType$") - (#not-match? @_name "\\c^Comments$")) + (section_name) @_name + (statement + (key) @_key) @type + (#match? @_key "\\c^ObjectType$") + (#not-match? @_name "\\c^Comments$")) (section - (section_name) @_name - (statement (key) @_key) @type - (#match? @_key "\\c^DataType$") - (#not-match? @_name "\\c^Comments$")) + (section_name) @_name + (statement + (key) @_key) @type + (#match? @_key "\\c^DataType$") + (#not-match? @_name "\\c^Comments$")) (section - (section_name) @_name - (statement (key) @_key) @type.qualifier - (#match? @_key "\\c^AccessType$") - (#not-match? @_name "\\c^Comments$")) + (section_name) @_name + (statement + (key) @_key) @type.qualifier + (#match? @_key "\\c^AccessType$") + (#not-match? @_name "\\c^Comments$")) (section - (section_name) @_name - (statement (key) @_key) @attribute - (#match? @_key "\\c^PDOMapping$") - (#not-match? @_name "\\c^Comments$")) + (section_name) @_name + (statement + (key) @_key) @attribute + (#match? @_key "\\c^PDOMapping$") + (#not-match? @_name "\\c^Comments$")) (section - (section_name) @_name - (statement (key) @_key) @number - (#match? @_key "\\c^(DefaultValue|LowLimit|HighLimit|SubNumber)$") - (#not-match? @_name "\\c^Comments$")) + (section_name) @_name + (statement + (key) @_key) @number + (#match? @_key "\\c^(DefaultValue|LowLimit|HighLimit|SubNumber)$") + (#not-match? @_name "\\c^Comments$")) diff --git a/queries/eex/highlights.scm b/queries/eex/highlights.scm index d032a7486..ae91a2774 100644 --- a/queries/eex/highlights.scm +++ b/queries/eex/highlights.scm @@ -7,6 +7,5 @@ "<%%=" "<%=" ] @tag.delimiter - ; EEx comments are highlighted as such (comment) @comment @spell diff --git a/queries/eex/injections.scm b/queries/eex/injections.scm index 9331f5925..f13d3c14e 100644 --- a/queries/eex/injections.scm +++ b/queries/eex/injections.scm @@ -1,8 +1,8 @@ ; EEx expressions are Elixir -((expression) @injection.content - (#set! injection.language "elixir")) +((expression) @injection.content + (#set! injection.language "elixir")) ; EEx expressions can span multiple interpolated lines ((partial_expression) @injection.content - (#set! injection.language "elixir") - (#set! injection.combined)) + (#set! injection.language "elixir") + (#set! injection.combined)) diff --git a/queries/elixir/highlights.scm b/queries/elixir/highlights.scm index 5a9297fc7..57e299b17 100644 --- a/queries/elixir/highlights.scm +++ b/queries/elixir/highlights.scm @@ -15,15 +15,14 @@ "}" ] @punctuation.bracket -[ - "%" -] @punctuation.special +"%" @punctuation.special ; Identifiers (identifier) @variable ; Unused Identifiers -((identifier) @comment (#lua-match? @comment "^_")) +((identifier) @comment + (#lua-match? @comment "^_")) ; Comments (comment) @comment @spell @@ -43,7 +42,11 @@ ] @string.special.symbol ; Interpolation -(interpolation ["#{" "}"] @string.special) +(interpolation + [ + "#{" + "}" + ] @string.special) ; Escape sequences (escape_sequence) @string.escape @@ -69,82 +72,65 @@ ; Operators (operator_identifier) @operator -(unary_operator operator: _ @operator) +(unary_operator + operator: _ @operator) -(binary_operator operator: _ @operator) +(binary_operator + operator: _ @operator) ; Pipe Operator -(binary_operator operator: "|>" right: (identifier) @function) +(binary_operator + operator: "|>" + right: (identifier) @function) -(dot operator: _ @operator) +(dot + operator: _ @operator) -(stab_clause operator: _ @operator) +(stab_clause + operator: _ @operator) ; Local Function Calls -(call target: (identifier) @function.call) +(call + target: (identifier) @function.call) ; Remote Function Calls -(call target: (dot left: [ - (atom) @type - (_) -] right: (identifier) @function.call) (arguments)) +(call + target: + (dot + left: + [ + (atom) @type + (_) + ] + right: (identifier) @function.call) + (arguments)) ; Definition Function Calls -(call target: ((identifier) @keyword.function (#any-of? @keyword.function - "def" - "defdelegate" - "defexception" - "defguard" - "defguardp" - "defimpl" - "defmacro" - "defmacrop" - "defmodule" - "defn" - "defnp" - "defoverridable" - "defp" - "defprotocol" - "defstruct" - )) - (arguments [ - (call (identifier) @function) - (identifier) @function - (binary_operator left: (call target: (identifier) @function) operator: "when")])?) +(call + target: + ((identifier) @keyword.function + (#any-of? @keyword.function "def" "defdelegate" "defexception" "defguard" "defguardp" "defimpl" "defmacro" "defmacrop" "defmodule" "defn" "defnp" "defoverridable" "defp" "defprotocol" "defstruct")) + (arguments + [ + (call + (identifier) @function) + (identifier) @function + (binary_operator + left: + (call + target: (identifier) @function) + operator: "when") + ])?) ; Kernel Keywords & Special Forms -(call target: ((identifier) @keyword (#any-of? @keyword - "alias" - "case" - "catch" - "cond" - "else" - "for" - "if" - "import" - "quote" - "raise" - "receive" - "require" - "reraise" - "super" - "throw" - "try" - "unless" - "unquote" - "unquote_splicing" - "use" - "with" -))) +(call + target: + ((identifier) @keyword + (#any-of? @keyword "alias" "case" "catch" "cond" "else" "for" "if" "import" "quote" "raise" "receive" "require" "reraise" "super" "throw" "try" "unless" "unquote" "unquote_splicing" "use" "with"))) ; Special Constants -((identifier) @constant.builtin (#any-of? @constant.builtin - "__CALLER__" - "__DIR__" - "__ENV__" - "__MODULE__" - "__STACKTRACE__" -)) +((identifier) @constant.builtin + (#any-of? @constant.builtin "__CALLER__" "__DIR__" "__ENV__" "__MODULE__" "__STACKTRACE__")) ; Reserved Keywords [ @@ -170,14 +156,22 @@ ; Capture Operator (unary_operator operator: "&" - operand: [ - (integer) @operator - (binary_operator - left: [ - (call target: (dot left: (_) right: (identifier) @function)) - (identifier) @function - ] operator: "/" right: (integer) @operator) - ]) + operand: + [ + (integer) @operator + (binary_operator + left: + [ + (call + target: + (dot + left: (_) + right: (identifier) @function)) + (identifier) @function + ] + operator: "/" + right: (integer) @operator) + ]) ; Non-String Sigils (sigil @@ -201,24 +195,30 @@ ; Module attributes (unary_operator operator: "@" - operand: [ - (identifier) - (call target: (identifier)) - ] @constant) @constant + operand: + [ + (identifier) + (call + target: (identifier)) + ] @constant) @constant ; Documentation (unary_operator operator: "@" - operand: (call - target: ((identifier) @_identifier (#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc")) @comment.documentation - (arguments [ - (string) - (boolean) - (charlist) - (sigil - "~" @comment.documentation - ((sigil_name) @comment.documentation) - quoted_start: _ @comment.documentation - (quoted_content) @comment.documentation - quoted_end: _ @comment.documentation) - ] @comment.documentation))) @comment.documentation + operand: + (call + target: + ((identifier) @_identifier + (#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc")) @comment.documentation + (arguments + [ + (string) + (boolean) + (charlist) + (sigil + "~" @comment.documentation + ((sigil_name) @comment.documentation) + quoted_start: _ @comment.documentation + (quoted_content) @comment.documentation + quoted_end: _ @comment.documentation) + ] @comment.documentation))) @comment.documentation diff --git a/queries/elixir/indents.scm b/queries/elixir/indents.scm index 0ba8fd442..5470b6422 100644 --- a/queries/elixir/indents.scm +++ b/queries/elixir/indents.scm @@ -20,4 +20,6 @@ ] @indent.end @indent.branch ; Elixir pipelines are not indented, but other binary operator chains are -((binary_operator operator: _ @_operator) @indent.begin (#not-eq? @_operator "|>")) +((binary_operator + operator: _ @_operator) @indent.begin + (#not-eq? @_operator "|>")) diff --git a/queries/elixir/injections.scm b/queries/elixir/injections.scm index 1f0b31f07..b580f2ea6 100644 --- a/queries/elixir/injections.scm +++ b/queries/elixir/injections.scm @@ -1,56 +1,61 @@ ; Comments -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) ; Documentation (unary_operator operator: "@" - operand: (call - target: ((identifier) @_identifier (#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc")) - (arguments [ - (string (quoted_content) @injection.content) - (sigil (quoted_content) @injection.content) - ]) - (#set! injection.language "markdown"))) + operand: + (call + target: + ((identifier) @_identifier + (#any-of? @_identifier "moduledoc" "typedoc" "shortdoc" "doc")) + (arguments + [ + (string + (quoted_content) @injection.content) + (sigil + (quoted_content) @injection.content) + ]) + (#set! injection.language "markdown"))) ; HEEx (sigil (sigil_name) @_sigil_name (quoted_content) @injection.content - (#eq? @_sigil_name "H") - (#set! injection.language "heex")) + (#eq? @_sigil_name "H") + (#set! injection.language "heex")) ; Surface (sigil (sigil_name) @_sigil_name (quoted_content) @injection.content - (#eq? @_sigil_name "F") - (#set! injection.language "surface")) + (#eq? @_sigil_name "F") + (#set! injection.language "surface")) ; Zigler (sigil (sigil_name) @_sigil_name (quoted_content) @injection.content - (#any-of? @_sigil_name "E" "L") - (#set! injection.language "eex")) + (#any-of? @_sigil_name "E" "L") + (#set! injection.language "eex")) (sigil (sigil_name) @_sigil_name (quoted_content) @injection.content - (#any-of? @_sigil_name "z" "Z") - (#set! injection.language "zig")) + (#any-of? @_sigil_name "z" "Z") + (#set! injection.language "zig")) ; Regex (sigil (sigil_name) @_sigil_name (quoted_content) @injection.content - (#any-of? @_sigil_name "r" "R") - (#set! injection.language "regex")) + (#any-of? @_sigil_name "r" "R") + (#set! injection.language "regex")) ; Json (sigil (sigil_name) @_sigil_name (quoted_content) @injection.content - (#any-of? @_sigil_name "j" "J") - (#set! injection.language "json")) - + (#any-of? @_sigil_name "j" "J") + (#set! injection.language "json")) diff --git a/queries/elixir/locals.scm b/queries/elixir/locals.scm index 59e55eae0..003ec4b1b 100644 --- a/queries/elixir/locals.scm +++ b/queries/elixir/locals.scm @@ -5,7 +5,7 @@ ; Module Definitions (call - target: + target: ((identifier) @_identifier (#eq? @_identifier "defmodule")) (arguments diff --git a/queries/elm/highlights.scm b/queries/elm/highlights.scm index 11bc0a00d..86351fe60 100644 --- a/queries/elm/highlights.scm +++ b/queries/elm/highlights.scm @@ -6,10 +6,8 @@ ((block_comment) @comment.documentation (#lua-match? @comment.documentation "^{[-]|[^|]")) - ; Keywords ;--------- - [ "if" "then" @@ -34,13 +32,9 @@ (exposing) ] @keyword.import - ; Punctuation ;------------ - -[ - (double_dot) -] @punctuation.special +(double_dot) @punctuation.special [ "," @@ -57,71 +51,89 @@ "]" ] @punctuation.bracket - ; Variables ;---------- - (value_qid (lower_case_identifier) @variable) + (value_declaration - (function_declaration_left (lower_case_identifier) @variable)) + (function_declaration_left + (lower_case_identifier) @variable)) + (type_annotation (lower_case_identifier) @variable) + (port_annotation (lower_case_identifier) @variable) + (anything_pattern (underscore) @variable) + (record_base_identifier (lower_case_identifier) @variable) + (lower_pattern (lower_case_identifier) @variable) + (exposed_value (lower_case_identifier) @variable) (value_qid - ((dot) (lower_case_identifier) @variable.member)) + ((dot) + (lower_case_identifier) @variable.member)) + (field_access_expr - ((dot) (lower_case_identifier) @variable.member)) + ((dot) + (lower_case_identifier) @variable.member)) (function_declaration_left - (anything_pattern (underscore) @variable.parameter)) -(function_declaration_left - (lower_pattern (lower_case_identifier) @variable.parameter)) + (anything_pattern + (underscore) @variable.parameter)) +(function_declaration_left + (lower_pattern + (lower_case_identifier) @variable.parameter)) ; Functions ;---------- - (value_declaration functionDeclarationLeft: (function_declaration_left (lower_case_identifier) @function (pattern))) + (value_declaration functionDeclarationLeft: (function_declaration_left (lower_case_identifier) @function pattern: (_))) + (value_declaration functionDeclarationLeft: (function_declaration_left (lower_case_identifier) @function) body: (anonymous_function_expr)) + (type_annotation name: (lower_case_identifier) @function - typeExpression: (type_expression (arrow))) + typeExpression: + (type_expression + (arrow))) + (port_annotation name: (lower_case_identifier) @function - typeExpression: (type_expression (arrow))) + typeExpression: + (type_expression + (arrow))) (function_call_expr - target: (value_expr - (value_qid (lower_case_identifier) @function.call))) - + target: + (value_expr + (value_qid + (lower_case_identifier) @function.call))) ; Operators ;---------- - [ (operator_identifier) (eq) @@ -131,31 +143,38 @@ "::" ] @operator - ; Modules ;-------- - (module_declaration - (upper_case_qid (upper_case_identifier) @module)) + (upper_case_qid + (upper_case_identifier) @module)) + (import_clause - (upper_case_qid (upper_case_identifier) @module)) + (upper_case_qid + (upper_case_identifier) @module)) + (as_clause (upper_case_identifier) @module) -(value_expr - (value_qid (upper_case_identifier) @module)) +(value_expr + (value_qid + (upper_case_identifier) @module)) ; Types ;------ - (type_declaration (upper_case_identifier) @type) + (type_ref - (upper_case_qid (upper_case_identifier) @type)) + (upper_case_qid + (upper_case_identifier) @type)) + (type_variable (lower_case_identifier) @type) + (lower_type_name (lower_case_identifier) @type) + (exposed_type (upper_case_identifier) @type) @@ -164,34 +183,43 @@ (field_type name: (lower_case_identifier) @property) + (field name: (lower_case_identifier) @property) (type_declaration - (union_variant (upper_case_identifier) @constructor)) + (union_variant + (upper_case_identifier) @constructor)) + (nullary_constructor_argument_pattern - (upper_case_qid (upper_case_identifier) @constructor)) + (upper_case_qid + (upper_case_identifier) @constructor)) + (union_pattern - (upper_case_qid (upper_case_identifier) @constructor)) -(value_expr - (upper_case_qid (upper_case_identifier)) @constructor) + (upper_case_qid + (upper_case_identifier) @constructor)) +(value_expr + (upper_case_qid + (upper_case_identifier)) @constructor) ; Literals ;--------- - (number_constant_expr (number_literal) @number) (upper_case_qid - ((upper_case_identifier) @boolean (#any-of? @boolean "True" "False"))) + ((upper_case_identifier) @boolean + (#any-of? @boolean "True" "False"))) [ (open_quote) (close_quote) ] @string + (string_constant_expr (string_escape) @string) + (string_constant_expr (regular_string_part) @string) @@ -199,7 +227,9 @@ (open_char) (close_char) ] @character + (char_constant_expr (string_escape) @character) + (char_constant_expr (regular_string_part) @character) diff --git a/queries/elm/injections.scm b/queries/elm/injections.scm index b8b3e9943..7ee6c7f03 100644 --- a/queries/elm/injections.scm +++ b/queries/elm/injections.scm @@ -1,8 +1,8 @@ ([ - (line_comment) + (line_comment) (block_comment) - ] @injection.content - (#set! injection.language "comment")) +] @injection.content + (#set! injection.language "comment")) ((glsl_content) @injection.content - (#set! injection.language "glsl")) + (#set! injection.language "glsl")) diff --git a/queries/elsa/highlights.scm b/queries/elsa/highlights.scm index 8e52b6f5b..1a974bda6 100644 --- a/queries/elsa/highlights.scm +++ b/queries/elsa/highlights.scm @@ -1,28 +1,22 @@ ; Keywords - [ "eval" "let" ] @keyword ; Function - (function) @function ; Method - (method) @function.method ; Parameter - (parameter) @variable.parameter ; Variables - (identifier) @variable ; Operators - [ "\\" "->" @@ -31,11 +25,12 @@ ] @operator ; Punctuation - -["(" ")"] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket ":" @punctuation.delimiter ; Comments - (comment) @comment @spell diff --git a/queries/elsa/injections.scm b/queries/elsa/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/elsa/injections.scm +++ b/queries/elsa/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/elvish/highlights.scm b/queries/elvish/highlights.scm index d6243549f..a2fd9302c 100644 --- a/queries/elvish/highlights.scm +++ b/queries/elvish/highlights.scm @@ -1,32 +1,90 @@ (comment) @comment @spell -["if" "elif"] @keyword.conditional -(if (else "else" @keyword.conditional)) +[ + "if" + "elif" +] @keyword.conditional + +(if + (else + "else" @keyword.conditional)) + +[ + "while" + "for" +] @keyword.repeat -["while" "for"] @keyword.repeat -(while (else "else" @keyword.repeat)) -(for (else "else" @keyword.repeat)) +(while + (else + "else" @keyword.repeat)) + +(for + (else + "else" @keyword.repeat)) + +[ + "try" + "catch" + "finally" +] @keyword.exception -["try" "catch" "finally"] @keyword.exception -(try (else "else" @keyword.exception)) +(try + (else + "else" @keyword.exception)) "use" @keyword.import -(import (bareword) @string.special.path) -(wildcard ["*" "**" "?"] @character.special) +(import + (bareword) @string.special.path) + +(wildcard + [ + "*" + "**" + "?" + ] @character.special) + +(command + argument: (bareword) @variable.parameter) + +(command + head: (identifier) @function.call) + +((command + head: (identifier) @keyword.return) + (#eq? @keyword.return "return")) + +((command + (identifier) @keyword.operator) + (#any-of? @keyword.operator "and" "or" "coalesce")) -(command argument: (bareword) @variable.parameter) -(command head: (identifier) @function.call) -((command head: (identifier) @keyword.return) - (#eq? @keyword.return "return")) -((command (identifier) @keyword.operator) - (#any-of? @keyword.operator "and" "or" "coalesce")) [ - "+" "-" "*" "/" "%" "<" "<=""==" "!=" ">" - ">=" "s" ">=s" + "+" + "-" + "*" + "/" + "%" + "<" + "<=" + "==" + "!=" + ">" + ">=" + "s" + ">=s" ] @function.builtin -[">" "<" ">>" "<>" "|"] @operator +[ + ">" + "<" + ">>" + "<>" + "|" +] @operator (io_port) @number @@ -35,36 +93,63 @@ (identifier) @function) (parameter_list) @variable.parameter -(parameter_list "|" @punctuation.bracket) -["var" "set" "tmp" "del"] @keyword +(parameter_list + "|" @punctuation.bracket) + +[ + "var" + "set" + "tmp" + "del" +] @keyword + (variable_declaration - (lhs (identifier) @variable)) + (lhs + (identifier) @variable)) (variable_assignment - (lhs (identifier) @variable)) + (lhs + (identifier) @variable)) (temporary_assignment - (lhs (identifier) @variable)) + (lhs + (identifier) @variable)) (variable_deletion (identifier) @variable) - (number) @number + (string) @string -(variable (identifier) @variable) -((variable (identifier) @function) +(variable + (identifier) @variable) + +((variable + (identifier) @function) (#match? @function ".+\\~$")) -((variable (identifier) @boolean) - (#any-of? @boolean "true" "false")) -((variable (identifier) @constant.builtin) - (#any-of? @constant.builtin - "_" "after-chdir" "args" "before-chdir" "buildinfo" "nil" - "notify-bg-job-success" "num-bg-jobs" "ok" "paths" "pid" - "pwd" "value-out-indicator" "version")) - -["$" "@"] @punctuation.special -["(" ")" "[" "]" "{" "}"] @punctuation.bracket + +((variable + (identifier) @boolean) + (#any-of? @boolean "true" "false")) + +((variable + (identifier) @constant.builtin) + (#any-of? @constant.builtin "_" "after-chdir" "args" "before-chdir" "buildinfo" "nil" "notify-bg-job-success" "num-bg-jobs" "ok" "paths" "pid" "pwd" "value-out-indicator" "version")) + +[ + "$" + "@" +] @punctuation.special + +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket + ";" @punctuation.delimiter diff --git a/queries/elvish/injections.scm b/queries/elvish/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/elvish/injections.scm +++ b/queries/elvish/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/embedded_template/injections.scm b/queries/embedded_template/injections.scm index 2824f7a00..cdeb2cd4f 100644 --- a/queries/embedded_template/injections.scm +++ b/queries/embedded_template/injections.scm @@ -1,7 +1,7 @@ ((content) @injection.content - (#set! injection.language "html") - (#set! injection.combined)) + (#set! injection.language "html") + (#set! injection.combined)) ((code) @injection.content - (#set! injection.language "ruby") - (#set! injection.combined)) + (#set! injection.language "ruby") + (#set! injection.combined)) diff --git a/queries/erlang/highlights.scm b/queries/erlang/highlights.scm index da0d1e600..1b9aeaf4e 100644 --- a/queries/erlang/highlights.scm +++ b/queries/erlang/highlights.scm @@ -1,8 +1,12 @@ -((atom) @constant (#set! "priority" "90")) +((atom) @constant + (#set! "priority" "90")) + (var) @variable (char) @character + (integer) @number + (float) @number.float (comment) @comment @spell @@ -10,13 +14,13 @@ ((comment) @comment.documentation (#lua-match? @comment.documentation "^[%%][%%]")) -;; keyword +; keyword [ "fun" "div" ] @keyword -;; bracket +; bracket [ "(" ")" @@ -27,7 +31,7 @@ "#" ] @punctuation.bracket -;;; Comparisons +; Comparisons [ "==" "=:=" @@ -36,14 +40,14 @@ ">=" "<" ">" -] @operator ;; .comparison +] @operator ; .comparison -;;; operator +; operator [ ":" ":=" "!" - ;; "-" + ; "-" "+" "=" "->" @@ -58,7 +62,7 @@ ";" ] @punctuation.delimiter -;; conditional +; conditional [ "receive" "if" @@ -77,54 +81,108 @@ "try" ] @keyword.exception -((atom) @boolean (#any-of? @boolean "true" "false")) +((atom) @boolean + (#any-of? @boolean "true" "false")) -;; Macros -((macro_call_expr) @constant.macro (#set! "priority" 101)) +; Macros +((macro_call_expr) @constant.macro + (#set! "priority" 101)) -;; Preprocessor +; Preprocessor (pp_define - lhs: _ @constant.macro (#set! "priority" 101) -) -(_preprocessor_directive) @keyword.directive (#set! "priority" 99) + lhs: _ @constant.macro + (#set! "priority" 101)) + +(_preprocessor_directive) @keyword.directive +(#set! "priority" 99) -;; Attributes +; Attributes (pp_include) @keyword.import + (pp_include_lib) @keyword.import + (export_attribute) @keyword.import + (export_type_attribute) @type.definition -(export_type_attribute types: (fa fun: _ @type (#set! "priority" 101))) + +(export_type_attribute + types: + (fa + fun: _ @type + (#set! "priority" 101))) + (behaviour_attribute) @keyword.import -(module_attribute (atom) @module) @keyword.import -(wild_attribute name: (attr_name name: _ @attribute)) @attribute -;; Records +(module_attribute + (atom) @module) @keyword.import + +(wild_attribute + name: + (attr_name + name: _ @attribute)) @attribute + +; Records (record_expr) @type -(record_field_expr _ @variable.member) @type -(record_field_name _ @variable.member) @type -(record_name "#" @type name: _ @type) @type -(record_decl name: _ @type) @type.definition -(record_field name: _ @variable.member) -(record_field name: _ @variable.member ty: _ @type) - -;; Type alias -(type_alias name: _ @type) @type.definition + +(record_field_expr + _ @variable.member) @type + +(record_field_name + _ @variable.member) @type + +(record_name + "#" @type + name: _ @type) @type + +(record_decl + name: _ @type) @type.definition + +(record_field + name: _ @variable.member) + +(record_field + name: _ @variable.member + ty: _ @type) + +; Type alias +(type_alias + name: _ @type) @type.definition + (spec) @type.definition -[(string) (binary)] @string +[ + (string) + (binary) +] @string + +; expr_function_call +(call + expr: + [ + (atom) + (remote) + (var) + ] @function) -;;; expr_function_call -(call expr: [(atom) (remote) (var)] @function) -(call (atom) @keyword.exception (#any-of? @keyword.exception "error" "throw" "exit")) +(call + (atom) @keyword.exception + (#any-of? @keyword.exception "error" "throw" "exit")) -;;; Parenthesized expression: (SomeFunc)(), only highlight the parens +; Parenthesized expression: (SomeFunc)(), only highlight the parens (call - expr: (paren_expr "(" @function.call ")" @function.call) -) + expr: + (paren_expr + "(" @function.call + ")" @function.call)) -;;; function +; function (external_fun) @function.call -(internal_fun fun: (atom) @function.call) -(function_clause name: (atom) @function) -(fa fun: (atom) @function) +(internal_fun + fun: (atom) @function.call) + +(function_clause + name: (atom) @function) + +(fa + fun: (atom) @function) diff --git a/queries/facility/highlights.scm b/queries/facility/highlights.scm index 060ccd05c..01f1bab19 100644 --- a/queries/facility/highlights.scm +++ b/queries/facility/highlights.scm @@ -11,9 +11,10 @@ "]" "{" "}" -] @punctuation.bracket +] @punctuation.bracket (comment) @comment @spell + (doc_comment) @comment.documentation @spell "method" @keyword.function @@ -78,4 +79,5 @@ name: (identifier) @function.method) (number_literal) @number + (string_literal) @string diff --git a/queries/facility/indents.scm b/queries/facility/indents.scm index 96a24f202..247949ba1 100644 --- a/queries/facility/indents.scm +++ b/queries/facility/indents.scm @@ -1,8 +1,7 @@ [ - (service_block) - (values_block) - (field_list) + (service_block) + (values_block) + (field_list) ] @indent.begin "}" @indent.branch - diff --git a/queries/facility/injections.scm b/queries/facility/injections.scm index 572849ab4..5d9b7836f 100644 --- a/queries/facility/injections.scm +++ b/queries/facility/injections.scm @@ -1,5 +1,8 @@ ((remarks) @injection.content (#set! injection.language "markdown")) -([(comment) (doc_comment)] @injection.content +([ + (comment) + (doc_comment) +] @injection.content (#set! injection.language "comment")) diff --git a/queries/fennel/folds.scm b/queries/fennel/folds.scm index c8427b188..619300c4f 100644 --- a/queries/fennel/folds.scm +++ b/queries/fennel/folds.scm @@ -1 +1,11 @@ -[(list) (table) (sequential_table) (let) (fn) (let_clause) (quoted_list) (local) (global)] @fold +[ + (list) + (table) + (sequential_table) + (let) + (fn) + (let_clause) + (quoted_list) + (local) + (global) +] @fold diff --git a/queries/fennel/highlights.scm b/queries/fennel/highlights.scm index 620c42ef3..ec2a82759 100644 --- a/queries/fennel/highlights.scm +++ b/queries/fennel/highlights.scm @@ -18,29 +18,38 @@ ] @punctuation.special (nil) @constant.builtin + (vararg) @punctuation.special (boolean) @boolean + (number) @number (string) @string + (escape_sequence) @string.escape (symbol) @variable (multi_symbol - "." @punctuation.delimiter - (symbol) @variable.member) + "." @punctuation.delimiter + (symbol) @variable.member) (multi_symbol_method - ":" @punctuation.delimiter - (symbol) @function.method.call .) + ":" @punctuation.delimiter + (symbol) @function.method.call .) -(list . (symbol) @function.call) -(list . (multi_symbol (symbol) @function.call .)) +(list + . + (symbol) @function.call) + +(list + . + (multi_symbol + (symbol) @function.call .)) ((symbol) @variable.builtin - (#lua-match? @variable.builtin "^[$]")) + (#lua-match? @variable.builtin "^[$]")) (binding) @string.special.symbol @@ -51,30 +60,34 @@ "#" ] @keyword.function -(fn name: [ - (symbol) @function - (multi_symbol (symbol) @function .) -]) - -(lambda name: [ - (symbol) @function - (multi_symbol (symbol) @function .) -]) +(fn + name: + [ + (symbol) @function + (multi_symbol + (symbol) @function .) + ]) + +(lambda + name: + [ + (symbol) @function + (multi_symbol + (symbol) @function .) + ]) [ "for" "each" ] @keyword.repeat + ((symbol) @keyword.repeat - (#any-of? @keyword.repeat - "while")) + (#any-of? @keyword.repeat "while")) + +"match" @keyword.conditional -[ - "match" -] @keyword.conditional ((symbol) @keyword.conditional - (#any-of? @keyword.conditional - "if" "when")) + (#any-of? @keyword.conditional "if" "when")) [ "global" @@ -85,13 +98,12 @@ "where" "or" ] @keyword + ((symbol) @keyword - (#any-of? @keyword - "comment" "do" "doc" "eval-compiler" "lua" "macros" "quote" "tset" "values")) + (#any-of? @keyword "comment" "do" "doc" "eval-compiler" "lua" "macros" "quote" "tset" "values")) ((symbol) @keyword.import - (#any-of? @keyword.import - "require" "require-macros" "import-macros" "include")) + (#any-of? @keyword.import "require" "require-macros" "import-macros" "include")) [ "collect" @@ -100,22 +112,14 @@ ] @function.macro ((symbol) @function.macro - (#any-of? @function.macro - "->" "->>" "-?>" "-?>>" "?." "doto" "macro" "macrodebug" "partial" "pick-args" - "pick-values" "with-open")) + (#any-of? @function.macro "->" "->>" "-?>" "-?>>" "?." "doto" "macro" "macrodebug" "partial" "pick-args" "pick-values" "with-open")) ; Lua builtins ((symbol) @constant.builtin - (#any-of? @constant.builtin - "arg" "_ENV" "_G" "_VERSION")) + (#any-of? @constant.builtin "arg" "_ENV" "_G" "_VERSION")) ((symbol) @function.builtin - (#any-of? @function.builtin - "assert" "collectgarbage" "dofile" "error" "getmetatable" "ipairs" - "load" "loadfile" "next" "pairs" "pcall" "print" "rawequal" "rawget" - "rawlen" "rawset" "require" "select" "setmetatable" "tonumber" "tostring" - "type" "warn" "xpcall")) + (#any-of? @function.builtin "assert" "collectgarbage" "dofile" "error" "getmetatable" "ipairs" "load" "loadfile" "next" "pairs" "pcall" "print" "rawequal" "rawget" "rawlen" "rawset" "require" "select" "setmetatable" "tonumber" "tostring" "type" "warn" "xpcall")) ((symbol) @function.builtin - (#any-of? @function.builtin - "loadstring" "module" "setfenv" "unpack")) + (#any-of? @function.builtin "loadstring" "module" "setfenv" "unpack")) diff --git a/queries/fennel/injections.scm b/queries/fennel/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/fennel/injections.scm +++ b/queries/fennel/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/fennel/locals.scm b/queries/fennel/locals.scm index 38e54bf6d..bf3701a50 100644 --- a/queries/fennel/locals.scm +++ b/queries/fennel/locals.scm @@ -1,26 +1,32 @@ [ - (program) - (fn) - (lambda) - (let) - (each) - (for) - (match) + (program) + (fn) + (lambda) + (let) + (each) + (for) + (match) ] @local.scope -( - (list . (symbol) @_special) @local.scope - (#any-of? @_special - "while" "if" "when" "do" "collect" "icollect" "accumulate") -) +((list + . + (symbol) @_special) @local.scope + (#any-of? @_special "while" "if" "when" "do" "collect" "icollect" "accumulate")) -(fn name: (symbol) @local.definition.function +(fn + name: (symbol) @local.definition.function (#set! definition.function.scope "parent")) -(lambda name: (symbol) @local.definition.function + +(lambda + name: (symbol) @local.definition.function (#set! definition.function.scope "parent")) ; TODO: use @local.definition.parameter for parameters -(binding (symbol) @local.definition.var) -(for_clause . (symbol) @local.definition.var) +(binding + (symbol) @local.definition.var) + +(for_clause + . + (symbol) @local.definition.var) (symbol) @local.reference diff --git a/queries/firrtl/folds.scm b/queries/firrtl/folds.scm index 437b2c81c..4c64e644f 100644 --- a/queries/firrtl/folds.scm +++ b/queries/firrtl/folds.scm @@ -1,6 +1,6 @@ [ - (circuit) - (module) - (when) - (else) + (circuit) + (module) + (when) + (else) ] @fold diff --git a/queries/firrtl/highlights.scm b/queries/firrtl/highlights.scm index 5f165eb32..8e078fad2 100644 --- a/queries/firrtl/highlights.scm +++ b/queries/firrtl/highlights.scm @@ -1,30 +1,26 @@ ; Namespaces +(circuit + (identifier) @module) -(circuit (identifier) @module) - -(module (identifier) @module) +(module + (identifier) @module) ; Types - ((identifier) @type (#lua-match? @type "^[A-Z][A-Za-z0-9_$]*$")) ; Keywords - [ "circuit" "module" "extmodule" - "flip" "parameter" "reset" "wire" - "cmem" "smem" "mem" - "reg" "with" "mport" @@ -34,39 +30,32 @@ "is" "invalid" "skip" - "infer" "read" "write" "rdwr" - "defname" ] @keyword ; Qualifiers - (qualifier) @type.qualifier ; Storageclasses - [ "input" "output" ] @keyword.storage ; Conditionals - [ "when" "else" ] @keyword.conditional ; Annotations - (info) @attribute ; Builtins - [ "stop" "printf" @@ -89,7 +78,6 @@ ] @type.builtin ; Fields - [ "data-type" "depth" @@ -104,33 +92,44 @@ ((field_id) @variable.member (#set! "priority" 105)) -(port (identifier) @variable.member) +(port + (identifier) @variable.member) -(wire (identifier) @variable.member) +(wire + (identifier) @variable.member) -(cmem (identifier) @variable.member) +(cmem + (identifier) @variable.member) -(smem (identifier) @variable.member) +(smem + (identifier) @variable.member) -(memory (identifier) @variable.member) +(memory + (identifier) @variable.member) -(register (identifier) @variable.member) +(register + (identifier) @variable.member) ; Parameters +(primitive_operation + (identifier) @variable.parameter) -(primitive_operation (identifier) @variable.parameter) +(mux + (identifier) @variable.parameter) -(mux (identifier) @variable.parameter) -(printf (identifier) @variable.parameter) -(reset (identifier) @variable.parameter) -(stop (identifier) @variable.parameter) +(printf + (identifier) @variable.parameter) -; Variables +(reset + (identifier) @variable.parameter) +(stop + (identifier) @variable.parameter) + +; Variables (identifier) @variable ; Operators - (primop) @keyword.operator [ @@ -143,7 +142,6 @@ ] @operator ; Literals - [ (uint) (number) @@ -164,14 +162,25 @@ ] @constant.builtin ; Punctuation +[ + "{" + "}" +] @punctuation.bracket -[ "{" "}" ] @punctuation.bracket - -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -[ "<" ">" ] @punctuation.bracket +[ + "<" + ">" +] @punctuation.bracket -[ "(" ")" ] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket [ "," @@ -180,7 +189,10 @@ ] @punctuation.delimiter ; Comments - (comment) @comment @spell -["=>" "<=" "="] @operator +[ + "=>" + "<=" + "=" +] @operator diff --git a/queries/firrtl/indents.scm b/queries/firrtl/indents.scm index 8bc1e2019..e172e1e81 100644 --- a/queries/firrtl/indents.scm +++ b/queries/firrtl/indents.scm @@ -1,9 +1,9 @@ [ - (circuit) - (module) - (memory) - (when) - (else) + (circuit) + (module) + (memory) + (when) + (else) ] @indent.begin [ diff --git a/queries/firrtl/injections.scm b/queries/firrtl/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/firrtl/injections.scm +++ b/queries/firrtl/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/firrtl/locals.scm b/queries/firrtl/locals.scm index aa0e294cd..97b7931bf 100644 --- a/queries/firrtl/locals.scm +++ b/queries/firrtl/locals.scm @@ -1,38 +1,45 @@ ; Scopes - [ (source_file) (circuit) (module) - (else) (when) ] @local.scope ; References - (identifier) @local.reference ; Definitions +(port + (identifier) @local.definition.field) -(port (identifier) @local.definition.field) - -(wire (identifier) @local.definition.field) +(wire + (identifier) @local.definition.field) -(cmem (identifier) @local.definition.field) +(cmem + (identifier) @local.definition.field) -(smem (identifier) @local.definition.field) +(smem + (identifier) @local.definition.field) -(memory (identifier) @local.definition.field) +(memory + (identifier) @local.definition.field) -(register (identifier) @local.definition.field) +(register + (identifier) @local.definition.field) -(circuit (identifier) @local.definition.namespace) +(circuit + (identifier) @local.definition.namespace) -(module (identifier) @local.definition.namespace) +(module + (identifier) @local.definition.namespace) -(parameter (identifier) @local.definition.parameter) +(parameter + (identifier) @local.definition.parameter) -(rdwr (identifier) @local.definition.var) +(rdwr + (identifier) @local.definition.var) -(node (identifier) @local.definition.var) +(node + (identifier) @local.definition.var) diff --git a/queries/fish/folds.scm b/queries/fish/folds.scm index 6075e2e04..06363e15e 100644 --- a/queries/fish/folds.scm +++ b/queries/fish/folds.scm @@ -1,8 +1,8 @@ [ - (function_definition) - (if_statement) - (switch_statement) - (for_statement) - (while_statement) - (begin_statement) + (function_definition) + (if_statement) + (switch_statement) + (for_statement) + (while_statement) + (begin_statement) ] @fold diff --git a/queries/fish/highlights.scm b/queries/fish/highlights.scm index 28ddf0b98..77dccbf89 100644 --- a/queries/fish/highlights.scm +++ b/queries/fish/highlights.scm @@ -1,163 +1,174 @@ -;; Fish highlighting - -;; Operators - +; Fish highlighting +; Operators [ - "&&" - "||" - "|" - "&" - ".." - "!" - (direction) - (stream_redirect) + "&&" + "||" + "|" + "&" + ".." + "!" + (direction) + (stream_redirect) ] @operator -;; match operators of test command +; match operators of test command (command - name: (word) @function.builtin (#eq? @function.builtin "test") - argument: (word) @operator (#match? @operator "^(!?\\=|-[a-zA-Z]+)$")) + name: (word) @function.builtin + (#eq? @function.builtin "test") + argument: (word) @operator + (#match? @operator "^(!?\\=|-[a-zA-Z]+)$")) -;; match operators of [ command +; match operators of [ command (command - name: (word) @punctuation.bracket (#eq? @punctuation.bracket "[") - argument: (word) @operator (#match? @operator "^(!?\\=|-[a-zA-Z]+)$")) + name: (word) @punctuation.bracket + (#eq? @punctuation.bracket "[") + argument: (word) @operator + (#match? @operator "^(!?\\=|-[a-zA-Z]+)$")) [ - "not" - "and" - "or" + "not" + "and" + "or" ] @keyword.operator -;; Conditionals - +; Conditionals (if_statement -[ - "if" - "end" -] @keyword.conditional) + [ + "if" + "end" + ] @keyword.conditional) (switch_statement -[ - "switch" - "end" -] @keyword.conditional) + [ + "switch" + "end" + ] @keyword.conditional) (case_clause -[ - "case" -] @keyword.conditional) + "case" @keyword.conditional) -(else_clause -[ - "else" -] @keyword.conditional) - -(else_if_clause -[ - "else" - "if" -] @keyword.conditional) +(else_clause + "else" @keyword.conditional) -;; Loops/Blocks +(else_if_clause + [ + "else" + "if" + ] @keyword.conditional) +; Loops/Blocks (while_statement -[ - "while" - "end" -] @keyword.repeat) + [ + "while" + "end" + ] @keyword.repeat) (for_statement -[ - "for" - "end" -] @keyword.repeat) + [ + "for" + "end" + ] @keyword.repeat) (begin_statement -[ - "begin" - "end" -] @keyword.repeat) - -;; Keywords + [ + "begin" + "end" + ] @keyword.repeat) +; Keywords [ - "in" - (break) - (continue) + "in" + (break) + (continue) ] @keyword "return" @keyword.return -;; Punctuation - +; Punctuation [ - "[" - "]" - "{" - "}" - "(" - ")" + "[" + "]" + "{" + "}" + "(" + ")" ] @punctuation.bracket "," @punctuation.delimiter -;; Commands - +; Commands (command - argument: [ - (word) @variable.parameter (#lua-match? @variable.parameter "^[-]") - ] -) + argument: + [ + (word) @variable.parameter + (#lua-match? @variable.parameter "^[-]") + ]) -(command_substitution "$" @punctuation.bracket) +(command_substitution + "$" @punctuation.bracket) ; non-builtin command names -(command name: (word) @function.call) +(command + name: (word) @function.call) ; derived from builtin -n (fish 3.2.2) (command - name: [ - (word) @function.builtin - (#any-of? @function.builtin "." ":" "_" "alias" "argparse" "bg" "bind" "block" "breakpoint" "builtin" "cd" "command" "commandline" "complete" "contains" "count" "disown" "echo" "emit" "eval" "exec" "exit" "fg" "functions" "history" "isatty" "jobs" "math" "printf" "pwd" "random" "read" "realpath" "set" "set_color" "source" "status" "string" "test" "time" "type" "ulimit" "wait") - ] -) - -;; Functions - -(function_definition ["function" "end"] @keyword.function) + name: + [ + (word) @function.builtin + (#any-of? @function.builtin "." ":" "_" "alias" "argparse" "bg" "bind" "block" "breakpoint" "builtin" "cd" "command" "commandline" "complete" "contains" "count" "disown" "echo" "emit" "eval" "exec" "exit" "fg" "functions" "history" "isatty" "jobs" "math" "printf" "pwd" "random" "read" "realpath" "set" "set_color" "source" "status" "string" "test" "time" "type" "ulimit" "wait") + ]) +; Functions (function_definition - name: [ - (word) (concatenation) - ] -@function) + [ + "function" + "end" + ] @keyword.function) (function_definition - option: [ - (word) - (concatenation (word)) - ] @variable.parameter (#lua-match? @variable.parameter "^[-]") -) + name: + [ + (word) + (concatenation) + ] @function) -;; Strings +(function_definition + option: + [ + (word) + (concatenation + (word)) + ] @variable.parameter + (#lua-match? @variable.parameter "^[-]")) + +; Strings +[ + (double_quote_string) + (single_quote_string) +] @string -[(double_quote_string) (single_quote_string)] @string (escape_sequence) @string.escape -;; Variables - +; Variables (variable_name) @variable + (variable_expansion) @constant -;; Nodes +; Nodes +[ + (integer) + (float) +] @number -[(integer) (float)] @number (comment) @comment + (comment) @spell ((word) @boolean -(#any-of? @boolean "true" "false")) + (#any-of? @boolean "true" "false")) -((program . (comment) @keyword.directive) +((program + . + (comment) @keyword.directive) (#lua-match? @keyword.directive "^#!/")) diff --git a/queries/fish/indents.scm b/queries/fish/indents.scm index 526c56e69..4984c4cb2 100644 --- a/queries/fish/indents.scm +++ b/queries/fish/indents.scm @@ -1,16 +1,16 @@ [ - (function_definition) - (while_statement) - (for_statement) - (if_statement) - (begin_statement) - (switch_statement) + (function_definition) + (while_statement) + (for_statement) + (if_statement) + (begin_statement) + (switch_statement) ] @indent.begin [ - "else" ; else and else if must both start the line with "else", so tag the string directly - "case" - "end" + "else" ; else and else if must both start the line with "else", so tag the string directly + "case" + "end" ] @indent.branch "end" @indent.end diff --git a/queries/fish/injections.scm b/queries/fish/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/fish/injections.scm +++ b/queries/fish/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/fish/locals.scm b/queries/fish/locals.scm index 15c3aac1d..904d568f9 100644 --- a/queries/fish/locals.scm +++ b/queries/fish/locals.scm @@ -1,4 +1,4 @@ -;; Scopes +; Scopes [ (command) (function_definition) @@ -9,10 +9,11 @@ (switch_statement) ] @local.scope -;; Definitions +; Definitions (function_definition name: (word) @local.definition.function) -;; References +; References (variable_name) @local.reference + (word) @local.reference diff --git a/queries/foam/folds.scm b/queries/foam/folds.scm index 2e499c2e2..e05d0dbaa 100644 --- a/queries/foam/folds.scm +++ b/queries/foam/folds.scm @@ -1,7 +1,8 @@ [ - (comment) - (list) - (dict_core) + (comment) + (list) + (dict_core) ] @fold -(code (code_body)* @fold) +(code + (code_body)* @fold) diff --git a/queries/foam/highlights.scm b/queries/foam/highlights.scm index 33370df66..9c96f196e 100644 --- a/queries/foam/highlights.scm +++ b/queries/foam/highlights.scm @@ -1,44 +1,47 @@ -;; Comments +; Comments (comment) @comment @spell -;; Generic Key-value pairs and dictionary keywords +; Generic Key-value pairs and dictionary keywords (key_value - keyword: (identifier) @function -) + keyword: (identifier) @function) + (dict - key: (identifier) @type -) + key: (identifier) @type) -;; Macros +; Macros (macro - "$" @keyword.conditional - (prev_scope)* @keyword.conditional - (identifier)* @module -) - + "$" @keyword.conditional + (prev_scope)* @keyword.conditional + (identifier)* @module) -;; Directives +; Directives "#" @keyword.conditional + (preproc_call - directive: (identifier)* @keyword.conditional - argument: (identifier)* @module -) + directive: (identifier)* @keyword.conditional + argument: (identifier)* @module) + ((preproc_call argument: (identifier)* @module) @keyword.conditional (#eq? @keyword.conditional "ifeq")) + ((preproc_call) @keyword.conditional (#any-of? @keyword.conditional "else" "endif")) -;; Literals +; Literals (number_literal) @number.float + (string_literal) @string + (escape_sequence) @string.escape + (boolean) @boolean -;; Treat [m^2 s^-2] the same as if it was put in numbers format -(dimensions dimension: (identifier) @number.float) +; Treat [m^2 s^-2] the same as if it was put in numbers format +(dimensions + dimension: (identifier) @number.float) -;; Punctuation +; Punctuation [ "(" ")" diff --git a/queries/foam/indents.scm b/queries/foam/indents.scm index a52cafea6..be02b80ed 100644 --- a/queries/foam/indents.scm +++ b/queries/foam/indents.scm @@ -3,9 +3,9 @@ "}" ] @indent.branch -[(dict) (key_value)] @indent.begin - - [ - (comment) -] @indent.ignore + (dict) + (key_value) +] @indent.begin + +(comment) @indent.ignore diff --git a/queries/foam/injections.scm b/queries/foam/injections.scm index 2d744f6af..e1c223bd2 100644 --- a/queries/foam/injections.scm +++ b/queries/foam/injections.scm @@ -1,20 +1,20 @@ -;; Pass code blocks to Cpp highlighter -(code - (code_body) @injection.content +; Pass code blocks to Cpp highlighter +(code + (code_body) @injection.content (#set! injection.language "cpp")) -;; Pass identifiers to Go highlighter (Cheating I know) -;; ((identifier) @injection.content -;; (#set! injection.language "lua") +; Pass identifiers to Go highlighter (Cheating I know) +; ((identifier) @injection.content +; (#set! injection.language "lua") +; Highlight regex syntax inside literal strings +((string_literal) @injection.content + (#set! injection.language "regex")) -;; Highlight regex syntax inside literal strings -((string_literal) @injection.content - (#set! injection.language "regex")) - -;; Highlight PyFoam syntax as Python statements +; Highlight PyFoam syntax as Python statements (pyfoam_variable code_body: (_) @injection.content (#set! injection.language "python")) + (pyfoam_expression code_body: (_) @injection.content (#set! injection.language "python")) diff --git a/queries/foam/locals.scm b/queries/foam/locals.scm index c1f635036..508643672 100644 --- a/queries/foam/locals.scm +++ b/queries/foam/locals.scm @@ -1,6 +1,12 @@ (dict) @local.scope -(dict key: (_) @local.definition.type) +(dict + key: (_) @local.definition.type) -(key_value keyword: (_) @local.definition.parameter) -(key_value value: (macro (identifier)*)* @local.reference) +(key_value + keyword: (_) @local.definition.parameter) + +(key_value + value: + (macro + (identifier)*)* @local.reference) diff --git a/queries/fortran/folds.scm b/queries/fortran/folds.scm index a2edc64d3..cedbdb635 100644 --- a/queries/fortran/folds.scm +++ b/queries/fortran/folds.scm @@ -1,11 +1,11 @@ -;; by @oponkork +; by @oponkork [ - (if_statement) - (where_statement) - (enum_statement) - (do_loop_statement) - (derived_type_definition) - (function) - (subroutine) - (interface) + (if_statement) + (where_statement) + (enum_statement) + (do_loop_statement) + (derived_type_definition) + (function) + (subroutine) + (interface) ] @fold diff --git a/queries/fortran/highlights.scm b/queries/fortran/highlights.scm index c2eaa6a7e..c88ad9cec 100644 --- a/queries/fortran/highlights.scm +++ b/queries/fortran/highlights.scm @@ -1,9 +1,7 @@ ; Preprocs - (preproc_file_line) @keyword.directive ; Namespaces - (program_statement (name) @module) @@ -23,7 +21,6 @@ (name) @module) ; Includes - [ "import" "include" @@ -32,10 +29,12 @@ (import_statement "," - ["all" "none"] @keyword) + [ + "all" + "none" + ] @keyword) ; Attributes - [ (none) "implicit" @@ -46,7 +45,6 @@ "type" @attribute) ; Keywords - [ "attributes" "associate" @@ -88,22 +86,14 @@ "typeis" ] @keyword -[ - (default) -] @keyword +(default) @keyword ; Types +(type_name) @type -[ - (type_name) -] @type - -[ - (intrinsic_type) -] @type.builtin +(intrinsic_type) @type.builtin ; Qualifiers - [ "abstract" "allocatable" @@ -150,7 +140,6 @@ ] @keyword.storage ; Labels - [ (statement_label) (statement_label_reference) @@ -174,7 +163,6 @@ ] @keyword.return ; Functions - (function_statement (name) @function) @@ -208,13 +196,9 @@ ] @function.builtin ; Exceptions - -[ - "error" -] @keyword.exception +"error" @keyword.exception ; Conditionals - [ "else" "elseif" @@ -227,7 +211,6 @@ ] @keyword.conditional ; Repeats - [ "do" "concurrent" @@ -241,11 +224,9 @@ ] @keyword.repeat ; Variables - (identifier) @variable ; Parameters - (keyword_argument name: (identifier) @variable.parameter) @@ -253,12 +234,10 @@ (identifier) @variable.parameter) ; Properties - (derived_type_member_expression (type_member) @property) ; Operators - [ "+" "-" @@ -291,15 +270,26 @@ ] @keyword.operator ; Punctuation +[ + "[" + "]" +] @punctuation.bracket -[ "[" "]" ] @punctuation.bracket - -[ "(" ")" ] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket -[ "<<<" ">>>" ] @punctuation.bracket +[ + "<<<" + ">>>" +] @punctuation.bracket (array_literal - ["(/" "/)"] @punctuation.bracket) + [ + "(/" + "/)" + ] @punctuation.bracket) [ ":" @@ -311,7 +301,6 @@ ] @punctuation.delimiter ; Literals - (string_literal) @string (number_literal) @number @@ -321,7 +310,6 @@ (null_literal) @constant.builtin ; Comments - (comment) @comment @spell ((comment) @comment.documentation diff --git a/queries/fsh/highlights.scm b/queries/fsh/highlights.scm index 9a11e279f..3404fa7c6 100644 --- a/queries/fsh/highlights.scm +++ b/queries/fsh/highlights.scm @@ -71,17 +71,23 @@ "Canonical" ] @type.builtin +(sd_metadata + (parent + (name))) @type -(sd_metadata (parent (name))) @type -(target_type (name)) @type +(target_type + (name)) @type ; Strings (string) @string + (multiline_string) @string ; Constants (strength_value) @constant + (bool) @constant.boolean + (flag) @constant ; Special Params diff --git a/queries/func/highlights.scm b/queries/func/highlights.scm index b5b6dde35..a6fb6bd0b 100644 --- a/queries/func/highlights.scm +++ b/queries/func/highlights.scm @@ -1,13 +1,10 @@ ; Include - "#include" @keyword.import + (include_path) @string ; Preproc - -[ - "#pragma" -] @keyword.directive +"#pragma" @keyword.directive (pragma_directive [ @@ -17,7 +14,6 @@ ] @keyword.directive) ; Keywords - [ "asm" "impure" @@ -27,12 +23,9 @@ "type" ] @keyword -[ - "return" -] @keyword.return +"return" @keyword.return ; Conditionals - [ "if" "ifnot" @@ -43,14 +36,12 @@ ] @keyword.conditional ; Exceptions - [ "try" "catch" ] @keyword.exception ; Repeats - [ "do" "forall" @@ -66,16 +57,13 @@ ] @type.qualifier ; Variables - (identifier) @variable ; Constants - (const_var_declarations name: (identifier) @constant) ; Functions/Methods - (function_definition name: (function_name) @function) @@ -86,17 +74,14 @@ method_name: (identifier) @function.method.call) ; Parameters - (parameter) @variable.parameter ; Types - (type_identifier) @type (primitive_type) @type.builtin ; Operators - [ "=" "+=" @@ -143,7 +128,6 @@ ] @operator ; Literals - [ (string) (asm_instruction) @@ -157,12 +141,21 @@ (number) @number ; Punctuation +[ + "{" + "}" +] @punctuation.bracket -["{" "}"] @punctuation.bracket - -["(" ")" "()"] @punctuation.bracket +[ + "(" + ")" + "()" +] @punctuation.bracket -["[" "]"] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket [ ";" @@ -171,5 +164,4 @@ ] @punctuation.delimiter ; Comments - (comment) @comment @spell diff --git a/queries/fusion/highlights.scm b/queries/fusion/highlights.scm index e8c217e67..dca576f84 100644 --- a/queries/fusion/highlights.scm +++ b/queries/fusion/highlights.scm @@ -1,11 +1,14 @@ (comment) @comment @spell + (afx_comment) @comment @spell ; identifiers afx (afx_opening_element (afx_identifier) @tag) + (afx_closing_element (afx_identifier) @tag) + (afx_element_self_closing (afx_identifier) @tag) @@ -15,11 +18,9 @@ (afx_text) @spell ; identifiers eel - (eel_object_path (eel_path_identifier) @variable.builtin - (#any-of? @variable.builtin "this" "props") -) + (#any-of? @variable.builtin "this" "props")) (eel_object_path (eel_path_identifier) @variable) @@ -33,19 +34,16 @@ ; identifiers fusion ; ----------- - (path_part) @property + (meta_property) @attribute + (prototype_signature - "prototype" @keyword + "prototype" @keyword) -) (include_statement - [ - "include" - ] @keyword.import - (source_file) @string.special.url -) + "include" @keyword.import + (source_file) @string.special.url) (namespace_declaration "namespace" @keyword @@ -58,21 +56,21 @@ ; ------ (afx_opening_element [ - "<" - ">" - ] @punctuation.bracket) + "<" + ">" + ] @punctuation.bracket) - (afx_closing_element +(afx_closing_element [ - "<" - ">" - "/" - ] @punctuation.bracket) + "<" + ">" + "/" + ] @punctuation.bracket) (afx_element_self_closing [ - "<" - "/>" + "<" + "/>" ] @punctuation.bracket) [ @@ -80,41 +78,55 @@ (alias_namespace) ] @module -(namespace_declaration "=" @operator) -(assignment "=" @operator) -(copy "<" @operator) +(namespace_declaration + "=" @operator) + +(assignment + "=" @operator) + +(copy + "<" @operator) + (deletion) @operator + (eel_binary_expression operator: _ @operator) + (eel_not_expression [ - "!" - "not" + "!" + "not" ] @operator) (string) @string + (number) @number + (boolean) @boolean + (null) @constant.builtin (value_expression start: _ @punctuation.special - end: _ @punctuation.special -) + end: _ @punctuation.special) + [ - "(" - ")" - "{" - "}" - "[" - "]" + "(" + ")" + "{" + "}" + "[" + "]" ] @punctuation.bracket [ - ":" - "." - "?" + ":" + "." + "?" ] @punctuation.delimiter (eel_ternary_expression - ["?" ":"] @keyword.conditional.ternary) + [ + "?" + ":" + ] @keyword.conditional.ternary) diff --git a/queries/fusion/indents.scm b/queries/fusion/indents.scm index 73133191b..0ba6cf758 100644 --- a/queries/fusion/indents.scm +++ b/queries/fusion/indents.scm @@ -7,13 +7,18 @@ (eel_object) ] @indent.begin +(block + end: _ @indent.branch) -(block end: _ @indent.branch) -(value_dsl end: _ @indent.branch) -(eel_array end: _ @indent.branch) -(eel_object end: _ @indent.branch) -[ - (afx_closing_element) -] @indent.branch +(value_dsl + end: _ @indent.branch) + +(eel_array + end: _ @indent.branch) + +(eel_object + end: _ @indent.branch) + +(afx_closing_element) @indent.branch (comment) @indent.ignore diff --git a/queries/fusion/locals.scm b/queries/fusion/locals.scm index 19afce078..d23e0ab46 100644 --- a/queries/fusion/locals.scm +++ b/queries/fusion/locals.scm @@ -1,21 +1,23 @@ -;; Fusion base +; Fusion base (block) @local.scope (namespace_declaration (alias_namespace) @local.definition.namespace) (property - (path (path_part) @local.definition.field)) + (path + (path_part) @local.definition.field)) (type namespace: (package_name)? @local.definition.namespace - name: (type_name) @local.definition.type -) + name: (type_name) @local.definition.type) -;; Eel Expressions +; Eel Expressions (eel_arrow_function) @local.scope + (eel_object) @local.scope (eel_parameter) @local.definition.parameter + (eel_object_pair key: (eel_property_name) @local.definition.field) diff --git a/queries/gdscript/folds.scm b/queries/gdscript/folds.scm index 946b0fea3..828ef807f 100644 --- a/queries/gdscript/folds.scm +++ b/queries/gdscript/folds.scm @@ -2,7 +2,6 @@ ; Body fold will "join" the next adjacent fold into a SUPER fold. ; This is an issue with the grammar. ; (body) - (if_statement) (elif_clause) (else_clause) @@ -16,10 +15,11 @@ (lambda) (constructor_definition) ] @fold - ; It's nice to be able to fold the if/elif/else clauses and the entire ; if_statement. -(if_statement (body) @fold) +(if_statement + (body) @fold) ; Fold strings that are probably doc strings. -(expression_statement (string) @fold) +(expression_statement + (string) @fold) diff --git a/queries/gdscript/highlights.scm b/queries/gdscript/highlights.scm index 21e0b8e0b..212bc67e3 100644 --- a/queries/gdscript/highlights.scm +++ b/queries/gdscript/highlights.scm @@ -1,23 +1,44 @@ -;; Basic - +; Basic (identifier) @variable + (name) @variable + (type) @type + (comment) @comment @spell + (string_name) @string + (string) @string + (float) @number.float + (integer) @number + (null) @constant + (setter) @function + (getter) @function -(set_body "set" @keyword.function) -(get_body "get" @keyword.function) + +(set_body + "set" @keyword.function) + +(get_body + "get" @keyword.function) + (static_keyword) @type.qualifier + (tool_statement) @keyword + (breakpoint_statement) @keyword.debug + (inferred_type) @operator -[(true) (false)] @boolean + +[ + (true) + (false) +] @boolean [ (get_node) @@ -31,68 +52,105 @@ "const" @type.qualifier (name) @constant) -(expression_statement (string) @comment @spell) +(expression_statement + (string) @comment @spell) -;; Identifier naming conventions +; Identifier naming conventions ((identifier) @type (#lua-match? @type "^[A-Z]")) + ((identifier) @constant (#lua-match? @constant "^[A-Z][A-Z_0-9]*$")) -;; Functions +; Functions (constructor_definition) @constructor (function_definition - (name) @function (parameters + (name) @function + (parameters (identifier) @variable.parameter)*) -(typed_parameter (identifier) @variable.parameter) -(default_parameter (identifier) @variable.parameter) +(typed_parameter + (identifier) @variable.parameter) + +(default_parameter + (identifier) @variable.parameter) -(call (identifier) @function.call) -(call (identifier) @keyword.import - (#any-of? @keyword.import "preload" "load")) +(call + (identifier) @function.call) -;; Properties and Methods +(call + (identifier) @keyword.import + (#any-of? @keyword.import "preload" "load")) +; Properties and Methods ; We'll use @property since that's the term Godot uses. ; But, should (source (variable_statement (name))) be @property, too? Since a ; script file is a class in gdscript. (class_definition - (body (variable_statement (name) @property))) + (body + (variable_statement + (name) @property))) ; Same question but for methods? (class_definition - (body (function_definition (name) @function.method))) + (body + (function_definition + (name) @function.method))) -(attribute_call (identifier) @function.method.call) -(attribute (_) (identifier) @property) +(attribute_call + (identifier) @function.method.call) -;; Enums +(attribute + (_) + (identifier) @property) -(enumerator left: (identifier) @constant) - -;; Special Builtins +; Enums +(enumerator + left: (identifier) @constant) +; Special Builtins ((identifier) @variable.builtin (#any-of? @variable.builtin "self" "super")) -(attribute_call (identifier) @keyword.operator - (#eq? @keyword.operator "new")) +(attribute_call + (identifier) @keyword.operator + (#eq? @keyword.operator "new")) -;; Match Pattern +; Match Pattern +(underscore) @constant ; The "_" pattern. -(underscore) @constant ; The "_" pattern. (pattern_open_ending) @operator ; The ".." pattern. -;; Alternations -["(" ")" "[" "]" "{" "}"] @punctuation.bracket +; Alternations +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket -["," "." ":"] @punctuation.delimiter +[ + "," + "." + ":" +] @punctuation.delimiter -["if" "elif" "else" "match"] @keyword.conditional +[ + "if" + "elif" + "else" + "match" +] @keyword.conditional -["for" "while" "break" "continue"] @keyword.repeat +[ + "for" + "while" + "break" + "continue" +] @keyword.repeat [ "~" @@ -157,28 +215,24 @@ "func" @keyword.function -[ - "return" -] @keyword.return - -[ - "await" -] @keyword.coroutine +"return" @keyword.return -(call (identifier) @keyword.coroutine - (#eq? @keyword.coroutine "yield")) +"await" @keyword.coroutine +(call + (identifier) @keyword.coroutine + (#eq? @keyword.coroutine "yield")) -;; Builtins +; Builtins ; generated from ; - https://github.com/godotengine/godot/blob/491ded18983a4ae963ce9c29e8df5d5680873ccb/doc/classes/@GlobalScope.xml ; - https://github.com/godotengine/godot/blob/491ded18983a4ae963ce9c29e8df5d5680873ccb/modules/gdscript/doc_classes/@GDScript.xml ; some from: ; - https://github.com/godotengine/godot-vscode-plugin/blob/0636797c22bf1e23a41fd24d55cdb9be62e0c992/syntaxes/GDScript.tmLanguage.json - -;; Built-in Annotations - -((annotation "@" @attribute (identifier) @attribute) +; Built-in Annotations +((annotation + "@" @attribute + (identifier) @attribute) ; format-ignore (#any-of? @attribute ; @GDScript @@ -191,9 +245,11 @@ "export_placeholder" "export_range" "export_subgroup" "icon" "onready" "rpc" "tool" "warning_ignore")) -;; Builtin Types - -([(identifier) (type)] @type.builtin +; Builtin Types +([ + (identifier) + (type) +] @type.builtin ; format-ignore (#any-of? @type.builtin ; from godot-vscode-plugin @@ -220,9 +276,9 @@ "TranslationServer" "WorkerThreadPool" "XRServer" )) -;; Builtin Funcs - -(call (identifier) @function.builtin +; Builtin Funcs +(call + (identifier) @function.builtin ; format-ignore (#any-of? @function.builtin ; @GlobalScope @@ -248,9 +304,7 @@ "Color8" "assert" "char" "convert" "dict_to_inst" "get_stack" "inst_to_dict" "is_instance_of" "len" "print_debug" "print_stack" "range" "type_exists")) - -;; Builtin Constants - +; Builtin Constants ((identifier) @constant.builtin ; format-ignore (#any-of? @constant.builtin @@ -341,4 +395,3 @@ "OP_EQUAL" "OP_NOT_EQUAL" "OP_LESS" "OP_LESS_EQUAL" "OP_GREATER" "OP_GREATER_EQUAL" "OP_ADD" "OP_SUBTRACT" "OP_MULTIPLY" "OP_DIVIDE" "OP_NEGATE" "OP_POSITIVE" "OP_MODULE" "OP_POWER" "OP_SHIFT_LEFT" "OP_SHIFT_RIGHT" "OP_BIT_AND" "OP_BIT_OR" "OP_BIT_XOR" "OP_BIT_NEGATE" "OP_AND" "OP_OR" "OP_XOR" "OP_NOT" "OP_IN" "OP_MAX")) - diff --git a/queries/gdscript/indents.scm b/queries/gdscript/indents.scm index 4eb579b22..22d155e6f 100644 --- a/queries/gdscript/indents.scm +++ b/queries/gdscript/indents.scm @@ -1,7 +1,6 @@ [ (lambda) (function_definition) - (for_statement) (while_statement) (if_statement) @@ -20,12 +19,12 @@ ] @indent.branch [ - (string) - (comment) - (array) - (dictionary) - (parenthesized_expression) - (ERROR) + (string) + (comment) + (array) + (dictionary) + (parenthesized_expression) + (ERROR) ] @indent.auto [ @@ -36,43 +35,43 @@ ] @indent.dedent [ - (ERROR "[") - (ERROR "(") - (ERROR "{") + (ERROR + "[") + (ERROR + "(") + (ERROR + "{") ] @indent.begin -;; This only works with expanded tabs. +; This only works with expanded tabs. ; ((parameters) @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")")) ; ((arguments) @indent.align (#set! indent.open_delimiter "(") (#set! indent.close_delimiter ")")) - -;; The following queries either do not agree with the current body parsing or are -;; attempted workarounds. Specifically as the last statement of a body. Opening -;; a new line in between statements works well. -;; -;; The overall experience is poor, so I've opted for @indent.auto. -;; -;; The gdscript parser will need to be patched to accommodate more interactive -;; edits. As far as I can tell the parser greedily consumes whitespace -;; as a zero-width token which causes trouble when inserting indents. - -;; This indents correctly with tabs. +; The following queries either do not agree with the current body parsing or are +; attempted workarounds. Specifically as the last statement of a body. Opening +; a new line in between statements works well. +; +; The overall experience is poor, so I've opted for @indent.auto. +; +; The gdscript parser will need to be patched to accommodate more interactive +; edits. As far as I can tell the parser greedily consumes whitespace +; as a zero-width token which causes trouble when inserting indents. +; This indents correctly with tabs. ; (arguments) @indent.begin ; (parameters) @indent.begin ; (array) @indent.begin ; (dictionary) @indent.begin ; (parenthesized_expression) @indent.begin - -;; Partial workaround for when the cursor is on the bracket character and a newline -;; is created with . Without this the newline is opened with extra -;; indentation. +; Partial workaround for when the cursor is on the bracket character and a newline +; is created with . Without this the newline is opened with extra +; indentation. ; (body (_ (array "]" @indent.end) ) _) -;; Problematic behaviors occur at the last statement of a body. -;; with @dedent: -;; - [ | ] i will dedent ] to 0. -;; - [ -;; ]| o will open new line at correct indentation. -;; with @auto: -;; - [ | ] i same -;; - [ -;; ]| o will open new line with extra indent. +; Problematic behaviors occur at the last statement of a body. +; with @dedent: +; - [ | ] i will dedent ] to 0. +; - [ +; ]| o will open new line at correct indentation. +; with @auto: +; - [ | ] i same +; - [ +; ]| o will open new line with extra indent. ;(body (_ (array "]" @indent.auto) ) .) diff --git a/queries/gdscript/injections.scm b/queries/gdscript/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/gdscript/injections.scm +++ b/queries/gdscript/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/gdscript/locals.scm b/queries/gdscript/locals.scm index ebcda4f7d..83a1b4433 100644 --- a/queries/gdscript/locals.scm +++ b/queries/gdscript/locals.scm @@ -1,5 +1,4 @@ -;; Scopes - +; Scopes [ (if_statement) (elif_clause) @@ -16,77 +15,107 @@ (set_body) ] @local.scope -;; Parameters +; Parameters +(parameters + (identifier) @local.definition.parameter) + +(default_parameter + (identifier) @local.definition.parameter) -(parameters (identifier) @local.definition.parameter) -(default_parameter (identifier) @local.definition.parameter) -(typed_parameter (identifier) @local.definition.parameter) -(typed_default_parameter (identifier) @local.definition.parameter) +(typed_parameter + (identifier) @local.definition.parameter) -;; Signals +(typed_default_parameter + (identifier) @local.definition.parameter) +; Signals ; Can gdscript 2 signals be considered fields? -(signal_statement (name) @local.definition.field) +(signal_statement + (name) @local.definition.field) -;; Variable Definitions +; Variable Definitions +(const_statement + (name) @local.definition.constant) -(const_statement (name) @local.definition.constant) ; onready and export variations are only properties. -(variable_statement (name) @local.definition.var) +(variable_statement + (name) @local.definition.var) (setter) @local.reference -(getter) @local.reference - -;; Function Definition -((function_definition (name) @local.definition.function) - (#set! "definition.function.scope" "parent")) +(getter) @local.reference -;; Lambda +; Function Definition +((function_definition + (name) @local.definition.function) + (#set! "definition.function.scope" "parent")) +; Lambda ; lambda names are not accessible and are only for debugging. -(lambda (name) @local.definition.function) +(lambda + (name) @local.definition.function) -;; Source +; Source +(class_name_statement + (name) @local.definition.type) -(class_name_statement (name) @local.definition.type) +(source + (variable_statement + (name) @local.definition.field)) -(source (variable_statement (name) @local.definition.field)) -(source (onready_variable_statement (name) @local.definition.field)) -(source (export_variable_statement (name) @local.definition.field)) +(source + (onready_variable_statement + (name) @local.definition.field)) -;; Class +(source + (export_variable_statement + (name) @local.definition.field)) -((class_definition (name) @local.definition.type) - (#set! "definition.type.scope" "parent")) +; Class +((class_definition + (name) @local.definition.type) + (#set! "definition.type.scope" "parent")) (class_definition - (body (variable_statement (name) @local.definition.field))) + (body + (variable_statement + (name) @local.definition.field))) + (class_definition - (body (onready_variable_statement (name) @local.definition.field))) + (body + (onready_variable_statement + (name) @local.definition.field))) + (class_definition - (body (export_variable_statement (name) @local.definition.field))) + (body + (export_variable_statement + (name) @local.definition.field))) + (class_definition - (body (signal_statement (name) @local.definition.field))) + (body + (signal_statement + (name) @local.definition.field))) ; Although a script is also a class, let's only define functions in an inner class as ; methods. ((class_definition - (body (function_definition (name) @local.definition.method))) - (#set! "definition.method.scope" "parent")) - -;; Enum - -((enum_definition (name) @local.definition.enum)) - -;; Repeat - -(for_statement . (identifier) @local.definition.var) + (body + (function_definition + (name) @local.definition.method))) + (#set! "definition.method.scope" "parent")) -;; Match Statement +; Enum +((enum_definition + (name) @local.definition.enum)) -(pattern_binding (identifier) @local.definition.var) +; Repeat +(for_statement + . + (identifier) @local.definition.var) -;; References +; Match Statement +(pattern_binding + (identifier) @local.definition.var) +; References (identifier) @local.reference diff --git a/queries/git_config/folds.scm b/queries/git_config/folds.scm index e69de29bb..8b1378917 100644 --- a/queries/git_config/folds.scm +++ b/queries/git_config/folds.scm @@ -0,0 +1 @@ + diff --git a/queries/git_config/highlights.scm b/queries/git_config/highlights.scm index df1dde803..ebae70e51 100644 --- a/queries/git_config/highlights.scm +++ b/queries/git_config/highlights.scm @@ -1,26 +1,23 @@ ; Sections - (section_name) @type ((section_name) @keyword.import - (#eq? @keyword.import "include")) + (#eq? @keyword.import "include")) ((section_header - (section_name) @keyword.import - (subsection_name)) - (#eq? @keyword.import "includeIf")) + (section_name) @keyword.import + (subsection_name)) + (#eq? @keyword.import "includeIf")) -(variable (name) @property) +(variable + (name) @property) ; Operators - -[ - "=" -] @operator +"=" @operator ; Literals - (integer) @number + [ (true) (false) @@ -29,10 +26,10 @@ (string) @string ((string) @string.special.path - (#lua-match? @string.special.path "^[.]?[/]")) + (#lua-match? @string.special.path "^[.]?[/]")) ((string) @string.special.path - (#lua-match? @string.special.path "^[~]")) + (#lua-match? @string.special.path "^[~]")) (section_header [ @@ -41,9 +38,10 @@ ] @string.special) ; Punctuation - -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket ; Comments - (comment) @comment @spell diff --git a/queries/git_rebase/highlights.scm b/queries/git_rebase/highlights.scm index 9ace6be26..248366e24 100644 --- a/queries/git_rebase/highlights.scm +++ b/queries/git_rebase/highlights.scm @@ -5,4 +5,3 @@ (option) @operator (comment) @comment - diff --git a/queries/git_rebase/injections.scm b/queries/git_rebase/injections.scm index 8e6815a68..da2628667 100644 --- a/queries/git_rebase/injections.scm +++ b/queries/git_rebase/injections.scm @@ -1,6 +1,5 @@ ((operation - (command) @_command - (message) @injection.content) -(#set! injection.language "bash") -(#any-of? @_command "exec" "x")) - + (command) @_command + (message) @injection.content) + (#set! injection.language "bash") + (#any-of? @_command "exec" "x")) diff --git a/queries/gitattributes/highlights.scm b/queries/gitattributes/highlights.scm index 9f3c03dfb..bc2e02e88 100644 --- a/queries/gitattributes/highlights.scm +++ b/queries/gitattributes/highlights.scm @@ -6,7 +6,10 @@ (range_notation) @string.special (range_notation - [ "[" "]" ] @punctuation.bracket) + [ + "[" + "]" + ] @punctuation.bracket) (wildcard) @character.special @@ -14,7 +17,8 @@ (character_class) @constant -(class_range ("-" @operator)) +(class_range + ("-" @operator)) [ (ansi_c_escape) @@ -48,5 +52,4 @@ ; (redundant_escape) ; (trailing_slash) ; ] @error - (comment) @comment @spell diff --git a/queries/gitattributes/injections.scm b/queries/gitattributes/injections.scm index 6adae45a2..2f0e58eb6 100644 --- a/queries/gitattributes/injections.scm +++ b/queries/gitattributes/injections.scm @@ -1,2 +1,2 @@ -((comment) @injection.content - (#set! injection.language "comment")) +((comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/gitattributes/locals.scm b/queries/gitattributes/locals.scm index 43082a43d..2471b8bc6 100644 --- a/queries/gitattributes/locals.scm +++ b/queries/gitattributes/locals.scm @@ -1,4 +1,8 @@ -(macro_def (attr_name) @local.definition.macro) +(macro_def + (attr_name) @local.definition.macro) -(attribute (attr_name) @local.reference) -(attribute (builtin_attr) @local.reference) +(attribute + (attr_name) @local.reference) + +(attribute + (builtin_attr) @local.reference) diff --git a/queries/gitcommit/highlights.scm b/queries/gitcommit/highlights.scm index d475021c2..880d05e01 100644 --- a/queries/gitcommit/highlights.scm +++ b/queries/gitcommit/highlights.scm @@ -1,32 +1,52 @@ (comment) @comment + (generated_comment) @comment + (title) @markup.heading + ; (text) @none (branch) @markup.link + (change) @keyword + (filepath) @string.special.url + (arrow) @punctuation.delimiter (subject) @markup.heading @spell -(subject (overflow) @none @spell) -(subject (subject_prefix) @function @nospell) -(prefix (type) @keyword @nospell) -(prefix (scope) @variable.parameter @nospell) -(prefix [ + +(subject + (overflow) @none @spell) + +(subject + (subject_prefix) @function @nospell) + +(prefix + (type) @keyword @nospell) + +(prefix + (scope) @variable.parameter @nospell) + +(prefix + [ "(" ")" ":" -] @punctuation.delimiter) -(prefix [ - "!" -] @punctuation.special) + ] @punctuation.delimiter) + +(prefix + "!" @punctuation.special) (message) @spell -(trailer (token) @label) +(trailer + (token) @label) + ; (trailer (value) @none) +(breaking_change + (token) @comment.warning) -(breaking_change (token) @comment.warning) -(breaking_change (value) @none @spell) +(breaking_change + (value) @none @spell) (scissor) @comment diff --git a/queries/gitcommit/injections.scm b/queries/gitcommit/injections.scm index 5e56dfa5f..5613d7e8e 100644 --- a/queries/gitcommit/injections.scm +++ b/queries/gitcommit/injections.scm @@ -1,5 +1,5 @@ ((diff) @injection.content - (#set! injection.language "diff")) + (#set! injection.language "diff")) -((rebase_command) @injection.content - (#set! injection.language "git_rebase")) +((rebase_command) @injection.content + (#set! injection.language "git_rebase")) diff --git a/queries/gitignore/highlights.scm b/queries/gitignore/highlights.scm index 6e83ea6f2..10ae3f309 100644 --- a/queries/gitignore/highlights.scm +++ b/queries/gitignore/highlights.scm @@ -19,13 +19,15 @@ (bracket_char_escaped) ] @string.escape -;; bracket expressions +; bracket expressions [ "[" "]" ] @punctuation.bracket (bracket_char) @constant -(bracket_range + +(bracket_range "-" @operator) + (bracket_char_class) @constant.builtin diff --git a/queries/gleam/folds.scm b/queries/gleam/folds.scm index 7c3b16741..b4cd225e7 100644 --- a/queries/gleam/folds.scm +++ b/queries/gleam/folds.scm @@ -1,7 +1,7 @@ ; Folds [ (case) - (function) + (function) (anonymous_function) (type_definition) ] @fold diff --git a/queries/gleam/highlights.scm b/queries/gleam/highlights.scm index f74f17ab7..5c34dde7a 100644 --- a/queries/gleam/highlights.scm +++ b/queries/gleam/highlights.scm @@ -9,14 +9,10 @@ ] @keyword ; Function Keywords -[ - "fn" -] @keyword.function +"fn" @keyword.function ; Imports -[ - "import" -] @keyword.import +"import" @keyword.import ; Conditionals [ @@ -25,9 +21,7 @@ ] @keyword.conditional ; Exceptions -[ - "assert" -] @keyword.exception +"assert" @keyword.exception ; Punctuation [ @@ -48,9 +42,7 @@ "->" ] @punctuation.delimiter -[ - "#" -] @punctuation.special +"#" @punctuation.special ; Operators [ @@ -83,9 +75,7 @@ (identifier) @variable ; Comments -[ - (comment) -] @comment @spell +(comment) @comment @spell [ (module_comment) @@ -100,9 +90,16 @@ ; Modules & Imports (module) @module -(import alias: ((identifier) @module)?) -(remote_type_identifier module: (identifier) @module) -(unqualified_import name: (identifier) @function) + +(import + alias: + ((identifier) @module)?) + +(remote_type_identifier + module: (identifier) @module) + +(unqualified_import + name: (identifier) @function) ; Strings (string) @string @@ -116,15 +113,35 @@ (float) @number.float ; Function Parameter Labels -(function_call arguments: (arguments (argument label: (label) @label))) -(function_parameter label: (label)? @label name: (identifier) @variable.parameter) +(function_call + arguments: + (arguments + (argument + label: (label) @label))) + +(function_parameter + label: (label)? @label + name: (identifier) @variable.parameter) ; Records -(record arguments: (arguments (argument label: (label) @property)?)) -(record_pattern_argument label: (label) @property) -(record_update_argument label: (label) @property) -(field_access record: (identifier) @variable field: (label) @property) -(data_constructor_argument (label) @property) +(record + arguments: + (arguments + (argument + label: (label) @property)?)) + +(record_pattern_argument + label: (label) @property) + +(record_update_argument + label: (label) @property) + +(field_access + record: (identifier) @variable + field: (label) @property) + +(data_constructor_argument + (label) @property) ; Types [ @@ -145,25 +162,44 @@ ] @type.qualifier ; Tuples -(tuple_access index: (integer) @operator) +(tuple_access + index: (integer) @operator) ; Functions -(function name: (identifier) @function) -(function_call function: (identifier) @function.call) -(function_call function: (field_access field: (label) @function.call)) +(function + name: (identifier) @function) + +(function_call + function: (identifier) @function.call) + +(function_call + function: + (field_access + field: (label) @function.call)) ; External Functions -(external_function name: (identifier) @function) -(external_function_body (string) @module . (string) @function) +(external_function + name: (identifier) @function) + +(external_function_body + (string) @module + . + (string) @function) ; Constructors (constructor_name) @type @constructor -([(type_identifier) (constructor_name)] @constant.builtin +([ + (type_identifier) + (constructor_name) +] @constant.builtin (#any-of? @constant.builtin "Ok" "Error")) ; Booleans -((constructor_name) @boolean (#any-of? @boolean "True" "False")) +((constructor_name) @boolean + (#any-of? @boolean "True" "False")) ; Pipe Operator -(binary_expression operator: "|>" right: (identifier) @function) +(binary_expression + operator: "|>" + right: (identifier) @function) diff --git a/queries/gleam/indents.scm b/queries/gleam/indents.scm index 37f88df66..c79854508 100644 --- a/queries/gleam/indents.scm +++ b/queries/gleam/indents.scm @@ -25,4 +25,6 @@ ] @indent.end @indent.branch ; Gleam pipelines are not indented, but other binary expression chains are -((binary_expression operator: _ @_operator) @indent.begin (#not-eq? @_operator "|>")) +((binary_expression + operator: _ @_operator) @indent.begin + (#not-eq? @_operator "|>")) diff --git a/queries/gleam/injections.scm b/queries/gleam/injections.scm index 378240e38..11d4f5d55 100644 --- a/queries/gleam/injections.scm +++ b/queries/gleam/injections.scm @@ -1,7 +1,7 @@ ; Comments ([ (module_comment) - (statement_comment) - (comment) - ] @injection.content - (#set! injection.language "comment")) + (statement_comment) + (comment) +] @injection.content + (#set! injection.language "comment")) diff --git a/queries/gleam/locals.scm b/queries/gleam/locals.scm index 43328ce1b..ba0632c0b 100644 --- a/queries/gleam/locals.scm +++ b/queries/gleam/locals.scm @@ -1,18 +1,25 @@ ; Let Binding Definition -(let pattern: (identifier) @local.definition) +(let + pattern: (identifier) @local.definition) ; List Pattern Definitions -(list_pattern (identifier) @local.definition) -(list_pattern assign: (identifier) @local.definition) +(list_pattern + (identifier) @local.definition) + +(list_pattern + assign: (identifier) @local.definition) ; Tuple Pattern Definition -(tuple_pattern (identifier) @local.definition) +(tuple_pattern + (identifier) @local.definition) ; Record Pattern Definition -(record_pattern_argument pattern: (identifier) @local.definition) +(record_pattern_argument + pattern: (identifier) @local.definition) ; Function Parameter Definition -(function_parameter name: (identifier) @local.definition) +(function_parameter + name: (identifier) @local.definition) ; References (identifier) @local.reference diff --git a/queries/glimmer/folds.scm b/queries/glimmer/folds.scm index cfe9d35b0..6502455d8 100644 --- a/queries/glimmer/folds.scm +++ b/queries/glimmer/folds.scm @@ -1,4 +1,5 @@ [ - (element_node (element_node_start)) - (block_statement) + (element_node + (element_node_start)) + (block_statement) ] @fold diff --git a/queries/glimmer/highlights.scm b/queries/glimmer/highlights.scm index 059a1069c..cfb1af15f 100644 --- a/queries/glimmer/highlights.scm +++ b/queries/glimmer/highlights.scm @@ -1,9 +1,9 @@ ; === Tag Names === - ; Tags that start with a lower case letter are HTML tags ; We'll also use this highlighting for named blocks (which start with `:`) ((tag_name) @tag (#lua-match? @tag "^:?[%l]")) + ; Tags that start with a capital letter are Glimmer components ((tag_name) @constructor (#lua-match? @constructor "^%u")) @@ -11,74 +11,106 @@ (attribute_name) @property (string_literal) @string + (number_literal) @number + (boolean_literal) @boolean (concat_statement) @string ; === Block Statements === - ; Highlight the brackets (block_statement_start) @tag.delimiter + (block_statement_end) @tag.delimiter ; Highlight `if`/`each`/`let` -(block_statement_start path: (identifier) @keyword.conditional) -(block_statement_end path: (identifier) @keyword.conditional) -((mustache_statement (identifier) @keyword.conditional) - (#lua-match? @keyword.conditional "else")) +(block_statement_start + path: (identifier) @keyword.conditional) -; == Mustache Statements === +(block_statement_end + path: (identifier) @keyword.conditional) + +((mustache_statement + (identifier) @keyword.conditional) + (#lua-match? @keyword.conditional "else")) +; == Mustache Statements === ; Highlight the whole statement, to color brackets and separators (mustache_statement) @tag.delimiter ; An identifier in a mustache expression is a variable -((mustache_statement [ - (path_expression (identifier) @variable) - (identifier) @variable +((mustache_statement + [ + (path_expression + (identifier) @variable) + (identifier) @variable ]) (#not-any-of? @variable "yield" "outlet" "this" "else")) + ; As are arguments in a block statement -(block_statement_start argument: [ - (path_expression (identifier) @variable) - (identifier) @variable - ]) +(block_statement_start + argument: + [ + (path_expression + (identifier) @variable) + (identifier) @variable + ]) + ; As is an identifier in a block param -(block_params (identifier) @variable) +(block_params + (identifier) @variable) + ; As are helper arguments -((helper_invocation argument: [ - (path_expression (identifier) @variable) - (identifier) @variable - ]) +((helper_invocation + argument: + [ + (path_expression + (identifier) @variable) + (identifier) @variable + ]) (#not-eq? @variable "this")) + ; `this` should be highlighted as a built-in variable ((identifier) @variable.builtin (#eq? @variable.builtin "this")) ; If the identifier is just "yield" or "outlet", it's a keyword -((mustache_statement (identifier) @keyword) +((mustache_statement + (identifier) @keyword) (#any-of? @keyword "yield" "outlet")) ; Helpers are functions -((helper_invocation helper: [ - (path_expression (identifier) @function) - (identifier) @function - ]) +((helper_invocation + helper: + [ + (path_expression + (identifier) @function) + (identifier) @function + ]) (#not-any-of? @function "if" "yield")) -((helper_invocation helper: (identifier) @keyword.conditional) + +((helper_invocation + helper: (identifier) @keyword.conditional) (#eq? @keyword.conditional "if")) -((helper_invocation helper: (identifier) @keyword) + +((helper_invocation + helper: (identifier) @keyword) (#eq? @keyword "yield")) -(hash_pair key: (identifier) @property) +(hash_pair + key: (identifier) @property) (comment_statement) @comment @spell -(attribute_node "=" @operator) +(attribute_node + "=" @operator) + +(block_params + "as" @keyword) -(block_params "as" @keyword) -(block_params "|" @operator) +(block_params + "|" @operator) [ "<" diff --git a/queries/glimmer/indents.scm b/queries/glimmer/indents.scm index 8bccf33fa..c1ef130c0 100644 --- a/queries/glimmer/indents.scm +++ b/queries/glimmer/indents.scm @@ -1,22 +1,34 @@ [ - (element_node (element_node_start)) + (element_node + (element_node_start)) (element_node_void) - (block_statement (block_statement_start)) + (block_statement + (block_statement_start)) (mustache_statement) ] @indent.begin -(element_node (element_node_end [">"] @indent.end)) -(element_node_void "/>" @indent.end) +(element_node + (element_node_end + ">" @indent.end)) + +(element_node_void + "/>" @indent.end) + [ - ">" - "/>" - "" + "/>" + "" @operator (comment) @comment @spell + (module_path) @string.special.url [ -(version) -(go_version) + (version) + (go_version) ] @string diff --git a/queries/gomod/injections.scm b/queries/gomod/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/gomod/injections.scm +++ b/queries/gomod/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/gosum/highlights.scm b/queries/gosum/highlights.scm index bd9595b2b..f20c5f176 100644 --- a/queries/gosum/highlights.scm +++ b/queries/gosum/highlights.scm @@ -7,17 +7,18 @@ "+incompatible" ] @keyword - (module_path) @string.special.url + (module_version) @string.special (hash_version) @attribute + (hash) @string.special.symbol [ - (number) - (number_with_decimal) - (hex_number) + (number) + (number_with_decimal) + (hex_number) ] @number (checksum diff --git a/queries/gowork/highlights.scm b/queries/gowork/highlights.scm index 0584f1a68..bca9a5f80 100644 --- a/queries/gowork/highlights.scm +++ b/queries/gowork/highlights.scm @@ -9,6 +9,6 @@ (comment) @comment @spell [ -(version) -(go_version) + (version) + (go_version) ] @string diff --git a/queries/gowork/injections.scm b/queries/gowork/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/gowork/injections.scm +++ b/queries/gowork/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/gpg/highlights.scm b/queries/gpg/highlights.scm index 1dac05562..09656b302 100644 --- a/queries/gpg/highlights.scm +++ b/queries/gpg/highlights.scm @@ -1,14 +1,17 @@ -(option . _ @keyword) +(option + . + _ @keyword) (option ("no-" @variable.parameter)? (name) @variable.parameter) -(string (content) @string) +(string + (content) @string) [ - (value) - "clear" + (value) + "clear" ] @string.special (url) @string.special.url @@ -16,9 +19,9 @@ (key) @constant [ - (number) - (expire_time) - (iso_time) + (number) + (expire_time) + (iso_time) ] @number (format) @character.special @@ -34,14 +37,18 @@ (filter_value) @string [ - (filter_op0) - (filter_op1) - (filter_lc) - "=" + (filter_op0) + (filter_op1) + (filter_lc) + "=" ] @operator "!" @punctuation.special -[ "\"" "'" "," ] @punctuation.delimiter +[ + "\"" + "'" + "," +] @punctuation.delimiter (comment) @comment @spell diff --git a/queries/gpg/injections.scm b/queries/gpg/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/gpg/injections.scm +++ b/queries/gpg/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/graphql/highlights.scm b/queries/graphql/highlights.scm index 136f287ee..24db06645 100644 --- a/queries/graphql/highlights.scm +++ b/queries/graphql/highlights.scm @@ -1,6 +1,5 @@ ; Types ;------ - (scalar_type_definition (name) @type) @@ -42,7 +41,6 @@ ; Directives ;----------- - (directive_definition "@" @attribute (name) @attribute) @@ -51,7 +49,6 @@ ; Properties ;----------- - (field (name) @property) @@ -69,9 +66,8 @@ (enum_value (name) @property) -; Variable Definitions and Arguments +; Variable Definitions and Arguments ;----------------------------------- - (operation_definition (name) @variable) @@ -98,7 +94,6 @@ ; Constants ;---------- - (string_value) @string (int_value) @number @@ -109,7 +104,6 @@ ; Literals ;--------- - (description (string_value) @string.documentation @spell) @@ -123,7 +117,6 @@ ; Keywords ;---------- - [ "query" "mutation" @@ -145,21 +138,23 @@ ; Punctuation ;------------ - [ - "(" - ")" - "[" - "]" - "{" - "}" + "(" + ")" + "[" + "]" + "{" + "}" ] @punctuation.bracket "=" @operator "|" @punctuation.delimiter + "&" @punctuation.delimiter + ":" @punctuation.delimiter "..." @punctuation.special + "!" @punctuation.special diff --git a/queries/graphql/injections.scm b/queries/graphql/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/graphql/injections.scm +++ b/queries/graphql/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/groovy/highlights.scm b/queries/groovy/highlights.scm index 25dcdb8ca..4306f17a3 100644 --- a/queries/groovy/highlights.scm +++ b/queries/groovy/highlights.scm @@ -1,5 +1,6 @@ (unit (identifier) @variable) + (string (identifier) @variable) @@ -24,52 +25,19 @@ (#eq? @constant.builtin "null")) ((identifier) @type - (#any-of? @type - "String" - "Map" - "Object" - "Boolean" - "Integer" - "List")) + (#any-of? @type "String" "Map" "Object" "Boolean" "Integer" "List")) ((identifier) @function.builtin - (#any-of? @function.builtin - "void" - "id" - "version" - "apply" - "implementation" - "testImplementation" - "androidTestImplementation" - "debugImplementation")) + (#any-of? @function.builtin "void" "id" "version" "apply" "implementation" "testImplementation" "androidTestImplementation" "debugImplementation")) ((identifier) @keyword - (#any-of? @keyword - "static" - "class" - "def" - "import" - "package" - "assert" - "extends" - "implements" - "instanceof" - "interface" - "new")) + (#any-of? @keyword "static" "class" "def" "import" "package" "assert" "extends" "implements" "instanceof" "interface" "new")) ((identifier) @type.qualifier - (#any-of? @type.qualifier - "abstract" - "protected" - "private" - "public")) + (#any-of? @type.qualifier "abstract" "protected" "private" "public")) ((identifier) @keyword.exception - (#any-of? @keyword.exception - "throw" - "finally" - "try" - "catch")) + (#any-of? @keyword.exception "throw" "finally" "try" "catch")) (string) @string @@ -92,4 +60,11 @@ (leading_key) ] @operator -["(" ")" "[" "]" "{" "}"] @punctuation.bracket +[ + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket diff --git a/queries/groovy/injections.scm b/queries/groovy/injections.scm index 0f3127b6b..14a5d393e 100644 --- a/queries/groovy/injections.scm +++ b/queries/groovy/injections.scm @@ -1,5 +1,5 @@ -((line_comment) @injection.content - (#set! injection.language "comment")) - ((block_comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) + +((line_comment) @injection.content + (#set! injection.language "comment")) diff --git a/queries/gstlaunch/highlights.scm b/queries/gstlaunch/highlights.scm index 36118712e..90729f876 100644 --- a/queries/gstlaunch/highlights.scm +++ b/queries/gstlaunch/highlights.scm @@ -1,30 +1,35 @@ [ - "!" - "=" + "!" + "=" ] @operator [ - "," - "." - ";" - "/" + "," + "." + ";" + "/" ] @punctuation.delimiter [ - "(" - ")" + "(" + ")" ] @punctuation.bracket (property key: (identifier) @variable.member) + (value) @string + (string_literal) @string + (cap . (identifier) @string . (identifier) @string) + (simple_element type: (_) @type) + (bin type: (_) @type) diff --git a/queries/hack/highlights.scm b/queries/hack/highlights.scm index 91efe90b4..22fa7ea50 100644 --- a/queries/hack/highlights.scm +++ b/queries/hack/highlights.scm @@ -1,13 +1,15 @@ (variable) @variable + (identifier) @variable + ((variable) @variable.builtin - (#eq? @variable.builtin "$this")) + (#eq? @variable.builtin "$this")) (braced_expression) @none (scoped_identifier - (qualified_identifier - (identifier) @type)) + (qualified_identifier + (identifier) @type)) [ (comment) @@ -20,16 +22,16 @@ "function" @keyword.function [ - "type" - "interface" - "implements" - "class" - "using" - "namespace" - "attribute" - "const" - "extends" - "insteadof" + "type" + "interface" + "implements" + "class" + "using" + "namespace" + "attribute" + "const" + "extends" + "insteadof" ] @keyword [ @@ -38,11 +40,11 @@ ] @keyword.coroutine [ - "use" - "include" - "include_once" - "require" - "require_once" + "use" + "include" + "include_once" + "require" + "require_once" ] @keyword.import [ @@ -80,9 +82,7 @@ "noreturn" ] @type.builtin -[ - (null) -] @constant.builtin +(null) @constant.builtin [ (true) @@ -90,14 +90,23 @@ ] @boolean (type_specifier) @type + (new_expression (_) @type) -(alias_declaration "newtype" . (_) @type) -(alias_declaration "type" . (_) @type) +(alias_declaration + "newtype" + . + (_) @type) + +(alias_declaration + "type" + . + (_) @type) (class_declaration name: (identifier) @type) + (type_parameter name: (identifier) @type) @@ -106,8 +115,8 @@ (identifier) @type .)) [ - "@required" - "@lateinit" + "@required" + "@lateinit" (attribute_modifier) ] @attribute @@ -126,7 +135,6 @@ "/=" "%=" "**=" - "==>" "|>" "??" @@ -154,13 +162,10 @@ "/" "%" "**" - "++" "--" "!" - "?:" - "=" "??=" ".=" @@ -176,110 +181,156 @@ "%=" "**=" "=>" - - ;; type modifiers + ; type modifiers "@" "?" "~" ] @operator (integer) @number + (float) @number.float (parameter (variable) @variable.parameter) (call_expression - function: (qualified_identifier (identifier) @function.call .)) + function: + (qualified_identifier + (identifier) @function.call .)) (call_expression - function: (scoped_identifier (identifier) @function.call .)) + function: + (scoped_identifier + (identifier) @function.call .)) (call_expression - function: (selection_expression - (qualified_identifier (identifier) @function.method.call .))) + function: + (selection_expression + (qualified_identifier + (identifier) @function.method.call .))) (qualified_identifier - (_) @module . + (_) @module + . (_)) (use_statement (qualified_identifier - (_) @module .) + (_) @module .) (use_clause)) (use_statement - (use_type "namespace") + (use_type + "namespace") (use_clause (qualified_identifier - (identifier) @module .) + (identifier) @module .) alias: (identifier)? @module)) (use_statement - (use_type "const") + (use_type + "const") (use_clause (qualified_identifier - (identifier) @constant .) + (identifier) @constant .) alias: (identifier)? @constant)) (use_statement - (use_type "function") + (use_type + "function") (use_clause (qualified_identifier - (identifier) @function .) + (identifier) @function .) alias: (identifier)? @function)) (use_statement - (use_type "type") + (use_type + "type") (use_clause (qualified_identifier - (identifier) @type .) + (identifier) @type .) alias: (identifier)? @type)) (use_clause - (use_type "namespace") + (use_type + "namespace") (qualified_identifier - (_) @module .) + (_) @module .) alias: (identifier)? @module) (use_clause - (use_type "function") + (use_type + "function") (qualified_identifier - (_) @function .) + (_) @function .) alias: (identifier)? @function) (use_clause - (use_type "const") + (use_type + "const") (qualified_identifier - (_) @constant .) + (_) @constant .) alias: (identifier)? @constant) (use_clause - (use_type "type") + (use_type + "type") (qualified_identifier - (_) @type .) + (_) @type .) alias: (identifier)? @type) (function_declaration name: (identifier) @function) + (method_declaration name: (identifier) @function.method) (type_arguments - [ "<" ">" ] @punctuation.bracket) -[ "(" ")" "[" "]" "{" "}" "<<" ">>"] @punctuation.bracket + [ + "<" + ">" + ] @punctuation.bracket) + +[ + "(" + ")" + "[" + "]" + "{" + "}" + "<<" + ">>" +] @punctuation.bracket (xhp_open - [ "<" ">" ] @tag.delimiter) + [ + "<" + ">" + ] @tag.delimiter) + (xhp_close - [ "" ] @tag.delimiter) + [ + "" + ] @tag.delimiter) + +[ + "." + ";" + "::" + ":" + "," +] @punctuation.delimiter -[ "." ";" "::" ":" "," ] @punctuation.delimiter (qualified_identifier "\\" @punctuation.delimiter) (ternary_expression - ["?" ":"] @keyword.conditional.ternary) + [ + "?" + ":" + ] @keyword.conditional.ternary) [ "if" @@ -305,11 +356,11 @@ ] @keyword.repeat [ - (string) - (xhp_string) + (string) + (xhp_string) ] @string [ - (xhp_open) - (xhp_close) + (xhp_open) + (xhp_close) ] @tag diff --git a/queries/hare/folds.scm b/queries/hare/folds.scm index 28f18b175..58b10bfdc 100644 --- a/queries/hare/folds.scm +++ b/queries/hare/folds.scm @@ -1,12 +1,10 @@ [ (imports) - (function_declaration) (enum_type) (struct_type) (tuple_type) (union_type) - (block) (if_statement) (for_statement) @@ -14,7 +12,6 @@ (switch_expression) (match_expression) (case) - (array_literal) (struct_literal) (tuple_literal) diff --git a/queries/hare/highlights.scm b/queries/hare/highlights.scm index fb9f3f158..817084886 100644 --- a/queries/hare/highlights.scm +++ b/queries/hare/highlights.scm @@ -1,44 +1,44 @@ ; Variables - (identifier) @variable ; Types - (type) @type (scoped_type_identifier - (identifier) . (identifier) @type) + (identifier) + . + (identifier) @type) (struct_literal - . (identifier) @type) + . + (identifier) @type) (builtin_type) @type.builtin ; Constants - ((identifier) @constant (#lua-match? @constant "^[A-Z_]+$")) ; Includes - -[ - "use" -] @keyword.import +"use" @keyword.import (use_statement (scoped_type_identifier (identifier) @module)) + (use_statement - (identifier) @module "{") + (identifier) @module + "{") + (use_statement - . (identifier) @module .) + . + (identifier) @module .) ((scoped_type_identifier path: (_) @module) (#set! "priority" 105)) ; Keywords - [ "def" "enum" @@ -49,9 +49,7 @@ "union" ] @keyword -[ - "fn" -] @keyword.function +"fn" @keyword.function [ "defer" @@ -65,12 +63,13 @@ ] @keyword.operator ; Typedefs - (type_declaration - "type" (identifier) @type.definition . "=") + "type" + (identifier) @type.definition + . + "=") ; Qualifiers - [ "const" "static" @@ -78,7 +77,6 @@ ] @type.qualifier ; Attributes - [ "@fini" "@init" @@ -89,62 +87,72 @@ ] @attribute ; Labels - ((label) @label (#set! "priority" 105)) ; Functions - (function_declaration - "fn" . (identifier) @function) + "fn" + . + (identifier) @function) (call_expression - . (identifier) @function.call) + . + (identifier) @function.call) (call_expression - . (scoped_type_identifier - . (identifier) . "::" . (identifier) @function.method.call)) + . + (scoped_type_identifier + . + (identifier) + . + "::" + . + (identifier) @function.method.call)) ((call_expression - . (identifier) @function.builtin) + . + (identifier) @function.builtin) (#any-of? @function.builtin "align" "assert" "free" "len" "offset" "size")) (size_expression "size" @function.builtin) ((function_declaration - "fn" . (identifier) @constructor) + "fn" + . + (identifier) @constructor) (#eq? @constructor "init")) ((call_expression - . (identifier) @constructor) + . + (identifier) @constructor) (#eq? @constructor "init")) ; Parameters - (parameter - (_) @variable.parameter . ":") + (_) @variable.parameter + . + ":") ; Fields - ((member_expression - "." (_) @variable.member) + "." + (_) @variable.member) (#set! "priority" 105)) (field - . (identifier) @variable.member) + . + (identifier) @variable.member) (field_assignment - . (identifier) @variable.member) + . + (identifier) @variable.member) ; Repeats - -[ - "for" -] @keyword.repeat +"for" @keyword.repeat ; Conditionals - [ "if" "else" @@ -155,7 +163,6 @@ ] @keyword.conditional ; Operators - [ "+" "-" @@ -196,12 +203,20 @@ ] @operator ; Punctuation +[ + "{" + "}" +] @punctuation.bracket -[ "{" "}" ] @punctuation.bracket - -[ "[" "]" ] @punctuation.bracket +[ + "[" + "]" +] @punctuation.bracket -[ "(" ")" ] @punctuation.bracket +[ + "(" + ")" +] @punctuation.bracket [ ".." @@ -209,11 +224,14 @@ "_" ] @punctuation.special -(pointer_type "*" @punctuation.special) +(pointer_type + "*" @punctuation.special) -(slice_type "*" @punctuation.special) +(slice_type + "*" @punctuation.special) -(error_type "!" @punctuation.special) +(error_type + "!" @punctuation.special) [ "," @@ -225,7 +243,6 @@ ] @punctuation.delimiter ; Literals - [ (string) (raw_string) @@ -247,5 +264,4 @@ ] @constant.builtin ; Comments - (comment) @comment @spell diff --git a/queries/hare/indents.scm b/queries/hare/indents.scm index b3aadcd6e..d729663e1 100644 --- a/queries/hare/indents.scm +++ b/queries/hare/indents.scm @@ -3,19 +3,18 @@ (struct_type) (tuple_type) (union_type) - (block) (for_statement) (call_expression) (case) - (array_literal) (struct_literal) (tuple_literal) ] @indent.begin (if_statement - ("(" condition: (_) ")") @indent.begin) + ("(" + condition: (_)")") @indent.begin) [ "}" @@ -23,11 +22,20 @@ ")" ] @indent.end -[ "{" "}" ] @indent.branch +[ + "{" + "}" +] @indent.branch -[ "[" "]" ] @indent.branch +[ + "[" + "]" +] @indent.branch -[ "(" ")" ] @indent.branch +[ + "(" + ")" +] @indent.branch [ (ERROR) diff --git a/queries/hare/injections.scm b/queries/hare/injections.scm index d3befb39b..88a3f1cdd 100644 --- a/queries/hare/injections.scm +++ b/queries/hare/injections.scm @@ -1,10 +1,18 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) ((call_expression - . (_) @_fnname - . "(" - . (_ [(string_content) (raw_string_content)] @injection.content) - . ")") + . + (_) @_fnname + . + "(" + . + (_ + [ + (string_content) + (raw_string_content) + ] @injection.content) + . + ")") (#any-of? @_fnname "compile" "regex::compile") (#set! injection.language "regex")) diff --git a/queries/hare/locals.scm b/queries/hare/locals.scm index bf606b9b1..b81ee5135 100644 --- a/queries/hare/locals.scm +++ b/queries/hare/locals.scm @@ -1,5 +1,4 @@ ; Scopes - [ (module) (function_declaration) @@ -10,38 +9,57 @@ ] @local.scope ; References - [ (identifier) (scoped_type_identifier) ] @local.reference ; Definitions - (global_binding - (identifier) @local.definition.constant . ":" (_)) + (identifier) @local.definition.constant + . + ":" + (_)) (const_declaration - "const" (identifier) @local.definition.constant . "=") + "const" + (identifier) @local.definition.constant + . + "=") (field - . (identifier) @local.definition.field) + . + (identifier) @local.definition.field) (field_assignment - . (identifier) @local.definition.field) + . + (identifier) @local.definition.field) (function_declaration - "fn" . (identifier) @local.definition.function) + "fn" + . + (identifier) @local.definition.function) (parameter - (_) @local.definition.parameter . ":") + (_) @local.definition.parameter + . + ":") (type_declaration - "type" (identifier) @local.definition.type . "=") + "type" + (identifier) @local.definition.type + . + "=") (type_declaration - "type" (identifier) @local.definition.enum . "=" (enum_type)) + "type" + (identifier) @local.definition.enum + . + "=" + (enum_type)) (let_declaration - "let" . (identifier) @local.definition.variable ","?) - + "let" + . + (identifier) @local.definition.variable + ","?) diff --git a/queries/haskell/folds.scm b/queries/haskell/folds.scm index 28eadf8f3..a1af2a169 100644 --- a/queries/haskell/folds.scm +++ b/queries/haskell/folds.scm @@ -1,5 +1,5 @@ [ - (exp_apply) - (exp_do) - (function) + (exp_apply) + (exp_do) + (function) ] @fold diff --git a/queries/haskell/highlights.scm b/queries/haskell/highlights.scm index 92b36434d..1a3cfd485 100644 --- a/queries/haskell/highlights.scm +++ b/queries/haskell/highlights.scm @@ -1,34 +1,44 @@ -;; ---------------------------------------------------------------------------- -;; Parameters and variables - -;; NOTE: These are at the top, so that they have low priority, -;; and don't override destructured parameters - +; ---------------------------------------------------------------------------- +; Parameters and variables +; NOTE: These are at the top, so that they have low priority, +; and don't override destructured parameters (variable) @variable + (pat_wildcard) @variable (function - patterns: (patterns (_) @variable.parameter)) + patterns: + (patterns + (_) @variable.parameter)) -(exp_lambda (_)+ @variable.parameter "->") +(exp_lambda + (_)+ @variable.parameter + "->") -(function - infix: (infix - lhs: (_) @variable.parameter)) -(function - infix: (infix - rhs: (_) @variable.parameter)) +(function + infix: + (infix + lhs: (_) @variable.parameter)) -;; ---------------------------------------------------------------------------- -;; Literals and comments +(function + infix: + (infix + rhs: (_) @variable.parameter)) +; ---------------------------------------------------------------------------- +; Literals and comments (integer) @number + (exp_negation) @number -(exp_literal (float)) @number.float + +(exp_literal + (float)) @number.float + (char) @character + (string) @string -(con_unit) @string.special.symbol ; unit, as in () +(con_unit) @string.special.symbol ; unit, as in () (comment) @comment @@ -37,30 +47,28 @@ ; ((comment) @_first . (comment)+ @comment.documentation) ; once https://github.com/neovim/neovim/pull/24738 has been merged. ; -; ((comment) @comment.documentation +; ((comment) @comment.documentation ; (#lua-match? @comment.documentation "^-- |")) ; -; ((comment) @_first @comment.documentation -; (comment) @comment.documentation +; ((comment) @_first @comment.documentation +; (comment) @comment.documentation ; (#lua-match? @_first "^-- |")) ; -; ((comment) @comment.documentation +; ((comment) @comment.documentation ; (#lua-match? @comment.documentation "^-- %^")) ; -; ((comment) @_first @comment.documentation -; (comment) @comment.documentation +; ((comment) @_first @comment.documentation +; (comment) @comment.documentation ; (#lua-match? @_first "^-- %^")) ; -; ((comment) @comment.documentation +; ((comment) @comment.documentation ; (#lua-match? @comment.documentation "^{-")) ; -; ((comment) @_first @comment.documentation -; (comment) @comment.documentation +; ((comment) @_first @comment.documentation +; (comment) @comment.documentation ; (#lua-match? @_first "^{-")) - -;; ---------------------------------------------------------------------------- -;; Punctuation - +; ---------------------------------------------------------------------------- +; Punctuation [ "(" ")" @@ -75,10 +83,8 @@ ";" ] @punctuation.delimiter - -;; ---------------------------------------------------------------------------- -;; Keywords, operators, includes - +; ---------------------------------------------------------------------------- +; Keywords, operators, includes [ "forall" "∀" @@ -105,7 +111,7 @@ (constructor_operator) (type_operator) (tycon_arrow) - (qualified_module) ; grabs the `.` (dot), ex: import System.IO + (qualified_module) ; grabs the `.` (dot), ex: import System.IO (qualified_type) (qualified_variable) (all_names) @@ -123,14 +129,26 @@ "@" ] @operator - (module) @module -((qualified_module (module) @constructor) - . (module)) -(qualified_type (module) @module) -(qualified_variable (module) @module) -(import (module) @module) -(import (module) @constructor . (module)) + +((qualified_module + (module) @constructor) + . + (module)) + +(qualified_type + (module) @module) + +(qualified_variable + (module) @module) + +(import + (module) @module) + +(import + (module) @constructor + . + (module)) [ (where) @@ -157,310 +175,449 @@ "infixr" ] @keyword +; ---------------------------------------------------------------------------- +; Functions and variables +(signature + name: (variable) @function) -;; ---------------------------------------------------------------------------- -;; Functions and variables - -(signature name: (variable) @function) - -(function name: (variable) @function) +(function + name: (variable) @function) -(function +(function name: (variable) @variable - rhs: [ - (exp_literal) - (exp_apply - (exp_name - [(constructor) - (variable) - (qualified_variable) - ])) - (quasiquote) - ((exp_name) . (operator)) - ]) + rhs: + [ + (exp_literal) + (exp_apply + (exp_name + [ + (constructor) + (variable) + (qualified_variable) + ])) + (quasiquote) + ((exp_name) + . + (operator)) + ]) -(function +(function name: (variable) @variable - rhs: (exp_infix [ - (exp_literal) - (exp_apply - (exp_name - [(constructor) - (variable) - (qualified_variable) - ])) - (quasiquote) - ((exp_name) . (operator)) - ])) - -;; Consider signatures (and accompanying functions) -;; with only one value on the rhs as variables -(signature . (variable) @variable . (_) . ) -((signature . (variable) @_name . (_) . ) - . (function name: (variable) @variable) - (#eq? @_name @variable)) -;; but consider a type that involves 'IO' a function -(signature name: (variable) @function - . (type_apply (type_name) @_type) - (#eq? @_type "IO")) -((signature name: (variable) @_name - . (type_apply (type_name) @_type) - (#eq? @_type "IO")) - . (function name: (variable) @function) - (#eq? @_name @function)) - -;; functions with parameters -;; + accompanying signatures + rhs: + (exp_infix + [ + (exp_literal) + (exp_apply + (exp_name + [ + (constructor) + (variable) + (qualified_variable) + ])) + (quasiquote) + ((exp_name) + . + (operator)) + ])) + +; Consider signatures (and accompanying functions) +; with only one value on the rhs as variables +(signature + . + (variable) @variable + . + (_) .) + +((signature + . + (variable) @_name + . + (_) .) + . + (function + name: (variable) @variable) + (#eq? @_name @variable)) + +; but consider a type that involves 'IO' a function +(signature + name: (variable) @function + . + (type_apply + (type_name) @_type) + (#eq? @_type "IO")) + +((signature + name: (variable) @_name + . + (type_apply + (type_name) @_type) + (#eq? @_type "IO")) + . + (function + name: (variable) @function) + (#eq? @_name @function)) + +; functions with parameters +; + accompanying signatures (function name: (variable) @function patterns: (patterns)) + ((signature) @function - . (function + . + (function name: (variable) @function patterns: (patterns))) + (function name: (variable) @function rhs: (exp_lambda)) ; view patterns -(pat_view (exp_name [ - ((variable) @function.call) - (qualified_variable (variable) @function.call) -])) +(pat_view + (exp_name + [ + ((variable) @function.call) + (qualified_variable + (variable) @function.call) + ])) ; consider infix functions as operators -(exp_infix [ - (variable) @operator - (qualified_variable (variable) @operator) -]) +(exp_infix + [ + (variable) @operator + (qualified_variable + (variable) @operator) + ]) + ; partially applied infix functions (sections) also get highlighted as operators -(exp_section_right [ - ((variable) @operator) - (qualified_variable (variable) @operator) -]) -(exp_section_left [ - ((variable) @operator) - (qualified_variable (variable) @operator) -]) +(exp_section_right + [ + ((variable) @operator) + (qualified_variable + (variable) @operator) + ]) + +(exp_section_left + [ + ((variable) @operator) + (qualified_variable + (variable) @operator) + ]) ; function calls with an infix operator ; e.g. func <$> a <*> b -(exp_infix - (exp_name +(exp_infix + (exp_name [ ((variable) @function.call) - (qualified_variable ( - (module) @module - (variable) @function.call)) + (qualified_variable + ((module) @module + (variable) @function.call)) ]) - . (operator)) + . + (operator)) + ; infix operators applied to variables -((exp_name (variable) @variable) . (operator)) -((operator) . (exp_name [ - ((variable) @variable) - (qualified_variable (variable) @variable) -])) +((exp_name + (variable) @variable) + . + (operator)) + +((operator) + . + (exp_name + [ + ((variable) @variable) + (qualified_variable + (variable) @variable) + ])) + ; function calls with infix operators -((exp_name [ +((exp_name + [ ((variable) @function.call) - (qualified_variable (variable) @function.call) - ]) . (operator) @_op - (#any-of? @_op "$" "<$>" ">>=" "=<<")) + (qualified_variable + (variable) @function.call) + ]) + . + (operator) @_op + (#any-of? @_op "$" "<$>" ">>=" "=<<")) + ; right hand side of infix operator -((exp_infix - [(operator)(variable)] ; infix or `func` - . (exp_name [ +((exp_infix + [ + (operator) + (variable) + ] ; infix or `func` + . + (exp_name + [ ((variable) @function.call) - (qualified_variable (variable) @function.call) - ])) . (operator) @_op - (#any-of? @_op "$" "<$>" "=<<")) + (qualified_variable + (variable) @function.call) + ])) + . + (operator) @_op + (#any-of? @_op "$" "<$>" "=<<")) + ; function composition, arrows, monadic composition (lhs) -((exp_name [ - ((variable) @function) - (qualified_variable (variable) @function) - ]) . (operator) @_op - (#any-of? @_op "." ">>>" "***" ">=>" "<=<")) +((exp_name + [ + ((variable) @function) + (qualified_variable + (variable) @function) + ]) + . + (operator) @_op + (#any-of? @_op "." ">>>" "***" ">=>" "<=<")) + ; right hand side of infix operator -((exp_infix - [(operator)(variable)] ; infix or `func` - . (exp_name [ +((exp_infix + [ + (operator) + (variable) + ] ; infix or `func` + . + (exp_name + [ ((variable) @function) - (qualified_variable (variable) @function) - ])) . (operator) @_op - (#any-of? @_op "." ">>>" "***" ">=>" "<=<")) + (qualified_variable + (variable) @function) + ])) + . + (operator) @_op + (#any-of? @_op "." ">>>" "***" ">=>" "<=<")) + ; function composition, arrows, monadic composition (rhs) -((operator) @_op . (exp_name [ - ((variable) @function) - (qualified_variable (variable) @function) - ]) - (#any-of? @_op "." ">>>" "***" ">=>" "<=<" )) - +((operator) @_op + . + (exp_name + [ + ((variable) @function) + (qualified_variable + (variable) @function) + ]) + (#any-of? @_op "." ">>>" "***" ">=>" "<=<")) + ; function defined in terms of a function composition -(function +(function name: (variable) @function - rhs: (exp_infix (_) . (operator) @_op . (_) - (#any-of? @_op "." ">>>" "***" ">=>" "<=<"))) - -(exp_apply (exp_name - [ - ((variable) @function.call) - (qualified_variable (variable) @function.call) - ])) + rhs: + (exp_infix + (_) + . + (operator) @_op + . + (_) + (#any-of? @_op "." ">>>" "***" ">=>" "<=<"))) + +(exp_apply + (exp_name + [ + ((variable) @function.call) + (qualified_variable + (variable) @function.call) + ])) ; function compositions, in parentheses, applied ; lhs -(exp_apply - . (exp_parens (exp_infix - (exp_name [((variable) @function.call) (qualified_variable (variable) @function.call)]) - . (operator)))) +(exp_apply + . + (exp_parens + (exp_infix + (exp_name + [ + ((variable) @function.call) + (qualified_variable + (variable) @function.call) + ]) + . + (operator)))) + ; rhs -(exp_apply - . (exp_parens (exp_infix - (operator) - . (exp_name [((variable) @function.call) (qualified_variable (variable) @function.call)]))) - ) - -;; variables being passed to a function call -(exp_apply (_)+ - . (exp_name [ - ((variable) @variable) - (qualified_variable (variable) @variable) - ])) - -;; Consider functions with only one value on the rhs -;; as variables, e.g. x = Rec {} or x = foo -(function - . (variable) @variable - . [ - (exp_record) - (exp_name [(variable) (qualified_variable)]) - (exp_list) - (exp_tuple) - (exp_cond) - ] . ) - -;; main is always a function -;; (this prevents `main = undefined` from being highlighted as a variable) -(function name: (variable) @function (#eq? @function "main")) - -;; scoped function types (func :: a -> b) -(pat_typed - pattern: (pat_name (variable) @function) - type: (fun)) +(exp_apply + . + (exp_parens + (exp_infix + (operator) + . + (exp_name + [ + ((variable) @function.call) + (qualified_variable + (variable) @function.call) + ])))) + +; variables being passed to a function call +(exp_apply + (_)+ + . + (exp_name + [ + ((variable) @variable) + (qualified_variable + (variable) @variable) + ])) -;; signatures that have a function type -;; + functions that follow them -((signature (variable) @function (fun))) -((signature (variable) @_type (fun)) . (function (variable) @function) (#eq? @function @_type)) -((signature (variable) @function (context (fun)))) -((signature (variable) @_type (context (fun))) . (function (variable) @function) (#eq? @function @_type)) -((signature (variable) @function (forall (context (fun)))) . (function (variable))) -((signature (variable) @_type (forall (context (fun)))) . (function (variable) @function) (#eq? @function @_type)) +; Consider functions with only one value on the rhs +; as variables, e.g. x = Rec {} or x = foo +(function + . + (variable) @variable + . + [ + (exp_record) + (exp_name + [ + (variable) + (qualified_variable) + ]) + (exp_list) + (exp_tuple) + (exp_cond) + ] .) + +; main is always a function +; (this prevents `main = undefined` from being highlighted as a variable) +(function + name: (variable) @function + (#eq? @function "main")) -;; ---------------------------------------------------------------------------- -;; Types +; scoped function types (func :: a -> b) +(pat_typed + pattern: + (pat_name + (variable) @function) + type: (fun)) +; signatures that have a function type +; + functions that follow them +((signature + (variable) @function + (fun))) + +((signature + (variable) @_type + (fun)) + . + (function + (variable) @function) + (#eq? @function @_type)) + +((signature + (variable) @function + (context + (fun)))) + +((signature + (variable) @_type + (context + (fun))) + . + (function + (variable) @function) + (#eq? @function @_type)) + +((signature + (variable) @function + (forall + (context + (fun)))) + . + (function + (variable))) + +((signature + (variable) @_type + (forall + (context + (fun)))) + . + (function + (variable) @function) + (#eq? @function @_type)) + +; ---------------------------------------------------------------------------- +; Types (type) @type + (type_star) @type + (type_variable) @type (constructor) @constructor ; True or False -((constructor) @boolean (#any-of? @boolean "True" "False")) +((constructor) @boolean + (#any-of? @boolean "True" "False")) + ; otherwise (= True) ((variable) @boolean (#eq? @boolean "otherwise")) -;; ---------------------------------------------------------------------------- -;; Quasi-quotes - +; ---------------------------------------------------------------------------- +; Quasi-quotes (quoter) @function.call -(quasiquote +(quasiquote [ - (quoter) @_name - (_ (variable) @_name) - ](#eq? @_name "qq") + (quoter) @_name + (_ + (variable) @_name) + ] + (#eq? @_name "qq") (quasiquote_body) @string) -(quasiquote - ((_ (variable) @_name)) (#eq? @_name "qq") +(quasiquote + ((_ + (variable) @_name)) + (#eq? @_name "qq") (quasiquote_body) @string) -;; namespaced quasi-quoter +; namespaced quasi-quoter (quasiquote (_ (module) @module - . (variable) @function.call - )) + . + (variable) @function.call)) ; Highlighting of quasiquote_body for other languages is handled by injections.scm - -;; ---------------------------------------------------------------------------- -;; Exceptions/error handling - +; ---------------------------------------------------------------------------- +; 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 + (#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 (variable) @variable.member) -(pat_field (variable) @variable.member) -(exp_projection field: (variable) @variable.member) -(import_item (type) . (import_con_names (variable) @variable.member)) -(exp_field field: [((variable) @variable.member) (qualified_variable (variable) @variable.member)]) - - -;; ---------------------------------------------------------------------------- -;; Spell checking + (#any-of? @keyword.debug "trace" "traceId" "traceShow" "traceShowId" "traceWith" "traceShowWith" "traceStack" "traceIO" "traceM" "traceShowM" "traceEvent" "traceEventWith" "traceEventIO" "flushEventLog" "traceMarker" "traceMarkerIO")) + +; ---------------------------------------------------------------------------- +; Fields +(field + (variable) @variable.member) + +(pat_field + (variable) @variable.member) + +(exp_projection + field: (variable) @variable.member) + +(import_item + (type) + . + (import_con_names + (variable) @variable.member)) + +(exp_field + field: + [ + ((variable) @variable.member) + (qualified_variable + (variable) @variable.member) + ]) +; ---------------------------------------------------------------------------- +; Spell checking (comment) @spell diff --git a/queries/haskell/injections.scm b/queries/haskell/injections.scm index bc70e012f..d1c8fe5fb 100644 --- a/queries/haskell/injections.scm +++ b/queries/haskell/injections.scm @@ -1,18 +1,15 @@ -;; ----------------------------------------------------------------------------- -;; General language injection - +; ----------------------------------------------------------------------------- +; General language injection (quasiquote - ((quoter) @injection.language) - ((quasiquote_body) @injection.content) -) + ((quoter) @injection.language) + ((quasiquote_body) @injection.content)) ((comment) @injection.content - (#set! injection.language "comment")) - -;; ----------------------------------------------------------------------------- -;; shakespeare library -;; NOTE: doesn't support templating + (#set! injection.language "comment")) +; ----------------------------------------------------------------------------- +; shakespeare library +; NOTE: doesn't support templating ; TODO: add once CoffeeScript parser is added ; ; CoffeeScript: Text.Coffee ; (quasiquote @@ -20,58 +17,52 @@ ; (#eq? @_name "coffee") ; ((quasiquote_body) @injection.content ; (#set! injection.language "coffeescript"))) - ; CSS: Text.Cassius, Text.Lucius (quasiquote - (quoter) @_name - (#any-of? @_name "cassius" "lucius") - ((quasiquote_body) @injection.content) - (#set! injection.language "css")) + (quoter) @_name + (#any-of? @_name "cassius" "lucius") + ((quasiquote_body) @injection.content) + (#set! injection.language "css")) ; HTML: Text.Hamlet (quasiquote - (quoter) @_name - (#any-of? @_name "shamlet" "xshamlet" "hamlet" "xhamlet" "ihamlet") - ((quasiquote_body) @injection.content) - (#set! injection.language "html")) + (quoter) @_name + (#any-of? @_name "shamlet" "xshamlet" "hamlet" "xhamlet" "ihamlet") + ((quasiquote_body) @injection.content) + (#set! injection.language "html")) ; JS: Text.Julius (quasiquote - (quoter) @_name - (#any-of? @_name "js" "julius") - ((quasiquote_body) @injection.content) - (#set! injection.language "javascript")) + (quoter) @_name + (#any-of? @_name "js" "julius") + ((quasiquote_body) @injection.content) + (#set! injection.language "javascript")) ; TS: Text.TypeScript (quasiquote - (quoter) @_name - (#any-of? @_name "tsc" "tscJSX") - ((quasiquote_body) @injection.content) - (#set! injection.language "typescript")) - - -;; ----------------------------------------------------------------------------- -;; HSX + (quoter) @_name + (#any-of? @_name "tsc" "tscJSX") + ((quasiquote_body) @injection.content) + (#set! injection.language "typescript")) +; ----------------------------------------------------------------------------- +; HSX (quasiquote - (quoter) @_name - (#eq? @_name "hsx") - ((quasiquote_body) @injection.content) - (#set! injection.language "html")) - -;; ----------------------------------------------------------------------------- -;; Inline JSON from aeson + (quoter) @_name + (#eq? @_name "hsx") + ((quasiquote_body) @injection.content) + (#set! injection.language "html")) +; ----------------------------------------------------------------------------- +; Inline JSON from aeson (quasiquote (quoter) @_name (#eq? @_name "aesonQQ") ((quasiquote_body) @injection.content) (#set! injection.language "json")) - -;; ----------------------------------------------------------------------------- -;; SQL - +; ----------------------------------------------------------------------------- +; SQL ; postgresql-simple (quasiquote (quoter) @injection.language diff --git a/queries/haskell_persistent/folds.scm b/queries/haskell_persistent/folds.scm index 2bdffd177..dd34d9f15 100644 --- a/queries/haskell_persistent/folds.scm +++ b/queries/haskell_persistent/folds.scm @@ -1,3 +1 @@ -[ - (entity_definition) -] @fold +(entity_definition) @fold diff --git a/queries/haskell_persistent/highlights.scm b/queries/haskell_persistent/highlights.scm index e806befcf..22cbf5cb3 100644 --- a/queries/haskell_persistent/highlights.scm +++ b/queries/haskell_persistent/highlights.scm @@ -1,20 +1,23 @@ -;; ---------------------------------------------------------------------------- -;; Literals and comments - +; ---------------------------------------------------------------------------- +; Literals and comments (integer) @number + (float) @number.float + (char) @character + (string) @string + (attribute_name) @attribute + (attribute_exclamation_mark) @attribute -(con_unit) @string.special.symbol ; unit, as in () +(con_unit) @string.special.symbol ; unit, as in () (comment) @comment @spell -;; ---------------------------------------------------------------------------- -;; Keywords, operators, includes - +; ---------------------------------------------------------------------------- +; Keywords, operators, includes [ "Id" "Primary" @@ -24,15 +27,12 @@ "=" @operator - -;; ---------------------------------------------------------------------------- -;; Functions and variables - +; ---------------------------------------------------------------------------- +; Functions and variables (variable) @variable -;; ---------------------------------------------------------------------------- -;; Types - +; ---------------------------------------------------------------------------- +; Types (type) @type (constructor) @constructor diff --git a/queries/hcl/folds.scm b/queries/hcl/folds.scm index cb20b2aa8..e0c5313a2 100644 --- a/queries/hcl/folds.scm +++ b/queries/hcl/folds.scm @@ -1,6 +1,6 @@ [ - (comment) - (block) - (heredoc_template) - (object) + (comment) + (block) + (heredoc_template) + (object) ] @fold diff --git a/queries/hcl/highlights.scm b/queries/hcl/highlights.scm index 7aa8b86fe..45a120dff 100644 --- a/queries/hcl/highlights.scm +++ b/queries/hcl/highlights.scm @@ -1,5 +1,4 @@ ; highlights.scm - [ "!" "\*" @@ -76,22 +75,45 @@ ] @punctuation.special (numeric_lit) @number + (bool_lit) @boolean + (null_lit) @constant + (comment) @comment @spell + (identifier) @variable -(body (block (identifier) @keyword)) -(body (block (body (block (identifier) @type)))) -(function_call (identifier) @function) -(attribute (identifier) @variable.member) +(body + (block + (identifier) @keyword)) + +(body + (block + (body + (block + (identifier) @type)))) + +(function_call + (identifier) @function) + +(attribute + (identifier) @variable.member) ; { key: val } ; ; highlight identifier keys as though they were block attributes -(object_elem key: (expression (variable_expr (identifier) @variable.member))) +(object_elem + key: + (expression + (variable_expr + (identifier) @variable.member))) ; var.foo, data.bar ; ; first element in get_attr is a variable.builtin or a reference to a variable.builtin -(expression (variable_expr (identifier) @variable.builtin) (get_attr (identifier) @variable.member)) +(expression + (variable_expr + (identifier) @variable.builtin) + (get_attr + (identifier) @variable.member)) diff --git a/queries/hcl/indents.scm b/queries/hcl/indents.scm index 93264de9d..1d7dc49d9 100644 --- a/queries/hcl/indents.scm +++ b/queries/hcl/indents.scm @@ -12,4 +12,5 @@ ] @indent.branch @indent.end (comment) @indent.auto + (ERROR) @indent.auto diff --git a/queries/hcl/injections.scm b/queries/hcl/injections.scm index fd881d503..b68f4caea 100644 --- a/queries/hcl/injections.scm +++ b/queries/hcl/injections.scm @@ -1,5 +1,5 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) (heredoc_template (template_literal) @injection.content diff --git a/queries/heex/highlights.scm b/queries/heex/highlights.scm index f13e5d04f..e2fb01880 100644 --- a/queries/heex/highlights.scm +++ b/queries/heex/highlights.scm @@ -31,23 +31,24 @@ ; HEEx text content is treated as markup ; (text) @none - ; HEEx tags and slots are highlighted as HTML [ - (tag_name) - (slot_name) + (tag_name) + (slot_name) ] @tag ; HEEx attributes are highlighted as HTML attributes (attribute_name) @tag.attribute + [ (attribute_value) (quoted_attribute_value) ] @string ; HEEx components are highlighted as modules and function calls -(component_name [ - (module) @type - (function) @function - "." @punctuation.delimiter -]) +(component_name + [ + (module) @type + (function) @function + "." @punctuation.delimiter + ]) diff --git a/queries/heex/injections.scm b/queries/heex/injections.scm index d8ae03caa..4f179ee80 100644 --- a/queries/heex/injections.scm +++ b/queries/heex/injections.scm @@ -27,4 +27,4 @@ ; HEEx comments ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/hjson/highlights.scm b/queries/hjson/highlights.scm index 6e092fa14..8333d8fe5 100644 --- a/queries/hjson/highlights.scm +++ b/queries/hjson/highlights.scm @@ -1,15 +1,28 @@ (true) @boolean + (false) @boolean + (null) @constant.builtin + (number) @number -(pair key: (string) @label) -(pair value: (string) @string) -(array (string) @string) + +(pair + key: (string) @label) + +(pair + value: (string) @string) + +(array + (string) @string) + ; (string_content (escape_sequence) @string.escape) ; "," @punctuation.delimiter "[" @punctuation.bracket + "]" @punctuation.bracket + "{" @punctuation.bracket + "}" @punctuation.bracket (comment) @comment @spell diff --git a/queries/hjson/indents.scm b/queries/hjson/indents.scm index 3b01ca999..350f670a0 100644 --- a/queries/hjson/indents.scm +++ b/queries/hjson/indents.scm @@ -1,3 +1,2 @@ ; inherits: json - (comment) @indent.ignore diff --git a/queries/hjson/injections.scm b/queries/hjson/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/hjson/injections.scm +++ b/queries/hjson/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/hlsl/highlights.scm b/queries/hlsl/highlights.scm index 68e9e44bd..b85c1a7fd 100644 --- a/queries/hlsl/highlights.scm +++ b/queries/hlsl/highlights.scm @@ -1,5 +1,4 @@ ; inherits: cpp - [ "in" "out" @@ -26,10 +25,13 @@ "triangle" ] @type.qualifier -( - (identifier) @variable.builtin - (#lua-match? @variable.builtin "^SV_") -) +((identifier) @variable.builtin + (#lua-match? @variable.builtin "^SV_")) (hlsl_attribute) @attribute -(hlsl_attribute ["[" "]"] @attribute) + +(hlsl_attribute + [ + "[" + "]" + ] @attribute) diff --git a/queries/hlsl/injections.scm b/queries/hlsl/injections.scm index 29222ee01..c2fca7121 100644 --- a/queries/hlsl/injections.scm +++ b/queries/hlsl/injections.scm @@ -1,5 +1,5 @@ ((preproc_arg) @injection.content - (#set! injection.language "hlsl")) + (#set! injection.language "hlsl")) ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/hocon/highlights.scm b/queries/hocon/highlights.scm index f0cc498b4..0eb94e6dd 100644 --- a/queries/hocon/highlights.scm +++ b/queries/hocon/highlights.scm @@ -1,37 +1,65 @@ (comment) @comment @spell (null) @constant.builtin -[ (true) (false) ] @boolean + +[ + (true) + (false) +] @boolean + (number) @number + (unit) @keyword + (string) @string + (multiline_string) @string -(string (escape_sequence) @string.escape) + +(string + (escape_sequence) @string.escape) + (unquoted_string) @string -[ "url" +[ + "url" "file" "classpath" "required" ] @keyword -(include "include" @keyword.import) +(include + "include" @keyword.import) + +(substitution + [ + "${" + "${?" + "}" + ] @punctuation.special) + +(substitution + (_) @variable.member) -(substitution ["${" "${?" "}"] @punctuation.special) -(substitution (_) @variable.member) +(path + (_) @variable.member) -(path (_) @variable.member) -(value [":" "=" "+=" ] @operator) +(value + [ + ":" + "=" + "+=" + ] @operator) [ - "(" - ")" - "[" - "]" - "{" - "}" -] @punctuation.bracket + "(" + ")" + "[" + "]" + "{" + "}" +] @punctuation.bracket -[ "," ] @punctuation.delimiter -(unquoted_path "." @punctuation.delimiter) +"," @punctuation.delimiter +(unquoted_path + "." @punctuation.delimiter) diff --git a/queries/hocon/injections.scm b/queries/hocon/injections.scm index 321c90add..2f0e58eb6 100644 --- a/queries/hocon/injections.scm +++ b/queries/hocon/injections.scm @@ -1,2 +1,2 @@ ((comment) @injection.content - (#set! injection.language "comment")) + (#set! injection.language "comment")) diff --git a/queries/hoon/folds.scm b/queries/hoon/folds.scm index 93d1386e7..cfb4b6d0c 100644 --- a/queries/hoon/folds.scm +++ b/queries/hoon/folds.scm @@ -1,6 +1,6 @@ [ - (bartisTall) - (luslusTall) - (lusbucTall) - (barcenTall) - ] @fold + (bartisTall) + (luslusTall) + (lusbucTall) + (barcenTall) +] @fold diff --git a/queries/hoon/highlights.scm b/queries/hoon/highlights.scm index 029d20c1e..767b0dd22 100644 --- a/queries/hoon/highlights.scm +++ b/queries/hoon/highlights.scm @@ -7,14 +7,13 @@ ")" "[" "]" -] @punctuation.bracket +] @punctuation.bracket [ (coreTerminator) (seriesTerminator) ] @punctuation.delimiter - (rune) @operator (term) @constant @@ -28,6 +27,9 @@ (date) @string.special (mold) @string.special.symbol + (specialIndex) @number.builtin + (lark) @operator + (fullContext) @string.special.symbol diff --git a/queries/hoon/locals.scm b/queries/hoon/locals.scm index f8cb5f857..fd7cc026d 100644 --- a/queries/hoon/locals.scm +++ b/queries/hoon/locals.scm @@ -1,4 +1,4 @@ (tisfasTall name: (name) @local.definition.var) - + (name) @local.reference diff --git a/queries/html/highlights.scm b/queries/html/highlights.scm index 4e2371d64..ae4e396c0 100644 --- a/queries/html/highlights.scm +++ b/queries/html/highlights.scm @@ -1,5 +1,4 @@ ; inherits: html_tags - (doctype) @constant "" - "" + "<" + ">" + "" ] @tag.delimiter "=" @operator diff --git a/queries/html_tags/indents.scm b/queries/html_tags/indents.scm index 2d9fd3864..59448d2fc 100644 --- a/queries/html_tags/indents.scm +++ b/queries/html_tags/indents.scm @@ -1,31 +1,32 @@ [ - ( - (element - (start_tag - (tag_name) @_not_special) - ) - (#not-any-of? @_not_special "meta" "link") - ) - (element (self_closing_tag)) + ((element + (start_tag + (tag_name) @_not_special)) + (#not-any-of? @_not_special "meta" "link")) + (element + (self_closing_tag)) ] @indent.begin - ; These tags are usually written one-lined and doesn't use self-closing tags so special-cased them ; but add indent to the tag to make sure attributes inside them are still indented if written multi-lined -( - (start_tag - (tag_name) @_special) - (#any-of? @_special "meta" "link") -) @indent.begin - +((start_tag + (tag_name) @_special) + (#any-of? @_special "meta" "link")) @indent.begin ; These are the nodes that will be captured when we do `normal o` ; But last element has already been ended, so capturing this ; to mark end of last element -(element (end_tag [">"] @indent.end)) -(element (self_closing_tag "/>" @indent.end)) +(element + (end_tag + ">" @indent.end)) + +(element + (self_closing_tag + "/>" @indent.end)) ; Script/style elements aren't indented, so only branch the end tag of other elements -(element (end_tag) @indent.branch) +(element + (end_tag) @indent.branch) + [ ">" "/>" diff --git a/queries/html_tags/injections.scm b/queries/html_tags/injections.scm index cef63ad8d..8cfcddf29 100644 --- a/queries/html_tags/injections.scm +++ b/queries/html_tags/injections.scm @@ -3,51 +3,57 @@ ; Add "lang" to predicate check so that vue/svelte can inherit this ; without having this element being captured twice ((style_element - (start_tag) @_no_type_lang - (raw_text) @injection.content) + (start_tag) @_no_type_lang + (raw_text) @injection.content) (#not-lua-match? @_no_type_lang "%slang%s*=") (#not-lua-match? @_no_type_lang "%stype%s*=") (#set! injection.language "css")) ((style_element - (start_tag - (attribute - (attribute_name) @_type - (quoted_attribute_value (attribute_value) @_css))) - (raw_text) @injection.content) - (#eq? @_type "type") - (#eq? @_css "text/css") - (#set! injection.language "css")) + (start_tag + (attribute + (attribute_name) @_type + (quoted_attribute_value + (attribute_value) @_css))) + (raw_text) @injection.content) + (#eq? @_type "type") + (#eq? @_css "text/css") + (#set! injection.language "css")) ; ; ((script_element - (start_tag) @_no_type_lang - (raw_text) @injection.content) - (#not-lua-match? @_no_type_lang "%slang%s*=") - (#not-lua-match? @_no_type_lang "%stype%s*=") - (#set! injection.language "javascript")) + (start_tag) @_no_type_lang + (raw_text) @injection.content) + (#not-lua-match? @_no_type_lang "%slang%s*=") + (#not-lua-match? @_no_type_lang "%stype%s*=") + (#set! injection.language "javascript")) ;