1 |
|
2 | import * as ls from "./languageclient";
|
3 | import { ChildProcess } from "child_process";
|
4 | import { Logger } from "./logger";
|
5 | import { CompositeDisposable, FilesystemChangeEvent, TextEditor } from "atom";
|
6 | import { ReportBusyWhile } from "./utils";
|
7 | export declare type MinimalLanguageServerProcess = Pick<ChildProcess, "stdin" | "stdout" | "stderr" | "pid" | "kill" | "on">;
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 | export declare type LanguageServerProcess = ChildProcess | MinimalLanguageServerProcess;
|
14 |
|
15 | export interface ActiveServer {
|
16 | disposable: CompositeDisposable;
|
17 | projectPath: string;
|
18 | process: LanguageServerProcess;
|
19 | connection: ls.LanguageClientConnection;
|
20 | capabilities: ls.ServerCapabilities;
|
21 |
|
22 | additionalPaths?: Set<string>;
|
23 | }
|
24 |
|
25 | export declare class ServerManager {
|
26 | private _startServer;
|
27 | private _logger;
|
28 | private _startForEditor;
|
29 | private _changeWatchedFileFilter;
|
30 | private _reportBusyWhile;
|
31 | private _languageServerName;
|
32 | private _determineProjectPath;
|
33 | private shutdownGracefully;
|
34 | private _activeServers;
|
35 | private _startingServerPromises;
|
36 | private _restartCounterPerProject;
|
37 | private _stoppingServers;
|
38 | private _disposable;
|
39 | private _editorToServer;
|
40 | private _normalizedProjectPaths;
|
41 | private _previousNormalizedProjectPaths;
|
42 | private _isStarted;
|
43 | constructor(_startServer: (projectPath: string) => Promise<ActiveServer>, _logger: Logger, _startForEditor: (editor: TextEditor) => boolean, _changeWatchedFileFilter: (filePath: string) => boolean, _reportBusyWhile: ReportBusyWhile, _languageServerName: string, _determineProjectPath: (textEditor: TextEditor) => string | null, shutdownGracefully: boolean);
|
44 | startListening(): void;
|
45 | stopListening(): void;
|
46 | private observeTextEditors;
|
47 | private _handleTextEditor;
|
48 | private _handleGrammarChange;
|
49 | getActiveServers(): Readonly<ActiveServer[]>;
|
50 | getServer(textEditor: TextEditor, { shouldStart }?: {
|
51 | shouldStart?: boolean;
|
52 | }): Promise<ActiveServer | null>;
|
53 | startServer(projectPath: string): Promise<ActiveServer>;
|
54 | stopUnusedServers(): Promise<void>;
|
55 | stopAllServers(): Promise<void>;
|
56 | restartAllServers(): Promise<void>;
|
57 | hasServerReachedRestartLimit(server: ActiveServer): boolean;
|
58 | stopServer(server: ActiveServer): Promise<void>;
|
59 | exitServer(server: ActiveServer): void;
|
60 | terminate(): void;
|
61 | updateNormalizedProjectPaths(): void;
|
62 | getNormalizedProjectPaths(): Readonly<string[]>;
|
63 | /**
|
64 | * Public: fetch the current open list of workspace folders
|
65 | *
|
66 | * @returns A {Promise} containing an {Array} of {lsp.WorkspaceFolder[]} or {null} if only a single file is open in the tool.
|
67 | */
|
68 | getWorkspaceFolders(): Promise<ls.WorkspaceFolder[] | null>;
|
69 | projectPathsChanged(projectPaths: string[]): Promise<void>;
|
70 | projectFilesChanged(fileEvents: FilesystemChangeEvent): void;
|
71 |
|
72 | normalizePath: typeof normalizePath;
|
73 | }
|
74 | export declare function projectPathToWorkspaceFolder(projectPath: string): ls.WorkspaceFolder;
|
75 | export declare function normalizedProjectPathToWorkspaceFolder(normalizedProjectPath: string): ls.WorkspaceFolder;
|
76 | export declare function normalizePath(projectPath: string): string;
|
77 |
|
78 | export declare function considerAdditionalPath(server: ActiveServer & {
|
79 | additionalPaths: Set<string>;
|
80 | }, additionalPath: string): void;
|