File tree Expand file tree Collapse file tree 3 files changed +7
-13
lines changed
Sources/SourceKitLSP/Swift Expand file tree Collapse file tree 3 files changed +7
-13
lines changed Original file line number Diff line number Diff 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)
Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff 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 )
You can’t perform that action at this time.
0 commit comments