Fix merging issues and multiple project scenario
This commit is contained in:
parent
94d44ad81d
commit
d387050aaa
|
@ -1219,7 +1219,7 @@ namespace ts {
|
|||
(oldOptions.noLib !== options.noLib) ||
|
||||
(oldOptions.jsx !== options.jsx) ||
|
||||
(oldOptions.allowJs !== options.allowJs) ||
|
||||
(oldOptions.disableSizeLimit !== options.disableSizeLimit) ||
|
||||
(oldOptions.disableSizeLimit !== options.disableSizeLimit) ||
|
||||
(oldOptions.rootDir !== options.rootDir) ||
|
||||
(oldOptions.typesSearchPaths !== options.typesSearchPaths) ||
|
||||
(oldOptions.configFilePath !== options.configFilePath) ||
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace ts {
|
|||
getDirectories(path: string): string[];
|
||||
readDirectory(path: string, extension?: string, exclude?: string[]): string[];
|
||||
readDirectoryWithMultipleExtensions?(path: string, extensions: string[], exclude?: string[]): string[];
|
||||
getModifiedTime?(path: string): Date;
|
||||
getModifiedTime?(path: string): Date;
|
||||
createHash?(data: string): string;
|
||||
getMemoryUsage?(): number;
|
||||
exit(exitCode?: number): void;
|
||||
|
@ -549,7 +549,7 @@ namespace ts {
|
|||
getDirectories,
|
||||
readDirectory,
|
||||
readDirectoryWithMultipleExtensions,
|
||||
getModifiedTime(path) {
|
||||
getModifiedTime(path) {
|
||||
try {
|
||||
return _fs.statSync(path).mtime;
|
||||
}
|
||||
|
|
|
@ -1217,7 +1217,7 @@ namespace ts.server {
|
|||
else {
|
||||
this.log("No config files found.");
|
||||
}
|
||||
this.log("end openOrUpdateConfiguredProjectForFile: " + new Date().getTime());
|
||||
this.log("end openOrUpdateConfiguredProjectForFile: " + new Date().getTime());
|
||||
return configFileName ? { configFileName } : {};
|
||||
}
|
||||
|
||||
|
@ -1398,7 +1398,7 @@ namespace ts.server {
|
|||
}
|
||||
}
|
||||
|
||||
updateConfiguredProject(project: Project) {
|
||||
updateConfiguredProject(project: Project): Diagnostic[] {
|
||||
if (!this.host.fileExists(project.projectFilename)) {
|
||||
this.log("Config file deleted");
|
||||
this.removeProject(project);
|
||||
|
@ -1434,9 +1434,6 @@ namespace ts.server {
|
|||
const info = this.openFile(rootFilename, /*openedByClient*/ false);
|
||||
project.addRoot(info);
|
||||
}
|
||||
else {
|
||||
return { errorMsg: "specified file " + rootFilename + " not found" };
|
||||
}
|
||||
}
|
||||
project.finishGraph();
|
||||
return;
|
||||
|
@ -1460,9 +1457,6 @@ namespace ts.server {
|
|||
for (const fileName of fileNamesToAdd) {
|
||||
let info = this.getScriptInfo(fileName);
|
||||
if (!info) {
|
||||
if (!this.host.fileExists(info.fileName)) {
|
||||
return { errorMsg: "specified file " + info.fileName + " not found" };
|
||||
}
|
||||
info = this.openFile(fileName, /*openedByClient*/ false);
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -444,11 +444,12 @@ namespace ts.server {
|
|||
const file = ts.normalizePath(fileName);
|
||||
const info = this.projectService.getScriptInfo(file);
|
||||
const projects = this.projectService.findReferencingProjects(info);
|
||||
if (!projects.length) {
|
||||
const projectsWithLanguageServiceEnabeld = ts.filter(projects, p => !p.languageServiceDiabled);
|
||||
if (projects.length === 0 || projectsWithLanguageServiceEnabeld.length === 0) {
|
||||
throw Errors.NoProject;
|
||||
}
|
||||
|
||||
const defaultProject = projects[0];
|
||||
const defaultProject = projectsWithLanguageServiceEnabeld[0];
|
||||
// The rename info should be the same for every project
|
||||
const defaultProjectCompilerService = defaultProject.compilerService;
|
||||
const position = defaultProjectCompilerService.host.lineOffsetToPosition(file, line, offset);
|
||||
|
@ -465,7 +466,7 @@ namespace ts.server {
|
|||
}
|
||||
|
||||
const fileSpans = combineProjectOutput(
|
||||
projects,
|
||||
projectsWithLanguageServiceEnabeld,
|
||||
(project: Project) => {
|
||||
const compilerService = project.compilerService;
|
||||
const renameLocations = compilerService.languageService.findRenameLocations(file, position, findInStrings, findInComments);
|
||||
|
@ -526,11 +527,12 @@ namespace ts.server {
|
|||
const file = ts.normalizePath(fileName);
|
||||
const info = this.projectService.getScriptInfo(file);
|
||||
const projects = this.projectService.findReferencingProjects(info);
|
||||
if (!projects.length) {
|
||||
const projectsWithLanguageServiceEnabeld = ts.filter(projects, p => !p.languageServiceDiabled);
|
||||
if (projects.length === 0 || projectsWithLanguageServiceEnabeld.length === 0) {
|
||||
throw Errors.NoProject;
|
||||
}
|
||||
|
||||
const defaultProject = projects[0];
|
||||
const defaultProject = projectsWithLanguageServiceEnabeld[0];
|
||||
const position = defaultProject.compilerService.host.lineOffsetToPosition(file, line, offset);
|
||||
const nameInfo = defaultProject.compilerService.languageService.getQuickInfoAtPosition(file, position);
|
||||
if (!nameInfo) {
|
||||
|
@ -542,7 +544,7 @@ namespace ts.server {
|
|||
const nameColStart = defaultProject.compilerService.host.positionToLineOffset(file, nameSpan.start).offset;
|
||||
const nameText = defaultProject.compilerService.host.getScriptSnapshot(file).getText(nameSpan.start, ts.textSpanEnd(nameSpan));
|
||||
const refs = combineProjectOutput<protocol.ReferencesResponseItem>(
|
||||
projects,
|
||||
projectsWithLanguageServiceEnabeld,
|
||||
(project: Project) => {
|
||||
const compilerService = project.compilerService;
|
||||
const references = compilerService.languageService.getReferencesAtPosition(file, position);
|
||||
|
@ -902,13 +904,13 @@ namespace ts.server {
|
|||
const file = ts.normalizePath(fileName);
|
||||
const info = this.projectService.getScriptInfo(file);
|
||||
const projects = this.projectService.findReferencingProjects(info);
|
||||
const defaultProject = projects[0];
|
||||
if (!defaultProject) {
|
||||
const projectsWithLanguageServiceEnabeld = ts.filter(projects, p => !p.languageServiceDiabled);
|
||||
if (projects.length === 0 || projectsWithLanguageServiceEnabeld.length === 0) {
|
||||
throw Errors.NoProject;
|
||||
}
|
||||
|
||||
const allNavToItems = combineProjectOutput(
|
||||
projects,
|
||||
projectsWithLanguageServiceEnabeld,
|
||||
(project: Project) => {
|
||||
const compilerService = project.compilerService;
|
||||
const navItems = compilerService.languageService.getNavigateToItems(searchValue, maxResultCount);
|
||||
|
|
Loading…
Reference in a new issue