Skip to content

Commit 39f7c0a

Browse files
authored
Merge pull request #724 from hamishknight/lets-go-back-to-the-island
2 parents 3af2f1d + d1015ae commit 39f7c0a

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

Sources/SourceKitLSP/DocumentTokens.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,8 @@ extension SyntaxClassification {
9696
return (.number, [])
9797
case .stringLiteral:
9898
return (.string, [])
99+
case .regexLiteral:
100+
return (.regexp, [])
99101
case .poundDirectiveKeyword:
100102
return (.macro, [])
101103
case .buildConfigId, .objectLiteral:

Tests/SourceKitLSPTests/SemanticTokensTests.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,17 @@ final class SemanticTokensTests: XCTestCase {
488488
])
489489
}
490490

491+
func testRegexSemanticTokens() {
492+
let text = """
493+
let r = /a[bc]*/
494+
"""
495+
let tokens = openAndPerformSemanticTokensRequest(text: text)
496+
XCTAssertEqual(tokens, [
497+
Token(line: 0, utf16index: 0, length: 3, kind: .keyword),
498+
Token(line: 0, utf16index: 4, length: 1, kind: .identifier),
499+
Token(line: 0, utf16index: 8, length: 8, kind: .regexp),
500+
])
501+
}
491502

492503
func testOperatorDeclaration() {
493504
let text = """

0 commit comments

Comments
 (0)