Skip to content

Commit 001cdf7

Browse files
committed
Fix build warnings
1 parent 4f58c55 commit 001cdf7

File tree

3 files changed

+7
-13
lines changed

3 files changed

+7
-13
lines changed

Sources/SourceKitLSP/Swift/MacroExpansion.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,12 +180,6 @@ extension SwiftLanguageService {
180180
}
181181

182182
func expandMacro(macroExpansionURLData: MacroExpansionReferenceDocumentURLData) async throws -> String {
183-
guard let sourceKitLSPServer = self.sourceKitLSPServer else {
184-
// `SourceKitLSPServer` has been destructed. We are tearing down the
185-
// language server. Nothing left to do.
186-
throw ResponseError.unknown("Connection to the editor closed")
187-
}
188-
189183
let expandMacroCommand = ExpandMacroCommand(
190184
positionRange: macroExpansionURLData.selectionRange,
191185
textDocument: TextDocumentIdentifier(macroExpansionURLData.primaryFile)

Sources/SourceKitLSP/Swift/MacroExpansionReferenceDocumentURLData.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ package struct MacroExpansionReferenceDocumentURLData {
5959
}
6060

6161
package init(displayName: String, queryItems: [URLQueryItem]) throws {
62-
guard let primaryFilePath = queryItems.last { $0.name == Parameters.primaryFilePath }?.value,
63-
let fromLine = Int(queryItems.last { $0.name == Parameters.fromLine }?.value ?? ""),
64-
let fromColumn = Int(queryItems.last { $0.name == Parameters.fromColumn }?.value ?? ""),
65-
let toLine = Int(queryItems.last { $0.name == Parameters.toLine }?.value ?? ""),
66-
let toColumn = Int(queryItems.last { $0.name == Parameters.toColumn }?.value ?? ""),
67-
let bufferName = queryItems.last { $0.name == Parameters.bufferName }?.value
62+
guard let primaryFilePath = queryItems.last(where: { $0.name == Parameters.primaryFilePath })?.value,
63+
let fromLine = Int(queryItems.last(where: { $0.name == Parameters.fromLine })?.value ?? ""),
64+
let fromColumn = Int(queryItems.last(where: { $0.name == Parameters.fromColumn })?.value ?? ""),
65+
let toLine = Int(queryItems.last(where: { $0.name == Parameters.toLine })?.value ?? ""),
66+
let toColumn = Int(queryItems.last(where: { $0.name == Parameters.toColumn })?.value ?? ""),
67+
let bufferName = queryItems.last(where: { $0.name == Parameters.bufferName })?.value
6868
else {
6969
throw ReferenceDocumentURLError(description: "Invalid queryItems for macro expansion reference document url")
7070
}

Sources/SourceKitLSP/Swift/ReferenceDocumentURL.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ package enum ReferenceDocumentURL {
7878
throw ReferenceDocumentURLError(
7979
description: "Bad URL for reference document: \(url)"
8080
)
81-
default:
81+
case let documentType?:
8282
throw ReferenceDocumentURLError(
8383
description: "Invalid document type in URL for reference document: \(documentType)"
8484
)

0 commit comments

Comments
 (0)