aboutsummaryrefslogtreecommitdiffstats
path: root/tests/query/highlights/smali
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-12-24 10:00:20 +0100
committerChristian Clason <c.clason@uni-graz.at>2024-01-19 16:58:37 +0100
commit1ae9b0e4558fe7868f8cda2db65239cfb14836d0 (patch)
tree4eea14b40b8b81d9388fb35cbc9e35b341a75c98 /tests/query/highlights/smali
parentchore(tests): consistent captures (diff)
downloadnvim-treesitter-1ae9b0e4558fe7868f8cda2db65239cfb14836d0.tar
nvim-treesitter-1ae9b0e4558fe7868f8cda2db65239cfb14836d0.tar.gz
nvim-treesitter-1ae9b0e4558fe7868f8cda2db65239cfb14836d0.tar.bz2
nvim-treesitter-1ae9b0e4558fe7868f8cda2db65239cfb14836d0.tar.lz
nvim-treesitter-1ae9b0e4558fe7868f8cda2db65239cfb14836d0.tar.xz
nvim-treesitter-1ae9b0e4558fe7868f8cda2db65239cfb14836d0.tar.zst
nvim-treesitter-1ae9b0e4558fe7868f8cda2db65239cfb14836d0.zip
feat!: align standard captures with upstream
Problem: Sharing highlight queries with upstream tree-sitter and Helix is difficult. Solution: Where reasonable, use capture names in tree-sitter's standard list or Helix's Atom-style hierarchy. Specifically: * tree-sitter "standard capture names" (https://github.com/tree-sitter/tree-sitter/blob/3f44b896852eb7daaa6df4fb778c9bb52c70c815/highlight/src/lib.rs#L20-L72): - `@parameter` -> `@variable.parameter` - `@field` -> `@variable.member` - `@namespace` -> `@module` - `@float` -> `@number.float` - `@symbol` -> `@string.special.symbol` - `@string.regex` -> `@string.regexp` - `@text.*` -> `@markup.*` (`strong`, `italic`, `link`, `strikethrough`; with exceptions; see below) - `@text.title` -> `@markup.heading` - `@text.literal` -> `@markup.raw` - `@text.reference` -> `@markup.link` - `@text.uri` -> `@markup.link.url` (in markup links) - `@string.special` -> `@markup.link.label` (non-url links) - `@punctuation.special` -> `@markup.list` (markdown lists only; move subitems from `@text.todo`) * Helix captures (https://docs.helix-editor.com/master/themes.html#syntax-highlighting): - `@method` -> `@function.method` - `@method.call` -> `@function.method.call` - `@text.{todo,warning,note,danger}` -> `@comment.{error,warning,hint,info,todo}` - `@text.diff.{add,delete,}` -> `@diff.{plus,minus,delta}` - `@text.uri` -> `@string.special.url` (outside markup) - `@preproc` -> `@keyword.directive` - `@define` -> `@keyword.directive`(`.define`?) - `@storageclass` -> `@keyword.storage` - `@conditional` -> `@keyword.conditional` - `@debug` -> `@keyword.debug` - `@exception` -> `@keyword.exception` - `@include` -> `@keyword.import` - `@repeat` -> `@keyword.repeat` * cleanup - remove some redundant `@conceal` (but still allow it for conceal-only patterns) - remove obsolete `@error` (syntax linting is out of scope for this repo) - sort, cleanup capture list in `CONTRIBUTING.md`
Diffstat (limited to 'tests/query/highlights/smali')
-rw-r--r--tests/query/highlights/smali/baksmali_test_class.smali26
1 files changed, 13 insertions, 13 deletions
diff --git a/tests/query/highlights/smali/baksmali_test_class.smali b/tests/query/highlights/smali/baksmali_test_class.smali
index 77eb0c83b..6412f8784 100644
--- a/tests/query/highlights/smali/baksmali_test_class.smali
+++ b/tests/query/highlights/smali/baksmali_test_class.smali
@@ -7,18 +7,18 @@
# ^ @punctuation.delimiter
.source "baksmali_test_class.smali"
-# <- @include
+# <- @keyword.import
.implements Lsome/interface;
.implements Lsome/other/interface;
.annotation build Lsome/annotation;
-# ^^^^^ @storageclass
+# ^^^^^ @keyword.storage
# ^^^^ @type
# ^ @punctuation.delimiter
value1 = "test"
-# ^^^^^^ @field
+# ^^^^^^ @variable.member
# ^ @operator
# ^^^^^^ @string
value2 = .subannotation Lsome/annotation;
@@ -50,7 +50,7 @@
.field public static byteNegStaticField:B = 0xAAt
.field public static floatStaticField:F = 3.1415926f
-# ^^^^^^^^^^ @float
+# ^^^^^^^^^^ @number.float
.field public static doubleStaticField:D = 3.141592653589793
@@ -73,7 +73,7 @@
.field public static methodStaticField:Ljava/lang/reflect/Method; = Lbaksmali/test/class;->testMethod(ILjava/lang/String;)Ljava/lang/String;
# ^^ @punctuation.delimiter
-# ^^^^^^^^^^ @method.call
+# ^^^^^^^^^^ @function.method.call
.field public static arrayStaticField:[I = {1, 2, 3, {1, 2, 3, 4}}
# ^ @punctuation.special
@@ -81,7 +81,7 @@
# ^ @punctuation.delimiter
.field public static enumStaticField:Lsome/enum; = .enum Lsome/enum;->someEnumValue:Lsome/enum;
-# ^^^^^^^^^^^^^ @field
+# ^^^^^^^^^^^^^ @variable.member
.field public static annotationStaticField:Lsome/annotation; = .subannotation Lsome/annotation;
value1 = "test"
@@ -93,7 +93,7 @@
.field public static staticFieldWithAnnotation:I
.annotation runtime La/field/annotation;
-# ^^^^^^^ @storageclass
+# ^^^^^^^ @keyword.storage
this = "is"
a = "test"
.end annotation
@@ -112,13 +112,13 @@
.registers 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
# ^^^^^^^^^^^^^ @keyword.operator
-# ^^ @parameter.builtin
+# ^^ @variable.parameter.builtin
return-void
# ^^^^^^^^^^^ @keyword.return
.end method
.method public testMethod(ILjava/lang/String;)Ljava/lang/String;
-# ^^^^^^^^^^ @method
+# ^^^^^^^^^^ @function.method
.registers 3
.annotation runtime Lorg/junit/Test;
.end annotation
@@ -144,9 +144,9 @@
nop
try_end:
.catch Ljava/lang/Exception; {try_start: .. try_end:} handler:
-# ^^^^^^ @exception
+# ^^^^^^ @keyword.exception
.catchall {try_start: .. try_end:} handler2:
-# ^^^^^^^^^ @exception
+# ^^^^^^^^^ @keyword.exception
# ^^ @operator
handler:
@@ -232,9 +232,9 @@
nop
.source "somefile.java"
-# ^^^^^^^ @include
+# ^^^^^^^ @keyword.import
.line 101
-# ^^^ @text.literal
+# ^^^ @string.special
nop