1 |
|
2 | import * as cp from "child_process";
|
3 | import * as ls from "./languageclient";
|
4 | import * as atomIde from "atom-ide";
|
5 | import * as linter from "atom/linter";
|
6 | import AutocompleteAdapter from "./adapters/autocomplete-adapter";
|
7 | import * as CallHierarchyAdapter from "./adapters/call-hierarchy-adapter";
|
8 | import DatatipAdapter from "./adapters/datatip-adapter";
|
9 | import DefinitionAdapter from "./adapters/definition-adapter";
|
10 | import FindReferencesAdapter from "./adapters/find-references-adapter";
|
11 | import LinterPushV2Adapter from "./adapters/linter-push-v2-adapter";
|
12 | import LoggingConsoleAdapter from "./adapters/logging-console-adapter";
|
13 | import OutlineViewAdapter from "./adapters/outline-view-adapter";
|
14 | import SignatureHelpAdapter from "./adapters/signature-help-adapter";
|
15 | import * as Utils from "./utils";
|
16 | import { Socket } from "net";
|
17 | import { LanguageClientConnection } from "./languageclient";
|
18 | import { Logger } from "./logger";
|
19 | import { LanguageServerProcess, ActiveServer } from "./server-manager.js";
|
20 | import { Disposable, Point, Range, TextEditor } from "atom";
|
21 | import * as ac from "atom/autocomplete-plus";
|
22 | export { ActiveServer, LanguageClientConnection, LanguageServerProcess };
|
23 | export declare type ConnectionType = "stdio" | "socket" | "ipc";
|
24 | export interface ServerAdapters {
|
25 | linterPushV2: LinterPushV2Adapter;
|
26 | loggingConsole: LoggingConsoleAdapter;
|
27 | signatureHelpAdapter?: SignatureHelpAdapter;
|
28 | }
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 |
|
38 | export default class AutoLanguageClient {
|
39 | private _disposable;
|
40 | private _serverManager;
|
41 | private _consoleDelegate?;
|
42 | private _linterDelegate?;
|
43 | private _signatureHelpRegistry?;
|
44 | private _lastAutocompleteRequest?;
|
45 | private _isDeactivating;
|
46 | private _serverAdapters;
|
47 |
|
48 | protected busySignalService?: atomIde.BusySignalService;
|
49 | protected processStdErr: string;
|
50 | protected logger: Logger;
|
51 | protected name: string;
|
52 | protected socket: Socket;
|
53 | protected autoComplete?: AutocompleteAdapter;
|
54 | protected callHierarchy?: typeof CallHierarchyAdapter;
|
55 | protected datatip?: DatatipAdapter;
|
56 | protected definitions?: DefinitionAdapter;
|
57 | protected findReferences?: FindReferencesAdapter;
|
58 | protected outlineView?: OutlineViewAdapter;
|
59 |
|
60 | protected getGrammarScopes(): string[];
|
61 |
|
62 | protected getLanguageName(): string;
|
63 |
|
64 | protected getServerName(): string;
|
65 |
|
66 | protected startServerProcess(_projectPath: string): LanguageServerProcess | Promise<LanguageServerProcess>;
|
67 |
|
68 | protected shouldStartForEditor(editor: TextEditor): boolean;
|
69 |
|
70 | protected getInitializeParams(projectPath: string, lsProcess: LanguageServerProcess): ls.InitializeParams;
|
71 |
|
72 | protected preInitialization(_connection: LanguageClientConnection): void;
|
73 |
|
74 | protected postInitialization(_server: ActiveServer): void;
|
75 |
|
76 | protected getConnectionType(): ConnectionType;
|
77 |
|
78 | protected getRootConfigurationKey(): string;
|
79 |
|
80 | protected mapConfigurationObject(configuration: any): any;
|
81 | |
82 |
|
83 |
|
84 |
|
85 |
|
86 |
|
87 |
|
88 |
|
89 |
|
90 |
|
91 |
|
92 |
|
93 |
|
94 |
|
95 |
|
96 |
|
97 |
|
98 |
|
99 | protected getLanguageIdFromEditor(editor: TextEditor): string;
|
100 |
|
101 | protected getConnectionForEditor(editor: TextEditor): Promise<LanguageClientConnection | null>;
|
102 |
|
103 | protected restartAllServers(): Promise<void>;
|
104 |
|
105 | activate(): void;
|
106 | private exitCleanup;
|
107 |
|
108 | deactivate(): Promise<any>;
|
109 | |
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 | protected spawn(exe: string, args?: string[], options?: cp.SpawnOptions, rootPath?: string, exeExtention?: string): LanguageServerProcess;
|
122 | |
123 |
|
124 |
|
125 |
|
126 | protected spawnChildNode(args: string[], options?: cp.SpawnOptions): LanguageServerProcess;
|
127 |
|
128 | protected getLogger(): Logger;
|
129 |
|
130 | private startServer;
|
131 | private captureServerErrors;
|
132 | |
133 |
|
134 |
|
135 |
|
136 | protected onSpawnError(err: Error): void;
|
137 | |
138 |
|
139 |
|
140 |
|
141 | protected onSpawnClose(code: number | null, signal: NodeJS.Signals | null): void;
|
142 | |
143 |
|
144 |
|
145 |
|
146 | protected onSpawnDisconnect(): void;
|
147 | |
148 |
|
149 |
|
150 |
|
151 | protected onSpawnExit(code: number | null, signal: NodeJS.Signals | null): void;
|
152 |
|
153 | protected determineProjectPath(textEditor: TextEditor): string | null;
|
154 | |
155 |
|
156 |
|
157 |
|
158 | protected onSpawnStdErrData(chunk: Buffer, projectPath: string): void;
|
159 |
|
160 | private createRpcConnection;
|
161 |
|
162 | private startExclusiveAdapters;
|
163 | shouldSyncForEditor(editor: TextEditor, projectPath: string): boolean;
|
164 | protected isFileInProject(editor: TextEditor, projectPath: string): boolean;
|
165 | |
166 |
|
167 |
|
168 |
|
169 |
|
170 |
|
171 |
|
172 | protected getAutocompleteDisabledScopes(): Array<string>;
|
173 | provideAutocomplete(): ac.AutocompleteProvider;
|
174 | protected getSuggestions(request: ac.SuggestionsRequestedEvent): Promise<ac.AnySuggestion[]>;
|
175 | protected getSuggestionDetailsOnSelect(suggestion: ac.AnySuggestion): Promise<ac.AnySuggestion | null>;
|
176 | protected onDidConvertAutocomplete(_completionItem: ls.CompletionItem, _suggestion: ac.AnySuggestion, _request: ac.SuggestionsRequestedEvent): void;
|
177 | protected onDidInsertSuggestion(_arg: ac.SuggestionInsertedEvent): void;
|
178 | provideDefinitions(): atomIde.DefinitionProvider;
|
179 | protected getDefinition(editor: TextEditor, point: Point): Promise<atomIde.DefinitionQueryResult | null>;
|
180 | provideOutlines(): atomIde.OutlineProvider;
|
181 | protected getOutline(editor: TextEditor): Promise<atomIde.Outline | null>;
|
182 | provideCallHierarchy(): atomIde.CallHierarchyProvider;
|
183 | protected getIncomingCallHierarchy(editor: TextEditor, point: Point): Promise<atomIde.CallHierarchy<"incoming"> | null>;
|
184 | protected getOutgoingCallHierarchy(editor: TextEditor, point: Point): Promise<atomIde.CallHierarchy<"outgoing"> | null>;
|
185 | consumeLinterV2(registerIndie: (params: {
|
186 | name: string;
|
187 | }) => linter.IndieDelegate): void;
|
188 | provideFindReferences(): atomIde.FindReferencesProvider;
|
189 | protected getReferences(editor: TextEditor, point: Point): Promise<atomIde.FindReferencesReturn | null>;
|
190 | consumeDatatip(service: atomIde.DatatipService): void;
|
191 | protected getDatatip(editor: TextEditor, point: Point): Promise<atomIde.Datatip | null>;
|
192 | consumeConsole(createConsole: atomIde.ConsoleService): Disposable;
|
193 | provideCodeFormat(): atomIde.RangeCodeFormatProvider;
|
194 | protected getCodeFormat(editor: TextEditor, range: Range): Promise<atomIde.TextEdit[]>;
|
195 | provideRangeCodeFormat(): atomIde.RangeCodeFormatProvider;
|
196 | protected getRangeCodeFormat(editor: TextEditor, range: Range): Promise<atomIde.TextEdit[]>;
|
197 | provideFileCodeFormat(): atomIde.FileCodeFormatProvider;
|
198 | provideOnSaveCodeFormat(): atomIde.OnSaveCodeFormatProvider;
|
199 | protected getFileCodeFormat(editor: TextEditor): Promise<atomIde.TextEdit[]>;
|
200 | provideOnTypeCodeFormat(): atomIde.OnTypeCodeFormatProvider;
|
201 | protected getOnTypeCodeFormat(editor: TextEditor, point: Point, character: string): Promise<atomIde.TextEdit[]>;
|
202 | provideCodeHighlight(): atomIde.CodeHighlightProvider;
|
203 | protected getCodeHighlight(editor: TextEditor, position: Point): Promise<Range[] | null>;
|
204 | provideCodeActions(): atomIde.CodeActionProvider;
|
205 | protected getCodeActions(editor: TextEditor, range: Range, diagnostics: atomIde.Diagnostic[]): Promise<atomIde.CodeAction[] | null>;
|
206 |
|
207 | protected filterCodeActions(actions: (ls.Command | ls.CodeAction)[] | null): (ls.Command | ls.CodeAction)[] | null;
|
208 | |
209 |
|
210 |
|
211 |
|
212 | protected onApplyCodeActions(_action: ls.Command | ls.CodeAction): Promise<boolean>;
|
213 | provideRefactor(): atomIde.RefactorProvider;
|
214 | protected getRename(editor: TextEditor, position: Point, newName: string): Promise<Map<string, atomIde.TextEdit[]> | null>;
|
215 | consumeSignatureHelp(registry: atomIde.SignatureHelpRegistry): Disposable;
|
216 | consumeBusySignal(service: atomIde.BusySignalService): Disposable;
|
217 | |
218 |
|
219 |
|
220 |
|
221 |
|
222 |
|
223 | protected filterChangeWatchedFiles(_filePath: string): boolean;
|
224 | |
225 |
|
226 |
|
227 |
|
228 | protected shutdownGracefully: boolean;
|
229 | |
230 |
|
231 |
|
232 |
|
233 |
|
234 | protected handleServerStderr(stderr: string, _projectPath: string): void;
|
235 | private getServerAdapter;
|
236 | protected reportBusyWhile: Utils.ReportBusyWhile;
|
237 | protected reportBusyWhileDefault: Utils.ReportBusyWhile;
|
238 | }
|