File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
Sources/SourceKitLSP/Swift Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -302,6 +302,9 @@ extension SwiftLanguageServer {
302
302
let skreq = SKDRequestDictionary ( sourcekitd: sourcekitd)
303
303
skreq [ keys. request] = requests. find_syntactic_rename_ranges
304
304
skreq [ keys. sourcefile] = snapshot. uri. pseudoPath
305
+ // find-syntactic-rename-ranges is a syntactic sourcekitd request that doesn't use the in-memory file snapshot.
306
+ // We need to send the source text again.
307
+ skreq [ keys. sourcetext] = snapshot. text
305
308
skreq [ keys. renamelocations] = renameLocations
306
309
307
310
let syntacticRenameRangesResponse = try await sourcekitd. send ( skreq, fileContents: snapshot. text)
Original file line number Diff line number Diff line change @@ -39,16 +39,17 @@ private func assertRename(
39
39
file: StaticString = #file,
40
40
line: UInt = #line
41
41
) async throws {
42
- // FIXME: syntactic rename does not support in-memory files... It should
43
- let ws = try await IndexedSingleSwiftFileWorkspace ( markedSource)
44
- let response = try await ws. testClient. send (
42
+ let testClient = try await TestSourceKitLSPClient ( )
43
+ let uri = DocumentURI . for ( . swift)
44
+ let positions = testClient. openDocument ( markedSource, uri: uri)
45
+ let response = try await testClient. send (
45
46
RenameRequest (
46
- textDocument: TextDocumentIdentifier ( ws . fileURI ) ,
47
- position: ws . positions [ " 1️⃣ " ] ,
47
+ textDocument: TextDocumentIdentifier ( uri ) ,
48
+ position: positions [ " 1️⃣ " ] ,
48
49
newName: newName
49
50
)
50
51
)
51
- let edits = try XCTUnwrap ( response? . changes ? [ ws . fileURI ] , file: file, line: line)
52
+ let edits = try XCTUnwrap ( response? . changes ? [ uri ] , file: file, line: line)
52
53
let source = extractMarkers ( markedSource) . textWithoutMarkers
53
54
let renamed = apply ( edits: edits, to: source)
54
55
XCTAssertEqual ( renamed, expected, file: file, line: line)
You can’t perform that action at this time.
0 commit comments