import { InitializeParams, WorkspaceFoldersChangeEvent, WorkspaceFolder as lspWorkspaceFolder } from 'vscode-languageserver'; import { AnalyzerService } from './analyzer/service'; import { ConsoleInterface } from './common/console'; import { ServiceProvider } from './common/serviceProvider'; import { Uri } from './common/uri/uri'; export declare enum WellKnownWorkspaceKinds { Default = "default", Regular = "regular", Limited = "limited", Cloned = "cloned", Test = "test" } export interface InitStatus { resolve(): void; reset(): InitStatus; markCalled(): void; promise: Promise; resolved(): boolean; } export declare function createInitStatus(): InitStatus; export interface WorkspaceFolder { workspaceName: string; rootUri: Uri | undefined; } export interface Workspace extends WorkspaceFolder { kinds: string[]; service: AnalyzerService; disableLanguageServices: boolean; disableTaggedHints: boolean; disableOrganizeImports: boolean; disableWorkspaceSymbol: boolean; isInitialized: InitStatus; searchPathsToWatch: Uri[]; } export interface NormalWorkspace extends Workspace { rootUri: Uri; } export declare function renameWorkspace(workspace: Workspace, name: string): void; export type CreateServiceFunction = (name: string, workspaceRoot: Uri | undefined, kinds: string[]) => AnalyzerService; export interface IWorkspaceFactory { handleInitialize(params: InitializeParams): void; handleWorkspaceFoldersChanged(params: WorkspaceFoldersChangeEvent, workspaces: lspWorkspaceFolder[] | null): void; items(): AllWorkspace[]; clear(): void; hasMultipleWorkspaces(kind?: string): boolean; getContainingWorkspace(filePath: Uri, pythonPath?: Uri): NormalWorkspace | undefined; getNonDefaultWorkspaces(kind?: string): NormalWorkspace[]; getWorkspaceForFile(uri: Uri, pythonPath: Uri | undefined): Promise; getContainingWorkspacesForFile(filePath: Uri): Promise; } export declare class WorkspaceFactory implements IWorkspaceFactory { private readonly _console; private readonly _createService; private readonly _onWorkspaceCreated; private readonly _onWorkspaceRemoved; private readonly _serviceProvider; private _defaultWorkspacePath; private _map; private _id; constructor(_console: ConsoleInterface, _createService: CreateServiceFunction, _onWorkspaceCreated: (workspace: AllWorkspace) => void, _onWorkspaceRemoved: (workspace: AllWorkspace) => void, _serviceProvider: ServiceProvider); handleInitialize(params: InitializeParams): void; handleWorkspaceFoldersChanged(params: WorkspaceFoldersChangeEvent, workspaces: lspWorkspaceFolder[] | null): void; items(): AllWorkspace[]; clear(): void; hasMultipleWorkspaces(kind?: string): boolean; getContainingWorkspace(filePath: Uri, pythonPath?: Uri): NormalWorkspace | undefined; getNonDefaultWorkspaces(kind?: string): NormalWorkspace[]; getWorkspaceForFile(uri: Uri, pythonPath: Uri | undefined): Promise; getContainingWorkspacesForFile(filePath: Uri): Promise; private _add; private _remove; private _getDefaultWorkspaceKey; private _getWorkspaceKey; private _getOrCreateBestWorkspaceForFile; private _getBestWorkspaceForFile; private _getOrCreateDefaultWorkspace; private _getLongestPathWorkspace; private _getBestRegularWorkspace; } interface DefaultWorkspace extends Workspace { rootUri: undefined; } type AllWorkspace = DefaultWorkspace | NormalWorkspace; export {};