Skip to content

Commit 79ca4c0

Browse files
committed
Remove redundant typealias
1 parent 0797a36 commit 79ca4c0

File tree

6 files changed

+17
-20
lines changed

6 files changed

+17
-20
lines changed

Sources/SKTestSupport/Array+SyntaxHighlightingToken.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ extension Array where Element == SyntaxHighlightingToken {
3737
current.utf16index = charDelta
3838
}
3939

40-
let kind = SyntaxHighlightingToken.Kind.all[Int(rawKind)]
41-
let modifiers = SyntaxHighlightingToken.Modifiers(rawValue: rawModifiers)
40+
let kind = SemanticTokenTypes.all[Int(rawKind)]
41+
let modifiers = SemanticTokenModifiers(rawValue: rawModifiers)
4242

4343
append(
4444
SyntaxHighlightingToken(

Sources/SourceKitLSP/Swift/SemanticTokens.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ extension SyntaxClassifiedRange {
129129
}
130130

131131
extension SyntaxClassification {
132-
fileprivate var highlightingKindAndModifiers: (SyntaxHighlightingToken.Kind, SyntaxHighlightingToken.Modifiers)? {
132+
fileprivate var highlightingKindAndModifiers: (SemanticTokenTypes, SemanticTokenModifiers)? {
133133
switch self {
134134
case .none:
135135
return nil

Sources/SourceKitLSP/Swift/SwiftLanguageServer.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,8 @@ extension SwiftLanguageServer {
231231
),
232232
semanticTokensProvider: SemanticTokensOptions(
233233
legend: SemanticTokensLegend(
234-
tokenTypes: SyntaxHighlightingToken.Kind.all.map(\.name),
235-
tokenModifiers: SyntaxHighlightingToken.Modifiers.all.compactMap(\.name)
234+
tokenTypes: SemanticTokenTypes.all.map(\.name),
235+
tokenModifiers: SemanticTokenModifiers.all.compactMap(\.name)
236236
),
237237
range: .bool(true),
238238
full: .bool(true)

Sources/SourceKitLSP/Swift/SyntaxHighlightingToken.swift

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ public struct SyntaxHighlightingToken: Hashable {
2323
}
2424
}
2525
/// The token type.
26-
public var kind: Kind
26+
public var kind: SemanticTokenTypes
2727
/// Additional metadata about the token.
28-
public var modifiers: Modifiers
28+
public var modifiers: SemanticTokenModifiers
2929

3030
/// The (inclusive) start position of the token.
3131
public var start: Position { range.lowerBound }
@@ -34,21 +34,18 @@ public struct SyntaxHighlightingToken: Hashable {
3434
/// The length of the token in UTF-16 code units.
3535
public var utf16length: Int { end.utf16index - start.utf16index }
3636

37-
public init(range: Range<Position>, kind: Kind, modifiers: Modifiers = []) {
37+
public init(range: Range<Position>, kind: SemanticTokenTypes, modifiers: SemanticTokenModifiers = []) {
3838
assert(range.lowerBound.line == range.upperBound.line)
3939

4040
self.range = range
4141
self.kind = kind
4242
self.modifiers = modifiers
4343
}
4444

45-
public init(start: Position, utf16length: Int, kind: Kind, modifiers: Modifiers = []) {
45+
public init(start: Position, utf16length: Int, kind: SemanticTokenTypes, modifiers: SemanticTokenModifiers = []) {
4646
let range = start..<Position(line: start.line, utf16index: start.utf16index + utf16length)
4747
self.init(range: range, kind: kind, modifiers: modifiers)
4848
}
49-
50-
public typealias Kind = SemanticTokenTypes
51-
public typealias Modifiers = SemanticTokenModifiers
5249
}
5350

5451
extension Array where Element == SyntaxHighlightingToken {

Sources/SourceKitLSP/Swift/SyntaxHighlightingTokenParser.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ struct SyntaxHighlightingTokenParser {
8686

8787
private func parseKindAndModifiers(
8888
_ uid: sourcekitd_uid_t
89-
) -> (SyntaxHighlightingToken.Kind, SyntaxHighlightingToken.Modifiers)? {
89+
) -> (SemanticTokenTypes, SemanticTokenModifiers)? {
9090
let api = sourcekitd.api
9191
let values = sourcekitd.values
9292
switch uid {

Tests/SourceKitLSPTests/SemanticTokensTests.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ final class SemanticTokensTests: XCTestCase {
5353
range: .bool(true),
5454
full: .bool(true)
5555
),
56-
tokenTypes: Token.Kind.all.map(\.name),
57-
tokenModifiers: Token.Modifiers.all.compactMap(\.name),
56+
tokenTypes: SemanticTokenTypes.all.map(\.name),
57+
tokenModifiers: SemanticTokenModifiers.all.compactMap(\.name),
5858
formats: [.relative]
5959
)
6060
)
@@ -176,14 +176,14 @@ final class SemanticTokensTests: XCTestCase {
176176
2, // line delta
177177
3, // char delta
178178
5, // length
179-
Token.Kind.string.tokenType, // kind
179+
SemanticTokenTypes.string.tokenType, // kind
180180
0, // modifiers
181181

182182
2, // line delta
183183
2, // char delta
184184
1, // length
185-
Token.Kind.interface.tokenType, // kind
186-
Token.Modifiers.deprecated.rawValue | Token.Modifiers.definition.rawValue, // modifiers
185+
SemanticTokenTypes.interface.tokenType, // kind
186+
SemanticTokenModifiers.deprecated.rawValue | SemanticTokenModifiers.definition.rawValue, // modifiers
187187
]
188188
)
189189

@@ -886,8 +886,8 @@ extension Token {
886886
line: Int,
887887
utf16index: Int,
888888
length: Int,
889-
kind: Token.Kind,
890-
modifiers: Token.Modifiers = []
889+
kind: SemanticTokenTypes,
890+
modifiers: SemanticTokenModifiers = []
891891
) {
892892
self.init(
893893
start: Position(line: line, utf16index: utf16index),

0 commit comments

Comments
 (0)