Skip to content

Commit 3bd4c4f

Browse files
committed
Properly report external filenames
1 parent 67f2716 commit 3bd4c4f

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

src/compiler/core.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1659,7 +1659,7 @@ namespace ts {
16591659
}
16601660

16611661
export function isRootedDiskPath(path: string) {
1662-
return getRootLength(path) !== 0;
1662+
return path && getRootLength(path) !== 0;
16631663
}
16641664

16651665
export function convertToRelativePath(absoluteOrRelativePath: string, basePath: string, getCanonicalFileName: (path: string) => string): string {

src/server/editorServices.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,7 +1191,8 @@ namespace ts.server {
11911191
projectOptions.compileOnSave === undefined ? false : projectOptions.compileOnSave);
11921192

11931193
this.addFilesToProjectAndUpdateGraph(project, projectOptions.files, fileNamePropertyReader, clientFileName, projectOptions.typeAcquisition, configFileErrors);
1194-
1194+
this.addFilesToProjectAndUpdateGraph(project, project.getExternalFiles(), fileNamePropertyReader, clientFileName, projectOptions.typeAcquisition, configFileErrors);
1195+
11951196
project.watchConfigFile(project => this.onConfigChangedForConfiguredProject(project));
11961197
if (!sizeLimitExceeded) {
11971198
this.watchConfigDirectoryForProject(project, projectOptions);
@@ -1210,7 +1211,7 @@ namespace ts.server {
12101211
}
12111212
}
12121213

1213-
private addFilesToProjectAndUpdateGraph<T>(project: ConfiguredProject | ExternalProject, files: T[], propertyReader: FilePropertyReader<T>, clientFileName: string, typeAcquisition: TypeAcquisition, configFileErrors: ReadonlyArray<Diagnostic>): void {
1214+
private addFilesToProjectAndUpdateGraph<T>(project: ConfiguredProject | ExternalProject, files: ReadonlyArray<T>, propertyReader: FilePropertyReader<T>, clientFileName: string, typeAcquisition: TypeAcquisition, configFileErrors: ReadonlyArray<Diagnostic>): void {
12141215
let errors: Diagnostic[];
12151216
for (const f of files) {
12161217
const rootFileName = propertyReader.getFileName(f);

src/server/project.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -747,7 +747,8 @@ namespace ts.server {
747747
}
748748
// compute and return the difference
749749
const lastReportedFileNames = this.lastReportedFileNames;
750-
const currentFiles = arrayToSet(this.getFileNames());
750+
const externalFiles = this.getExternalFiles().map(f => toNormalizedPath(f));
751+
const currentFiles = arrayToSet(this.getFileNames().concat(externalFiles));
751752

752753
const added: string[] = [];
753754
const removed: string[] = [];
@@ -770,7 +771,8 @@ namespace ts.server {
770771
else {
771772
// unknown version - return everything
772773
const projectFileNames = this.getFileNames();
773-
this.lastReportedFileNames = arrayToSet(projectFileNames);
774+
const externalFiles = this.getExternalFiles().map(f => toNormalizedPath(f));
775+
this.lastReportedFileNames = arrayToSet(projectFileNames.concat(externalFiles));
774776
this.lastReportedVersion = this.projectStructureVersion;
775777
return { info, files: projectFileNames, projectErrors: this.getGlobalProjectErrors() };
776778
}
@@ -1085,6 +1087,9 @@ namespace ts.server {
10851087
}
10861088
catch (e) {
10871089
this.projectService.logger.info(`A plugin threw an exception in getExternalFiles: ${e}`);
1090+
if (e.stack) {
1091+
this.projectService.logger.info(e.stack);
1092+
}
10881093
}
10891094
}));
10901095
}

0 commit comments

Comments
 (0)