Skip to content

Commit 4493d45

Browse files
committed
Fix change text notification
1 parent a20a307 commit 4493d45

1 file changed

Lines changed: 13 additions & 14 deletions

File tree

Core/Sources/CopilotService/CopilotService.swift

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ import CopilotModel
22
import Foundation
33
import LanguageClient
44
import LanguageServerProtocol
5+
import Logger
56
import Preferences
67
import XPCShared
7-
import Logger
88

99
public protocol CopilotAuthServiceType {
1010
func checkStatus() async throws -> CopilotStatus
@@ -275,34 +275,34 @@ public final class CopilotSuggestionService: CopilotBaseService, CopilotSuggesti
275275
)
276276
)
277277
}
278-
278+
279279
public func notifyChangeTextDocument(fileURL: URL, content: String) async throws {
280-
let languageId = languageIdentifierFromFileURL(fileURL)
281280
let uri = "file://\(fileURL.path)"
282281
// Logger.service.debug("Change \(uri)")
283282
try await server.sendNotification(
284-
.didOpenTextDocument(
285-
DidOpenTextDocumentParams(
286-
textDocument: .init(
287-
uri: uri,
288-
languageId: languageId.rawValue,
289-
version: 0,
283+
.didChangeTextDocument(
284+
DidChangeTextDocumentParams(
285+
uri: uri,
286+
version: 0,
287+
contentChange: .init(
288+
range: nil,
289+
rangeLength: nil,
290290
text: content
291291
)
292292
)
293293
)
294294
)
295295
}
296-
296+
297297
public func notifySaveTextDocument(fileURL: URL) async throws {
298298
let uri = "file://\(fileURL.path)"
299-
Logger.service.debug("Save \(uri)")
299+
// Logger.service.debug("Save \(uri)")
300300
try await server.sendNotification(.didSaveTextDocument(.init(uri: uri)))
301301
}
302-
302+
303303
public func notifyCloseTextDocument(fileURL: URL) async throws {
304304
let uri = "file://\(fileURL.path)"
305-
Logger.service.debug("Close \(uri)")
305+
// Logger.service.debug("Close \(uri)")
306306
try await server.sendNotification(.didCloseTextDocument(.init(uri: uri)))
307307
}
308308
}
@@ -312,4 +312,3 @@ extension InitializingServer: CopilotLSP {
312312
try await sendRequest(endpoint.request)
313313
}
314314
}
315-

0 commit comments

Comments
 (0)