@theia/markers 1.45.1 → 1.46.0-next.72
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/lib/browser/index.d.ts +2 -2
- package/lib/browser/index.js +29 -29
- package/lib/browser/marker-manager.d.ts +47 -47
- package/lib/browser/marker-manager.js +187 -187
- package/lib/browser/marker-tree-label-provider.d.ts +15 -15
- package/lib/browser/marker-tree-label-provider.js +84 -84
- package/lib/browser/marker-tree-label-provider.spec.d.ts +1 -1
- package/lib/browser/marker-tree-label-provider.spec.js +201 -201
- package/lib/browser/marker-tree-model.d.ts +12 -12
- package/lib/browser/marker-tree-model.js +60 -60
- package/lib/browser/marker-tree.d.ts +42 -42
- package/lib/browser/marker-tree.js +143 -143
- package/lib/browser/problem/problem-composite-tree-node.d.ts +11 -11
- package/lib/browser/problem/problem-composite-tree-node.js +76 -76
- package/lib/browser/problem/problem-composite-tree-node.spec.d.ts +1 -1
- package/lib/browser/problem/problem-composite-tree-node.spec.js +238 -238
- package/lib/browser/problem/problem-container.d.ts +8 -8
- package/lib/browser/problem/problem-container.js +46 -46
- package/lib/browser/problem/problem-contribution.d.ts +51 -51
- package/lib/browser/problem/problem-contribution.js +247 -247
- package/lib/browser/problem/problem-decorations-provider.d.ts +21 -21
- package/lib/browser/problem/problem-decorations-provider.js +95 -95
- package/lib/browser/problem/problem-decorator.d.ts +57 -57
- package/lib/browser/problem/problem-decorator.js +233 -233
- package/lib/browser/problem/problem-frontend-module.d.ts +4 -4
- package/lib/browser/problem/problem-frontend-module.js +55 -55
- package/lib/browser/problem/problem-layout-migrations.d.ts +5 -5
- package/lib/browser/problem/problem-layout-migrations.js +43 -43
- package/lib/browser/problem/problem-manager.d.ts +11 -11
- package/lib/browser/problem/problem-manager.js +53 -53
- package/lib/browser/problem/problem-manager.spec.d.ts +1 -1
- package/lib/browser/problem/problem-manager.spec.js +167 -167
- package/lib/browser/problem/problem-preferences.d.ts +13 -13
- package/lib/browser/problem/problem-preferences.js +56 -56
- package/lib/browser/problem/problem-selection.d.ts +12 -12
- package/lib/browser/problem/problem-selection.js +34 -34
- package/lib/browser/problem/problem-tabbar-decorator.d.ts +42 -42
- package/lib/browser/problem/problem-tabbar-decorator.js +160 -160
- package/lib/browser/problem/problem-tree-model.d.ts +32 -32
- package/lib/browser/problem/problem-tree-model.js +131 -131
- package/lib/browser/problem/problem-tree-model.spec.d.ts +1 -1
- package/lib/browser/problem/problem-tree-model.spec.js +172 -172
- package/lib/browser/problem/problem-utils.d.ts +44 -44
- package/lib/browser/problem/problem-utils.js +84 -84
- package/lib/browser/problem/problem-widget-tab-bar-decorator.d.ts +14 -14
- package/lib/browser/problem/problem-widget-tab-bar-decorator.js +69 -69
- package/lib/browser/problem/problem-widget.d.ts +46 -46
- package/lib/browser/problem/problem-widget.js +235 -235
- package/lib/common/marker.d.ts +16 -16
- package/lib/common/marker.js +31 -31
- package/lib/common/problem-marker.d.ts +9 -9
- package/lib/common/problem-marker.js +27 -27
- 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 +81 -81
- 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 +124 -124
- 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,248 +1,248 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2017 TypeFox and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
-
};
|
|
23
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
-
};
|
|
26
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
-
exports.ProblemContribution = exports.ProblemsCommands = exports.ProblemsMenu = exports.PROBLEMS_CONTEXT_MENU = void 0;
|
|
28
|
-
const debounce = require("@theia/core/shared/lodash.debounce");
|
|
29
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
30
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
31
|
-
const status_bar_1 = require("@theia/core/lib/browser/status-bar/status-bar");
|
|
32
|
-
const view_contribution_1 = require("@theia/core/lib/browser/shell/view-contribution");
|
|
33
|
-
const problem_marker_1 = require("../../common/problem-marker");
|
|
34
|
-
const problem_manager_1 = require("./problem-manager");
|
|
35
|
-
const problem_widget_1 = require("./problem-widget");
|
|
36
|
-
const command_1 = require("@theia/core/lib/common/command");
|
|
37
|
-
const selection_service_1 = require("@theia/core/lib/common/selection-service");
|
|
38
|
-
const problem_selection_1 = require("./problem-selection");
|
|
39
|
-
const nls_1 = require("@theia/core/lib/common/nls");
|
|
40
|
-
exports.PROBLEMS_CONTEXT_MENU = [problem_marker_1.PROBLEM_KIND];
|
|
41
|
-
var ProblemsMenu;
|
|
42
|
-
(function (ProblemsMenu) {
|
|
43
|
-
ProblemsMenu.CLIPBOARD = [...exports.PROBLEMS_CONTEXT_MENU, '1_clipboard'];
|
|
44
|
-
ProblemsMenu.PROBLEMS = [...exports.PROBLEMS_CONTEXT_MENU, '2_problems'];
|
|
45
|
-
})(ProblemsMenu = exports.ProblemsMenu || (exports.ProblemsMenu = {}));
|
|
46
|
-
var ProblemsCommands;
|
|
47
|
-
(function (ProblemsCommands) {
|
|
48
|
-
ProblemsCommands.COLLAPSE_ALL = {
|
|
49
|
-
id: 'problems.collapse.all'
|
|
50
|
-
};
|
|
51
|
-
ProblemsCommands.COLLAPSE_ALL_TOOLBAR = {
|
|
52
|
-
id: 'problems.collapse.all.toolbar',
|
|
53
|
-
iconClass: (0, browser_1.codicon)('collapse-all')
|
|
54
|
-
};
|
|
55
|
-
ProblemsCommands.COPY = {
|
|
56
|
-
id: 'problems.copy'
|
|
57
|
-
};
|
|
58
|
-
ProblemsCommands.COPY_MESSAGE = {
|
|
59
|
-
id: 'problems.copy.message',
|
|
60
|
-
};
|
|
61
|
-
ProblemsCommands.CLEAR_ALL = command_1.Command.toLocalizedCommand({
|
|
62
|
-
id: 'problems.clear.all',
|
|
63
|
-
category: 'Problems',
|
|
64
|
-
label: 'Clear All',
|
|
65
|
-
iconClass: (0, browser_1.codicon)('clear-all')
|
|
66
|
-
}, 'theia/markers/clearAll', nls_1.nls.getDefaultKey('Problems'));
|
|
67
|
-
})(ProblemsCommands = exports.ProblemsCommands || (exports.ProblemsCommands = {}));
|
|
68
|
-
let ProblemContribution = class ProblemContribution extends view_contribution_1.AbstractViewContribution {
|
|
69
|
-
constructor() {
|
|
70
|
-
super({
|
|
71
|
-
widgetId: problem_widget_1.PROBLEMS_WIDGET_ID,
|
|
72
|
-
widgetName: nls_1.nls.localizeByDefault('Problems'),
|
|
73
|
-
defaultWidgetOptions: {
|
|
74
|
-
area: 'bottom'
|
|
75
|
-
},
|
|
76
|
-
toggleCommandId: 'problemsView:toggle',
|
|
77
|
-
toggleKeybinding: 'ctrlcmd+shift+m'
|
|
78
|
-
});
|
|
79
|
-
this.updateStatusBarElement = debounce(() => this.setStatusBarElement(this.problemManager.getProblemStat()), 10);
|
|
80
|
-
}
|
|
81
|
-
onStart(app) {
|
|
82
|
-
this.updateStatusBarElement();
|
|
83
|
-
this.problemManager.onDidChangeMarkers(this.updateStatusBarElement);
|
|
84
|
-
}
|
|
85
|
-
async initializeLayout(app) {
|
|
86
|
-
await this.openView();
|
|
87
|
-
}
|
|
88
|
-
setStatusBarElement(problemStat) {
|
|
89
|
-
this.statusBar.setElement('problem-marker-status', {
|
|
90
|
-
text: problemStat.infos <= 0
|
|
91
|
-
? `$(codicon-error) ${problemStat.errors} $(codicon-warning) ${problemStat.warnings}`
|
|
92
|
-
: `$(codicon-error) ${problemStat.errors} $(codicon-warning) ${problemStat.warnings} $(codicon-info) ${problemStat.infos}`,
|
|
93
|
-
alignment: status_bar_1.StatusBarAlignment.LEFT,
|
|
94
|
-
priority: 10,
|
|
95
|
-
command: this.toggleCommand ? this.toggleCommand.id : undefined,
|
|
96
|
-
tooltip: this.getStatusBarTooltip(problemStat)
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
/**
|
|
100
|
-
* Get the tooltip to be displayed when hovering over the problem statusbar item.
|
|
101
|
-
* - Displays `No Problems` when no problems are present.
|
|
102
|
-
* - Displays a human-readable label which describes for each type of problem stat properties,
|
|
103
|
-
* their overall count and type when any one of these properties has a positive count.
|
|
104
|
-
* @param stat the problem stat describing the number of `errors`, `warnings` and `infos`.
|
|
105
|
-
*
|
|
106
|
-
* @return the tooltip to be displayed in the statusbar.
|
|
107
|
-
*/
|
|
108
|
-
getStatusBarTooltip(stat) {
|
|
109
|
-
if (stat.errors <= 0 && stat.warnings <= 0 && stat.infos <= 0) {
|
|
110
|
-
return nls_1.nls.localizeByDefault('No Problems');
|
|
111
|
-
}
|
|
112
|
-
const tooltip = [];
|
|
113
|
-
if (stat.errors > 0) {
|
|
114
|
-
tooltip.push(nls_1.nls.localizeByDefault('{0} Errors', stat.errors));
|
|
115
|
-
}
|
|
116
|
-
if (stat.warnings > 0) {
|
|
117
|
-
tooltip.push(nls_1.nls.localizeByDefault('{0} Warnings', stat.warnings));
|
|
118
|
-
}
|
|
119
|
-
if (stat.infos > 0) {
|
|
120
|
-
tooltip.push(nls_1.nls.localizeByDefault('{0} Infos', stat.infos));
|
|
121
|
-
}
|
|
122
|
-
return tooltip.join(', ');
|
|
123
|
-
}
|
|
124
|
-
registerCommands(commands) {
|
|
125
|
-
super.registerCommands(commands);
|
|
126
|
-
commands.registerCommand(ProblemsCommands.COLLAPSE_ALL, {
|
|
127
|
-
execute: () => this.collapseAllProblems()
|
|
128
|
-
});
|
|
129
|
-
commands.registerCommand(ProblemsCommands.COLLAPSE_ALL_TOOLBAR, {
|
|
130
|
-
isEnabled: widget => this.withWidget(widget, () => true),
|
|
131
|
-
isVisible: widget => this.withWidget(widget, () => true),
|
|
132
|
-
execute: widget => this.withWidget(widget, () => this.collapseAllProblems())
|
|
133
|
-
});
|
|
134
|
-
commands.registerCommand(ProblemsCommands.COPY, new problem_selection_1.ProblemSelection.CommandHandler(this.selectionService, {
|
|
135
|
-
multi: false,
|
|
136
|
-
isEnabled: () => true,
|
|
137
|
-
isVisible: () => true,
|
|
138
|
-
execute: selection => this.copy(selection)
|
|
139
|
-
}));
|
|
140
|
-
commands.registerCommand(ProblemsCommands.COPY_MESSAGE, new problem_selection_1.ProblemSelection.CommandHandler(this.selectionService, {
|
|
141
|
-
multi: false,
|
|
142
|
-
isEnabled: () => true,
|
|
143
|
-
isVisible: () => true,
|
|
144
|
-
execute: selection => this.copyMessage(selection)
|
|
145
|
-
}));
|
|
146
|
-
commands.registerCommand(ProblemsCommands.CLEAR_ALL, {
|
|
147
|
-
isEnabled: widget => this.withWidget(widget, () => true),
|
|
148
|
-
isVisible: widget => this.withWidget(widget, () => true),
|
|
149
|
-
execute: widget => this.withWidget(widget, () => this.problemManager.cleanAllMarkers())
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
registerMenus(menus) {
|
|
153
|
-
super.registerMenus(menus);
|
|
154
|
-
menus.registerMenuAction(ProblemsMenu.CLIPBOARD, {
|
|
155
|
-
commandId: ProblemsCommands.COPY.id,
|
|
156
|
-
label: nls_1.nls.localizeByDefault('Copy'),
|
|
157
|
-
order: '0'
|
|
158
|
-
});
|
|
159
|
-
menus.registerMenuAction(ProblemsMenu.CLIPBOARD, {
|
|
160
|
-
commandId: ProblemsCommands.COPY_MESSAGE.id,
|
|
161
|
-
label: nls_1.nls.localizeByDefault('Copy Message'),
|
|
162
|
-
order: '1'
|
|
163
|
-
});
|
|
164
|
-
menus.registerMenuAction(ProblemsMenu.PROBLEMS, {
|
|
165
|
-
commandId: ProblemsCommands.COLLAPSE_ALL.id,
|
|
166
|
-
label: nls_1.nls.localizeByDefault('Collapse All'),
|
|
167
|
-
order: '2'
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
async registerToolbarItems(toolbarRegistry) {
|
|
171
|
-
toolbarRegistry.registerItem({
|
|
172
|
-
id: ProblemsCommands.COLLAPSE_ALL_TOOLBAR.id,
|
|
173
|
-
command: ProblemsCommands.COLLAPSE_ALL_TOOLBAR.id,
|
|
174
|
-
tooltip: nls_1.nls.localizeByDefault('Collapse All'),
|
|
175
|
-
priority: 0,
|
|
176
|
-
});
|
|
177
|
-
toolbarRegistry.registerItem({
|
|
178
|
-
id: ProblemsCommands.CLEAR_ALL.id,
|
|
179
|
-
command: ProblemsCommands.CLEAR_ALL.id,
|
|
180
|
-
tooltip: ProblemsCommands.CLEAR_ALL.label,
|
|
181
|
-
priority: 1,
|
|
182
|
-
});
|
|
183
|
-
}
|
|
184
|
-
async collapseAllProblems() {
|
|
185
|
-
const { model } = await this.widget;
|
|
186
|
-
const root = model.root;
|
|
187
|
-
const firstChild = root.children[0];
|
|
188
|
-
root.children.forEach(child => browser_1.CompositeTreeNode.is(child) && model.collapseAll(child));
|
|
189
|
-
if (browser_1.SelectableTreeNode.is(firstChild)) {
|
|
190
|
-
model.selectNode(firstChild);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
addToClipboard(content) {
|
|
194
|
-
const handleCopy = (e) => {
|
|
195
|
-
document.removeEventListener('copy', handleCopy);
|
|
196
|
-
if (e.clipboardData) {
|
|
197
|
-
e.clipboardData.setData('text/plain', content);
|
|
198
|
-
e.preventDefault();
|
|
199
|
-
}
|
|
200
|
-
};
|
|
201
|
-
document.addEventListener('copy', handleCopy);
|
|
202
|
-
document.execCommand('copy');
|
|
203
|
-
}
|
|
204
|
-
copy(selection) {
|
|
205
|
-
const marker = selection.marker;
|
|
206
|
-
const serializedProblem = JSON.stringify({
|
|
207
|
-
resource: marker.uri,
|
|
208
|
-
owner: marker.owner,
|
|
209
|
-
code: marker.data.code,
|
|
210
|
-
severity: marker.data.severity,
|
|
211
|
-
message: marker.data.message,
|
|
212
|
-
source: marker.data.source,
|
|
213
|
-
startLineNumber: marker.data.range.start.line,
|
|
214
|
-
startColumn: marker.data.range.start.character,
|
|
215
|
-
endLineNumber: marker.data.range.end.line,
|
|
216
|
-
endColumn: marker.data.range.end.character
|
|
217
|
-
}, undefined, '\t');
|
|
218
|
-
this.addToClipboard(serializedProblem);
|
|
219
|
-
}
|
|
220
|
-
copyMessage(selection) {
|
|
221
|
-
const marker = selection.marker;
|
|
222
|
-
this.addToClipboard(marker.data.message);
|
|
223
|
-
}
|
|
224
|
-
withWidget(widget = this.tryGetWidget(), cb) {
|
|
225
|
-
if (widget instanceof problem_widget_1.ProblemWidget && widget.id === problem_widget_1.PROBLEMS_WIDGET_ID) {
|
|
226
|
-
return cb(widget);
|
|
227
|
-
}
|
|
228
|
-
return false;
|
|
229
|
-
}
|
|
230
|
-
};
|
|
231
|
-
__decorate([
|
|
232
|
-
(0, inversify_1.inject)(problem_manager_1.ProblemManager),
|
|
233
|
-
__metadata("design:type", problem_manager_1.ProblemManager)
|
|
234
|
-
], ProblemContribution.prototype, "problemManager", void 0);
|
|
235
|
-
__decorate([
|
|
236
|
-
(0, inversify_1.inject)(status_bar_1.StatusBar),
|
|
237
|
-
__metadata("design:type", Object)
|
|
238
|
-
], ProblemContribution.prototype, "statusBar", void 0);
|
|
239
|
-
__decorate([
|
|
240
|
-
(0, inversify_1.inject)(selection_service_1.SelectionService),
|
|
241
|
-
__metadata("design:type", selection_service_1.SelectionService)
|
|
242
|
-
], ProblemContribution.prototype, "selectionService", void 0);
|
|
243
|
-
ProblemContribution = __decorate([
|
|
244
|
-
(0, inversify_1.injectable)(),
|
|
245
|
-
__metadata("design:paramtypes", [])
|
|
246
|
-
], ProblemContribution);
|
|
247
|
-
exports.ProblemContribution = ProblemContribution;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2017 TypeFox and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
24
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
25
|
+
};
|
|
26
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
27
|
+
exports.ProblemContribution = exports.ProblemsCommands = exports.ProblemsMenu = exports.PROBLEMS_CONTEXT_MENU = void 0;
|
|
28
|
+
const debounce = require("@theia/core/shared/lodash.debounce");
|
|
29
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
30
|
+
const browser_1 = require("@theia/core/lib/browser");
|
|
31
|
+
const status_bar_1 = require("@theia/core/lib/browser/status-bar/status-bar");
|
|
32
|
+
const view_contribution_1 = require("@theia/core/lib/browser/shell/view-contribution");
|
|
33
|
+
const problem_marker_1 = require("../../common/problem-marker");
|
|
34
|
+
const problem_manager_1 = require("./problem-manager");
|
|
35
|
+
const problem_widget_1 = require("./problem-widget");
|
|
36
|
+
const command_1 = require("@theia/core/lib/common/command");
|
|
37
|
+
const selection_service_1 = require("@theia/core/lib/common/selection-service");
|
|
38
|
+
const problem_selection_1 = require("./problem-selection");
|
|
39
|
+
const nls_1 = require("@theia/core/lib/common/nls");
|
|
40
|
+
exports.PROBLEMS_CONTEXT_MENU = [problem_marker_1.PROBLEM_KIND];
|
|
41
|
+
var ProblemsMenu;
|
|
42
|
+
(function (ProblemsMenu) {
|
|
43
|
+
ProblemsMenu.CLIPBOARD = [...exports.PROBLEMS_CONTEXT_MENU, '1_clipboard'];
|
|
44
|
+
ProblemsMenu.PROBLEMS = [...exports.PROBLEMS_CONTEXT_MENU, '2_problems'];
|
|
45
|
+
})(ProblemsMenu = exports.ProblemsMenu || (exports.ProblemsMenu = {}));
|
|
46
|
+
var ProblemsCommands;
|
|
47
|
+
(function (ProblemsCommands) {
|
|
48
|
+
ProblemsCommands.COLLAPSE_ALL = {
|
|
49
|
+
id: 'problems.collapse.all'
|
|
50
|
+
};
|
|
51
|
+
ProblemsCommands.COLLAPSE_ALL_TOOLBAR = {
|
|
52
|
+
id: 'problems.collapse.all.toolbar',
|
|
53
|
+
iconClass: (0, browser_1.codicon)('collapse-all')
|
|
54
|
+
};
|
|
55
|
+
ProblemsCommands.COPY = {
|
|
56
|
+
id: 'problems.copy'
|
|
57
|
+
};
|
|
58
|
+
ProblemsCommands.COPY_MESSAGE = {
|
|
59
|
+
id: 'problems.copy.message',
|
|
60
|
+
};
|
|
61
|
+
ProblemsCommands.CLEAR_ALL = command_1.Command.toLocalizedCommand({
|
|
62
|
+
id: 'problems.clear.all',
|
|
63
|
+
category: 'Problems',
|
|
64
|
+
label: 'Clear All',
|
|
65
|
+
iconClass: (0, browser_1.codicon)('clear-all')
|
|
66
|
+
}, 'theia/markers/clearAll', nls_1.nls.getDefaultKey('Problems'));
|
|
67
|
+
})(ProblemsCommands = exports.ProblemsCommands || (exports.ProblemsCommands = {}));
|
|
68
|
+
let ProblemContribution = class ProblemContribution extends view_contribution_1.AbstractViewContribution {
|
|
69
|
+
constructor() {
|
|
70
|
+
super({
|
|
71
|
+
widgetId: problem_widget_1.PROBLEMS_WIDGET_ID,
|
|
72
|
+
widgetName: nls_1.nls.localizeByDefault('Problems'),
|
|
73
|
+
defaultWidgetOptions: {
|
|
74
|
+
area: 'bottom'
|
|
75
|
+
},
|
|
76
|
+
toggleCommandId: 'problemsView:toggle',
|
|
77
|
+
toggleKeybinding: 'ctrlcmd+shift+m'
|
|
78
|
+
});
|
|
79
|
+
this.updateStatusBarElement = debounce(() => this.setStatusBarElement(this.problemManager.getProblemStat()), 10);
|
|
80
|
+
}
|
|
81
|
+
onStart(app) {
|
|
82
|
+
this.updateStatusBarElement();
|
|
83
|
+
this.problemManager.onDidChangeMarkers(this.updateStatusBarElement);
|
|
84
|
+
}
|
|
85
|
+
async initializeLayout(app) {
|
|
86
|
+
await this.openView();
|
|
87
|
+
}
|
|
88
|
+
setStatusBarElement(problemStat) {
|
|
89
|
+
this.statusBar.setElement('problem-marker-status', {
|
|
90
|
+
text: problemStat.infos <= 0
|
|
91
|
+
? `$(codicon-error) ${problemStat.errors} $(codicon-warning) ${problemStat.warnings}`
|
|
92
|
+
: `$(codicon-error) ${problemStat.errors} $(codicon-warning) ${problemStat.warnings} $(codicon-info) ${problemStat.infos}`,
|
|
93
|
+
alignment: status_bar_1.StatusBarAlignment.LEFT,
|
|
94
|
+
priority: 10,
|
|
95
|
+
command: this.toggleCommand ? this.toggleCommand.id : undefined,
|
|
96
|
+
tooltip: this.getStatusBarTooltip(problemStat)
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Get the tooltip to be displayed when hovering over the problem statusbar item.
|
|
101
|
+
* - Displays `No Problems` when no problems are present.
|
|
102
|
+
* - Displays a human-readable label which describes for each type of problem stat properties,
|
|
103
|
+
* their overall count and type when any one of these properties has a positive count.
|
|
104
|
+
* @param stat the problem stat describing the number of `errors`, `warnings` and `infos`.
|
|
105
|
+
*
|
|
106
|
+
* @return the tooltip to be displayed in the statusbar.
|
|
107
|
+
*/
|
|
108
|
+
getStatusBarTooltip(stat) {
|
|
109
|
+
if (stat.errors <= 0 && stat.warnings <= 0 && stat.infos <= 0) {
|
|
110
|
+
return nls_1.nls.localizeByDefault('No Problems');
|
|
111
|
+
}
|
|
112
|
+
const tooltip = [];
|
|
113
|
+
if (stat.errors > 0) {
|
|
114
|
+
tooltip.push(nls_1.nls.localizeByDefault('{0} Errors', stat.errors));
|
|
115
|
+
}
|
|
116
|
+
if (stat.warnings > 0) {
|
|
117
|
+
tooltip.push(nls_1.nls.localizeByDefault('{0} Warnings', stat.warnings));
|
|
118
|
+
}
|
|
119
|
+
if (stat.infos > 0) {
|
|
120
|
+
tooltip.push(nls_1.nls.localizeByDefault('{0} Infos', stat.infos));
|
|
121
|
+
}
|
|
122
|
+
return tooltip.join(', ');
|
|
123
|
+
}
|
|
124
|
+
registerCommands(commands) {
|
|
125
|
+
super.registerCommands(commands);
|
|
126
|
+
commands.registerCommand(ProblemsCommands.COLLAPSE_ALL, {
|
|
127
|
+
execute: () => this.collapseAllProblems()
|
|
128
|
+
});
|
|
129
|
+
commands.registerCommand(ProblemsCommands.COLLAPSE_ALL_TOOLBAR, {
|
|
130
|
+
isEnabled: widget => this.withWidget(widget, () => true),
|
|
131
|
+
isVisible: widget => this.withWidget(widget, () => true),
|
|
132
|
+
execute: widget => this.withWidget(widget, () => this.collapseAllProblems())
|
|
133
|
+
});
|
|
134
|
+
commands.registerCommand(ProblemsCommands.COPY, new problem_selection_1.ProblemSelection.CommandHandler(this.selectionService, {
|
|
135
|
+
multi: false,
|
|
136
|
+
isEnabled: () => true,
|
|
137
|
+
isVisible: () => true,
|
|
138
|
+
execute: selection => this.copy(selection)
|
|
139
|
+
}));
|
|
140
|
+
commands.registerCommand(ProblemsCommands.COPY_MESSAGE, new problem_selection_1.ProblemSelection.CommandHandler(this.selectionService, {
|
|
141
|
+
multi: false,
|
|
142
|
+
isEnabled: () => true,
|
|
143
|
+
isVisible: () => true,
|
|
144
|
+
execute: selection => this.copyMessage(selection)
|
|
145
|
+
}));
|
|
146
|
+
commands.registerCommand(ProblemsCommands.CLEAR_ALL, {
|
|
147
|
+
isEnabled: widget => this.withWidget(widget, () => true),
|
|
148
|
+
isVisible: widget => this.withWidget(widget, () => true),
|
|
149
|
+
execute: widget => this.withWidget(widget, () => this.problemManager.cleanAllMarkers())
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
registerMenus(menus) {
|
|
153
|
+
super.registerMenus(menus);
|
|
154
|
+
menus.registerMenuAction(ProblemsMenu.CLIPBOARD, {
|
|
155
|
+
commandId: ProblemsCommands.COPY.id,
|
|
156
|
+
label: nls_1.nls.localizeByDefault('Copy'),
|
|
157
|
+
order: '0'
|
|
158
|
+
});
|
|
159
|
+
menus.registerMenuAction(ProblemsMenu.CLIPBOARD, {
|
|
160
|
+
commandId: ProblemsCommands.COPY_MESSAGE.id,
|
|
161
|
+
label: nls_1.nls.localizeByDefault('Copy Message'),
|
|
162
|
+
order: '1'
|
|
163
|
+
});
|
|
164
|
+
menus.registerMenuAction(ProblemsMenu.PROBLEMS, {
|
|
165
|
+
commandId: ProblemsCommands.COLLAPSE_ALL.id,
|
|
166
|
+
label: nls_1.nls.localizeByDefault('Collapse All'),
|
|
167
|
+
order: '2'
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
async registerToolbarItems(toolbarRegistry) {
|
|
171
|
+
toolbarRegistry.registerItem({
|
|
172
|
+
id: ProblemsCommands.COLLAPSE_ALL_TOOLBAR.id,
|
|
173
|
+
command: ProblemsCommands.COLLAPSE_ALL_TOOLBAR.id,
|
|
174
|
+
tooltip: nls_1.nls.localizeByDefault('Collapse All'),
|
|
175
|
+
priority: 0,
|
|
176
|
+
});
|
|
177
|
+
toolbarRegistry.registerItem({
|
|
178
|
+
id: ProblemsCommands.CLEAR_ALL.id,
|
|
179
|
+
command: ProblemsCommands.CLEAR_ALL.id,
|
|
180
|
+
tooltip: ProblemsCommands.CLEAR_ALL.label,
|
|
181
|
+
priority: 1,
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
async collapseAllProblems() {
|
|
185
|
+
const { model } = await this.widget;
|
|
186
|
+
const root = model.root;
|
|
187
|
+
const firstChild = root.children[0];
|
|
188
|
+
root.children.forEach(child => browser_1.CompositeTreeNode.is(child) && model.collapseAll(child));
|
|
189
|
+
if (browser_1.SelectableTreeNode.is(firstChild)) {
|
|
190
|
+
model.selectNode(firstChild);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
addToClipboard(content) {
|
|
194
|
+
const handleCopy = (e) => {
|
|
195
|
+
document.removeEventListener('copy', handleCopy);
|
|
196
|
+
if (e.clipboardData) {
|
|
197
|
+
e.clipboardData.setData('text/plain', content);
|
|
198
|
+
e.preventDefault();
|
|
199
|
+
}
|
|
200
|
+
};
|
|
201
|
+
document.addEventListener('copy', handleCopy);
|
|
202
|
+
document.execCommand('copy');
|
|
203
|
+
}
|
|
204
|
+
copy(selection) {
|
|
205
|
+
const marker = selection.marker;
|
|
206
|
+
const serializedProblem = JSON.stringify({
|
|
207
|
+
resource: marker.uri,
|
|
208
|
+
owner: marker.owner,
|
|
209
|
+
code: marker.data.code,
|
|
210
|
+
severity: marker.data.severity,
|
|
211
|
+
message: marker.data.message,
|
|
212
|
+
source: marker.data.source,
|
|
213
|
+
startLineNumber: marker.data.range.start.line,
|
|
214
|
+
startColumn: marker.data.range.start.character,
|
|
215
|
+
endLineNumber: marker.data.range.end.line,
|
|
216
|
+
endColumn: marker.data.range.end.character
|
|
217
|
+
}, undefined, '\t');
|
|
218
|
+
this.addToClipboard(serializedProblem);
|
|
219
|
+
}
|
|
220
|
+
copyMessage(selection) {
|
|
221
|
+
const marker = selection.marker;
|
|
222
|
+
this.addToClipboard(marker.data.message);
|
|
223
|
+
}
|
|
224
|
+
withWidget(widget = this.tryGetWidget(), cb) {
|
|
225
|
+
if (widget instanceof problem_widget_1.ProblemWidget && widget.id === problem_widget_1.PROBLEMS_WIDGET_ID) {
|
|
226
|
+
return cb(widget);
|
|
227
|
+
}
|
|
228
|
+
return false;
|
|
229
|
+
}
|
|
230
|
+
};
|
|
231
|
+
__decorate([
|
|
232
|
+
(0, inversify_1.inject)(problem_manager_1.ProblemManager),
|
|
233
|
+
__metadata("design:type", problem_manager_1.ProblemManager)
|
|
234
|
+
], ProblemContribution.prototype, "problemManager", void 0);
|
|
235
|
+
__decorate([
|
|
236
|
+
(0, inversify_1.inject)(status_bar_1.StatusBar),
|
|
237
|
+
__metadata("design:type", Object)
|
|
238
|
+
], ProblemContribution.prototype, "statusBar", void 0);
|
|
239
|
+
__decorate([
|
|
240
|
+
(0, inversify_1.inject)(selection_service_1.SelectionService),
|
|
241
|
+
__metadata("design:type", selection_service_1.SelectionService)
|
|
242
|
+
], ProblemContribution.prototype, "selectionService", void 0);
|
|
243
|
+
ProblemContribution = __decorate([
|
|
244
|
+
(0, inversify_1.injectable)(),
|
|
245
|
+
__metadata("design:paramtypes", [])
|
|
246
|
+
], ProblemContribution);
|
|
247
|
+
exports.ProblemContribution = ProblemContribution;
|
|
248
248
|
//# sourceMappingURL=problem-contribution.js.map
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
/// <reference types="lodash" />
|
|
2
|
-
import URI from '@theia/core/lib/common/uri';
|
|
3
|
-
import { Decoration, DecorationsProvider, DecorationsService } from '@theia/core/lib/browser/decorations-service';
|
|
4
|
-
import { ProblemManager } from './problem-manager';
|
|
5
|
-
import { FrontendApplicationContribution } from '@theia/core/lib/browser';
|
|
6
|
-
import { CancellationToken, Emitter, Event } from '@theia/core';
|
|
7
|
-
export declare class ProblemDecorationsProvider implements DecorationsProvider {
|
|
8
|
-
protected readonly problemManager: ProblemManager;
|
|
9
|
-
protected currentUris: URI[];
|
|
10
|
-
protected readonly onDidChangeEmitter: Emitter<URI[]>;
|
|
11
|
-
get onDidChange(): Event<URI[]>;
|
|
12
|
-
protected init(): void;
|
|
13
|
-
protected fireDidDecorationsChanged: import("lodash").DebouncedFunc<() => void>;
|
|
14
|
-
protected doFireDidDecorationsChanged(): void;
|
|
15
|
-
provideDecorations(uri: URI, token: CancellationToken): Decoration | Promise<Decoration | undefined> | undefined;
|
|
16
|
-
}
|
|
17
|
-
export declare class ProblemDecorationContribution implements FrontendApplicationContribution {
|
|
18
|
-
protected readonly decorationsService: DecorationsService;
|
|
19
|
-
protected readonly problemDecorationProvider: ProblemDecorationsProvider;
|
|
20
|
-
initialize(): void;
|
|
21
|
-
}
|
|
1
|
+
/// <reference types="lodash" />
|
|
2
|
+
import URI from '@theia/core/lib/common/uri';
|
|
3
|
+
import { Decoration, DecorationsProvider, DecorationsService } from '@theia/core/lib/browser/decorations-service';
|
|
4
|
+
import { ProblemManager } from './problem-manager';
|
|
5
|
+
import { FrontendApplicationContribution } from '@theia/core/lib/browser';
|
|
6
|
+
import { CancellationToken, Emitter, Event } from '@theia/core';
|
|
7
|
+
export declare class ProblemDecorationsProvider implements DecorationsProvider {
|
|
8
|
+
protected readonly problemManager: ProblemManager;
|
|
9
|
+
protected currentUris: URI[];
|
|
10
|
+
protected readonly onDidChangeEmitter: Emitter<URI[]>;
|
|
11
|
+
get onDidChange(): Event<URI[]>;
|
|
12
|
+
protected init(): void;
|
|
13
|
+
protected fireDidDecorationsChanged: import("lodash").DebouncedFunc<() => void>;
|
|
14
|
+
protected doFireDidDecorationsChanged(): void;
|
|
15
|
+
provideDecorations(uri: URI, token: CancellationToken): Decoration | Promise<Decoration | undefined> | undefined;
|
|
16
|
+
}
|
|
17
|
+
export declare class ProblemDecorationContribution implements FrontendApplicationContribution {
|
|
18
|
+
protected readonly decorationsService: DecorationsService;
|
|
19
|
+
protected readonly problemDecorationProvider: ProblemDecorationsProvider;
|
|
20
|
+
initialize(): void;
|
|
21
|
+
}
|
|
22
22
|
//# sourceMappingURL=problem-decorations-provider.d.ts.map
|