mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Merge remote-tracking branch 'origin/master' into import_completions_pr
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 };
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
"types": []
|
||||
},
|
||||
"files": [
|
||||
"../services/shims.ts",
|
||||
"../services/utilities.ts",
|
||||
"editorServices.ts",
|
||||
"protocol.d.ts",
|
||||
"session.ts"
|
||||
|
||||
Reference in New Issue
Block a user