Allow dynamic files without external project and also use file names starting with ^ as dynamic file

Fixes #21204
This commit is contained in:
Sheetal Nandi
2018-01-17 15:35:17 -08:00
parent 588716926d
commit 146256b7dc
3 changed files with 42 additions and 3 deletions

View File

@@ -898,7 +898,7 @@ namespace ts.server {
const project = this.getOrCreateInferredProjectForProjectRootPathIfEnabled(info, projectRootPath) ||
this.getOrCreateSingleInferredProjectIfEnabled() ||
this.createInferredProject(getDirectoryPath(info.path));
this.createInferredProject(info.isDynamic ? this.currentDirectory : getDirectoryPath(info.path));
project.addRoot(info);
project.updateGraph();
@@ -1655,7 +1655,7 @@ namespace ts.server {
}
private getOrCreateInferredProjectForProjectRootPathIfEnabled(info: ScriptInfo, projectRootPath: NormalizedPath | undefined): InferredProject | undefined {
if (!this.useInferredProjectPerProjectRoot) {
if (info.isDynamic || !this.useInferredProjectPerProjectRoot) {
return undefined;
}

View File

@@ -196,7 +196,7 @@ namespace ts.server {
/*@internal*/
export function isDynamicFileName(fileName: NormalizedPath) {
return getBaseFileName(fileName)[0] === "^";
return fileName[0] === "^" || getBaseFileName(fileName)[0] === "^";
}
export class ScriptInfo {