@codingame/monaco-vscode-markers-service-override 3.2.3 → 4.1.0
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/markers.js +1 -1
- package/package.json +2 -2
- package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
- package/external/tslib/tslib.es6.js +0 -11
- package/vscode/src/vs/workbench/contrib/markers/browser/markers.contribution.js +0 -759
- package/vscode/src/vs/workbench/contrib/markers/browser/markersFilterOptions.js +0 -77
- package/vscode/src/vs/workbench/contrib/markers/browser/markersModel.js +0 -202
- package/vscode/src/vs/workbench/contrib/markers/browser/markersTable.js +0 -467
- package/vscode/src/vs/workbench/contrib/markers/browser/markersTreeViewer.js +0 -689
- package/vscode/src/vs/workbench/contrib/markers/browser/markersView.js +0 -902
- package/vscode/src/vs/workbench/contrib/markers/browser/markersViewActions.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/markers/browser/markersViewActions.js +0 -134
- package/vscode/src/vs/workbench/contrib/markers/browser/media/markers.css.js +0 -6
- package/vscode/src/vs/workbench/contrib/markers/browser/messages.js +0 -303
|
@@ -1,902 +0,0 @@
|
|
|
1
|
-
import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
|
|
2
|
-
import './media/markers.css.js';
|
|
3
|
-
import { addDisposableListener, append, $, isActiveElement, clearNode, addStandardDisposableListener, EventType } from 'vscode/vscode/vs/base/browser/dom';
|
|
4
|
-
import { Separator } from 'vscode/vscode/vs/base/common/actions';
|
|
5
|
-
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry';
|
|
6
|
-
import { SIDE_GROUP, ACTIVE_GROUP, IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
|
|
7
|
-
import { MarkersModel, Marker, RelatedInformation, MarkerTableItem, ResourceMarkers, compareMarkersByUri } from './markersModel.js';
|
|
8
|
-
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
9
|
-
import { MarkersFilters } from './markersViewActions.js';
|
|
10
|
-
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
|
|
11
|
-
import Messages from './messages.js';
|
|
12
|
-
import { RangeHighlightDecorations } from 'vscode/vscode/vs/workbench/browser/codeeditor';
|
|
13
|
-
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService';
|
|
14
|
-
import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
|
|
15
|
-
import { localizeWithPath } from 'vscode/vscode/vs/nls';
|
|
16
|
-
import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
17
|
-
import { Iterable } from 'vscode/vscode/vs/base/common/iterator';
|
|
18
|
-
import { Event, Relay } from 'vscode/vscode/vs/base/common/event';
|
|
19
|
-
import { WorkbenchObjectTree, IListService } from 'vscode/vscode/vs/platform/list/browser/listService';
|
|
20
|
-
import { FilterOptions } from './markersFilterOptions.js';
|
|
21
|
-
import { deepClone } from 'vscode/vscode/vs/base/common/objects';
|
|
22
|
-
import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace';
|
|
23
|
-
import { MarkersViewModel, MarkersWidgetAccessibilityProvider, Filter, VirtualDelegate, ResourceMarkersRenderer, MarkerRenderer, RelatedInformationRenderer } from './markersTreeViewer.js';
|
|
24
|
-
import { IContextMenuService } from 'vscode/vscode/vs/platform/contextview/browser/contextView';
|
|
25
|
-
import { MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
|
|
26
|
-
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding';
|
|
27
|
-
import { StandardKeyboardEvent } from 'vscode/vscode/vs/base/browser/keyboardEvent';
|
|
28
|
-
import { ResourceLabels } from 'vscode/vscode/vs/workbench/browser/labels';
|
|
29
|
-
import { MarkerSeverity, IMarkerService } from 'vscode/vscode/vs/platform/markers/common/markers';
|
|
30
|
-
import { Memento } from 'vscode/vscode/vs/workbench/common/memento';
|
|
31
|
-
import { FilterViewPane } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPane';
|
|
32
|
-
import { IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views';
|
|
33
|
-
import { withSelection, IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener';
|
|
34
|
-
import { ActionViewItem } from 'vscode/vscode/vs/base/browser/ui/actionbar/actionViewItems';
|
|
35
|
-
import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity';
|
|
36
|
-
import { DisposableStore, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
37
|
-
import { groupBy } from 'vscode/vscode/vs/base/common/arrays';
|
|
38
|
-
import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
|
|
39
|
-
import { EditorResourceAccessor, SideBySideEditor } from 'vscode/vscode/vs/workbench/common/editor';
|
|
40
|
-
import { ResourceListDnDHandler } from 'vscode/vscode/vs/workbench/browser/dnd';
|
|
41
|
-
import { MarkersTable } from './markersTable.js';
|
|
42
|
-
import { Markers, MarkersContextKeys } from 'vscode/vscode/vs/workbench/contrib/markers/common/markers';
|
|
43
|
-
import { registerNavigableContainer } from 'vscode/vscode/vs/workbench/browser/actions/widgetNavigationCommands';
|
|
44
|
-
|
|
45
|
-
function createResourceMarkersIterator(resourceMarkers) {
|
|
46
|
-
return ( Iterable.map(resourceMarkers.markers, m => {
|
|
47
|
-
const relatedInformationIt = Iterable.from(m.relatedInformation);
|
|
48
|
-
const children = ( Iterable.map(relatedInformationIt, r => ({ element: r })));
|
|
49
|
-
return { element: m, children };
|
|
50
|
-
}));
|
|
51
|
-
}
|
|
52
|
-
let MarkersView = class MarkersView extends FilterViewPane {
|
|
53
|
-
constructor(options, instantiationService, viewDescriptorService, editorService, configurationService, telemetryService, markerService, contextKeyService, workspaceContextService, contextMenuService, uriIdentityService, keybindingService, storageService, openerService, themeService) {
|
|
54
|
-
const memento = ( new Memento(Markers.MARKERS_VIEW_STORAGE_ID, storageService));
|
|
55
|
-
const panelState = memento.getMemento(1 , 1 );
|
|
56
|
-
super({
|
|
57
|
-
...options,
|
|
58
|
-
filterOptions: {
|
|
59
|
-
ariaLabel: Messages.MARKERS_PANEL_FILTER_ARIA_LABEL,
|
|
60
|
-
placeholder: Messages.MARKERS_PANEL_FILTER_PLACEHOLDER,
|
|
61
|
-
focusContextKey: MarkersContextKeys.MarkerViewFilterFocusContextKey.key,
|
|
62
|
-
text: panelState['filter'] || '',
|
|
63
|
-
history: panelState['filterHistory'] || []
|
|
64
|
-
}
|
|
65
|
-
}, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService);
|
|
66
|
-
this.editorService = editorService;
|
|
67
|
-
this.markerService = markerService;
|
|
68
|
-
this.workspaceContextService = workspaceContextService;
|
|
69
|
-
this.uriIdentityService = uriIdentityService;
|
|
70
|
-
this.lastSelectedRelativeTop = 0;
|
|
71
|
-
this.currentActiveResource = null;
|
|
72
|
-
this.onVisibleDisposables = this._register(( new DisposableStore()));
|
|
73
|
-
this.widgetDisposables = this._register(( new DisposableStore()));
|
|
74
|
-
this.currentHeight = 0;
|
|
75
|
-
this.currentWidth = 0;
|
|
76
|
-
this.cachedFilterStats = undefined;
|
|
77
|
-
this.currentResourceGotAddedToMarkersData = false;
|
|
78
|
-
this.onDidChangeVisibility = this.onDidChangeBodyVisibility;
|
|
79
|
-
this.memento = memento;
|
|
80
|
-
this.panelState = panelState;
|
|
81
|
-
this.markersModel = this._register(instantiationService.createInstance(MarkersModel));
|
|
82
|
-
this.markersViewModel = this._register(instantiationService.createInstance(MarkersViewModel, this.panelState['multiline'], this.panelState['viewMode'] ?? this.getDefaultViewMode()));
|
|
83
|
-
this._register(this.onDidChangeVisibility(visible => this.onDidChangeMarkersViewVisibility(visible)));
|
|
84
|
-
this._register(this.markersViewModel.onDidChangeViewMode(_ => this.onDidChangeViewMode()));
|
|
85
|
-
this.widgetAccessibilityProvider = instantiationService.createInstance(MarkersWidgetAccessibilityProvider);
|
|
86
|
-
this.widgetIdentityProvider = { getId(element) { return element.id; } };
|
|
87
|
-
this.setCurrentActiveEditor();
|
|
88
|
-
this.filter = ( new Filter(FilterOptions.EMPTY(uriIdentityService)));
|
|
89
|
-
this.rangeHighlightDecorations = this._register(this.instantiationService.createInstance(RangeHighlightDecorations));
|
|
90
|
-
this.filters = this._register(( new MarkersFilters({
|
|
91
|
-
filterHistory: this.panelState['filterHistory'] || [],
|
|
92
|
-
showErrors: this.panelState['showErrors'] !== false,
|
|
93
|
-
showWarnings: this.panelState['showWarnings'] !== false,
|
|
94
|
-
showInfos: this.panelState['showInfos'] !== false,
|
|
95
|
-
excludedFiles: !!this.panelState['useFilesExclude'],
|
|
96
|
-
activeFile: !!this.panelState['activeFile'],
|
|
97
|
-
}, this.contextKeyService)));
|
|
98
|
-
this._register(this.configurationService.onDidChangeConfiguration(e => {
|
|
99
|
-
if (this.filters.excludedFiles && e.affectsConfiguration('files.exclude')) {
|
|
100
|
-
this.updateFilter();
|
|
101
|
-
}
|
|
102
|
-
}));
|
|
103
|
-
}
|
|
104
|
-
render() {
|
|
105
|
-
super.render();
|
|
106
|
-
this._register(registerNavigableContainer({
|
|
107
|
-
focusNotifiers: [this, this.filterWidget],
|
|
108
|
-
focusNextWidget: () => {
|
|
109
|
-
if (this.filterWidget.hasFocus()) {
|
|
110
|
-
this.focus();
|
|
111
|
-
}
|
|
112
|
-
},
|
|
113
|
-
focusPreviousWidget: () => {
|
|
114
|
-
if (!this.filterWidget.hasFocus()) {
|
|
115
|
-
this.focusFilter();
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
}));
|
|
119
|
-
}
|
|
120
|
-
renderBody(parent) {
|
|
121
|
-
super.renderBody(parent);
|
|
122
|
-
parent.classList.add('markers-panel');
|
|
123
|
-
this._register(addDisposableListener(parent, 'keydown', e => {
|
|
124
|
-
if (this.keybindingService.mightProducePrintableCharacter(( new StandardKeyboardEvent(e)))) {
|
|
125
|
-
this.focusFilter();
|
|
126
|
-
}
|
|
127
|
-
}));
|
|
128
|
-
const panelContainer = append(parent, $('.markers-panel-container'));
|
|
129
|
-
this.createArialLabelElement(panelContainer);
|
|
130
|
-
this.createMessageBox(panelContainer);
|
|
131
|
-
this.widgetContainer = append(panelContainer, $('.widget-container'));
|
|
132
|
-
this.createWidget(this.widgetContainer);
|
|
133
|
-
this.updateFilter();
|
|
134
|
-
this.renderContent();
|
|
135
|
-
}
|
|
136
|
-
getTitle() {
|
|
137
|
-
return Messages.MARKERS_PANEL_TITLE_PROBLEMS.value;
|
|
138
|
-
}
|
|
139
|
-
layoutBodyContent(height = this.currentHeight, width = this.currentWidth) {
|
|
140
|
-
if (this.messageBoxContainer) {
|
|
141
|
-
this.messageBoxContainer.style.height = `${height}px`;
|
|
142
|
-
}
|
|
143
|
-
this.widget.layout(height, width);
|
|
144
|
-
this.currentHeight = height;
|
|
145
|
-
this.currentWidth = width;
|
|
146
|
-
}
|
|
147
|
-
focus() {
|
|
148
|
-
super.focus();
|
|
149
|
-
if (isActiveElement(this.widget.getHTMLElement())) {
|
|
150
|
-
return;
|
|
151
|
-
}
|
|
152
|
-
if (this.hasNoProblems()) {
|
|
153
|
-
this.messageBoxContainer.focus();
|
|
154
|
-
}
|
|
155
|
-
else {
|
|
156
|
-
this.widget.domFocus();
|
|
157
|
-
this.widget.setMarkerSelection();
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
focusFilter() {
|
|
161
|
-
this.filterWidget.focus();
|
|
162
|
-
}
|
|
163
|
-
updateBadge(total, filtered) {
|
|
164
|
-
this.filterWidget.updateBadge(total === filtered || total === 0 ? undefined : ( localizeWithPath(
|
|
165
|
-
'vs/workbench/contrib/markers/browser/markersView',
|
|
166
|
-
'showing filtered problems',
|
|
167
|
-
"Showing {0} of {1}",
|
|
168
|
-
filtered,
|
|
169
|
-
total
|
|
170
|
-
)));
|
|
171
|
-
}
|
|
172
|
-
checkMoreFilters() {
|
|
173
|
-
this.filterWidget.checkMoreFilters(!this.filters.showErrors || !this.filters.showWarnings || !this.filters.showInfos || this.filters.excludedFiles || this.filters.activeFile);
|
|
174
|
-
}
|
|
175
|
-
clearFilterText() {
|
|
176
|
-
this.filterWidget.setFilterText('');
|
|
177
|
-
}
|
|
178
|
-
showQuickFixes(marker) {
|
|
179
|
-
const viewModel = this.markersViewModel.getViewModel(marker);
|
|
180
|
-
if (viewModel) {
|
|
181
|
-
viewModel.quickFixAction.run();
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
openFileAtElement(element, preserveFocus, sideByside, pinned) {
|
|
185
|
-
const { resource, selection } = element instanceof Marker ? { resource: element.resource, selection: element.range } :
|
|
186
|
-
element instanceof RelatedInformation ? { resource: element.raw.resource, selection: element.raw } :
|
|
187
|
-
'marker' in element ? { resource: element.marker.resource, selection: element.marker.range } :
|
|
188
|
-
{ resource: null, selection: null };
|
|
189
|
-
if (resource && selection) {
|
|
190
|
-
this.editorService.openEditor({
|
|
191
|
-
resource,
|
|
192
|
-
options: {
|
|
193
|
-
selection,
|
|
194
|
-
preserveFocus,
|
|
195
|
-
pinned,
|
|
196
|
-
revealIfVisible: true
|
|
197
|
-
},
|
|
198
|
-
}, sideByside ? SIDE_GROUP : ACTIVE_GROUP).then(editor => {
|
|
199
|
-
if (editor && preserveFocus) {
|
|
200
|
-
this.rangeHighlightDecorations.highlightRange({ resource, range: selection }, editor.getControl());
|
|
201
|
-
}
|
|
202
|
-
else {
|
|
203
|
-
this.rangeHighlightDecorations.removeHighlightRange();
|
|
204
|
-
}
|
|
205
|
-
});
|
|
206
|
-
return true;
|
|
207
|
-
}
|
|
208
|
-
else {
|
|
209
|
-
this.rangeHighlightDecorations.removeHighlightRange();
|
|
210
|
-
}
|
|
211
|
-
return false;
|
|
212
|
-
}
|
|
213
|
-
refreshPanel(markerOrChange) {
|
|
214
|
-
if (this.isVisible()) {
|
|
215
|
-
const hasSelection = this.widget.getSelection().length > 0;
|
|
216
|
-
if (markerOrChange) {
|
|
217
|
-
if (markerOrChange instanceof Marker) {
|
|
218
|
-
this.widget.updateMarker(markerOrChange);
|
|
219
|
-
}
|
|
220
|
-
else {
|
|
221
|
-
if (markerOrChange.added.size || markerOrChange.removed.size) {
|
|
222
|
-
this.resetWidget();
|
|
223
|
-
}
|
|
224
|
-
else {
|
|
225
|
-
this.widget.update([...markerOrChange.updated]);
|
|
226
|
-
}
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
else {
|
|
230
|
-
this.resetWidget();
|
|
231
|
-
}
|
|
232
|
-
if (hasSelection) {
|
|
233
|
-
this.widget.setMarkerSelection();
|
|
234
|
-
}
|
|
235
|
-
this.cachedFilterStats = undefined;
|
|
236
|
-
const { total, filtered } = this.getFilterStats();
|
|
237
|
-
this.toggleVisibility(total === 0 || filtered === 0);
|
|
238
|
-
this.renderMessage();
|
|
239
|
-
this.updateBadge(total, filtered);
|
|
240
|
-
this.checkMoreFilters();
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
onDidChangeViewState(marker) {
|
|
244
|
-
this.refreshPanel(marker);
|
|
245
|
-
}
|
|
246
|
-
resetWidget() {
|
|
247
|
-
this.widget.reset(this.getResourceMarkers());
|
|
248
|
-
}
|
|
249
|
-
updateFilter() {
|
|
250
|
-
this.filter.options = ( new FilterOptions(
|
|
251
|
-
this.filterWidget.getFilterText(),
|
|
252
|
-
this.getFilesExcludeExpressions(),
|
|
253
|
-
this.filters.showWarnings,
|
|
254
|
-
this.filters.showErrors,
|
|
255
|
-
this.filters.showInfos,
|
|
256
|
-
this.uriIdentityService
|
|
257
|
-
));
|
|
258
|
-
this.widget.filterMarkers(this.getResourceMarkers(), this.filter.options);
|
|
259
|
-
this.cachedFilterStats = undefined;
|
|
260
|
-
const { total, filtered } = this.getFilterStats();
|
|
261
|
-
this.toggleVisibility(total === 0 || filtered === 0);
|
|
262
|
-
this.renderMessage();
|
|
263
|
-
this.updateBadge(total, filtered);
|
|
264
|
-
this.checkMoreFilters();
|
|
265
|
-
}
|
|
266
|
-
getDefaultViewMode() {
|
|
267
|
-
switch (this.configurationService.getValue('problems.defaultViewMode')) {
|
|
268
|
-
case 'table':
|
|
269
|
-
return "table" ;
|
|
270
|
-
case 'tree':
|
|
271
|
-
return "tree" ;
|
|
272
|
-
default:
|
|
273
|
-
return "tree" ;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
getFilesExcludeExpressions() {
|
|
277
|
-
if (!this.filters.excludedFiles) {
|
|
278
|
-
return [];
|
|
279
|
-
}
|
|
280
|
-
const workspaceFolders = this.workspaceContextService.getWorkspace().folders;
|
|
281
|
-
return workspaceFolders.length
|
|
282
|
-
? ( workspaceFolders.map(
|
|
283
|
-
workspaceFolder => ({ root: workspaceFolder.uri, expression: this.getFilesExclude(workspaceFolder.uri) })
|
|
284
|
-
))
|
|
285
|
-
: this.getFilesExclude();
|
|
286
|
-
}
|
|
287
|
-
getFilesExclude(resource) {
|
|
288
|
-
return deepClone(this.configurationService.getValue('files.exclude', { resource })) || {};
|
|
289
|
-
}
|
|
290
|
-
getResourceMarkers() {
|
|
291
|
-
if (!this.filters.activeFile) {
|
|
292
|
-
return this.markersModel.resourceMarkers;
|
|
293
|
-
}
|
|
294
|
-
let resourceMarkers = [];
|
|
295
|
-
if (this.currentActiveResource) {
|
|
296
|
-
const activeResourceMarkers = this.markersModel.getResourceMarkers(this.currentActiveResource);
|
|
297
|
-
if (activeResourceMarkers) {
|
|
298
|
-
resourceMarkers = [activeResourceMarkers];
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
return resourceMarkers;
|
|
302
|
-
}
|
|
303
|
-
createMessageBox(parent) {
|
|
304
|
-
this.messageBoxContainer = append(parent, $('.message-box-container'));
|
|
305
|
-
this.messageBoxContainer.setAttribute('aria-labelledby', 'markers-panel-arialabel');
|
|
306
|
-
}
|
|
307
|
-
createArialLabelElement(parent) {
|
|
308
|
-
this.ariaLabelElement = append(parent, $(''));
|
|
309
|
-
this.ariaLabelElement.setAttribute('id', 'markers-panel-arialabel');
|
|
310
|
-
}
|
|
311
|
-
createWidget(parent) {
|
|
312
|
-
this.widget = this.markersViewModel.viewMode === "table" ? this.createTable(parent) : this.createTree(parent);
|
|
313
|
-
this.widgetDisposables.add(this.widget);
|
|
314
|
-
const markerFocusContextKey = MarkersContextKeys.MarkerFocusContextKey.bindTo(this.widget.contextKeyService);
|
|
315
|
-
const relatedInformationFocusContextKey = MarkersContextKeys.RelatedInformationFocusContextKey.bindTo(this.widget.contextKeyService);
|
|
316
|
-
this.widgetDisposables.add(this.widget.onDidChangeFocus(focus => {
|
|
317
|
-
markerFocusContextKey.set(( focus.elements.some(e => e instanceof Marker)));
|
|
318
|
-
relatedInformationFocusContextKey.set(( focus.elements.some(e => e instanceof RelatedInformation)));
|
|
319
|
-
}));
|
|
320
|
-
this.widgetDisposables.add(Event.debounce(this.widget.onDidOpen, (last, event) => event, 75, true)(options => {
|
|
321
|
-
this.openFileAtElement(options.element, !!options.editorOptions.preserveFocus, options.sideBySide, !!options.editorOptions.pinned);
|
|
322
|
-
}));
|
|
323
|
-
this.widgetDisposables.add(Event.any(this.widget.onDidChangeSelection, this.widget.onDidChangeFocus)(() => {
|
|
324
|
-
const elements = [...this.widget.getSelection(), ...this.widget.getFocus()];
|
|
325
|
-
for (const element of elements) {
|
|
326
|
-
if (element instanceof Marker) {
|
|
327
|
-
const viewModel = this.markersViewModel.getViewModel(element);
|
|
328
|
-
viewModel?.showLightBulb();
|
|
329
|
-
}
|
|
330
|
-
}
|
|
331
|
-
}));
|
|
332
|
-
this.widgetDisposables.add(this.widget.onContextMenu(this.onContextMenu, this));
|
|
333
|
-
this.widgetDisposables.add(this.widget.onDidChangeSelection(this.onSelected, this));
|
|
334
|
-
}
|
|
335
|
-
createTable(parent) {
|
|
336
|
-
const table = this.instantiationService.createInstance(MarkersTable, append(parent, $('.markers-table-container')), this.markersViewModel, this.getResourceMarkers(), this.filter.options, {
|
|
337
|
-
accessibilityProvider: this.widgetAccessibilityProvider,
|
|
338
|
-
dnd: this.instantiationService.createInstance(ResourceListDnDHandler, (element) => {
|
|
339
|
-
if (element instanceof MarkerTableItem) {
|
|
340
|
-
return withSelection(element.resource, element.range);
|
|
341
|
-
}
|
|
342
|
-
return null;
|
|
343
|
-
}),
|
|
344
|
-
horizontalScrolling: false,
|
|
345
|
-
identityProvider: this.widgetIdentityProvider,
|
|
346
|
-
multipleSelectionSupport: true,
|
|
347
|
-
selectionNavigation: true
|
|
348
|
-
});
|
|
349
|
-
return table;
|
|
350
|
-
}
|
|
351
|
-
createTree(parent) {
|
|
352
|
-
const onDidChangeRenderNodeCount = ( new Relay());
|
|
353
|
-
const treeLabels = this.instantiationService.createInstance(ResourceLabels, this);
|
|
354
|
-
const virtualDelegate = ( new VirtualDelegate(this.markersViewModel));
|
|
355
|
-
const renderers = [
|
|
356
|
-
this.instantiationService.createInstance(ResourceMarkersRenderer, treeLabels, onDidChangeRenderNodeCount.event),
|
|
357
|
-
this.instantiationService.createInstance(MarkerRenderer, this.markersViewModel),
|
|
358
|
-
this.instantiationService.createInstance(RelatedInformationRenderer)
|
|
359
|
-
];
|
|
360
|
-
const tree = this.instantiationService.createInstance(MarkersTree, 'MarkersView', append(parent, $('.tree-container.show-file-icons')), virtualDelegate, renderers, {
|
|
361
|
-
filter: this.filter,
|
|
362
|
-
accessibilityProvider: this.widgetAccessibilityProvider,
|
|
363
|
-
identityProvider: this.widgetIdentityProvider,
|
|
364
|
-
dnd: this.instantiationService.createInstance(ResourceListDnDHandler, (element) => {
|
|
365
|
-
if (element instanceof ResourceMarkers) {
|
|
366
|
-
return element.resource;
|
|
367
|
-
}
|
|
368
|
-
if (element instanceof Marker) {
|
|
369
|
-
return withSelection(element.resource, element.range);
|
|
370
|
-
}
|
|
371
|
-
if (element instanceof RelatedInformation) {
|
|
372
|
-
return withSelection(element.raw.resource, element.raw);
|
|
373
|
-
}
|
|
374
|
-
return null;
|
|
375
|
-
}),
|
|
376
|
-
expandOnlyOnTwistieClick: (e) => e instanceof Marker && e.relatedInformation.length > 0,
|
|
377
|
-
overrideStyles: {
|
|
378
|
-
listBackground: this.getBackgroundColor()
|
|
379
|
-
},
|
|
380
|
-
selectionNavigation: true,
|
|
381
|
-
multipleSelectionSupport: true,
|
|
382
|
-
});
|
|
383
|
-
onDidChangeRenderNodeCount.input = tree.onDidChangeRenderNodeCount;
|
|
384
|
-
return tree;
|
|
385
|
-
}
|
|
386
|
-
collapseAll() {
|
|
387
|
-
this.widget.collapseMarkers();
|
|
388
|
-
}
|
|
389
|
-
setMultiline(multiline) {
|
|
390
|
-
this.markersViewModel.multiline = multiline;
|
|
391
|
-
}
|
|
392
|
-
setViewMode(viewMode) {
|
|
393
|
-
this.markersViewModel.viewMode = viewMode;
|
|
394
|
-
}
|
|
395
|
-
onDidChangeMarkersViewVisibility(visible) {
|
|
396
|
-
this.onVisibleDisposables.clear();
|
|
397
|
-
if (visible) {
|
|
398
|
-
for (const disposable of this.reInitialize()) {
|
|
399
|
-
this.onVisibleDisposables.add(disposable);
|
|
400
|
-
}
|
|
401
|
-
this.refreshPanel();
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
reInitialize() {
|
|
405
|
-
const disposables = [];
|
|
406
|
-
const readMarkers = (resource) => this.markerService.read({ resource, severities: MarkerSeverity.Error | MarkerSeverity.Warning | MarkerSeverity.Info });
|
|
407
|
-
this.markersModel.setResourceMarkers(( groupBy(readMarkers(), compareMarkersByUri).map(group => [group[0].resource, group])));
|
|
408
|
-
disposables.push(Event.debounce(this.markerService.onMarkerChanged, (resourcesMap, resources) => {
|
|
409
|
-
resourcesMap = resourcesMap || ( new ResourceMap());
|
|
410
|
-
resources.forEach(resource => resourcesMap.set(resource, resource));
|
|
411
|
-
return resourcesMap;
|
|
412
|
-
}, 64)(resourcesMap => {
|
|
413
|
-
this.markersModel.setResourceMarkers(( [...( resourcesMap.values())].map(resource => [resource, readMarkers(resource)])));
|
|
414
|
-
}));
|
|
415
|
-
disposables.push(Event.any(this.markersModel.onDidChange, this.editorService.onDidActiveEditorChange)(changes => {
|
|
416
|
-
if (changes) {
|
|
417
|
-
this.onDidChangeModel(changes);
|
|
418
|
-
}
|
|
419
|
-
else {
|
|
420
|
-
this.onActiveEditorChanged();
|
|
421
|
-
}
|
|
422
|
-
}));
|
|
423
|
-
disposables.push(toDisposable(() => this.markersModel.reset()));
|
|
424
|
-
this.markersModel.resourceMarkers.forEach(resourceMarker => resourceMarker.markers.forEach(marker => this.markersViewModel.add(marker)));
|
|
425
|
-
disposables.push(this.markersViewModel.onDidChange(marker => this.onDidChangeViewState(marker)));
|
|
426
|
-
disposables.push(toDisposable(() => this.markersModel.resourceMarkers.forEach(resourceMarker => this.markersViewModel.remove(resourceMarker.resource))));
|
|
427
|
-
disposables.push(this.filters.onDidChange((event) => {
|
|
428
|
-
if (event.activeFile) {
|
|
429
|
-
this.refreshPanel();
|
|
430
|
-
}
|
|
431
|
-
else if (event.excludedFiles || event.showWarnings || event.showErrors || event.showInfos) {
|
|
432
|
-
this.updateFilter();
|
|
433
|
-
}
|
|
434
|
-
}));
|
|
435
|
-
disposables.push(this.filterWidget.onDidChangeFilterText(e => this.updateFilter()));
|
|
436
|
-
disposables.push(toDisposable(() => { this.cachedFilterStats = undefined; }));
|
|
437
|
-
disposables.push(toDisposable(() => this.rangeHighlightDecorations.removeHighlightRange()));
|
|
438
|
-
return disposables;
|
|
439
|
-
}
|
|
440
|
-
onDidChangeModel(change) {
|
|
441
|
-
const resourceMarkers = [...change.added, ...change.removed, ...change.updated];
|
|
442
|
-
const resources = [];
|
|
443
|
-
for (const { resource } of resourceMarkers) {
|
|
444
|
-
this.markersViewModel.remove(resource);
|
|
445
|
-
const resourceMarkers = this.markersModel.getResourceMarkers(resource);
|
|
446
|
-
if (resourceMarkers) {
|
|
447
|
-
for (const marker of resourceMarkers.markers) {
|
|
448
|
-
this.markersViewModel.add(marker);
|
|
449
|
-
}
|
|
450
|
-
}
|
|
451
|
-
resources.push(resource);
|
|
452
|
-
}
|
|
453
|
-
this.currentResourceGotAddedToMarkersData = this.currentResourceGotAddedToMarkersData || this.isCurrentResourceGotAddedToMarkersData(resources);
|
|
454
|
-
this.refreshPanel(change);
|
|
455
|
-
this.updateRangeHighlights();
|
|
456
|
-
if (this.currentResourceGotAddedToMarkersData) {
|
|
457
|
-
this.autoReveal();
|
|
458
|
-
this.currentResourceGotAddedToMarkersData = false;
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
onDidChangeViewMode() {
|
|
462
|
-
if (this.widgetContainer && this.widget) {
|
|
463
|
-
this.widgetContainer.textContent = '';
|
|
464
|
-
this.widgetDisposables.clear();
|
|
465
|
-
}
|
|
466
|
-
const selection = ( new Set());
|
|
467
|
-
for (const marker of this.widget.getSelection()) {
|
|
468
|
-
if (marker instanceof ResourceMarkers) {
|
|
469
|
-
marker.markers.forEach(m => selection.add(m));
|
|
470
|
-
}
|
|
471
|
-
else if (marker instanceof Marker || marker instanceof MarkerTableItem) {
|
|
472
|
-
selection.add(marker);
|
|
473
|
-
}
|
|
474
|
-
}
|
|
475
|
-
const focus = ( new Set());
|
|
476
|
-
for (const marker of this.widget.getFocus()) {
|
|
477
|
-
if (marker instanceof Marker || marker instanceof MarkerTableItem) {
|
|
478
|
-
focus.add(marker);
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
this.createWidget(this.widgetContainer);
|
|
482
|
-
this.refreshPanel();
|
|
483
|
-
if (selection.size > 0) {
|
|
484
|
-
this.widget.setMarkerSelection(Array.from(selection), Array.from(focus));
|
|
485
|
-
this.widget.domFocus();
|
|
486
|
-
}
|
|
487
|
-
}
|
|
488
|
-
isCurrentResourceGotAddedToMarkersData(changedResources) {
|
|
489
|
-
const currentlyActiveResource = this.currentActiveResource;
|
|
490
|
-
if (!currentlyActiveResource) {
|
|
491
|
-
return false;
|
|
492
|
-
}
|
|
493
|
-
const resourceForCurrentActiveResource = this.getResourceForCurrentActiveResource();
|
|
494
|
-
if (resourceForCurrentActiveResource) {
|
|
495
|
-
return false;
|
|
496
|
-
}
|
|
497
|
-
return ( changedResources.some(r => ( r.toString()) === ( currentlyActiveResource.toString())));
|
|
498
|
-
}
|
|
499
|
-
onActiveEditorChanged() {
|
|
500
|
-
this.setCurrentActiveEditor();
|
|
501
|
-
if (this.filters.activeFile) {
|
|
502
|
-
this.refreshPanel();
|
|
503
|
-
}
|
|
504
|
-
this.autoReveal();
|
|
505
|
-
}
|
|
506
|
-
setCurrentActiveEditor() {
|
|
507
|
-
const activeEditor = this.editorService.activeEditor;
|
|
508
|
-
this.currentActiveResource = activeEditor ? EditorResourceAccessor.getOriginalUri(activeEditor, { supportSideBySide: SideBySideEditor.PRIMARY }) ?? null : null;
|
|
509
|
-
}
|
|
510
|
-
onSelected() {
|
|
511
|
-
const selection = this.widget.getSelection();
|
|
512
|
-
if (selection && selection.length > 0) {
|
|
513
|
-
this.lastSelectedRelativeTop = this.widget.getRelativeTop(selection[0]) || 0;
|
|
514
|
-
}
|
|
515
|
-
}
|
|
516
|
-
hasNoProblems() {
|
|
517
|
-
const { total, filtered } = this.getFilterStats();
|
|
518
|
-
return total === 0 || filtered === 0;
|
|
519
|
-
}
|
|
520
|
-
renderContent() {
|
|
521
|
-
this.cachedFilterStats = undefined;
|
|
522
|
-
this.resetWidget();
|
|
523
|
-
this.toggleVisibility(this.hasNoProblems());
|
|
524
|
-
this.renderMessage();
|
|
525
|
-
}
|
|
526
|
-
renderMessage() {
|
|
527
|
-
if (!this.messageBoxContainer || !this.ariaLabelElement) {
|
|
528
|
-
return;
|
|
529
|
-
}
|
|
530
|
-
clearNode(this.messageBoxContainer);
|
|
531
|
-
const { total, filtered } = this.getFilterStats();
|
|
532
|
-
if (filtered === 0) {
|
|
533
|
-
this.messageBoxContainer.style.display = 'block';
|
|
534
|
-
this.messageBoxContainer.setAttribute('tabIndex', '0');
|
|
535
|
-
if (this.filters.activeFile) {
|
|
536
|
-
this.renderFilterMessageForActiveFile(this.messageBoxContainer);
|
|
537
|
-
}
|
|
538
|
-
else {
|
|
539
|
-
if (total > 0) {
|
|
540
|
-
this.renderFilteredByFilterMessage(this.messageBoxContainer);
|
|
541
|
-
}
|
|
542
|
-
else {
|
|
543
|
-
this.renderNoProblemsMessage(this.messageBoxContainer);
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
else {
|
|
548
|
-
this.messageBoxContainer.style.display = 'none';
|
|
549
|
-
if (filtered === total) {
|
|
550
|
-
this.setAriaLabel(( localizeWithPath(
|
|
551
|
-
'vs/workbench/contrib/markers/browser/markersView',
|
|
552
|
-
'No problems filtered',
|
|
553
|
-
"Showing {0} problems",
|
|
554
|
-
total
|
|
555
|
-
)));
|
|
556
|
-
}
|
|
557
|
-
else {
|
|
558
|
-
this.setAriaLabel(( localizeWithPath(
|
|
559
|
-
'vs/workbench/contrib/markers/browser/markersView',
|
|
560
|
-
'problems filtered',
|
|
561
|
-
"Showing {0} of {1} problems",
|
|
562
|
-
filtered,
|
|
563
|
-
total
|
|
564
|
-
)));
|
|
565
|
-
}
|
|
566
|
-
this.messageBoxContainer.removeAttribute('tabIndex');
|
|
567
|
-
}
|
|
568
|
-
}
|
|
569
|
-
renderFilterMessageForActiveFile(container) {
|
|
570
|
-
if (this.currentActiveResource && this.markersModel.getResourceMarkers(this.currentActiveResource)) {
|
|
571
|
-
this.renderFilteredByFilterMessage(container);
|
|
572
|
-
}
|
|
573
|
-
else {
|
|
574
|
-
this.renderNoProblemsMessageForActiveFile(container);
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
renderFilteredByFilterMessage(container) {
|
|
578
|
-
const span1 = append(container, $('span'));
|
|
579
|
-
span1.textContent = Messages.MARKERS_PANEL_NO_PROBLEMS_FILTERS;
|
|
580
|
-
const link = append(container, $('a.messageAction'));
|
|
581
|
-
link.textContent = ( localizeWithPath(
|
|
582
|
-
'vs/workbench/contrib/markers/browser/markersView',
|
|
583
|
-
'clearFilter',
|
|
584
|
-
"Clear Filters"
|
|
585
|
-
));
|
|
586
|
-
link.setAttribute('tabIndex', '0');
|
|
587
|
-
const span2 = append(container, $('span'));
|
|
588
|
-
span2.textContent = '.';
|
|
589
|
-
addStandardDisposableListener(link, EventType.CLICK, () => this.clearFilters());
|
|
590
|
-
addStandardDisposableListener(link, EventType.KEY_DOWN, (e) => {
|
|
591
|
-
if (e.equals(3 ) || e.equals(10 )) {
|
|
592
|
-
this.clearFilters();
|
|
593
|
-
e.stopPropagation();
|
|
594
|
-
}
|
|
595
|
-
});
|
|
596
|
-
this.setAriaLabel(Messages.MARKERS_PANEL_NO_PROBLEMS_FILTERS);
|
|
597
|
-
}
|
|
598
|
-
renderNoProblemsMessageForActiveFile(container) {
|
|
599
|
-
const span = append(container, $('span'));
|
|
600
|
-
span.textContent = Messages.MARKERS_PANEL_NO_PROBLEMS_ACTIVE_FILE_BUILT;
|
|
601
|
-
this.setAriaLabel(Messages.MARKERS_PANEL_NO_PROBLEMS_ACTIVE_FILE_BUILT);
|
|
602
|
-
}
|
|
603
|
-
renderNoProblemsMessage(container) {
|
|
604
|
-
const span = append(container, $('span'));
|
|
605
|
-
span.textContent = Messages.MARKERS_PANEL_NO_PROBLEMS_BUILT;
|
|
606
|
-
this.setAriaLabel(Messages.MARKERS_PANEL_NO_PROBLEMS_BUILT);
|
|
607
|
-
}
|
|
608
|
-
setAriaLabel(label) {
|
|
609
|
-
this.widget.setAriaLabel(label);
|
|
610
|
-
this.ariaLabelElement.setAttribute('aria-label', label);
|
|
611
|
-
}
|
|
612
|
-
clearFilters() {
|
|
613
|
-
this.filterWidget.setFilterText('');
|
|
614
|
-
this.filters.excludedFiles = false;
|
|
615
|
-
this.filters.showErrors = true;
|
|
616
|
-
this.filters.showWarnings = true;
|
|
617
|
-
this.filters.showInfos = true;
|
|
618
|
-
}
|
|
619
|
-
autoReveal(focus = false) {
|
|
620
|
-
if (this.filters.activeFile) {
|
|
621
|
-
return;
|
|
622
|
-
}
|
|
623
|
-
const autoReveal = this.configurationService.getValue('problems.autoReveal');
|
|
624
|
-
if (typeof autoReveal === 'boolean' && autoReveal) {
|
|
625
|
-
const currentActiveResource = this.getResourceForCurrentActiveResource();
|
|
626
|
-
this.widget.revealMarkers(currentActiveResource, focus, this.lastSelectedRelativeTop);
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
getResourceForCurrentActiveResource() {
|
|
630
|
-
return this.currentActiveResource ? this.markersModel.getResourceMarkers(this.currentActiveResource) : null;
|
|
631
|
-
}
|
|
632
|
-
updateRangeHighlights() {
|
|
633
|
-
this.rangeHighlightDecorations.removeHighlightRange();
|
|
634
|
-
if (isActiveElement(this.widget.getHTMLElement())) {
|
|
635
|
-
this.highlightCurrentSelectedMarkerRange();
|
|
636
|
-
}
|
|
637
|
-
}
|
|
638
|
-
highlightCurrentSelectedMarkerRange() {
|
|
639
|
-
const selections = this.widget.getSelection() ?? [];
|
|
640
|
-
if (selections.length !== 1) {
|
|
641
|
-
return;
|
|
642
|
-
}
|
|
643
|
-
const selection = selections[0];
|
|
644
|
-
if (!(selection instanceof Marker)) {
|
|
645
|
-
return;
|
|
646
|
-
}
|
|
647
|
-
this.rangeHighlightDecorations.highlightRange(selection);
|
|
648
|
-
}
|
|
649
|
-
onContextMenu(e) {
|
|
650
|
-
const element = e.element;
|
|
651
|
-
if (!element) {
|
|
652
|
-
return;
|
|
653
|
-
}
|
|
654
|
-
e.browserEvent.preventDefault();
|
|
655
|
-
e.browserEvent.stopPropagation();
|
|
656
|
-
this.contextMenuService.showContextMenu({
|
|
657
|
-
getAnchor: () => e.anchor,
|
|
658
|
-
menuId: MenuId.ProblemsPanelContext,
|
|
659
|
-
contextKeyService: this.widget.contextKeyService,
|
|
660
|
-
getActions: () => this.getMenuActions(element),
|
|
661
|
-
getActionViewItem: (action) => {
|
|
662
|
-
const keybinding = this.keybindingService.lookupKeybinding(action.id);
|
|
663
|
-
if (keybinding) {
|
|
664
|
-
return ( new ActionViewItem(action, action, { label: true, keybinding: keybinding.getLabel() }));
|
|
665
|
-
}
|
|
666
|
-
return undefined;
|
|
667
|
-
},
|
|
668
|
-
onHide: (wasCancelled) => {
|
|
669
|
-
if (wasCancelled) {
|
|
670
|
-
this.widget.domFocus();
|
|
671
|
-
}
|
|
672
|
-
}
|
|
673
|
-
});
|
|
674
|
-
}
|
|
675
|
-
getMenuActions(element) {
|
|
676
|
-
const result = [];
|
|
677
|
-
if (element instanceof Marker) {
|
|
678
|
-
const viewModel = this.markersViewModel.getViewModel(element);
|
|
679
|
-
if (viewModel) {
|
|
680
|
-
const quickFixActions = viewModel.quickFixAction.quickFixes;
|
|
681
|
-
if (quickFixActions.length) {
|
|
682
|
-
result.push(...quickFixActions);
|
|
683
|
-
result.push(( new Separator()));
|
|
684
|
-
}
|
|
685
|
-
}
|
|
686
|
-
}
|
|
687
|
-
return result;
|
|
688
|
-
}
|
|
689
|
-
getFocusElement() {
|
|
690
|
-
return this.widget.getFocus()[0] ?? undefined;
|
|
691
|
-
}
|
|
692
|
-
getFocusedSelectedElements() {
|
|
693
|
-
const focus = this.getFocusElement();
|
|
694
|
-
if (!focus) {
|
|
695
|
-
return null;
|
|
696
|
-
}
|
|
697
|
-
const selection = this.widget.getSelection();
|
|
698
|
-
if (selection.includes(focus)) {
|
|
699
|
-
const result = [];
|
|
700
|
-
for (const selected of selection) {
|
|
701
|
-
if (selected) {
|
|
702
|
-
result.push(selected);
|
|
703
|
-
}
|
|
704
|
-
}
|
|
705
|
-
return result;
|
|
706
|
-
}
|
|
707
|
-
else {
|
|
708
|
-
return [focus];
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
getAllResourceMarkers() {
|
|
712
|
-
return this.markersModel.resourceMarkers;
|
|
713
|
-
}
|
|
714
|
-
getFilterStats() {
|
|
715
|
-
if (!this.cachedFilterStats) {
|
|
716
|
-
this.cachedFilterStats = {
|
|
717
|
-
total: this.markersModel.total,
|
|
718
|
-
filtered: this.widget?.getVisibleItemCount() ?? 0
|
|
719
|
-
};
|
|
720
|
-
}
|
|
721
|
-
return this.cachedFilterStats;
|
|
722
|
-
}
|
|
723
|
-
toggleVisibility(hide) {
|
|
724
|
-
this.widget.toggleVisibility(hide);
|
|
725
|
-
this.layoutBodyContent();
|
|
726
|
-
}
|
|
727
|
-
saveState() {
|
|
728
|
-
this.panelState['filter'] = this.filterWidget.getFilterText();
|
|
729
|
-
this.panelState['filterHistory'] = this.filters.filterHistory;
|
|
730
|
-
this.panelState['showErrors'] = this.filters.showErrors;
|
|
731
|
-
this.panelState['showWarnings'] = this.filters.showWarnings;
|
|
732
|
-
this.panelState['showInfos'] = this.filters.showInfos;
|
|
733
|
-
this.panelState['useFilesExclude'] = this.filters.excludedFiles;
|
|
734
|
-
this.panelState['activeFile'] = this.filters.activeFile;
|
|
735
|
-
this.panelState['multiline'] = this.markersViewModel.multiline;
|
|
736
|
-
this.panelState['viewMode'] = this.markersViewModel.viewMode;
|
|
737
|
-
this.memento.saveMemento();
|
|
738
|
-
super.saveState();
|
|
739
|
-
}
|
|
740
|
-
dispose() {
|
|
741
|
-
super.dispose();
|
|
742
|
-
}
|
|
743
|
-
};
|
|
744
|
-
MarkersView = ( __decorate([
|
|
745
|
-
( __param(1, IInstantiationService)),
|
|
746
|
-
( __param(2, IViewDescriptorService)),
|
|
747
|
-
( __param(3, IEditorService)),
|
|
748
|
-
( __param(4, IConfigurationService)),
|
|
749
|
-
( __param(5, ITelemetryService)),
|
|
750
|
-
( __param(6, IMarkerService)),
|
|
751
|
-
( __param(7, IContextKeyService)),
|
|
752
|
-
( __param(8, IWorkspaceContextService)),
|
|
753
|
-
( __param(9, IContextMenuService)),
|
|
754
|
-
( __param(10, IUriIdentityService)),
|
|
755
|
-
( __param(11, IKeybindingService)),
|
|
756
|
-
( __param(12, IStorageService)),
|
|
757
|
-
( __param(13, IOpenerService)),
|
|
758
|
-
( __param(14, IThemeService))
|
|
759
|
-
], MarkersView));
|
|
760
|
-
let MarkersTree = class MarkersTree extends WorkbenchObjectTree {
|
|
761
|
-
constructor(user, container, delegate, renderers, options, instantiationService, contextKeyService, listService, themeService, configurationService) {
|
|
762
|
-
super(user, container, delegate, renderers, options, instantiationService, contextKeyService, listService, configurationService);
|
|
763
|
-
this.container = container;
|
|
764
|
-
this.visibilityContextKey = MarkersContextKeys.MarkersTreeVisibilityContextKey.bindTo(contextKeyService);
|
|
765
|
-
}
|
|
766
|
-
collapseMarkers() {
|
|
767
|
-
this.collapseAll();
|
|
768
|
-
this.setSelection([]);
|
|
769
|
-
this.setFocus([]);
|
|
770
|
-
this.getHTMLElement().focus();
|
|
771
|
-
this.focusFirst();
|
|
772
|
-
}
|
|
773
|
-
filterMarkers() {
|
|
774
|
-
this.refilter();
|
|
775
|
-
}
|
|
776
|
-
getVisibleItemCount() {
|
|
777
|
-
let filtered = 0;
|
|
778
|
-
const root = this.getNode();
|
|
779
|
-
for (const resourceMarkerNode of root.children) {
|
|
780
|
-
for (const markerNode of resourceMarkerNode.children) {
|
|
781
|
-
if (resourceMarkerNode.visible && markerNode.visible) {
|
|
782
|
-
filtered++;
|
|
783
|
-
}
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
return filtered;
|
|
787
|
-
}
|
|
788
|
-
isVisible() {
|
|
789
|
-
return !this.container.classList.contains('hidden');
|
|
790
|
-
}
|
|
791
|
-
toggleVisibility(hide) {
|
|
792
|
-
this.visibilityContextKey.set(!hide);
|
|
793
|
-
this.container.classList.toggle('hidden', hide);
|
|
794
|
-
}
|
|
795
|
-
reset(resourceMarkers) {
|
|
796
|
-
this.setChildren(null, ( Iterable.map(
|
|
797
|
-
resourceMarkers,
|
|
798
|
-
m => ({ element: m, children: createResourceMarkersIterator(m) })
|
|
799
|
-
)));
|
|
800
|
-
}
|
|
801
|
-
revealMarkers(activeResource, focus, lastSelectedRelativeTop) {
|
|
802
|
-
if (activeResource) {
|
|
803
|
-
if (this.hasElement(activeResource)) {
|
|
804
|
-
if (!this.isCollapsed(activeResource) && this.hasSelectedMarkerFor(activeResource)) {
|
|
805
|
-
this.reveal(this.getSelection()[0], lastSelectedRelativeTop);
|
|
806
|
-
if (focus) {
|
|
807
|
-
this.setFocus(this.getSelection());
|
|
808
|
-
}
|
|
809
|
-
}
|
|
810
|
-
else {
|
|
811
|
-
this.expand(activeResource);
|
|
812
|
-
this.reveal(activeResource, 0);
|
|
813
|
-
if (focus) {
|
|
814
|
-
this.setFocus([activeResource]);
|
|
815
|
-
this.setSelection([activeResource]);
|
|
816
|
-
}
|
|
817
|
-
}
|
|
818
|
-
}
|
|
819
|
-
}
|
|
820
|
-
else if (focus) {
|
|
821
|
-
this.setSelection([]);
|
|
822
|
-
this.focusFirst();
|
|
823
|
-
}
|
|
824
|
-
}
|
|
825
|
-
setAriaLabel(label) {
|
|
826
|
-
this.ariaLabel = label;
|
|
827
|
-
}
|
|
828
|
-
setMarkerSelection(selection, focus) {
|
|
829
|
-
if (this.isVisible()) {
|
|
830
|
-
if (selection && selection.length > 0) {
|
|
831
|
-
this.setSelection(( selection.map(m => this.findMarkerNode(m))));
|
|
832
|
-
if (focus && focus.length > 0) {
|
|
833
|
-
this.setFocus(( focus.map(f => this.findMarkerNode(f))));
|
|
834
|
-
}
|
|
835
|
-
else {
|
|
836
|
-
this.setFocus([this.findMarkerNode(selection[0])]);
|
|
837
|
-
}
|
|
838
|
-
this.reveal(this.findMarkerNode(selection[0]));
|
|
839
|
-
}
|
|
840
|
-
else if (this.getSelection().length === 0) {
|
|
841
|
-
const firstVisibleElement = this.firstVisibleElement;
|
|
842
|
-
const marker = firstVisibleElement ?
|
|
843
|
-
firstVisibleElement instanceof ResourceMarkers ? firstVisibleElement.markers[0] :
|
|
844
|
-
firstVisibleElement instanceof Marker ? firstVisibleElement : undefined
|
|
845
|
-
: undefined;
|
|
846
|
-
if (marker) {
|
|
847
|
-
this.setSelection([marker]);
|
|
848
|
-
this.setFocus([marker]);
|
|
849
|
-
this.reveal(marker);
|
|
850
|
-
}
|
|
851
|
-
}
|
|
852
|
-
}
|
|
853
|
-
}
|
|
854
|
-
update(resourceMarkers) {
|
|
855
|
-
for (const resourceMarker of resourceMarkers) {
|
|
856
|
-
if (this.hasElement(resourceMarker)) {
|
|
857
|
-
this.setChildren(resourceMarker, createResourceMarkersIterator(resourceMarker));
|
|
858
|
-
this.rerender(resourceMarker);
|
|
859
|
-
}
|
|
860
|
-
}
|
|
861
|
-
}
|
|
862
|
-
updateMarker(marker) {
|
|
863
|
-
this.rerender(marker);
|
|
864
|
-
}
|
|
865
|
-
findMarkerNode(marker) {
|
|
866
|
-
for (const resourceNode of this.getNode().children) {
|
|
867
|
-
for (const markerNode of resourceNode.children) {
|
|
868
|
-
if (markerNode.element instanceof Marker && markerNode.element.marker === marker.marker) {
|
|
869
|
-
return markerNode.element;
|
|
870
|
-
}
|
|
871
|
-
}
|
|
872
|
-
}
|
|
873
|
-
return null;
|
|
874
|
-
}
|
|
875
|
-
hasSelectedMarkerFor(resource) {
|
|
876
|
-
const selectedElement = this.getSelection();
|
|
877
|
-
if (selectedElement && selectedElement.length > 0) {
|
|
878
|
-
if (selectedElement[0] instanceof Marker) {
|
|
879
|
-
if (( resource.has(selectedElement[0].marker.resource))) {
|
|
880
|
-
return true;
|
|
881
|
-
}
|
|
882
|
-
}
|
|
883
|
-
}
|
|
884
|
-
return false;
|
|
885
|
-
}
|
|
886
|
-
dispose() {
|
|
887
|
-
super.dispose();
|
|
888
|
-
}
|
|
889
|
-
layout(height, width) {
|
|
890
|
-
this.container.style.height = `${height}px`;
|
|
891
|
-
super.layout(height, width);
|
|
892
|
-
}
|
|
893
|
-
};
|
|
894
|
-
MarkersTree = ( __decorate([
|
|
895
|
-
( __param(5, IInstantiationService)),
|
|
896
|
-
( __param(6, IContextKeyService)),
|
|
897
|
-
( __param(7, IListService)),
|
|
898
|
-
( __param(8, IThemeService)),
|
|
899
|
-
( __param(9, IConfigurationService))
|
|
900
|
-
], MarkersTree));
|
|
901
|
-
|
|
902
|
-
export { MarkersView };
|