Skip to content

Commit cdb9fe2

Browse files
committed
Fix Tests
1 parent ca9fb94 commit cdb9fe2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

CodeEditTests/Features/LSP/LanguageServer+DocumentTests.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ final class LanguageServerDocumentTests: XCTestCase {
9292
ofType: "public.swift-source"
9393
)
9494

95+
// This is usually sent from the LSPService
96+
try await server.openDocument(codeFile)
97+
9598
await waitForClientEventCount(
9699
3,
97100
connection: connection,
@@ -101,7 +104,6 @@ final class LanguageServerDocumentTests: XCTestCase {
101104
// Set up full content changes
102105
server.serverCapabilities = ServerCapabilities()
103106
server.serverCapabilities.textDocumentSync = syncOption
104-
server.openFiles.addDocument(codeFile, for: server)
105107

106108
return codeFile
107109
}
@@ -127,6 +129,7 @@ final class LanguageServerDocumentTests: XCTestCase {
127129
// Set up test server
128130
let (connection, server) = try await makeTestServer()
129131

132+
// This service should receive the didOpen/didClose notifications
130133
let lspService = ServiceContainer.resolve(.singleton, LSPService.self)
131134
await MainActor.run { lspService?.languageClients[.init(.swift, tempTestDir.path() + "/")] = server }
132135

@@ -148,8 +151,6 @@ final class LanguageServerDocumentTests: XCTestCase {
148151
ofType: "public.swift-source"
149152
)
150153
file.fileDocument = codeFile
151-
152-
// This should trigger a documentDidOpen event
153154
CodeEditDocumentController.shared.addDocument(codeFile)
154155

155156
await waitForClientEventCount(3, connection: connection, description: "Pre-close event count")

0 commit comments

Comments
 (0)