6
6
import * as vscode from 'vscode' ;
7
7
8
8
/**
9
- * This interface describes the shape for the references viewlet API. It consists
10
- * of a single `setInput` function which must be called with a full implementation
11
- * of the `SymbolTreeInput`-interface. To acquire this API use the default mechanics, e.g:
12
- *
9
+ * This interface describes the shape for the references viewlet API. It includes
10
+ * a single `setInput` function which must be called with a full implementation
11
+ * of the `SymbolTreeInput`-interface. You can also use `getInput` function to
12
+ * get the current `SymbolTreeInput`. To acquire this API use the default mechanics, e.g:
13
+ *
13
14
* ```ts
14
15
* // get references viewlet API
15
16
* const api = await vscode.extensions.getExtension<SymbolTree>('ms-vscode.references-view').activate();
16
- *
17
+ *
17
18
* // instantiate and set input which updates the view
18
19
* const myInput: SymbolTreeInput<MyItems> = ...
19
- * api.setInput(myInput)
20
+ * api.setInput(myInput);
21
+ * const currentInput = api.getInput();
20
22
* ```
21
23
*/
22
24
export interface SymbolTree {
23
25
24
26
/**
25
- * Set the contents of the references viewlet.
26
- *
27
+ * Set the contents of the references viewlet.
28
+ *
27
29
* @param input A symbol tree input object
28
30
*/
29
31
setInput ( input : SymbolTreeInput < unknown > ) : void ;
32
+
33
+ /**
34
+ * Get the contents of the references viewlet.
35
+ *
36
+ * @returns The current symbol tree input object
37
+ */
38
+ getInput ( ) : SymbolTreeInput < unknown > | undefined ;
30
39
}
31
40
32
41
/**
33
42
* A symbol tree input is the entry point for populating the references viewlet.
34
- * Inputs must be anchored at a code location, they must have a title, and they
43
+ * Inputs must be anchored at a code location, they must have a title, and they
35
44
* must resolve to a model.
36
45
*/
37
46
export interface SymbolTreeInput < T > {
@@ -54,17 +63,17 @@ export interface SymbolTreeInput<T> {
54
63
readonly location : vscode . Location ;
55
64
56
65
/**
57
- * Resolve this input to a model that contains the actual data. When there are no result
66
+ * Resolve this input to a model that contains the actual data. When there are no result
58
67
* than `undefined` or `null` should be returned.
59
68
*/
60
69
resolve ( ) : vscode . ProviderResult < SymbolTreeModel < T > > ;
61
70
62
71
/**
63
72
* This function is called when re-running from history. The symbols tree has tracked
64
- * the original location of this input and that is now passed to this input. The
73
+ * the original location of this input and that is now passed to this input. The
65
74
* implementation of this function should return a clone where the `location`-property
66
75
* uses the provided `location`
67
- *
76
+ *
68
77
* @param location The location at which the new input should be anchored.
69
78
* @returns A new input which location is anchored at the position.
70
79
*/
@@ -94,7 +103,7 @@ export interface SymbolTreeModel<T> {
94
103
navigation ?: SymbolItemNavigation < T > ;
95
104
96
105
/**
97
- * Optional support for editor highlights. WHen implemented, the editor will highlight
106
+ * Optional support for editor highlights. WHen implemented, the editor will highlight
98
107
* symbol ranges in the source code.
99
108
*/
100
109
highlights ?: SymbolItemEditorHighlights < T > ;
0 commit comments