Handle untitled files from vscode which are of format: untitled:^Untitled-1 (#36240)

* Test for #36200

* Handle dynamic files by vscode
Fixes #36200
This commit is contained in:
Sheetal Nandi
2020-01-16 15:38:55 -08:00
committed by GitHub
parent 797c5362a2
commit b2a7d42032
5 changed files with 48 additions and 5 deletions
+1 -1
View File
@@ -1304,7 +1304,7 @@ namespace ts.server {
// Closing file should trigger re-reading the file content from disk. This is
// because the user may chose to discard the buffer content before saving
// to the disk, and the server's version of the file can be out of sync.
const fileExists = this.host.fileExists(info.fileName);
const fileExists = info.isDynamic ? false : this.host.fileExists(info.fileName);
info.close(fileExists);
this.stopWatchingConfigFilesForClosedScriptInfo(info);
+2 -1
View File
@@ -272,7 +272,8 @@ namespace ts.server {
/*@internal*/
export function isDynamicFileName(fileName: NormalizedPath) {
return fileName[0] === "^";
return fileName[0] === "^" ||
(stringContains(fileName, ":^") && !stringContains(fileName, directorySeparator));
}
/*@internal*/