summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephan Seitz <stephan.seitz@fau.de>2022-01-16 14:59:22 +0100
committerStephan Seitz <stephan.seitz@fau.de>2022-01-18 22:09:21 +0100
commita3c86fe843b1056b3d02596711882719517a8f9f (patch)
tree04c7df80e0715ded1045c0d264a5a4380a42133d
parentb42de973399ff6aea8530de7240b6bf897ed6b03 (diff)
highlights(swift): highlight punctuation
"?" is still missing: https://github.com/tree-sitter/tree-sitter-swift/issues/38
-rw-r--r--queries/swift/highlights.scm3
-rw-r--r--tests/query/highlights/swift/string-interpolation.swift7
2 files changed, 10 insertions, 0 deletions
diff --git a/queries/swift/highlights.scm b/queries/swift/highlights.scm
index d744669c..e30618c7 100644
--- a/queries/swift/highlights.scm
+++ b/queries/swift/highlights.scm
@@ -1,3 +1,6 @@
+[ "." ";" ":" "," "->" ] @punctuation.delimiter
+[ "\\(" "(" ")" "[" "]" "{" "}"] @punctuation.bracket ; TODO: "\\(" ")" in interpolations should be @punctuation.special
+
; Identifiers
(attribute) @variable
(simple_identifier) @variable
diff --git a/tests/query/highlights/swift/string-interpolation.swift b/tests/query/highlights/swift/string-interpolation.swift
new file mode 100644
index 00000000..d500d7cf
--- /dev/null
+++ b/tests/query/highlights/swift/string-interpolation.swift
@@ -0,0 +1,7 @@
+var one = 1
+var two = 2
+var name = "Let's do some math: \(one) + \(one) = \(one + one) = \(two)"
+// ^ punctuation.bracket
+// ^ variable
+// ^ punctuation.bracket
+// ^ punctuation.bracket