Merge remote-tracking branch 'origin/master' into import_completions_pr

This commit is contained in:
Richard Knoll
2016-08-15 15:20:22 -07:00
314 changed files with 8832 additions and 29228 deletions

View File

@@ -21,7 +21,7 @@ namespace ts.server {
export class SessionClient implements LanguageService {
private sequence: number = 0;
private lineMaps: ts.Map<number[]> = {};
private lineMaps: ts.Map<number[]> = ts.createMap<number[]>();
private messages: string[] = [];
private lastRenameEntry: RenameEntry;

View File

@@ -115,6 +115,9 @@ namespace ts.server {
readFile: fileName => this.host.readFile(fileName),
directoryExists: directoryName => this.host.directoryExists(directoryName)
};
if (this.host.realpath) {
this.moduleResolutionHost.realpath = path => this.host.realpath(path);
}
}
private resolveNamesWithLocalCache<T extends Timestamped & { failedLookupLocations: string[] }, R>(
@@ -127,7 +130,7 @@ namespace ts.server {
const path = toPath(containingFile, this.host.getCurrentDirectory(), this.getCanonicalFileName);
const currentResolutionsInFile = cache.get(path);
const newResolutions: Map<T> = {};
const newResolutions = createMap<T>();
const resolvedModules: R[] = [];
const compilerOptions = this.getCompilationSettings();
@@ -383,7 +386,7 @@ namespace ts.server {
export interface ProjectOptions {
// these fields can be present in the project file
files?: string[];
wildcardDirectories?: ts.Map<ts.WatchDirectoryFlags>;
wildcardDirectories?: ts.MapLike<ts.WatchDirectoryFlags>;
compilerOptions?: ts.CompilerOptions;
}
@@ -396,7 +399,7 @@ namespace ts.server {
// Used to keep track of what directories are watched for this project
directoriesWatchedForTsconfig: string[] = [];
program: ts.Program;
filenameToSourceFile: ts.Map<ts.SourceFile> = {};
filenameToSourceFile = ts.createMap<ts.SourceFile>();
updateGraphSeq = 0;
/** Used for configured projects which may have multiple open roots */
openRefCount = 0;
@@ -509,7 +512,7 @@ namespace ts.server {
return;
}
this.filenameToSourceFile = {};
this.filenameToSourceFile = createMap<SourceFile>();
const sourceFiles = this.program.getSourceFiles();
for (let i = 0, len = sourceFiles.length; i < len; i++) {
const normFilename = ts.normalizePath(sourceFiles[i].fileName);
@@ -618,7 +621,7 @@ namespace ts.server {
}
export class ProjectService {
filenameToScriptInfo: ts.Map<ScriptInfo> = {};
filenameToScriptInfo = ts.createMap<ScriptInfo>();
// open, non-configured root files
openFileRoots: ScriptInfo[] = [];
// projects built from openFileRoots
@@ -630,12 +633,12 @@ namespace ts.server {
// open files that are roots of a configured project
openFileRootsConfigured: ScriptInfo[] = [];
// a path to directory watcher map that detects added tsconfig files
directoryWatchersForTsconfig: ts.Map<FileWatcher> = {};
directoryWatchersForTsconfig = ts.createMap<FileWatcher>();
// count of how many projects are using the directory watcher. If the
// number becomes 0 for a watcher, then we should close it.
directoryWatchersRefCount: ts.Map<number> = {};
directoryWatchersRefCount = ts.createMap<number>();
hostConfiguration: HostConfiguration;
timerForDetectingProjectFileListChanges: Map<any> = {};
timerForDetectingProjectFileListChanges = createMap<any>();
constructor(public host: ServerHost, public psLogger: Logger, public eventHandler?: ProjectServiceEventHandler) {
// ts.disableIncrementalParsing = true;

View File

@@ -1062,7 +1062,7 @@ namespace ts.server {
return { response, responseRequired: true };
}
private handlers: Map<(request: protocol.Request) => { response?: any, responseRequired?: boolean }> = {
private handlers: MapLike<(request: protocol.Request) => { response?: any, responseRequired?: boolean }> = {
[CommandNames.Exit]: () => {
this.exit();
return { responseRequired: false };

View File

@@ -10,6 +10,8 @@
"types": []
},
"files": [
"../services/shims.ts",
"../services/utilities.ts",
"editorServices.ts",
"protocol.d.ts",
"session.ts"