From 36be64a690ea7e5377d98b938b693bffa8a0a8bb Mon Sep 17 00:00:00 2001 From: Nils Hjelte Date: Sun, 1 Oct 2023 19:17:57 +0200 Subject: [PATCH] Avoid redundant document loading --- Sources/hylo-lsp/DocumentProvider.swift | 8 ++++---- Sources/hylo-lsp/HyloServer.swift | 5 +++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/Sources/hylo-lsp/DocumentProvider.swift b/Sources/hylo-lsp/DocumentProvider.swift index 93d03d6..095d9e1 100644 --- a/Sources/hylo-lsp/DocumentProvider.swift +++ b/Sources/hylo-lsp/DocumentProvider.swift @@ -137,10 +137,10 @@ actor DocumentProvider { return resolveDocumentUrl(uri).absoluteString } - public func preloadDocument(_ textDocument: TextDocumentProtocol) -> DocumentBuildRequest { - let uri = DocumentProvider.resolveDocumentUri(textDocument.uri) - return preloadDocument(uri) - } + // public func preloadDocument(_ textDocument: TextDocumentProtocol) -> DocumentBuildRequest { + // let uri = DocumentProvider.resolveDocumentUri(textDocument.uri) + // return preloadDocument(uri) + // } private func preloadDocument(_ uri: DocumentUri) -> DocumentBuildRequest { let document = requestDocument(uri) diff --git a/Sources/hylo-lsp/HyloServer.swift b/Sources/hylo-lsp/HyloServer.swift index 4b9bd64..e2539e7 100644 --- a/Sources/hylo-lsp/HyloServer.swift +++ b/Sources/hylo-lsp/HyloServer.swift @@ -66,11 +66,12 @@ public struct HyloNotificationHandler : NotificationHandler { public func textDocumentDidOpen(_ params: TextDocumentDidOpenParams) async { - _ = await state.documentProvider.preloadDocument(params.textDocument) + // _ = await state.documentProvider.preloadDocument(params.textDocument) } public func textDocumentDidChange(_ params: TextDocumentDidChangeParams) async { - _ = await state.documentProvider.preloadDocument(params.textDocument) + // _ = await state.documentProvider.preloadDocument(params.textDocument) + // TODO: Handle changes from input (not stored on disk) } public func textDocumentDidClose(_ params: TextDocumentDidCloseParams) async {