1 | import type * as atomIde from "atom-ide-base";
|
2 | import { LanguageClientConnection, ServerCapabilities, SymbolInformation, DocumentSymbol } from "../languageclient";
|
3 | import { TextEditor } from "atom";
|
4 | /** Public: Adapts the documentSymbolProvider of the language server to the Outline View supplied by Atom IDE UI. */
|
5 | export default class OutlineViewAdapter {
|
6 | private _cancellationTokens;
|
7 | /**
|
8 | * Public: Determine whether this adapter can be used to adapt a language server based on the serverCapabilities
|
9 | * matrix containing a documentSymbolProvider.
|
10 | *
|
11 | * @param serverCapabilities The {ServerCapabilities} of the language server to consider.
|
12 | * @returns A {Boolean} indicating adapter can adapt the server based on the given serverCapabilities.
|
13 | */
|
14 | static canAdapt(serverCapabilities: ServerCapabilities): boolean;
|
15 | /**
|
16 | * Public: Obtain the Outline for document via the {LanguageClientConnection} as identified by the {TextEditor}.
|
17 | *
|
18 | * @param connection A {LanguageClientConnection} to the language server that will be queried for the outline.
|
19 | * @param editor The Atom {TextEditor} containing the text the Outline should represent.
|
20 | * @returns A {Promise} containing the {Outline} of this document.
|
21 | */
|
22 | getOutline(connection: LanguageClientConnection, editor: TextEditor): Promise<atomIde.Outline | null>;
|
23 | /**
|
24 | * Public: Create an {Array} of {OutlineTree}s from the Array of {DocumentSymbol} recieved from the language server.
|
25 | * This includes converting all the children nodes in the entire hierarchy.
|
26 | *
|
27 | * @param symbols An {Array} of {DocumentSymbol}s received from the language server that should be converted to an
|
28 | * {Array} of {OutlineTree}.
|
29 | * @returns An {Array} of {OutlineTree} containing the given symbols that the Outline View can display.
|
30 | */
|
31 | static createHierarchicalOutlineTrees(symbols: DocumentSymbol[]): atomIde.OutlineTree[];
|
32 | /**
|
33 | * Public: Create an {Array} of {OutlineTree}s from the Array of {SymbolInformation} recieved from the language
|
34 | * server. This includes determining the appropriate child and parent relationships for the hierarchy.
|
35 | *
|
36 | * @param symbols An {Array} of {SymbolInformation}s received from the language server that should be converted to an
|
37 | * {OutlineTree}.
|
38 | * @returns An {OutlineTree} containing the given symbols that the Outline View can display.
|
39 | */
|
40 | static createOutlineTrees(symbols: SymbolInformation[]): atomIde.OutlineTree[];
|
41 | private static _getClosestParent;
|
42 | /**
|
43 | * Public: Convert an individual {DocumentSymbol} from the language server to an {OutlineTree} for use by the Outline
|
44 | * View. It does NOT recursively process the given symbol's children (if any).
|
45 | *
|
46 | * @param symbol The {DocumentSymbol} to convert to an {OutlineTree}.
|
47 | * @returns The {OutlineTree} corresponding to the given {DocumentSymbol}.
|
48 | */
|
49 | static hierarchicalSymbolToOutline(symbol: DocumentSymbol): atomIde.OutlineTree;
|
50 | /**
|
51 | * Public: Convert an individual {SymbolInformation} from the language server to an {OutlineTree} for use by the Outline View.
|
52 | *
|
53 | * @param symbol The {SymbolInformation} to convert to an {OutlineTree}.
|
54 | * @returns The {OutlineTree} equivalent to the given {SymbolInformation}.
|
55 | */
|
56 | static symbolToOutline(symbol: SymbolInformation): atomIde.OutlineTree;
|
57 | /**
|
58 | * Public: Convert a symbol kind into an outline entity kind used to determine the styling such as the appropriate
|
59 | * icon in the Outline View.
|
60 | *
|
61 | * @param symbol The numeric symbol kind received from the language server.
|
62 | * @returns A string representing the equivalent OutlineView entity kind.
|
63 | */
|
64 | static symbolKindToEntityKind(symbol: number): string | null;
|
65 | /**
|
66 | * Public: Convert a symbol kind to the appropriate token kind used to syntax highlight the symbol name in the Outline View.
|
67 | *
|
68 | * @param symbol The numeric symbol kind received from the language server.
|
69 | * @returns A string representing the equivalent syntax token kind.
|
70 | */
|
71 | static symbolKindToTokenKind(symbol: number): atomIde.TokenKind;
|
72 | }
|