@theia/markers 1.53.0-next.4 → 1.53.0-next.55
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/README.md +33 -33
- package/package.json +6 -6
- package/src/browser/index.ts +18 -18
- package/src/browser/marker-manager.ts +205 -205
- package/src/browser/marker-tree-label-provider.spec.ts +245 -245
- package/src/browser/marker-tree-label-provider.ts +75 -75
- package/src/browser/marker-tree-model.ts +47 -47
- package/src/browser/marker-tree.ts +154 -154
- package/src/browser/problem/problem-composite-tree-node.spec.ts +277 -277
- package/src/browser/problem/problem-composite-tree-node.ts +86 -86
- package/src/browser/problem/problem-container.ts +47 -47
- package/src/browser/problem/problem-contribution.ts +247 -247
- package/src/browser/problem/problem-decorations-provider.ts +72 -72
- package/src/browser/problem/problem-decorator.ts +222 -222
- package/src/browser/problem/problem-frontend-module.ts +64 -64
- package/src/browser/problem/problem-layout-migrations.ts +32 -32
- package/src/browser/problem/problem-manager.spec.ts +216 -216
- package/src/browser/problem/problem-manager.ts +51 -51
- package/src/browser/problem/problem-preferences.ts +64 -64
- package/src/browser/problem/problem-selection.ts +45 -45
- package/src/browser/problem/problem-tabbar-decorator.ts +151 -151
- package/src/browser/problem/problem-tree-model.spec.ts +189 -189
- package/src/browser/problem/problem-tree-model.ts +133 -133
- package/src/browser/problem/problem-utils.ts +90 -90
- package/src/browser/problem/problem-widget-tab-bar-decorator.ts +55 -55
- package/src/browser/problem/problem-widget.tsx +246 -246
- package/src/browser/style/index.css +92 -92
- package/src/common/marker.ts +53 -53
- package/src/common/problem-marker.ts +30 -30
|
@@ -1,246 +1,246 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2017 TypeFox and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
|
|
18
|
-
import { ProblemManager } from './problem-manager';
|
|
19
|
-
import { ProblemMarker } from '../../common/problem-marker';
|
|
20
|
-
import { ProblemTreeModel } from './problem-tree-model';
|
|
21
|
-
import { MarkerInfoNode, MarkerNode, MarkerRootNode } from '../marker-tree';
|
|
22
|
-
import {
|
|
23
|
-
TreeWidget, TreeProps, ContextMenuRenderer, TreeNode, NodeProps, TreeModel,
|
|
24
|
-
ApplicationShell, Navigatable, ExpandableTreeNode, SelectableTreeNode, TREE_NODE_INFO_CLASS, codicon, Message
|
|
25
|
-
} from '@theia/core/lib/browser';
|
|
26
|
-
import { DiagnosticSeverity } from '@theia/core/shared/vscode-languageserver-protocol';
|
|
27
|
-
import * as React from '@theia/core/shared/react';
|
|
28
|
-
import { ProblemPreferences } from './problem-preferences';
|
|
29
|
-
import { DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
30
|
-
import { nls } from '@theia/core/lib/common/nls';
|
|
31
|
-
|
|
32
|
-
export const PROBLEMS_WIDGET_ID = 'problems';
|
|
33
|
-
|
|
34
|
-
@injectable()
|
|
35
|
-
export class ProblemWidget extends TreeWidget {
|
|
36
|
-
|
|
37
|
-
protected readonly toDisposeOnCurrentWidgetChanged = new DisposableCollection();
|
|
38
|
-
|
|
39
|
-
@inject(ProblemPreferences)
|
|
40
|
-
protected readonly preferences: ProblemPreferences;
|
|
41
|
-
|
|
42
|
-
@inject(ApplicationShell)
|
|
43
|
-
protected readonly shell: ApplicationShell;
|
|
44
|
-
|
|
45
|
-
@inject(ProblemManager)
|
|
46
|
-
protected readonly problemManager: ProblemManager;
|
|
47
|
-
|
|
48
|
-
constructor(
|
|
49
|
-
@inject(TreeProps) treeProps: TreeProps,
|
|
50
|
-
@inject(ProblemTreeModel) override readonly model: ProblemTreeModel,
|
|
51
|
-
@inject(ContextMenuRenderer) contextMenuRenderer: ContextMenuRenderer
|
|
52
|
-
) {
|
|
53
|
-
super(treeProps, model, contextMenuRenderer);
|
|
54
|
-
|
|
55
|
-
this.id = PROBLEMS_WIDGET_ID;
|
|
56
|
-
this.title.label = nls.localizeByDefault('Problems');
|
|
57
|
-
this.title.caption = this.title.label;
|
|
58
|
-
this.title.iconClass = codicon('warning');
|
|
59
|
-
this.title.closable = true;
|
|
60
|
-
this.addClass('theia-marker-container');
|
|
61
|
-
|
|
62
|
-
this.addClipboardListener(this.node, 'copy', e => this.handleCopy(e));
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
@postConstruct()
|
|
66
|
-
protected override init(): void {
|
|
67
|
-
super.init();
|
|
68
|
-
this.updateFollowActiveEditor();
|
|
69
|
-
this.toDispose.push(this.preferences.onPreferenceChanged(e => {
|
|
70
|
-
if (e.preferenceName === 'problems.autoReveal') {
|
|
71
|
-
this.updateFollowActiveEditor();
|
|
72
|
-
}
|
|
73
|
-
}));
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
protected override onActivateRequest(msg: Message): void {
|
|
77
|
-
super.onActivateRequest(msg);
|
|
78
|
-
this.update();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
protected updateFollowActiveEditor(): void {
|
|
82
|
-
this.toDisposeOnCurrentWidgetChanged.dispose();
|
|
83
|
-
this.toDispose.push(this.toDisposeOnCurrentWidgetChanged);
|
|
84
|
-
if (this.preferences.get('problems.autoReveal')) {
|
|
85
|
-
this.followActiveEditor();
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
protected followActiveEditor(): void {
|
|
90
|
-
this.autoRevealFromActiveEditor();
|
|
91
|
-
this.toDisposeOnCurrentWidgetChanged.push(this.shell.onDidChangeCurrentWidget(() => this.autoRevealFromActiveEditor()));
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
protected autoRevealFromActiveEditor(): void {
|
|
95
|
-
const widget = this.shell.currentWidget;
|
|
96
|
-
if (widget && Navigatable.is(widget)) {
|
|
97
|
-
const uri = widget.getResourceUri();
|
|
98
|
-
const node = uri && this.model.getNode(uri.toString());
|
|
99
|
-
if (ExpandableTreeNode.is(node) && SelectableTreeNode.is(node)) {
|
|
100
|
-
this.model.expandNode(node);
|
|
101
|
-
this.model.selectNode(node);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
override storeState(): object {
|
|
107
|
-
// no-op
|
|
108
|
-
return {};
|
|
109
|
-
}
|
|
110
|
-
protected superStoreState(): object {
|
|
111
|
-
return super.storeState();
|
|
112
|
-
}
|
|
113
|
-
override restoreState(state: object): void {
|
|
114
|
-
// no-op
|
|
115
|
-
}
|
|
116
|
-
protected superRestoreState(state: object): void {
|
|
117
|
-
super.restoreState(state);
|
|
118
|
-
return;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
protected override tapNode(node?: TreeNode): void {
|
|
122
|
-
super.tapNode(node);
|
|
123
|
-
if (MarkerNode.is(node)) {
|
|
124
|
-
this.model.revealNode(node);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
protected handleCopy(event: ClipboardEvent): void {
|
|
129
|
-
const uris = this.model.selectedNodes.filter(MarkerNode.is).map(node => node.uri.toString());
|
|
130
|
-
if (uris.length > 0 && event.clipboardData) {
|
|
131
|
-
event.clipboardData.setData('text/plain', uris.join('\n'));
|
|
132
|
-
event.preventDefault();
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
protected override handleDown(event: KeyboardEvent): void {
|
|
137
|
-
const node = this.model.getNextSelectableNode();
|
|
138
|
-
super.handleDown(event);
|
|
139
|
-
if (MarkerNode.is(node)) {
|
|
140
|
-
this.model.revealNode(node);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
protected override handleUp(event: KeyboardEvent): void {
|
|
145
|
-
const node = this.model.getPrevSelectableNode();
|
|
146
|
-
super.handleUp(event);
|
|
147
|
-
if (MarkerNode.is(node)) {
|
|
148
|
-
this.model.revealNode(node);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
protected override renderTree(model: TreeModel): React.ReactNode {
|
|
153
|
-
if (MarkerRootNode.is(model.root) && model.root.children.length > 0) {
|
|
154
|
-
return super.renderTree(model);
|
|
155
|
-
}
|
|
156
|
-
return <div className='theia-widget-noInfo noMarkers'>{nls.localize('theia/markers/noProblems', 'No problems have been detected in the workspace so far.')}</div>;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
protected override renderCaption(node: TreeNode, props: NodeProps): React.ReactNode {
|
|
160
|
-
if (MarkerInfoNode.is(node)) {
|
|
161
|
-
return this.decorateMarkerFileNode(node);
|
|
162
|
-
} else if (MarkerNode.is(node)) {
|
|
163
|
-
return this.decorateMarkerNode(node);
|
|
164
|
-
}
|
|
165
|
-
return 'caption';
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
protected override renderTailDecorations(node: TreeNode, props: NodeProps): JSX.Element {
|
|
169
|
-
return <div className='row-button-container'>
|
|
170
|
-
{this.renderRemoveButton(node)}
|
|
171
|
-
</div>;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
protected renderRemoveButton(node: TreeNode): React.ReactNode {
|
|
175
|
-
return <ProblemMarkerRemoveButton model={this.model} node={node} />;
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
protected decorateMarkerNode(node: MarkerNode): React.ReactNode {
|
|
179
|
-
if (ProblemMarker.is(node.marker)) {
|
|
180
|
-
let severityClass: string = '';
|
|
181
|
-
const problemMarker = node.marker;
|
|
182
|
-
if (problemMarker.data.severity) {
|
|
183
|
-
severityClass = this.getSeverityClass(problemMarker.data.severity);
|
|
184
|
-
}
|
|
185
|
-
const location = nls.localizeByDefault('Ln {0}, Col {1}', problemMarker.data.range.start.line + 1, problemMarker.data.range.start.character + 1);
|
|
186
|
-
return <div
|
|
187
|
-
className='markerNode'
|
|
188
|
-
title={`${problemMarker.data.message} (${problemMarker.data.range.start.line + 1}, ${problemMarker.data.range.start.character + 1})`}>
|
|
189
|
-
<div>
|
|
190
|
-
<i className={`${severityClass} ${TREE_NODE_INFO_CLASS}`}></i>
|
|
191
|
-
</div>
|
|
192
|
-
<div className='message'>{problemMarker.data.message}
|
|
193
|
-
{(!!problemMarker.data.source || !!problemMarker.data.code) &&
|
|
194
|
-
<span className={'owner ' + TREE_NODE_INFO_CLASS}>
|
|
195
|
-
{problemMarker.data.source || ''}
|
|
196
|
-
{problemMarker.data.code ? `(${problemMarker.data.code})` : ''}
|
|
197
|
-
</span>
|
|
198
|
-
}
|
|
199
|
-
<span className={'position ' + TREE_NODE_INFO_CLASS}>
|
|
200
|
-
{`[${location}]`}
|
|
201
|
-
</span>
|
|
202
|
-
</div>
|
|
203
|
-
</div>;
|
|
204
|
-
}
|
|
205
|
-
return '';
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
protected getSeverityClass(severity: DiagnosticSeverity): string {
|
|
209
|
-
switch (severity) {
|
|
210
|
-
case 1: return `${codicon('error')} error`;
|
|
211
|
-
case 2: return `${codicon('warning')} warning`;
|
|
212
|
-
case 3: return `${codicon('info')} information`;
|
|
213
|
-
default: return `${codicon('thumbsup')} hint`;
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
protected decorateMarkerFileNode(node: MarkerInfoNode): React.ReactNode {
|
|
218
|
-
const icon = this.toNodeIcon(node);
|
|
219
|
-
const name = this.toNodeName(node);
|
|
220
|
-
const description = this.toNodeDescription(node);
|
|
221
|
-
// Use a custom scheme so that we fallback to the `DefaultUriLabelProviderContribution`.
|
|
222
|
-
const path = this.labelProvider.getLongName(node.uri.withScheme('marker'));
|
|
223
|
-
return <div title={path} className='markerFileNode'>
|
|
224
|
-
{icon && <div className={icon + ' file-icon'}></div>}
|
|
225
|
-
<div className='name'>{name}</div>
|
|
226
|
-
<div className={'path ' + TREE_NODE_INFO_CLASS}>{description}</div>
|
|
227
|
-
<div className='notification-count-container'>
|
|
228
|
-
<span className='notification-count'>{node.numberOfMarkers.toString()}</span>
|
|
229
|
-
</div>
|
|
230
|
-
</div>;
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
export class ProblemMarkerRemoveButton extends React.Component<{ model: ProblemTreeModel, node: TreeNode }> {
|
|
236
|
-
|
|
237
|
-
override render(): React.ReactNode {
|
|
238
|
-
return <span className={codicon('close')} onClick={this.remove}></span>;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
protected readonly remove = (e: React.MouseEvent<HTMLElement>) => this.doRemove(e);
|
|
242
|
-
protected doRemove(e: React.MouseEvent<HTMLElement>): void {
|
|
243
|
-
this.props.model.removeNode(this.props.node);
|
|
244
|
-
e.stopPropagation();
|
|
245
|
-
}
|
|
246
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2017 TypeFox and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
|
|
18
|
+
import { ProblemManager } from './problem-manager';
|
|
19
|
+
import { ProblemMarker } from '../../common/problem-marker';
|
|
20
|
+
import { ProblemTreeModel } from './problem-tree-model';
|
|
21
|
+
import { MarkerInfoNode, MarkerNode, MarkerRootNode } from '../marker-tree';
|
|
22
|
+
import {
|
|
23
|
+
TreeWidget, TreeProps, ContextMenuRenderer, TreeNode, NodeProps, TreeModel,
|
|
24
|
+
ApplicationShell, Navigatable, ExpandableTreeNode, SelectableTreeNode, TREE_NODE_INFO_CLASS, codicon, Message
|
|
25
|
+
} from '@theia/core/lib/browser';
|
|
26
|
+
import { DiagnosticSeverity } from '@theia/core/shared/vscode-languageserver-protocol';
|
|
27
|
+
import * as React from '@theia/core/shared/react';
|
|
28
|
+
import { ProblemPreferences } from './problem-preferences';
|
|
29
|
+
import { DisposableCollection } from '@theia/core/lib/common/disposable';
|
|
30
|
+
import { nls } from '@theia/core/lib/common/nls';
|
|
31
|
+
|
|
32
|
+
export const PROBLEMS_WIDGET_ID = 'problems';
|
|
33
|
+
|
|
34
|
+
@injectable()
|
|
35
|
+
export class ProblemWidget extends TreeWidget {
|
|
36
|
+
|
|
37
|
+
protected readonly toDisposeOnCurrentWidgetChanged = new DisposableCollection();
|
|
38
|
+
|
|
39
|
+
@inject(ProblemPreferences)
|
|
40
|
+
protected readonly preferences: ProblemPreferences;
|
|
41
|
+
|
|
42
|
+
@inject(ApplicationShell)
|
|
43
|
+
protected readonly shell: ApplicationShell;
|
|
44
|
+
|
|
45
|
+
@inject(ProblemManager)
|
|
46
|
+
protected readonly problemManager: ProblemManager;
|
|
47
|
+
|
|
48
|
+
constructor(
|
|
49
|
+
@inject(TreeProps) treeProps: TreeProps,
|
|
50
|
+
@inject(ProblemTreeModel) override readonly model: ProblemTreeModel,
|
|
51
|
+
@inject(ContextMenuRenderer) contextMenuRenderer: ContextMenuRenderer
|
|
52
|
+
) {
|
|
53
|
+
super(treeProps, model, contextMenuRenderer);
|
|
54
|
+
|
|
55
|
+
this.id = PROBLEMS_WIDGET_ID;
|
|
56
|
+
this.title.label = nls.localizeByDefault('Problems');
|
|
57
|
+
this.title.caption = this.title.label;
|
|
58
|
+
this.title.iconClass = codicon('warning');
|
|
59
|
+
this.title.closable = true;
|
|
60
|
+
this.addClass('theia-marker-container');
|
|
61
|
+
|
|
62
|
+
this.addClipboardListener(this.node, 'copy', e => this.handleCopy(e));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@postConstruct()
|
|
66
|
+
protected override init(): void {
|
|
67
|
+
super.init();
|
|
68
|
+
this.updateFollowActiveEditor();
|
|
69
|
+
this.toDispose.push(this.preferences.onPreferenceChanged(e => {
|
|
70
|
+
if (e.preferenceName === 'problems.autoReveal') {
|
|
71
|
+
this.updateFollowActiveEditor();
|
|
72
|
+
}
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
protected override onActivateRequest(msg: Message): void {
|
|
77
|
+
super.onActivateRequest(msg);
|
|
78
|
+
this.update();
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
protected updateFollowActiveEditor(): void {
|
|
82
|
+
this.toDisposeOnCurrentWidgetChanged.dispose();
|
|
83
|
+
this.toDispose.push(this.toDisposeOnCurrentWidgetChanged);
|
|
84
|
+
if (this.preferences.get('problems.autoReveal')) {
|
|
85
|
+
this.followActiveEditor();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
protected followActiveEditor(): void {
|
|
90
|
+
this.autoRevealFromActiveEditor();
|
|
91
|
+
this.toDisposeOnCurrentWidgetChanged.push(this.shell.onDidChangeCurrentWidget(() => this.autoRevealFromActiveEditor()));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
protected autoRevealFromActiveEditor(): void {
|
|
95
|
+
const widget = this.shell.currentWidget;
|
|
96
|
+
if (widget && Navigatable.is(widget)) {
|
|
97
|
+
const uri = widget.getResourceUri();
|
|
98
|
+
const node = uri && this.model.getNode(uri.toString());
|
|
99
|
+
if (ExpandableTreeNode.is(node) && SelectableTreeNode.is(node)) {
|
|
100
|
+
this.model.expandNode(node);
|
|
101
|
+
this.model.selectNode(node);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
override storeState(): object {
|
|
107
|
+
// no-op
|
|
108
|
+
return {};
|
|
109
|
+
}
|
|
110
|
+
protected superStoreState(): object {
|
|
111
|
+
return super.storeState();
|
|
112
|
+
}
|
|
113
|
+
override restoreState(state: object): void {
|
|
114
|
+
// no-op
|
|
115
|
+
}
|
|
116
|
+
protected superRestoreState(state: object): void {
|
|
117
|
+
super.restoreState(state);
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
protected override tapNode(node?: TreeNode): void {
|
|
122
|
+
super.tapNode(node);
|
|
123
|
+
if (MarkerNode.is(node)) {
|
|
124
|
+
this.model.revealNode(node);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
protected handleCopy(event: ClipboardEvent): void {
|
|
129
|
+
const uris = this.model.selectedNodes.filter(MarkerNode.is).map(node => node.uri.toString());
|
|
130
|
+
if (uris.length > 0 && event.clipboardData) {
|
|
131
|
+
event.clipboardData.setData('text/plain', uris.join('\n'));
|
|
132
|
+
event.preventDefault();
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
protected override handleDown(event: KeyboardEvent): void {
|
|
137
|
+
const node = this.model.getNextSelectableNode();
|
|
138
|
+
super.handleDown(event);
|
|
139
|
+
if (MarkerNode.is(node)) {
|
|
140
|
+
this.model.revealNode(node);
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
protected override handleUp(event: KeyboardEvent): void {
|
|
145
|
+
const node = this.model.getPrevSelectableNode();
|
|
146
|
+
super.handleUp(event);
|
|
147
|
+
if (MarkerNode.is(node)) {
|
|
148
|
+
this.model.revealNode(node);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
protected override renderTree(model: TreeModel): React.ReactNode {
|
|
153
|
+
if (MarkerRootNode.is(model.root) && model.root.children.length > 0) {
|
|
154
|
+
return super.renderTree(model);
|
|
155
|
+
}
|
|
156
|
+
return <div className='theia-widget-noInfo noMarkers'>{nls.localize('theia/markers/noProblems', 'No problems have been detected in the workspace so far.')}</div>;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
protected override renderCaption(node: TreeNode, props: NodeProps): React.ReactNode {
|
|
160
|
+
if (MarkerInfoNode.is(node)) {
|
|
161
|
+
return this.decorateMarkerFileNode(node);
|
|
162
|
+
} else if (MarkerNode.is(node)) {
|
|
163
|
+
return this.decorateMarkerNode(node);
|
|
164
|
+
}
|
|
165
|
+
return 'caption';
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
protected override renderTailDecorations(node: TreeNode, props: NodeProps): JSX.Element {
|
|
169
|
+
return <div className='row-button-container'>
|
|
170
|
+
{this.renderRemoveButton(node)}
|
|
171
|
+
</div>;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
protected renderRemoveButton(node: TreeNode): React.ReactNode {
|
|
175
|
+
return <ProblemMarkerRemoveButton model={this.model} node={node} />;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
protected decorateMarkerNode(node: MarkerNode): React.ReactNode {
|
|
179
|
+
if (ProblemMarker.is(node.marker)) {
|
|
180
|
+
let severityClass: string = '';
|
|
181
|
+
const problemMarker = node.marker;
|
|
182
|
+
if (problemMarker.data.severity) {
|
|
183
|
+
severityClass = this.getSeverityClass(problemMarker.data.severity);
|
|
184
|
+
}
|
|
185
|
+
const location = nls.localizeByDefault('Ln {0}, Col {1}', problemMarker.data.range.start.line + 1, problemMarker.data.range.start.character + 1);
|
|
186
|
+
return <div
|
|
187
|
+
className='markerNode'
|
|
188
|
+
title={`${problemMarker.data.message} (${problemMarker.data.range.start.line + 1}, ${problemMarker.data.range.start.character + 1})`}>
|
|
189
|
+
<div>
|
|
190
|
+
<i className={`${severityClass} ${TREE_NODE_INFO_CLASS}`}></i>
|
|
191
|
+
</div>
|
|
192
|
+
<div className='message'>{problemMarker.data.message}
|
|
193
|
+
{(!!problemMarker.data.source || !!problemMarker.data.code) &&
|
|
194
|
+
<span className={'owner ' + TREE_NODE_INFO_CLASS}>
|
|
195
|
+
{problemMarker.data.source || ''}
|
|
196
|
+
{problemMarker.data.code ? `(${problemMarker.data.code})` : ''}
|
|
197
|
+
</span>
|
|
198
|
+
}
|
|
199
|
+
<span className={'position ' + TREE_NODE_INFO_CLASS}>
|
|
200
|
+
{`[${location}]`}
|
|
201
|
+
</span>
|
|
202
|
+
</div>
|
|
203
|
+
</div>;
|
|
204
|
+
}
|
|
205
|
+
return '';
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
protected getSeverityClass(severity: DiagnosticSeverity): string {
|
|
209
|
+
switch (severity) {
|
|
210
|
+
case 1: return `${codicon('error')} error`;
|
|
211
|
+
case 2: return `${codicon('warning')} warning`;
|
|
212
|
+
case 3: return `${codicon('info')} information`;
|
|
213
|
+
default: return `${codicon('thumbsup')} hint`;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
protected decorateMarkerFileNode(node: MarkerInfoNode): React.ReactNode {
|
|
218
|
+
const icon = this.toNodeIcon(node);
|
|
219
|
+
const name = this.toNodeName(node);
|
|
220
|
+
const description = this.toNodeDescription(node);
|
|
221
|
+
// Use a custom scheme so that we fallback to the `DefaultUriLabelProviderContribution`.
|
|
222
|
+
const path = this.labelProvider.getLongName(node.uri.withScheme('marker'));
|
|
223
|
+
return <div title={path} className='markerFileNode'>
|
|
224
|
+
{icon && <div className={icon + ' file-icon'}></div>}
|
|
225
|
+
<div className='name'>{name}</div>
|
|
226
|
+
<div className={'path ' + TREE_NODE_INFO_CLASS}>{description}</div>
|
|
227
|
+
<div className='notification-count-container'>
|
|
228
|
+
<span className='notification-count'>{node.numberOfMarkers.toString()}</span>
|
|
229
|
+
</div>
|
|
230
|
+
</div>;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export class ProblemMarkerRemoveButton extends React.Component<{ model: ProblemTreeModel, node: TreeNode }> {
|
|
236
|
+
|
|
237
|
+
override render(): React.ReactNode {
|
|
238
|
+
return <span className={codicon('close')} onClick={this.remove}></span>;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
protected readonly remove = (e: React.MouseEvent<HTMLElement>) => this.doRemove(e);
|
|
242
|
+
protected doRemove(e: React.MouseEvent<HTMLElement>): void {
|
|
243
|
+
this.props.model.removeNode(this.props.node);
|
|
244
|
+
e.stopPropagation();
|
|
245
|
+
}
|
|
246
|
+
}
|