From a3c86fe843b1056b3d02596711882719517a8f9f Mon Sep 17 00:00:00 2001 From: Stephan Seitz Date: Sun, 16 Jan 2022 14:59:22 +0100 Subject: [PATCH] highlights(swift): highlight punctuation "?" is still missing: https://github.com/tree-sitter/tree-sitter-swift/issues/38 --- queries/swift/highlights.scm | 3 +++ tests/query/highlights/swift/string-interpolation.swift | 7 +++++++ 2 files changed, 10 insertions(+) create mode 100644 tests/query/highlights/swift/string-interpolation.swift diff --git a/queries/swift/highlights.scm b/queries/swift/highlights.scm index d744669c0..e30618c74 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 000000000..d500d7cfa --- /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