Skip to content

Commit

Permalink
fix: avoid close project while saving file
Browse files Browse the repository at this point in the history
  • Loading branch information
andrius-pra authored and Keen Yee Liau committed Aug 13, 2019
1 parent 08415b4 commit e769a76
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 1 addition & 3 deletions server/src/documents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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++;
}
}));
Expand Down
9 changes: 9 additions & 0 deletions server/src/editorServices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down

0 comments on commit e769a76

Please sign in to comment.