Merge branch 'watchImprovements' into builder

This commit is contained in:
Sheetal Nandi 2017-08-18 11:56:12 -07:00
commit e639ceb038
2 changed files with 28 additions and 9 deletions

View File

@ -1479,6 +1479,7 @@ namespace ts {
}
}
/*@internal*/
export function isErrorNoInputFiles(error: Diagnostic) {
return error.code === Diagnostics.No_inputs_were_found_in_config_file_0_Specified_include_paths_were_1_and_exclude_paths_were_2.code;
}

View File

@ -161,8 +161,6 @@ namespace ts.server {
private typingFiles: SortedReadonlyArray<string>;
protected projectErrors: Diagnostic[];
public typesVersion = 0;
public isNonTsProject() {
@ -257,12 +255,12 @@ namespace ts.server {
/**
* Get the errors that dont have any file name associated
*/
getGlobalProjectErrors() {
return filter(this.projectErrors, diagnostic => !diagnostic.file);
getGlobalProjectErrors(): ReadonlyArray<Diagnostic> {
return emptyArray;
}
getAllProjectErrors() {
return this.projectErrors;
getAllProjectErrors(): ReadonlyArray<Diagnostic> {
return emptyArray;
}
getLanguageService(ensureSynchronized = true): LanguageService {
@ -378,7 +376,6 @@ namespace ts.server {
this.resolutionCache.clear();
this.resolutionCache = undefined;
this.cachedUnresolvedImportsPerFile = undefined;
this.projectErrors = undefined;
this.lsHost.dispose();
this.lsHost = undefined;
@ -426,6 +423,7 @@ namespace ts.server {
return result;
}
/*@internal*/
getRootFilesMap() {
return this.rootFilesMap;
}
@ -536,7 +534,7 @@ namespace ts.server {
this.markAsDirty();
}
// add a root file to project
// add a root file that doesnt exist on host
addMissingFileRoot(fileName: NormalizedPath) {
const path = this.projectService.toPath(fileName);
this.rootFilesMap.set(path, fileName);
@ -1044,6 +1042,8 @@ namespace ts.server {
/** Used for configured projects which may have multiple open roots */
openRefCount = 0;
private projectErrors: Diagnostic[];
constructor(configFileName: NormalizedPath,
projectService: ProjectService,
documentRegistry: DocumentRegistry,
@ -1058,7 +1058,7 @@ namespace ts.server {
}
/**
* Checks if the project has reload from disk pending, if thats pending, it reloads (and then updates graph as part of that) instead of just updating the graph
* If the project has reload from disk pending, it reloads (and then updates graph as part of that) instead of just updating the graph
* @returns: true if set of files in the project stays the same and false - otherwise.
*/
updateGraph(): boolean {
@ -1160,6 +1160,20 @@ namespace ts.server {
return getDirectoryPath(this.getConfigFilePath());
}
/**
* Get the errors that dont have any file name associated
*/
getGlobalProjectErrors(): ReadonlyArray<Diagnostic> {
return filter(this.projectErrors, diagnostic => !diagnostic.file);
}
/**
* Get all the project errors
*/
getAllProjectErrors(): ReadonlyArray<Diagnostic> {
return this.projectErrors;
}
setProjectErrors(projectErrors: Diagnostic[]) {
this.projectErrors = projectErrors;
}
@ -1184,6 +1198,7 @@ namespace ts.server {
}));
}
/*@internal*/
watchWildcards(wildcardDirectories: Map<WatchDirectoryFlags>) {
updateWatchingWildcardDirectories(
this.directoriesWatchedForWildcards || (this.directoriesWatchedForWildcards = createMap()),
@ -1205,6 +1220,7 @@ namespace ts.server {
this.projectService.closeDirectoryWatcher(WatchType.WildcardDirectories, this, directory, watcher, flags, closeReason);
}
/*@internal*/
stopWatchingWildCards(reason: WatcherCloseReason) {
if (this.directoriesWatchedForWildcards) {
clearMap(
@ -1215,6 +1231,7 @@ namespace ts.server {
}
}
/*@internal*/
watchTypeRoots() {
const newTypeRoots = arrayToSet(this.getEffectiveTypeRoots(), dir => this.projectService.toCanonicalFileName(dir));
mutateMap(
@ -1233,6 +1250,7 @@ namespace ts.server {
);
}
/*@internal*/
stopWatchingTypeRoots(reason: WatcherCloseReason) {
if (this.typeRootsWatchers) {
clearMap(