File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -1410,6 +1410,36 @@ final class SwiftCompletionTests: XCTestCase {
14101410 )
14111411 XCTAssertEqual ( completions. items. only? . detail, " String " )
14121412 }
1413+
1414+ func testSuggestInMemoryFunctionsFromFilesWithinSameModule( ) async throws {
1415+ let project = try await SwiftPMTestProject ( files: [
1416+ " First.swift " : """
1417+ myFancyFunc1️⃣
1418+ """ ,
1419+ " Second.swift " : " 2️⃣ " ,
1420+ ] )
1421+
1422+ let ( secondUri, secondPositions) = try project. openDocument ( " Second.swift " )
1423+ project. testClient. send (
1424+ DidChangeTextDocumentNotification (
1425+ textDocument: VersionedTextDocumentIdentifier ( secondUri, version: 2 ) ,
1426+ contentChanges: [
1427+ TextDocumentContentChangeEvent (
1428+ range: Range ( secondPositions [ " 2️⃣ " ] ) ,
1429+ text: """
1430+ func myFancyFunction() {}
1431+ """
1432+ )
1433+ ]
1434+ )
1435+ )
1436+
1437+ let ( firstUri, firstPositions) = try project. openDocument ( " First.swift " )
1438+ let completions = try await project. testClient. send (
1439+ CompletionRequest ( textDocument: TextDocumentIdentifier ( firstUri) , position: firstPositions [ " 1️⃣ " ] )
1440+ )
1441+ XCTAssert ( completions. items. contains ( where: { $0. label. contains ( " myFancyFunction " ) } ) )
1442+ }
14131443}
14141444
14151445private func countFs( _ response: CompletionList ) -> Int {
You can’t perform that action at this time.
0 commit comments