constructor()

in tsc/src/lsif.ts [2603:2665]


	constructor(context: TSProjectContext, languageService: ts.LanguageService, importMonikers: ImportMonikers, exportMonikers: ExportMonikers | undefined, references: ProjectInfo[], options: Options, symbolDataContext: SymbolDataContext) {
		this.id = ProjectId.next();
		this.context = context;
		this.languageService = languageService;
		this.importMonikers = importMonikers;
		this.exportMonikers = exportMonikers;
		this.references = references;
		const program = languageService.getProgram()!;
		const typeChecker = program.getTypeChecker();
		this.typeChecker = typeChecker;


		let dependentOutDirs = [];
		for (const info of references) {
			dependentOutDirs.push(info.outDir);
		}
		dependentOutDirs.sort((a, b) => {
			return b.length - a.length;
		});

		const configLocation = options.tsConfigFile !== undefined ? path.dirname(options.tsConfigFile) : undefined;
		const compilerOptions = program.getCompilerOptions();
		let sourceRoot: string;
		if (compilerOptions.rootDir !== undefined) {
			sourceRoot = tss.makeAbsolute(compilerOptions.rootDir, configLocation);
		} else if (compilerOptions.baseUrl !== undefined) {
			sourceRoot = tss.makeAbsolute(compilerOptions.baseUrl, configLocation);
		} else {
			sourceRoot = tss.normalizePath(tss.Program.getCommonSourceDirectory(program));
		}
		let outDir: string;
		if (compilerOptions.outDir !== undefined) {
			outDir = tss.makeAbsolute(compilerOptions.outDir, configLocation);
		} else {
			outDir = sourceRoot;
		}

		this.config = {
			workspaceRoot: options.workspaceRoot,
			configLocation,
			sourceRoot,
			outDir,
			dependentOutDirs
		};

		this.referencedProjectIds = new Set();
		const flatten = (projectInfo: ProjectInfo): void => {
			this.referencedProjectIds.add(projectInfo.id);
			projectInfo.references.forEach(flatten);
		};
		references.forEach(flatten);
		this.rootFileNames = new Set(program.getRootFileNames());

		this.symbols = new Symbols(typeChecker);
		this.symbolDataFactories = {
			standard: new StandardSymbolDataFactory(typeChecker, this.symbols, context, symbolDataContext),
			alias: new AliasFactory(typeChecker, this.symbols, context, symbolDataContext),
			method: new MethodFactory(typeChecker, this.symbols, context, symbolDataContext),
			withRoots: new SymbolDataWithRootsFactory(typeChecker, this.symbols, context, symbolDataContext),
			transient: new TransientFactory(typeChecker, this.symbols, context, symbolDataContext),
			typeAlias: new TypeAliasFactory(typeChecker, this.symbols, context, symbolDataContext)
		};
	}