@lpc-lang/core
Version:
LPC Language Compiler Library
143 lines • 6.71 kB
TypeScript
import * as lpc from "./_namespaces/lpc.js";
import { CompilerOptions, Diagnostic, DirectoryStructureHost, DocumentRegistry, IScriptSnapshot, JSDocParsingMode, LanguageService, LanguageServiceHost, ModuleResolutionHost, ProjectReference, TypeAcquisition, WatchOptions } from "./_namespaces/lpc.js";
import { HostCancellationToken, NormalizedPath, ProjectService, ScriptInfo } from "./_namespaces/lpc.server.js";
export declare enum ProjectKind {
Inferred = 0,
Configured = 1,
External = 2,
AutoImportProvider = 3,
Auxiliary = 4
}
export declare abstract class Project implements LanguageServiceHost, ModuleResolutionHost, lpc.LpcFileHandlerHost {
readonly projectKind: ProjectKind;
readonly projectService: ProjectService;
private documentRegistry;
private compilerOptions;
compileOnSaveEnabled: boolean;
protected watchOptions: WatchOptions | undefined;
private rootFilesMap;
private program;
private externalFiles;
private missingFilesMap;
private hasAddedorRemovedFiles;
private hasAddedOrRemovedSymlinks;
protected languageService: LanguageService;
languageServiceEnabled: boolean;
readonly trace?: (s: string) => void;
readonly realpath?: (path: string) => string;
/**
* Set of files names that were updated since the last call to getChangesSinceVersion.
*/
private updatedFileNames;
/**
* Set of files that was returned from the last call to getChangesSinceVersion.
*/
private lastReportedFileNames;
/**
* Last version that was reported.
*/
private lastReportedVersion;
protected projectErrors: Diagnostic[] | undefined;
protected isInitialLoadPending: () => boolean;
private readonly cancellationToken;
private exportMapCache;
private changedFilesForExportMapCache;
fileHandler: lpc.LpcFileHandler;
readonly jsDocParsingMode: JSDocParsingMode | undefined;
constructor(projectName: string, projectKind: ProjectKind, projectService: ProjectService, documentRegistry: DocumentRegistry, hasExplicitListOfFiles: boolean, lastFileExceededProgramSize: string | undefined, compilerOptions: CompilerOptions, compileOnSaveEnabled: boolean, watchOptions: WatchOptions | undefined, directoryStructureHost: DirectoryStructureHost, currentDirectory: string);
disableLanguageService(lastFileExceededProgramSize?: string): void;
getIncludeDirs(): string[];
/**
* Get all the project errors
*/
getAllProjectErrors(): readonly Diagnostic[];
getConfigFilePath(): lpc.server.NormalizedPath;
getCompilationSettings(): lpc.CompilerOptions;
getCompilerOptions(): lpc.CompilerOptions;
getNewLine(): string;
getProjectVersion(): string;
getScriptInfo(uncheckedFileName: string): lpc.server.ScriptInfo;
getRootScriptInfos(): lpc.server.ScriptInfo[];
getProjectReferences(): readonly ProjectReference[] | undefined;
getProjectName(): string;
onAllFilesNeedReparse(fileNames: string[]): void;
getScriptFileNames(): string[];
isClosed(): boolean;
hasRoots(): boolean;
setTypeAcquisition(newTypeAcquisition: TypeAcquisition | undefined): void;
enableLanguageService(): void;
addRoot(info: ScriptInfo, fileName?: NormalizedPath): void;
getLanguageService(ensureSynchronized?: boolean): LanguageService;
setCompilerOptions(compilerOptions: CompilerOptions): void;
hasConfigFile(configFilePath: NormalizedPath): boolean;
getRootFiles(): NormalizedPath[];
getFileNames(excludeFilesFromExternalLibraries?: boolean, excludeConfigFiles?: boolean): lpc.server.NormalizedPath[];
private getOrCreateScriptInfoAndAttachToProject;
getScriptKind(fileName: string): lpc.ScriptKind;
getScriptVersion(filename: string): string;
getScriptSnapshot(filename: string): IScriptSnapshot | undefined;
getCancellationToken(): HostCancellationToken;
getCurrentDirectory(): string;
getDefaultLibFileName(): string;
useCaseSensitiveFileNames(): boolean;
readDirectory(path: string, extensions?: readonly string[], exclude?: readonly string[], include?: readonly string[], depth?: number): string[];
readFile(fileName: string): string | undefined;
writeFile(fileName: string, content: string): void;
fileExists(file: string): boolean;
/**
* Get the errors that dont have any file name associated
*/
getGlobalProjectErrors(): readonly Diagnostic[];
setProjectErrors(projectErrors: Diagnostic[] | undefined): void;
private isWatchedMissingFile;
isRoot(info: ScriptInfo): boolean;
protected removeRoot(info: ScriptInfo): void;
removeFile(info: ScriptInfo, fileExists: boolean, detachFromProject: boolean): void;
addMissingFileRoot(fileName: NormalizedPath): void;
getTypeAcquisition(): lpc.TypeAcquisition;
/**
* Updates set of files that contribute to this project
* @returns: true if set of files in the project stays the same and false - otherwise.
*/
updateGraph(): boolean;
close(): void;
private updateGraphWorker;
private addMissingFileWatcher;
registerFileUpdate(fileName: string): void;
containsScriptInfo(info: ScriptInfo): boolean;
filesToString(writeProjectFileNames: boolean): string;
private detachScriptInfoIfNotRoot;
private detachScriptInfoFromProject;
containsFile(filename: NormalizedPath, requireOpen?: boolean): boolean;
getScriptInfoForNormalizedPath(fileName: NormalizedPath): ScriptInfo | undefined;
}
export declare class ConfiguredProject extends Project {
readonly canonicalConfigFilePath: NormalizedPath;
private projectReferences;
getProjectReferences(): readonly ProjectReference[] | undefined;
/**
* Get all the project errors
*/
getAllProjectErrors(): readonly Diagnostic[];
/**
* 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;
updateReferences(refs: readonly ProjectReference[] | undefined): void;
close(): void;
/**
* Get the errors that dont have any file name associated
*/
getGlobalProjectErrors(): readonly Diagnostic[];
setProjectErrors(projectErrors: Diagnostic[]): void;
}
export declare class InferredProject extends Project {
/** this is canonical project root path */
readonly projectRootPath: string | undefined;
isProjectWithSingleRoot(): boolean;
addRoot(info: ScriptInfo): void;
removeRoot(info: ScriptInfo): void;
close(): void;
}
//# sourceMappingURL=project.d.ts.map