( uri: string, update: TransactionSpec, )
| 198 | } |
| 199 | |
| 200 | async #applyUpdateToClosedFile( |
| 201 | uri: string, |
| 202 | update: TransactionSpec, |
| 203 | ): Promise<void> { |
| 204 | if (typeof this.options.displayFile !== "function") return; |
| 205 | |
| 206 | try { |
| 207 | const view = await this.options.displayFile(uri); |
| 208 | if (!view?.state?.doc) return; |
| 209 | const languageId = this.#resolveLanguageIdForUri(uri); |
| 210 | const file = this.#getOrCreateFile(uri, languageId, view); |
| 211 | const fileView = file.getView(); |
| 212 | if (fileView) { |
| 213 | fileView.dispatch(update); |
| 214 | } |
| 215 | } catch (error) { |
| 216 | this.#log("error", `Workspace failed to apply update: ${uri}`, error); |
| 217 | console.error(`[LSP:Workspace] Failed to apply update: ${uri}`, error); |
| 218 | } |
| 219 | } |
| 220 | |
| 221 | async displayFile(uri: string): Promise<EditorView | null> { |
| 222 | if (typeof this.options.displayFile === "function") { |
no test coverage detected