@codingame/monaco-vscode-views-service-override 1.85.1 → 1.85.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +11 -9
- package/tools/editor.js +1 -1
- package/views.js +1 -6
- package/vscode/src/vs/workbench/api/browser/viewsExtensionPoint.js +1 -1
- package/vscode/src/vs/workbench/services/history/browser/historyService.js +3 -0
- package/vscode/src/vs/base/browser/ui/tree/treeDefaults.js +0 -16
- package/vscode/src/vs/workbench/browser/parts/views/checkbox.js +0 -107
- package/vscode/src/vs/workbench/browser/parts/views/media/views.css.js +0 -6
- package/vscode/src/vs/workbench/browser/parts/views/treeView.js +0 -1604
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/outline/documentSymbolsOutline.js +0 -371
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/outline/documentSymbolsTree.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/codeEditor/browser/outline/documentSymbolsTree.js +0 -277
- package/vscode/src/vs/workbench/contrib/outline/browser/outline.contribution.js +0 -367
- package/vscode/src/vs/workbench/contrib/outline/browser/outline.js +0 -12
- package/vscode/src/vs/workbench/contrib/outline/browser/outlinePane.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/outline/browser/outlinePane.js +0 -307
- package/vscode/src/vs/workbench/contrib/outline/browser/outlineViewState.js +0 -68
- package/vscode/src/vs/workbench/services/outline/browser/outlineService.js +0 -37
package/vscode/src/vs/workbench/contrib/codeEditor/browser/outline/documentSymbolsOutline.js
DELETED
|
@@ -1,371 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import { Emitter } from 'monaco-editor/esm/vs/base/common/event.js';
|
|
3
|
-
import { DisposableStore, Disposable, toDisposable } from 'monaco-editor/esm/vs/base/common/lifecycle.js';
|
|
4
|
-
import { IOutlineService } from 'vscode/vscode/vs/workbench/services/outline/browser/outline';
|
|
5
|
-
import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
6
|
-
import { Registry } from 'monaco-editor/esm/vs/platform/registry/common/platform.js';
|
|
7
|
-
import { DocumentSymbolFilter, DocumentSymbolGroupRenderer, DocumentSymbolRenderer, DocumentSymbolComparator, DocumentSymbolIdentityProvider, DocumentSymbolNavigationLabelProvider, DocumentSymbolAccessibilityProvider, DocumentSymbolVirtualDelegate } from './documentSymbolsTree.js';
|
|
8
|
-
import { isCodeEditor, isDiffEditor } from 'monaco-editor/esm/vs/editor/browser/editorBrowser.js';
|
|
9
|
-
import { OutlineModel, OutlineGroup, OutlineElement, TreeElement, IOutlineModelService } from 'monaco-editor/esm/vs/editor/contrib/documentSymbols/browser/outlineModel.js';
|
|
10
|
-
import { CancellationTokenSource } from 'monaco-editor/esm/vs/base/common/cancellation.js';
|
|
11
|
-
import { Barrier, TimeoutTimer, timeout, raceCancellation } from 'monaco-editor/esm/vs/base/common/async.js';
|
|
12
|
-
import { onUnexpectedError } from 'monaco-editor/esm/vs/base/common/errors.js';
|
|
13
|
-
import { ITextResourceConfigurationService } from 'monaco-editor/esm/vs/editor/common/services/textResourceConfiguration.js';
|
|
14
|
-
import { IInstantiationService } from 'monaco-editor/esm/vs/platform/instantiation/common/instantiation.js';
|
|
15
|
-
import { Range } from 'monaco-editor/esm/vs/editor/common/core/range.js';
|
|
16
|
-
import { ICodeEditorService } from 'monaco-editor/esm/vs/editor/browser/services/codeEditorService.js';
|
|
17
|
-
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
18
|
-
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
19
|
-
import { IMarkerDecorationsService } from 'monaco-editor/esm/vs/editor/common/services/markerDecorations.js';
|
|
20
|
-
import { MarkerSeverity } from 'monaco-editor/esm/vs/platform/markers/common/markers.js';
|
|
21
|
-
import { isEqual } from 'monaco-editor/esm/vs/base/common/resources.js';
|
|
22
|
-
import { ILanguageFeaturesService } from 'monaco-editor/esm/vs/editor/common/services/languageFeatures.js';
|
|
23
|
-
|
|
24
|
-
let DocumentSymbolBreadcrumbsSource = class DocumentSymbolBreadcrumbsSource {
|
|
25
|
-
constructor(_editor, _textResourceConfigurationService) {
|
|
26
|
-
this._editor = _editor;
|
|
27
|
-
this._textResourceConfigurationService = _textResourceConfigurationService;
|
|
28
|
-
this._breadcrumbs = [];
|
|
29
|
-
}
|
|
30
|
-
getBreadcrumbElements() {
|
|
31
|
-
return this._breadcrumbs;
|
|
32
|
-
}
|
|
33
|
-
clear() {
|
|
34
|
-
this._breadcrumbs = [];
|
|
35
|
-
}
|
|
36
|
-
update(model, position) {
|
|
37
|
-
const newElements = this._computeBreadcrumbs(model, position);
|
|
38
|
-
this._breadcrumbs = newElements;
|
|
39
|
-
}
|
|
40
|
-
_computeBreadcrumbs(model, position) {
|
|
41
|
-
let item = model.getItemEnclosingPosition(position);
|
|
42
|
-
if (!item) {
|
|
43
|
-
return [];
|
|
44
|
-
}
|
|
45
|
-
const chain = [];
|
|
46
|
-
while (item) {
|
|
47
|
-
chain.push(item);
|
|
48
|
-
const parent = item.parent;
|
|
49
|
-
if (parent instanceof OutlineModel) {
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
if (parent instanceof OutlineGroup && parent.parent && parent.parent.children.size === 1) {
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
item = parent;
|
|
56
|
-
}
|
|
57
|
-
const result = [];
|
|
58
|
-
for (let i = chain.length - 1; i >= 0; i--) {
|
|
59
|
-
const element = chain[i];
|
|
60
|
-
if (this._isFiltered(element)) {
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
result.push(element);
|
|
64
|
-
}
|
|
65
|
-
if (result.length === 0) {
|
|
66
|
-
return [];
|
|
67
|
-
}
|
|
68
|
-
return result;
|
|
69
|
-
}
|
|
70
|
-
_isFiltered(element) {
|
|
71
|
-
if (!(element instanceof OutlineElement)) {
|
|
72
|
-
return false;
|
|
73
|
-
}
|
|
74
|
-
const key = `breadcrumbs.${DocumentSymbolFilter.kindToConfigName[element.symbol.kind]}`;
|
|
75
|
-
let uri;
|
|
76
|
-
if (this._editor && this._editor.getModel()) {
|
|
77
|
-
const model = this._editor.getModel();
|
|
78
|
-
uri = model.uri;
|
|
79
|
-
}
|
|
80
|
-
return !this._textResourceConfigurationService.getValue(uri, key);
|
|
81
|
-
}
|
|
82
|
-
};
|
|
83
|
-
DocumentSymbolBreadcrumbsSource = ( __decorate([
|
|
84
|
-
( __param(1, ITextResourceConfigurationService))
|
|
85
|
-
], DocumentSymbolBreadcrumbsSource));
|
|
86
|
-
let DocumentSymbolsOutline = class DocumentSymbolsOutline {
|
|
87
|
-
get activeElement() {
|
|
88
|
-
const posistion = this._editor.getPosition();
|
|
89
|
-
if (!posistion || !this._outlineModel) {
|
|
90
|
-
return undefined;
|
|
91
|
-
}
|
|
92
|
-
else {
|
|
93
|
-
return this._outlineModel.getItemEnclosingPosition(posistion);
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
constructor(_editor, target, firstLoadBarrier, _languageFeaturesService, _codeEditorService, _outlineModelService, _configurationService, _markerDecorationsService, textResourceConfigurationService, instantiationService) {
|
|
97
|
-
this._editor = _editor;
|
|
98
|
-
this._languageFeaturesService = _languageFeaturesService;
|
|
99
|
-
this._codeEditorService = _codeEditorService;
|
|
100
|
-
this._outlineModelService = _outlineModelService;
|
|
101
|
-
this._configurationService = _configurationService;
|
|
102
|
-
this._markerDecorationsService = _markerDecorationsService;
|
|
103
|
-
this._disposables = ( new DisposableStore());
|
|
104
|
-
this._onDidChange = ( new Emitter());
|
|
105
|
-
this.onDidChange = this._onDidChange.event;
|
|
106
|
-
this._outlineDisposables = ( new DisposableStore());
|
|
107
|
-
this.outlineKind = 'documentSymbols';
|
|
108
|
-
this._breadcrumbsDataSource = ( new DocumentSymbolBreadcrumbsSource(_editor, textResourceConfigurationService));
|
|
109
|
-
const delegate = ( new DocumentSymbolVirtualDelegate());
|
|
110
|
-
const renderers = [( new DocumentSymbolGroupRenderer()), instantiationService.createInstance(DocumentSymbolRenderer, true)];
|
|
111
|
-
const treeDataSource = {
|
|
112
|
-
getChildren: (parent) => {
|
|
113
|
-
if (parent instanceof OutlineElement || parent instanceof OutlineGroup) {
|
|
114
|
-
return ( parent.children.values());
|
|
115
|
-
}
|
|
116
|
-
if (parent === this && this._outlineModel) {
|
|
117
|
-
return ( this._outlineModel.children.values());
|
|
118
|
-
}
|
|
119
|
-
return [];
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
const comparator = ( new DocumentSymbolComparator());
|
|
123
|
-
const initialState = textResourceConfigurationService.getValue(_editor.getModel()?.uri, "outline.collapseItems" );
|
|
124
|
-
const options = {
|
|
125
|
-
collapseByDefault: target === 2 || ((target === 1 && initialState === "alwaysCollapse") ),
|
|
126
|
-
expandOnlyOnTwistieClick: true,
|
|
127
|
-
multipleSelectionSupport: false,
|
|
128
|
-
identityProvider: ( new DocumentSymbolIdentityProvider()),
|
|
129
|
-
keyboardNavigationLabelProvider: ( new DocumentSymbolNavigationLabelProvider()),
|
|
130
|
-
accessibilityProvider: ( new DocumentSymbolAccessibilityProvider(( localizeWithPath(
|
|
131
|
-
'vs/workbench/contrib/codeEditor/browser/outline/documentSymbolsOutline',
|
|
132
|
-
'document',
|
|
133
|
-
"Document Symbols"
|
|
134
|
-
)))),
|
|
135
|
-
filter: target === 1
|
|
136
|
-
? instantiationService.createInstance(DocumentSymbolFilter, 'outline')
|
|
137
|
-
: target === 2
|
|
138
|
-
? instantiationService.createInstance(DocumentSymbolFilter, 'breadcrumbs')
|
|
139
|
-
: undefined
|
|
140
|
-
};
|
|
141
|
-
this.config = {
|
|
142
|
-
breadcrumbsDataSource: this._breadcrumbsDataSource,
|
|
143
|
-
delegate,
|
|
144
|
-
renderers,
|
|
145
|
-
treeDataSource,
|
|
146
|
-
comparator,
|
|
147
|
-
options,
|
|
148
|
-
quickPickDataSource: { getQuickPickElements: () => { throw new Error('not implemented'); } }
|
|
149
|
-
};
|
|
150
|
-
this._disposables.add(_languageFeaturesService.documentSymbolProvider.onDidChange(_ => this._createOutline()));
|
|
151
|
-
this._disposables.add(this._editor.onDidChangeModel(_ => this._createOutline()));
|
|
152
|
-
this._disposables.add(this._editor.onDidChangeModelLanguage(_ => this._createOutline()));
|
|
153
|
-
const updateSoon = ( new TimeoutTimer());
|
|
154
|
-
this._disposables.add(updateSoon);
|
|
155
|
-
this._disposables.add(this._editor.onDidChangeModelContent(event => {
|
|
156
|
-
const model = this._editor.getModel();
|
|
157
|
-
if (model) {
|
|
158
|
-
const timeout = _outlineModelService.getDebounceValue(model);
|
|
159
|
-
updateSoon.cancelAndSet(() => this._createOutline(event), timeout);
|
|
160
|
-
}
|
|
161
|
-
}));
|
|
162
|
-
this._disposables.add(this._editor.onDidDispose(() => this._outlineDisposables.clear()));
|
|
163
|
-
this._createOutline().finally(() => firstLoadBarrier.open());
|
|
164
|
-
}
|
|
165
|
-
dispose() {
|
|
166
|
-
this._disposables.dispose();
|
|
167
|
-
this._outlineDisposables.dispose();
|
|
168
|
-
}
|
|
169
|
-
get isEmpty() {
|
|
170
|
-
return !this._outlineModel || TreeElement.empty(this._outlineModel);
|
|
171
|
-
}
|
|
172
|
-
get uri() {
|
|
173
|
-
return this._outlineModel?.uri;
|
|
174
|
-
}
|
|
175
|
-
async reveal(entry, options, sideBySide) {
|
|
176
|
-
const model = OutlineModel.get(entry);
|
|
177
|
-
if (!model || !(entry instanceof OutlineElement)) {
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
await this._codeEditorService.openCodeEditor({
|
|
181
|
-
resource: model.uri,
|
|
182
|
-
options: {
|
|
183
|
-
...options,
|
|
184
|
-
selection: Range.collapseToStart(entry.symbol.selectionRange),
|
|
185
|
-
selectionRevealType: 3 ,
|
|
186
|
-
}
|
|
187
|
-
}, this._editor, sideBySide);
|
|
188
|
-
}
|
|
189
|
-
preview(entry) {
|
|
190
|
-
if (!(entry instanceof OutlineElement)) {
|
|
191
|
-
return Disposable.None;
|
|
192
|
-
}
|
|
193
|
-
const { symbol } = entry;
|
|
194
|
-
this._editor.revealRangeInCenterIfOutsideViewport(symbol.range, 0 );
|
|
195
|
-
const decorationsCollection = this._editor.createDecorationsCollection([{
|
|
196
|
-
range: symbol.range,
|
|
197
|
-
options: {
|
|
198
|
-
description: 'document-symbols-outline-range-highlight',
|
|
199
|
-
className: 'rangeHighlight',
|
|
200
|
-
isWholeLine: true
|
|
201
|
-
}
|
|
202
|
-
}]);
|
|
203
|
-
return toDisposable(() => decorationsCollection.clear());
|
|
204
|
-
}
|
|
205
|
-
captureViewState() {
|
|
206
|
-
const viewState = this._editor.saveViewState();
|
|
207
|
-
return toDisposable(() => {
|
|
208
|
-
if (viewState) {
|
|
209
|
-
this._editor.restoreViewState(viewState);
|
|
210
|
-
}
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
async _createOutline(contentChangeEvent) {
|
|
214
|
-
this._outlineDisposables.clear();
|
|
215
|
-
if (!contentChangeEvent) {
|
|
216
|
-
this._setOutlineModel(undefined);
|
|
217
|
-
}
|
|
218
|
-
if (!this._editor.hasModel()) {
|
|
219
|
-
return;
|
|
220
|
-
}
|
|
221
|
-
const buffer = this._editor.getModel();
|
|
222
|
-
if (!( this._languageFeaturesService.documentSymbolProvider.has(buffer))) {
|
|
223
|
-
return;
|
|
224
|
-
}
|
|
225
|
-
const cts = ( new CancellationTokenSource());
|
|
226
|
-
const versionIdThen = buffer.getVersionId();
|
|
227
|
-
const timeoutTimer = ( new TimeoutTimer());
|
|
228
|
-
this._outlineDisposables.add(timeoutTimer);
|
|
229
|
-
this._outlineDisposables.add(toDisposable(() => cts.dispose(true)));
|
|
230
|
-
try {
|
|
231
|
-
const model = await this._outlineModelService.getOrCreate(buffer, cts.token);
|
|
232
|
-
if (cts.token.isCancellationRequested) {
|
|
233
|
-
return;
|
|
234
|
-
}
|
|
235
|
-
if (TreeElement.empty(model) || !this._editor.hasModel()) {
|
|
236
|
-
this._setOutlineModel(model);
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
if (contentChangeEvent && this._outlineModel && buffer.getLineCount() >= 25) {
|
|
240
|
-
const newSize = TreeElement.size(model);
|
|
241
|
-
const newLength = buffer.getValueLength();
|
|
242
|
-
const newRatio = newSize / newLength;
|
|
243
|
-
const oldSize = TreeElement.size(this._outlineModel);
|
|
244
|
-
const oldLength = newLength - contentChangeEvent.changes.reduce((prev, value) => prev + value.rangeLength, 0);
|
|
245
|
-
const oldRatio = oldSize / oldLength;
|
|
246
|
-
if (newRatio <= oldRatio * 0.5 || newRatio >= oldRatio * 1.5) {
|
|
247
|
-
const value = await raceCancellation(timeout(2000).then(() => true), cts.token, false);
|
|
248
|
-
if (!value) {
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
this._applyMarkersToOutline(model);
|
|
254
|
-
this._outlineDisposables.add(this._markerDecorationsService.onDidChangeMarker(textModel => {
|
|
255
|
-
if (isEqual(model.uri, textModel.uri)) {
|
|
256
|
-
this._applyMarkersToOutline(model);
|
|
257
|
-
this._onDidChange.fire({});
|
|
258
|
-
}
|
|
259
|
-
}));
|
|
260
|
-
this._outlineDisposables.add(this._configurationService.onDidChangeConfiguration(e => {
|
|
261
|
-
if (e.affectsConfiguration("outline.problems.enabled" ) || e.affectsConfiguration('problems.visibility')) {
|
|
262
|
-
const problem = this._configurationService.getValue('problems.visibility');
|
|
263
|
-
const config = this._configurationService.getValue("outline.problems.enabled" );
|
|
264
|
-
if (!problem || !config) {
|
|
265
|
-
model.updateMarker([]);
|
|
266
|
-
}
|
|
267
|
-
else {
|
|
268
|
-
this._applyMarkersToOutline(model);
|
|
269
|
-
}
|
|
270
|
-
this._onDidChange.fire({});
|
|
271
|
-
}
|
|
272
|
-
if (e.affectsConfiguration('outline')) {
|
|
273
|
-
this._onDidChange.fire({});
|
|
274
|
-
}
|
|
275
|
-
if (e.affectsConfiguration('breadcrumbs') && this._editor.hasModel()) {
|
|
276
|
-
this._breadcrumbsDataSource.update(model, this._editor.getPosition());
|
|
277
|
-
this._onDidChange.fire({});
|
|
278
|
-
}
|
|
279
|
-
}));
|
|
280
|
-
this._outlineDisposables.add(this._configurationService.onDidChangeConfiguration(e => {
|
|
281
|
-
if (e.affectsConfiguration("outline.icons" )) {
|
|
282
|
-
this._onDidChange.fire({});
|
|
283
|
-
}
|
|
284
|
-
if (e.affectsConfiguration('outline')) {
|
|
285
|
-
this._onDidChange.fire({});
|
|
286
|
-
}
|
|
287
|
-
}));
|
|
288
|
-
this._outlineDisposables.add(this._editor.onDidChangeCursorPosition(_ => {
|
|
289
|
-
timeoutTimer.cancelAndSet(() => {
|
|
290
|
-
if (!buffer.isDisposed() && versionIdThen === buffer.getVersionId() && this._editor.hasModel()) {
|
|
291
|
-
this._breadcrumbsDataSource.update(model, this._editor.getPosition());
|
|
292
|
-
this._onDidChange.fire({ affectOnlyActiveElement: true });
|
|
293
|
-
}
|
|
294
|
-
}, 150);
|
|
295
|
-
}));
|
|
296
|
-
this._setOutlineModel(model);
|
|
297
|
-
}
|
|
298
|
-
catch (err) {
|
|
299
|
-
this._setOutlineModel(undefined);
|
|
300
|
-
onUnexpectedError(err);
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
_applyMarkersToOutline(model) {
|
|
304
|
-
const problem = this._configurationService.getValue('problems.visibility');
|
|
305
|
-
const config = this._configurationService.getValue("outline.problems.enabled" );
|
|
306
|
-
if (!model || !problem || !config) {
|
|
307
|
-
return;
|
|
308
|
-
}
|
|
309
|
-
const markers = [];
|
|
310
|
-
for (const [range, marker] of this._markerDecorationsService.getLiveMarkers(model.uri)) {
|
|
311
|
-
if (marker.severity === MarkerSeverity.Error || marker.severity === MarkerSeverity.Warning) {
|
|
312
|
-
markers.push({ ...range, severity: marker.severity });
|
|
313
|
-
}
|
|
314
|
-
}
|
|
315
|
-
model.updateMarker(markers);
|
|
316
|
-
}
|
|
317
|
-
_setOutlineModel(model) {
|
|
318
|
-
const position = this._editor.getPosition();
|
|
319
|
-
if (!position || !model) {
|
|
320
|
-
this._outlineModel = undefined;
|
|
321
|
-
this._breadcrumbsDataSource.clear();
|
|
322
|
-
}
|
|
323
|
-
else {
|
|
324
|
-
if (!this._outlineModel?.merge(model)) {
|
|
325
|
-
this._outlineModel = model;
|
|
326
|
-
}
|
|
327
|
-
this._breadcrumbsDataSource.update(model, position);
|
|
328
|
-
}
|
|
329
|
-
this._onDidChange.fire({});
|
|
330
|
-
}
|
|
331
|
-
};
|
|
332
|
-
DocumentSymbolsOutline = ( __decorate([
|
|
333
|
-
( __param(3, ILanguageFeaturesService)),
|
|
334
|
-
( __param(4, ICodeEditorService)),
|
|
335
|
-
( __param(5, IOutlineModelService)),
|
|
336
|
-
( __param(6, IConfigurationService)),
|
|
337
|
-
( __param(7, IMarkerDecorationsService)),
|
|
338
|
-
( __param(8, ITextResourceConfigurationService)),
|
|
339
|
-
( __param(9, IInstantiationService))
|
|
340
|
-
], DocumentSymbolsOutline));
|
|
341
|
-
let DocumentSymbolsOutlineCreator = class DocumentSymbolsOutlineCreator {
|
|
342
|
-
constructor(outlineService) {
|
|
343
|
-
const reg = outlineService.registerOutlineCreator(this);
|
|
344
|
-
this.dispose = () => reg.dispose();
|
|
345
|
-
}
|
|
346
|
-
matches(candidate) {
|
|
347
|
-
const ctrl = candidate.getControl();
|
|
348
|
-
return isCodeEditor(ctrl) || isDiffEditor(ctrl);
|
|
349
|
-
}
|
|
350
|
-
async createOutline(pane, target, _token) {
|
|
351
|
-
const control = pane.getControl();
|
|
352
|
-
let editor;
|
|
353
|
-
if (isCodeEditor(control)) {
|
|
354
|
-
editor = control;
|
|
355
|
-
}
|
|
356
|
-
else if (isDiffEditor(control)) {
|
|
357
|
-
editor = control.getModifiedEditor();
|
|
358
|
-
}
|
|
359
|
-
if (!editor) {
|
|
360
|
-
return undefined;
|
|
361
|
-
}
|
|
362
|
-
const firstLoadBarrier = ( new Barrier());
|
|
363
|
-
const result = editor.invokeWithinContext(accessor => accessor.get(IInstantiationService).createInstance(DocumentSymbolsOutline, editor, target, firstLoadBarrier));
|
|
364
|
-
await firstLoadBarrier.wait();
|
|
365
|
-
return result;
|
|
366
|
-
}
|
|
367
|
-
};
|
|
368
|
-
DocumentSymbolsOutlineCreator = ( __decorate([
|
|
369
|
-
( __param(0, IOutlineService))
|
|
370
|
-
], DocumentSymbolsOutlineCreator));
|
|
371
|
-
( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(DocumentSymbolsOutlineCreator, 4 );
|
package/vscode/src/vs/workbench/contrib/codeEditor/browser/outline/documentSymbolsTree.css.js
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import n from '../../../../../../../../external/rollup-plugin-styles/dist/runtime/inject-css.js';
|
|
2
|
-
|
|
3
|
-
var css = ".monaco-list .monaco-list-row.focused.selected .outline-element .monaco-highlighted-label,.monaco-list .monaco-list-row.focused.selected .outline-element-decoration{color:inherit!important}.monaco-list .outline-element{align-items:center;display:flex;flex:1;flex-flow:row nowrap}.monaco-list .outline-element .monaco-highlighted-label{color:var(--outline-element-color)}.monaco-breadcrumbs .outline-element .outline-element-decoration,.monaco-list .outline-element .outline-element-decoration{color:var(--outline-element-color);font-size:90%;font-weight:600;margin-left:auto;opacity:.75;padding:0 12px 0 5px;text-align:center}.monaco-breadcrumbs .outline-element .monaco-icon-label-container .monaco-icon-description-container,.monaco-breadcrumbs .outline-element .outline-element-decoration{display:none}.monaco-list .outline-element .outline-element-decoration.bubble{font-family:codicon;font-size:14px;opacity:.4;padding-right:8px}.monaco-list .outline-element .outline-element-icon{margin-right:4px}";
|
|
4
|
-
n(css,{});
|
|
5
|
-
|
|
6
|
-
export { css, css as default };
|
|
@@ -1,277 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import './documentSymbolsTree.css.js';
|
|
3
|
-
import * as dom from 'monaco-editor/esm/vs/base/browser/dom.js';
|
|
4
|
-
import { HighlightedLabel } from 'monaco-editor/esm/vs/base/browser/ui/highlightedlabel/highlightedLabel.js';
|
|
5
|
-
import { createMatches } from 'monaco-editor/esm/vs/base/common/filters.js';
|
|
6
|
-
import { Range } from 'monaco-editor/esm/vs/editor/common/core/range.js';
|
|
7
|
-
import { symbolKindNames, SymbolKinds, getAriaLabelForSymbol } from 'monaco-editor/esm/vs/editor/common/languages.js';
|
|
8
|
-
import { OutlineModel, OutlineElement, OutlineGroup } from 'monaco-editor/esm/vs/editor/contrib/documentSymbols/browser/outlineModel.js';
|
|
9
|
-
import { localizeWithPath } from 'monaco-editor/esm/vs/nls.js';
|
|
10
|
-
import { IconLabel } from 'monaco-editor/esm/vs/base/browser/ui/iconLabel/iconLabel.js';
|
|
11
|
-
import { IConfigurationService } from 'monaco-editor/esm/vs/platform/configuration/common/configuration.js';
|
|
12
|
-
import { MarkerSeverity } from 'monaco-editor/esm/vs/platform/markers/common/markers.js';
|
|
13
|
-
import { IThemeService } from 'monaco-editor/esm/vs/platform/theme/common/themeService.js';
|
|
14
|
-
import { listErrorForeground, listWarningForeground } from 'monaco-editor/esm/vs/platform/theme/common/colorRegistry.js';
|
|
15
|
-
import { ITextResourceConfigurationService } from 'monaco-editor/esm/vs/editor/common/services/textResourceConfiguration.js';
|
|
16
|
-
import { ThemeIcon } from 'monaco-editor/esm/vs/base/common/themables.js';
|
|
17
|
-
import { mainWindow } from 'monaco-editor/esm/vs/base/browser/window.js';
|
|
18
|
-
|
|
19
|
-
var DocumentSymbolFilter_1;
|
|
20
|
-
class DocumentSymbolNavigationLabelProvider {
|
|
21
|
-
getKeyboardNavigationLabel(element) {
|
|
22
|
-
if (element instanceof OutlineGroup) {
|
|
23
|
-
return element.label;
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
return element.symbol.name;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
class DocumentSymbolAccessibilityProvider {
|
|
31
|
-
constructor(_ariaLabel) {
|
|
32
|
-
this._ariaLabel = _ariaLabel;
|
|
33
|
-
}
|
|
34
|
-
getWidgetAriaLabel() {
|
|
35
|
-
return this._ariaLabel;
|
|
36
|
-
}
|
|
37
|
-
getAriaLabel(element) {
|
|
38
|
-
if (element instanceof OutlineGroup) {
|
|
39
|
-
return element.label;
|
|
40
|
-
}
|
|
41
|
-
else {
|
|
42
|
-
return getAriaLabelForSymbol(element.symbol.name, element.symbol.kind);
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
class DocumentSymbolIdentityProvider {
|
|
47
|
-
getId(element) {
|
|
48
|
-
return element.id;
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
class DocumentSymbolGroupTemplate {
|
|
52
|
-
static { this.id = 'DocumentSymbolGroupTemplate'; }
|
|
53
|
-
constructor(labelContainer, label) {
|
|
54
|
-
this.labelContainer = labelContainer;
|
|
55
|
-
this.label = label;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
class DocumentSymbolTemplate {
|
|
59
|
-
static { this.id = 'DocumentSymbolTemplate'; }
|
|
60
|
-
constructor(container, iconLabel, iconClass, decoration) {
|
|
61
|
-
this.container = container;
|
|
62
|
-
this.iconLabel = iconLabel;
|
|
63
|
-
this.iconClass = iconClass;
|
|
64
|
-
this.decoration = decoration;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
class DocumentSymbolVirtualDelegate {
|
|
68
|
-
getHeight(_element) {
|
|
69
|
-
return 22;
|
|
70
|
-
}
|
|
71
|
-
getTemplateId(element) {
|
|
72
|
-
return element instanceof OutlineGroup
|
|
73
|
-
? DocumentSymbolGroupTemplate.id
|
|
74
|
-
: DocumentSymbolTemplate.id;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
class DocumentSymbolGroupRenderer {
|
|
78
|
-
constructor() {
|
|
79
|
-
this.templateId = DocumentSymbolGroupTemplate.id;
|
|
80
|
-
}
|
|
81
|
-
renderTemplate(container) {
|
|
82
|
-
const labelContainer = dom.$('.outline-element-label');
|
|
83
|
-
container.classList.add('outline-element');
|
|
84
|
-
dom.append(container, labelContainer);
|
|
85
|
-
return ( new DocumentSymbolGroupTemplate(labelContainer, ( new HighlightedLabel(labelContainer))));
|
|
86
|
-
}
|
|
87
|
-
renderElement(node, _index, template) {
|
|
88
|
-
template.label.set(node.element.label, createMatches(node.filterData));
|
|
89
|
-
}
|
|
90
|
-
disposeTemplate(_template) {
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
let DocumentSymbolRenderer = class DocumentSymbolRenderer {
|
|
94
|
-
constructor(_renderMarker, _configurationService, _themeService) {
|
|
95
|
-
this._renderMarker = _renderMarker;
|
|
96
|
-
this._configurationService = _configurationService;
|
|
97
|
-
this._themeService = _themeService;
|
|
98
|
-
this.templateId = DocumentSymbolTemplate.id;
|
|
99
|
-
}
|
|
100
|
-
renderTemplate(container) {
|
|
101
|
-
container.classList.add('outline-element');
|
|
102
|
-
const iconLabel = ( new IconLabel(container, { supportHighlights: true }));
|
|
103
|
-
const iconClass = dom.$('.outline-element-icon');
|
|
104
|
-
const decoration = dom.$('.outline-element-decoration');
|
|
105
|
-
container.prepend(iconClass);
|
|
106
|
-
container.appendChild(decoration);
|
|
107
|
-
return ( new DocumentSymbolTemplate(container, iconLabel, iconClass, decoration));
|
|
108
|
-
}
|
|
109
|
-
renderElement(node, _index, template) {
|
|
110
|
-
const { element } = node;
|
|
111
|
-
const extraClasses = ['nowrap'];
|
|
112
|
-
const options = {
|
|
113
|
-
matches: createMatches(node.filterData),
|
|
114
|
-
labelEscapeNewLines: true,
|
|
115
|
-
extraClasses,
|
|
116
|
-
title: ( localizeWithPath(
|
|
117
|
-
'vs/workbench/contrib/codeEditor/browser/outline/documentSymbolsTree',
|
|
118
|
-
'title.template',
|
|
119
|
-
"{0} ({1})",
|
|
120
|
-
element.symbol.name,
|
|
121
|
-
symbolKindNames[element.symbol.kind]
|
|
122
|
-
))
|
|
123
|
-
};
|
|
124
|
-
if (this._configurationService.getValue("outline.icons" )) {
|
|
125
|
-
template.iconClass.className = '';
|
|
126
|
-
template.iconClass.classList.add('outline-element-icon', 'inline', ...ThemeIcon.asClassNameArray(SymbolKinds.toIcon(element.symbol.kind)));
|
|
127
|
-
}
|
|
128
|
-
if (element.symbol.tags.indexOf(1 ) >= 0) {
|
|
129
|
-
extraClasses.push(`deprecated`);
|
|
130
|
-
options.matches = [];
|
|
131
|
-
}
|
|
132
|
-
template.iconLabel.setLabel(element.symbol.name, element.symbol.detail, options);
|
|
133
|
-
if (this._renderMarker) {
|
|
134
|
-
this._renderMarkerInfo(element, template);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
_renderMarkerInfo(element, template) {
|
|
138
|
-
if (!element.marker) {
|
|
139
|
-
dom.hide(template.decoration);
|
|
140
|
-
template.container.style.removeProperty('--outline-element-color');
|
|
141
|
-
return;
|
|
142
|
-
}
|
|
143
|
-
const { count, topSev } = element.marker;
|
|
144
|
-
const color = this._themeService.getColorTheme().getColor(topSev === MarkerSeverity.Error ? listErrorForeground : listWarningForeground);
|
|
145
|
-
const cssColor = color ? ( color.toString()) : 'inherit';
|
|
146
|
-
const problem = this._configurationService.getValue('problems.visibility');
|
|
147
|
-
const configProblems = this._configurationService.getValue("outline.problems.colors" );
|
|
148
|
-
if (!problem || !configProblems) {
|
|
149
|
-
template.container.style.removeProperty('--outline-element-color');
|
|
150
|
-
}
|
|
151
|
-
else {
|
|
152
|
-
template.container.style.setProperty('--outline-element-color', cssColor);
|
|
153
|
-
}
|
|
154
|
-
if (problem === undefined) {
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
const configBadges = this._configurationService.getValue("outline.problems.badges" );
|
|
158
|
-
if (!configBadges || !problem) {
|
|
159
|
-
dom.hide(template.decoration);
|
|
160
|
-
}
|
|
161
|
-
else if (count > 0) {
|
|
162
|
-
dom.show(template.decoration);
|
|
163
|
-
template.decoration.classList.remove('bubble');
|
|
164
|
-
template.decoration.innerText = count < 10 ? ( count.toString()) : '+9';
|
|
165
|
-
template.decoration.title = count === 1 ? ( localizeWithPath(
|
|
166
|
-
'vs/workbench/contrib/codeEditor/browser/outline/documentSymbolsTree',
|
|
167
|
-
'1.problem',
|
|
168
|
-
"1 problem in this element"
|
|
169
|
-
)) : ( localizeWithPath(
|
|
170
|
-
'vs/workbench/contrib/codeEditor/browser/outline/documentSymbolsTree',
|
|
171
|
-
'N.problem',
|
|
172
|
-
"{0} problems in this element",
|
|
173
|
-
count
|
|
174
|
-
));
|
|
175
|
-
template.decoration.style.setProperty('--outline-element-color', cssColor);
|
|
176
|
-
}
|
|
177
|
-
else {
|
|
178
|
-
dom.show(template.decoration);
|
|
179
|
-
template.decoration.classList.add('bubble');
|
|
180
|
-
template.decoration.innerText = '\uea71';
|
|
181
|
-
template.decoration.title = ( localizeWithPath(
|
|
182
|
-
'vs/workbench/contrib/codeEditor/browser/outline/documentSymbolsTree',
|
|
183
|
-
'deep.problem',
|
|
184
|
-
"Contains elements with problems"
|
|
185
|
-
));
|
|
186
|
-
template.decoration.style.setProperty('--outline-element-color', cssColor);
|
|
187
|
-
}
|
|
188
|
-
}
|
|
189
|
-
disposeTemplate(_template) {
|
|
190
|
-
_template.iconLabel.dispose();
|
|
191
|
-
}
|
|
192
|
-
};
|
|
193
|
-
DocumentSymbolRenderer = ( __decorate([
|
|
194
|
-
( __param(1, IConfigurationService)),
|
|
195
|
-
( __param(2, IThemeService))
|
|
196
|
-
], DocumentSymbolRenderer));
|
|
197
|
-
let DocumentSymbolFilter = class DocumentSymbolFilter {
|
|
198
|
-
static { DocumentSymbolFilter_1 = this; }
|
|
199
|
-
static { this.kindToConfigName = ( Object.freeze({
|
|
200
|
-
[0 ]: 'showFiles',
|
|
201
|
-
[1 ]: 'showModules',
|
|
202
|
-
[2 ]: 'showNamespaces',
|
|
203
|
-
[3 ]: 'showPackages',
|
|
204
|
-
[4 ]: 'showClasses',
|
|
205
|
-
[5 ]: 'showMethods',
|
|
206
|
-
[6 ]: 'showProperties',
|
|
207
|
-
[7 ]: 'showFields',
|
|
208
|
-
[8 ]: 'showConstructors',
|
|
209
|
-
[9 ]: 'showEnums',
|
|
210
|
-
[10 ]: 'showInterfaces',
|
|
211
|
-
[11 ]: 'showFunctions',
|
|
212
|
-
[12 ]: 'showVariables',
|
|
213
|
-
[13 ]: 'showConstants',
|
|
214
|
-
[14 ]: 'showStrings',
|
|
215
|
-
[15 ]: 'showNumbers',
|
|
216
|
-
[16 ]: 'showBooleans',
|
|
217
|
-
[17 ]: 'showArrays',
|
|
218
|
-
[18 ]: 'showObjects',
|
|
219
|
-
[19 ]: 'showKeys',
|
|
220
|
-
[20 ]: 'showNull',
|
|
221
|
-
[21 ]: 'showEnumMembers',
|
|
222
|
-
[22 ]: 'showStructs',
|
|
223
|
-
[23 ]: 'showEvents',
|
|
224
|
-
[24 ]: 'showOperators',
|
|
225
|
-
[25 ]: 'showTypeParameters',
|
|
226
|
-
})); }
|
|
227
|
-
constructor(_prefix, _textResourceConfigService) {
|
|
228
|
-
this._prefix = _prefix;
|
|
229
|
-
this._textResourceConfigService = _textResourceConfigService;
|
|
230
|
-
}
|
|
231
|
-
filter(element) {
|
|
232
|
-
const outline = OutlineModel.get(element);
|
|
233
|
-
if (!(element instanceof OutlineElement)) {
|
|
234
|
-
return true;
|
|
235
|
-
}
|
|
236
|
-
const configName = DocumentSymbolFilter_1.kindToConfigName[element.symbol.kind];
|
|
237
|
-
const configKey = `${this._prefix}.${configName}`;
|
|
238
|
-
return this._textResourceConfigService.getValue(outline?.uri, configKey);
|
|
239
|
-
}
|
|
240
|
-
};
|
|
241
|
-
DocumentSymbolFilter = DocumentSymbolFilter_1 = ( __decorate([
|
|
242
|
-
( __param(1, ITextResourceConfigurationService))
|
|
243
|
-
], DocumentSymbolFilter));
|
|
244
|
-
class DocumentSymbolComparator {
|
|
245
|
-
constructor() {
|
|
246
|
-
this._collator = new dom.WindowIdleValue(mainWindow, () => new Intl.Collator(undefined, { numeric: true }));
|
|
247
|
-
}
|
|
248
|
-
compareByPosition(a, b) {
|
|
249
|
-
if (a instanceof OutlineGroup && b instanceof OutlineGroup) {
|
|
250
|
-
return a.order - b.order;
|
|
251
|
-
}
|
|
252
|
-
else if (a instanceof OutlineElement && b instanceof OutlineElement) {
|
|
253
|
-
return Range.compareRangesUsingStarts(a.symbol.range, b.symbol.range) || this._collator.value.compare(a.symbol.name, b.symbol.name);
|
|
254
|
-
}
|
|
255
|
-
return 0;
|
|
256
|
-
}
|
|
257
|
-
compareByType(a, b) {
|
|
258
|
-
if (a instanceof OutlineGroup && b instanceof OutlineGroup) {
|
|
259
|
-
return a.order - b.order;
|
|
260
|
-
}
|
|
261
|
-
else if (a instanceof OutlineElement && b instanceof OutlineElement) {
|
|
262
|
-
return a.symbol.kind - b.symbol.kind || this._collator.value.compare(a.symbol.name, b.symbol.name);
|
|
263
|
-
}
|
|
264
|
-
return 0;
|
|
265
|
-
}
|
|
266
|
-
compareByName(a, b) {
|
|
267
|
-
if (a instanceof OutlineGroup && b instanceof OutlineGroup) {
|
|
268
|
-
return a.order - b.order;
|
|
269
|
-
}
|
|
270
|
-
else if (a instanceof OutlineElement && b instanceof OutlineElement) {
|
|
271
|
-
return this._collator.value.compare(a.symbol.name, b.symbol.name) || Range.compareRangesUsingStarts(a.symbol.range, b.symbol.range);
|
|
272
|
-
}
|
|
273
|
-
return 0;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
export { DocumentSymbolAccessibilityProvider, DocumentSymbolComparator, DocumentSymbolFilter, DocumentSymbolGroupRenderer, DocumentSymbolIdentityProvider, DocumentSymbolNavigationLabelProvider, DocumentSymbolRenderer, DocumentSymbolVirtualDelegate };
|