This repository has been archived by the owner on Nov 16, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
/
Copy pathreferences-view.d.ts
125 lines (107 loc) · 3.44 KB
/
references-view.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
import * as vscode from 'vscode';
export interface SymbolTree {
/**
* Set the contents of the references viewlet.
*
* @param input A symbol tree input object
*/
setInput(input: SymbolTreeInput): void;
}
/**
* A symbol tree input is the entry point for populating the references viewlet.
* Inputs must be anchored at a code location, they must have a title, and they
* must resolve to a model.
*/
export interface SymbolTreeInput {
/**
* The value of the `reference-list.source` context key. Use this to control
* input dependent commands.
*/
readonly contextValue: string;
/**
* The (short) title of this input, like "Implementations" or "Callers Of"
*/
readonly title: string;
/**
* The location at which this position is anchored. Locations are validated and inputs
* with "funny" locations might be ignored
*/
readonly location: vscode.Location;
/**
* Return a new input object with the given position. This is used when the editor has tracked
* an input and re-runs it from history.
*/
with(position: vscode.Position): SymbolTreeInput;
/**
* Resolve this input to a model that contains the actual data.
*/
resolve(): Promise<SymbolTreeModel>;
}
/**
* A symbol tree model which is used to populate the symbols tree.
*/
export interface SymbolTreeModel {
/**
* Signal that there are no results. This is only read after receiving
* the input and used to for a message like "No results, try a previous search..."
*/
readonly empty: boolean;
/**
* A tree data provider which is used to populate the symbols tree.
*/
provider: vscode.TreeDataProvider<unknown>;
/**
* An optional message that is displayed above the tree. Whenever the provider
* fires a change event this message is read again.
*/
message: string | undefined;
/**
* Optional support for symbol navigation. When implemented, navigation commands like
* "Go to Next" and "Go to Previous" will be working with this model.
*/
navigation?: SymbolItemNavigation<unknown>;
/**
* Optional support for editor highlights. WHen implemented, the editor will highlight
* symbol ranges in the source code.
*/
highlights?: SymbolItemEditorHighlights<unknown>;
/**
* Optional dispose function which is invoked when this model is
* needed anymore
*/
dispose?(): void;
}
/**
* Interface to support the built-in symbol navigation.
*/
export interface SymbolItemNavigation<T> {
/**
* Return the item that is the nearest to the given location or `undefined`
*/
nearest(uri: vscode.Uri, position: vscode.Position): T | undefined;
/**
* Return the next item from the given item or the item itself.
*/
next(from: T): T;
/**
* Return the previous item from the given item or the item itself.
*/
previous(from: T): T;
/**
* Return the location of the given item.
*/
location(item: T): vscode.Location | undefined;
}
/**
* Interface to support the built-in editor highlights.
*/
export interface SymbolItemEditorHighlights<T> {
/**
* Given an item and an uri return an array of ranges to highlight.
*/
getEditorHighlights(item: T, uri: vscode.Uri): vscode.Range[] | undefined;
}