From 7a1ffeda0a7c63a24008fbc33024e5e15a759cce Mon Sep 17 00:00:00 2001 From: Andrius Date: Mon, 12 Aug 2019 21:08:59 +0300 Subject: [PATCH] fix: avoid close project while saving file --- server/src/documents.ts | 4 +--- server/src/editorServices.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/server/src/documents.ts b/server/src/documents.ts index c38deaa24e..df5ceae61a 100644 --- a/server/src/documents.ts +++ b/server/src/documents.ts @@ -211,9 +211,7 @@ export class TextDocuments { this.changeNumber++; const file = uriToFileName(event.textDocument.uri); if (file) { - const savedContent = this.host.readFile(file); - this.projectService.closeClientFile(file); - this.projectService.openClientFile(file, savedContent); + this.projectService.reloadScript(file); this.changeNumber++; } })); diff --git a/server/src/editorServices.ts b/server/src/editorServices.ts index 7dbaf8d379..c297192db0 100644 --- a/server/src/editorServices.ts +++ b/server/src/editorServices.ts @@ -1641,6 +1641,15 @@ export class ProjectService { this.report("change", file, project); } + reloadScript(filename: string): void { + const info: ScriptInfo = this.filenameToScriptInfo[filename]; + if (info) { + info.svc.reloadFromFile(filename); + this.changeSeq++; + this.report("change", info.fileName) + } + } + forcedGetProjectForFile(fileName: string): Project { const file = normalizePath(fileName); const info = this.filenameToScriptInfo[file];