svelte-language-server
Version:
A language server for Svelte
60 lines (59 loc) • 2.51 kB
TypeScript
import ts from 'typescript';
import { DocumentSnapshot, JSOrTSDocumentSnapshot } from './DocumentSnapshot';
import { TextDocumentContentChangeEvent } from 'vscode-languageserver';
type SnapshotChangeHandler = (fileName: string, newDocument: DocumentSnapshot | undefined) => void;
/**
* Every snapshot corresponds to a unique file on disk.
* A snapshot can be part of multiple projects, but for a given file path
* there can be only one snapshot.
*/
export declare class GlobalSnapshotsManager {
private readonly tsSystem;
private emitter;
private documents;
private getCanonicalFileName;
constructor(tsSystem: ts.System);
get(fileName: string): DocumentSnapshot | undefined;
getByPrefix(path: string): DocumentSnapshot[];
set(fileName: string, document: DocumentSnapshot): void;
delete(fileName: string): void;
updateTsOrJsFile(fileName: string, changes?: TextDocumentContentChangeEvent[]): JSOrTSDocumentSnapshot | undefined;
onChange(listener: SnapshotChangeHandler): void;
removeChangeListener(listener: SnapshotChangeHandler): void;
}
export interface TsFilesSpec {
include?: readonly string[];
exclude?: readonly string[];
}
/**
* Should only be used by `service.ts`
*/
export declare class SnapshotManager {
private globalSnapshotsManager;
private fileSpec;
private workspaceRoot;
private tsSystem;
private readonly documents;
private lastLogged;
private readonly projectFileToOriginalCasing;
private getCanonicalFileName;
private watchingCanonicalDirectories;
private readonly watchExtensions;
constructor(globalSnapshotsManager: GlobalSnapshotsManager, fileSpec: TsFilesSpec, workspaceRoot: string, tsSystem: ts.System, projectFiles: string[], wildcardDirectories: ts.MapLike<ts.WatchDirectoryFlags> | undefined);
private onSnapshotChange;
areIgnoredFromNewFileWatch(watcherNewFiles: string[]): boolean;
updateProjectFiles(): void;
updateTsOrJsFile(fileName: string, changes?: TextDocumentContentChangeEvent[]): void;
has(fileName: string): boolean;
set(fileName: string, snapshot: DocumentSnapshot): void;
get(fileName: string): DocumentSnapshot | undefined;
delete(fileName: string): void;
getClientFileNames(): string[];
getProjectFileNames(): string[];
isProjectFile(fileName: string): boolean;
private logStatistics;
allFilesAreJsOrDts(): boolean;
dispose(): void;
}
export declare const ignoredBuildDirectories: string[];
export {};