mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Merge pull request #18456 from RyanCavanaugh/pluginWork
Properly report external filenames
This commit is contained in:
@@ -1659,7 +1659,7 @@ namespace ts {
|
||||
}
|
||||
|
||||
export function isRootedDiskPath(path: string) {
|
||||
return getRootLength(path) !== 0;
|
||||
return path && getRootLength(path) !== 0;
|
||||
}
|
||||
|
||||
export function convertToRelativePath(absoluteOrRelativePath: string, basePath: string, getCanonicalFileName: (path: string) => string): string {
|
||||
|
||||
@@ -1190,7 +1190,8 @@ namespace ts.server {
|
||||
/*languageServiceEnabled*/ !sizeLimitExceeded,
|
||||
projectOptions.compileOnSave === undefined ? false : projectOptions.compileOnSave);
|
||||
|
||||
this.addFilesToProjectAndUpdateGraph(project, projectOptions.files, fileNamePropertyReader, clientFileName, projectOptions.typeAcquisition, configFileErrors);
|
||||
const filesToAdd = projectOptions.files.concat(project.getExternalFiles());
|
||||
this.addFilesToProjectAndUpdateGraph(project, filesToAdd, fileNamePropertyReader, clientFileName, projectOptions.typeAcquisition, configFileErrors);
|
||||
|
||||
project.watchConfigFile(project => this.onConfigChangedForConfiguredProject(project));
|
||||
if (!sizeLimitExceeded) {
|
||||
@@ -1210,7 +1211,7 @@ namespace ts.server {
|
||||
}
|
||||
}
|
||||
|
||||
private addFilesToProjectAndUpdateGraph<T>(project: ConfiguredProject | ExternalProject, files: T[], propertyReader: FilePropertyReader<T>, clientFileName: string, typeAcquisition: TypeAcquisition, configFileErrors: ReadonlyArray<Diagnostic>): void {
|
||||
private addFilesToProjectAndUpdateGraph<T>(project: ConfiguredProject | ExternalProject, files: ReadonlyArray<T>, propertyReader: FilePropertyReader<T>, clientFileName: string, typeAcquisition: TypeAcquisition, configFileErrors: ReadonlyArray<Diagnostic>): void {
|
||||
let errors: Diagnostic[];
|
||||
for (const f of files) {
|
||||
const rootFileName = propertyReader.getFileName(f);
|
||||
|
||||
@@ -746,7 +746,8 @@ namespace ts.server {
|
||||
}
|
||||
// compute and return the difference
|
||||
const lastReportedFileNames = this.lastReportedFileNames;
|
||||
const currentFiles = arrayToSet(this.getFileNames());
|
||||
const externalFiles = this.getExternalFiles().map(f => toNormalizedPath(f));
|
||||
const currentFiles = arrayToSet(this.getFileNames().concat(externalFiles));
|
||||
|
||||
const added: string[] = [];
|
||||
const removed: string[] = [];
|
||||
@@ -769,7 +770,8 @@ namespace ts.server {
|
||||
else {
|
||||
// unknown version - return everything
|
||||
const projectFileNames = this.getFileNames();
|
||||
this.lastReportedFileNames = arrayToSet(projectFileNames);
|
||||
const externalFiles = this.getExternalFiles().map(f => toNormalizedPath(f));
|
||||
this.lastReportedFileNames = arrayToSet(projectFileNames.concat(externalFiles));
|
||||
this.lastReportedVersion = this.projectStructureVersion;
|
||||
return { info, files: projectFileNames, projectErrors: this.getGlobalProjectErrors() };
|
||||
}
|
||||
@@ -1084,6 +1086,9 @@ namespace ts.server {
|
||||
}
|
||||
catch (e) {
|
||||
this.projectService.logger.info(`A plugin threw an exception in getExternalFiles: ${e}`);
|
||||
if (e.stack) {
|
||||
this.projectService.logger.info(e.stack);
|
||||
}
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user