@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.
Files changed (81) hide show
  1. package/README.md +33 -33
  2. package/lib/browser/index.d.ts +2 -2
  3. package/lib/browser/index.js +29 -29
  4. package/lib/browser/marker-manager.d.ts +47 -47
  5. package/lib/browser/marker-manager.js +187 -187
  6. package/lib/browser/marker-tree-label-provider.d.ts +15 -15
  7. package/lib/browser/marker-tree-label-provider.js +84 -84
  8. package/lib/browser/marker-tree-label-provider.spec.d.ts +1 -1
  9. package/lib/browser/marker-tree-label-provider.spec.js +201 -201
  10. package/lib/browser/marker-tree-model.d.ts +12 -12
  11. package/lib/browser/marker-tree-model.js +60 -60
  12. package/lib/browser/marker-tree.d.ts +42 -42
  13. package/lib/browser/marker-tree.js +143 -143
  14. package/lib/browser/problem/problem-composite-tree-node.d.ts +11 -11
  15. package/lib/browser/problem/problem-composite-tree-node.js +76 -76
  16. package/lib/browser/problem/problem-composite-tree-node.spec.d.ts +1 -1
  17. package/lib/browser/problem/problem-composite-tree-node.spec.js +238 -238
  18. package/lib/browser/problem/problem-container.d.ts +8 -8
  19. package/lib/browser/problem/problem-container.js +46 -46
  20. package/lib/browser/problem/problem-contribution.d.ts +51 -51
  21. package/lib/browser/problem/problem-contribution.js +247 -247
  22. package/lib/browser/problem/problem-decorations-provider.d.ts +21 -21
  23. package/lib/browser/problem/problem-decorations-provider.js +95 -95
  24. package/lib/browser/problem/problem-decorator.d.ts +57 -57
  25. package/lib/browser/problem/problem-decorator.js +233 -233
  26. package/lib/browser/problem/problem-frontend-module.d.ts +4 -4
  27. package/lib/browser/problem/problem-frontend-module.js +55 -55
  28. package/lib/browser/problem/problem-layout-migrations.d.ts +5 -5
  29. package/lib/browser/problem/problem-layout-migrations.js +43 -43
  30. package/lib/browser/problem/problem-manager.d.ts +11 -11
  31. package/lib/browser/problem/problem-manager.js +53 -53
  32. package/lib/browser/problem/problem-manager.spec.d.ts +1 -1
  33. package/lib/browser/problem/problem-manager.spec.js +167 -167
  34. package/lib/browser/problem/problem-preferences.d.ts +13 -13
  35. package/lib/browser/problem/problem-preferences.js +56 -56
  36. package/lib/browser/problem/problem-selection.d.ts +12 -12
  37. package/lib/browser/problem/problem-selection.js +34 -34
  38. package/lib/browser/problem/problem-tabbar-decorator.d.ts +42 -42
  39. package/lib/browser/problem/problem-tabbar-decorator.js +160 -160
  40. package/lib/browser/problem/problem-tree-model.d.ts +32 -32
  41. package/lib/browser/problem/problem-tree-model.js +131 -131
  42. package/lib/browser/problem/problem-tree-model.spec.d.ts +1 -1
  43. package/lib/browser/problem/problem-tree-model.spec.js +172 -172
  44. package/lib/browser/problem/problem-utils.d.ts +44 -44
  45. package/lib/browser/problem/problem-utils.js +84 -84
  46. package/lib/browser/problem/problem-widget-tab-bar-decorator.d.ts +14 -14
  47. package/lib/browser/problem/problem-widget-tab-bar-decorator.js +69 -69
  48. package/lib/browser/problem/problem-widget.d.ts +46 -46
  49. package/lib/browser/problem/problem-widget.js +235 -235
  50. package/lib/common/marker.d.ts +16 -16
  51. package/lib/common/marker.js +31 -31
  52. package/lib/common/problem-marker.d.ts +9 -9
  53. package/lib/common/problem-marker.js +27 -27
  54. package/package.json +6 -6
  55. package/src/browser/index.ts +18 -18
  56. package/src/browser/marker-manager.ts +205 -205
  57. package/src/browser/marker-tree-label-provider.spec.ts +245 -245
  58. package/src/browser/marker-tree-label-provider.ts +75 -75
  59. package/src/browser/marker-tree-model.ts +47 -47
  60. package/src/browser/marker-tree.ts +154 -154
  61. package/src/browser/problem/problem-composite-tree-node.spec.ts +277 -277
  62. package/src/browser/problem/problem-composite-tree-node.ts +81 -81
  63. package/src/browser/problem/problem-container.ts +47 -47
  64. package/src/browser/problem/problem-contribution.ts +247 -247
  65. package/src/browser/problem/problem-decorations-provider.ts +72 -72
  66. package/src/browser/problem/problem-decorator.ts +222 -222
  67. package/src/browser/problem/problem-frontend-module.ts +64 -64
  68. package/src/browser/problem/problem-layout-migrations.ts +32 -32
  69. package/src/browser/problem/problem-manager.spec.ts +216 -216
  70. package/src/browser/problem/problem-manager.ts +51 -51
  71. package/src/browser/problem/problem-preferences.ts +64 -64
  72. package/src/browser/problem/problem-selection.ts +45 -45
  73. package/src/browser/problem/problem-tabbar-decorator.ts +151 -151
  74. package/src/browser/problem/problem-tree-model.spec.ts +189 -189
  75. package/src/browser/problem/problem-tree-model.ts +124 -124
  76. package/src/browser/problem/problem-utils.ts +90 -90
  77. package/src/browser/problem/problem-widget-tab-bar-decorator.ts +55 -55
  78. package/src/browser/problem/problem-widget.tsx +246 -246
  79. package/src/browser/style/index.css +92 -92
  80. package/src/common/marker.ts +53 -53
  81. package/src/common/problem-marker.ts +30 -30
@@ -1,234 +1,234 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2018 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
- var __param = (this && this.__param) || function (paramIndex, decorator) {
27
- return function (target, key) { decorator(target, key, paramIndex); }
28
- };
29
- var ProblemDecorator_1;
30
- Object.defineProperty(exports, "__esModule", { value: true });
31
- exports.ProblemDecorator = void 0;
32
- const inversify_1 = require("@theia/core/shared/inversify");
33
- const vscode_languageserver_protocol_1 = require("@theia/core/shared/vscode-languageserver-protocol");
34
- const event_1 = require("@theia/core/lib/common/event");
35
- const tree_iterator_1 = require("@theia/core/lib/browser/tree/tree-iterator");
36
- const tree_decorator_1 = require("@theia/core/lib/browser/tree/tree-decorator");
37
- const browser_1 = require("@theia/filesystem/lib/browser");
38
- const problem_manager_1 = require("./problem-manager");
39
- const problem_preferences_1 = require("./problem-preferences");
40
- const problem_utils_1 = require("./problem-utils");
41
- const browser_2 = require("@theia/core/lib/browser");
42
- const browser_3 = require("@theia/workspace/lib/browser");
43
- /**
44
- * @deprecated since 1.25.0
45
- * URI-based decorators should implement `DecorationsProvider` and contribute decorations via the `DecorationsService`.
46
- */
47
- let ProblemDecorator = ProblemDecorator_1 = class ProblemDecorator {
48
- constructor(problemManager) {
49
- this.problemManager = problemManager;
50
- this.id = 'theia-problem-decorator';
51
- this.emitter = new event_1.Emitter();
52
- this.problemManager.onDidChangeMarkers(() => this.fireDidChangeDecorations((tree) => this.collectDecorators(tree)));
53
- }
54
- init() {
55
- this.problemPreferences.onPreferenceChanged(event => {
56
- if (event.preferenceName === 'problems.decorations.enabled') {
57
- this.fireDidChangeDecorations(tree => this.collectDecorators(tree));
58
- }
59
- });
60
- this.workspaceService.onWorkspaceChanged(() => {
61
- this.fireDidChangeDecorations((tree) => this.collectDecorators(tree));
62
- });
63
- this.workspaceService.onWorkspaceLocationChanged(() => {
64
- this.fireDidChangeDecorations((tree) => this.collectDecorators(tree));
65
- });
66
- }
67
- async decorations(tree) {
68
- return this.collectDecorators(tree);
69
- }
70
- get onDidChangeDecorations() {
71
- return this.emitter.event;
72
- }
73
- fireDidChangeDecorations(event) {
74
- this.emitter.fire(event);
75
- }
76
- collectDecorators(tree) {
77
- const decorations = new Map();
78
- // If the tree root is undefined or the preference for the decorations is disabled, return an empty result map.
79
- if (!tree.root || !this.problemPreferences['problems.decorations.enabled']) {
80
- return decorations;
81
- }
82
- const baseDecorations = this.collectMarkers(tree);
83
- for (const node of new tree_iterator_1.DepthFirstTreeIterator(tree.root)) {
84
- const nodeUri = this.getUriFromNode(node);
85
- if (nodeUri) {
86
- const decorator = baseDecorations.get(nodeUri);
87
- if (decorator) {
88
- this.appendContainerMarkers(node, decorator, decorations);
89
- }
90
- if (decorator) {
91
- decorations.set(node.id, decorator);
92
- }
93
- }
94
- }
95
- return decorations;
96
- }
97
- generateCaptionSuffix(nodeURI) {
98
- var _a;
99
- const workspaceRoots = this.workspaceService.tryGetRoots();
100
- const parentWorkspace = this.workspaceService.getWorkspaceRootUri(nodeURI);
101
- let workspacePrefixString = '';
102
- let separator = '';
103
- let filePathString = '';
104
- const nodeURIDir = nodeURI.parent;
105
- if (parentWorkspace) {
106
- const relativeDirFromWorkspace = parentWorkspace.relative(nodeURIDir);
107
- workspacePrefixString = workspaceRoots.length > 1 ? this.labelProvider.getName(parentWorkspace) : '';
108
- filePathString = (_a = relativeDirFromWorkspace === null || relativeDirFromWorkspace === void 0 ? void 0 : relativeDirFromWorkspace.fsPath()) !== null && _a !== void 0 ? _a : '';
109
- separator = filePathString && workspacePrefixString ? ' \u2022 ' : ''; // add a bullet point between workspace and path
110
- }
111
- else {
112
- workspacePrefixString = nodeURIDir.path.fsPath();
113
- }
114
- return `${workspacePrefixString}${separator}${filePathString}`;
115
- }
116
- /**
117
- * Traverses up the tree from the given node and attaches decorations to any parents.
118
- */
119
- appendContainerMarkers(node, decoration, decorations) {
120
- let parent = node === null || node === void 0 ? void 0 : node.parent;
121
- while (parent) {
122
- const existing = decorations.get(parent.id);
123
- // Make sure the highest diagnostic severity (smaller number) will be propagated to the container directory.
124
- if (existing === undefined || this.compareDecorators(existing, decoration) < 0) {
125
- decorations.set(parent.id, decoration);
126
- parent = parent.parent;
127
- }
128
- else {
129
- break;
130
- }
131
- }
132
- }
133
- /**
134
- * @returns a map matching stringified URI's to a decoration whose features reflect the highest-severity problem found
135
- * and the number of problems found (based on {@link ProblemDecorator.toDecorator })
136
- */
137
- collectMarkers(tree) {
138
- const decorationsForUri = new Map();
139
- const compare = this.compare.bind(this);
140
- const filter = this.filterMarker.bind(this);
141
- for (const [, markers] of this.problemManager.getMarkersByUri()) {
142
- const relevant = markers.findMarkers({}).filter(filter).sort(compare);
143
- if (relevant.length) {
144
- decorationsForUri.set(relevant[0].uri, this.toDecorator(relevant));
145
- }
146
- }
147
- return decorationsForUri;
148
- }
149
- toDecorator(markers) {
150
- const color = this.getColor(markers[0]);
151
- const priority = this.getPriority(markers[0]);
152
- return {
153
- priority,
154
- fontData: {
155
- color,
156
- },
157
- tailDecorations: [{
158
- color,
159
- data: markers.length.toString(),
160
- }],
161
- };
162
- }
163
- getColor(marker) {
164
- const { severity } = marker.data;
165
- switch (severity) {
166
- case 1: return 'var(--theia-list-errorForeground)';
167
- case 2: return 'var(--theia-list-warningForeground)';
168
- default: return 'var(--theia-successBackground)';
169
- }
170
- }
171
- /**
172
- * Get the decoration for a given marker diagnostic.
173
- * Markers with higher severity have a higher priority and should be displayed.
174
- * @param marker the diagnostic marker.
175
- */
176
- getPriority(marker) {
177
- const { severity } = marker.data;
178
- switch (severity) {
179
- case 1: return 30; // Errors.
180
- case 2: return 20; // Warnings.
181
- case 3: return 10; // Infos.
182
- default: return 0;
183
- }
184
- }
185
- /**
186
- * Returns `true` if the diagnostic (`data`) of the marker argument has `Error`, `Warning`, or `Information` severity.
187
- * Otherwise, returns `false`.
188
- */
189
- filterMarker(marker) {
190
- const { severity } = marker.data;
191
- return severity === vscode_languageserver_protocol_1.DiagnosticSeverity.Error
192
- || severity === vscode_languageserver_protocol_1.DiagnosticSeverity.Warning
193
- || severity === vscode_languageserver_protocol_1.DiagnosticSeverity.Information;
194
- }
195
- getUriFromNode(node) {
196
- return browser_1.FileStatNode.getUri(node);
197
- }
198
- compare(left, right) {
199
- return ProblemDecorator_1.severityCompare(left, right);
200
- }
201
- compareDecorators(left, right) {
202
- return tree_decorator_1.TreeDecoration.Data.comparePriority(left, right);
203
- }
204
- };
205
- __decorate([
206
- (0, inversify_1.inject)(problem_preferences_1.ProblemPreferences),
207
- __metadata("design:type", Object)
208
- ], ProblemDecorator.prototype, "problemPreferences", void 0);
209
- __decorate([
210
- (0, inversify_1.inject)(browser_3.WorkspaceService),
211
- __metadata("design:type", browser_3.WorkspaceService)
212
- ], ProblemDecorator.prototype, "workspaceService", void 0);
213
- __decorate([
214
- (0, inversify_1.inject)(browser_2.LabelProvider),
215
- __metadata("design:type", browser_2.LabelProvider)
216
- ], ProblemDecorator.prototype, "labelProvider", void 0);
217
- __decorate([
218
- (0, inversify_1.postConstruct)(),
219
- __metadata("design:type", Function),
220
- __metadata("design:paramtypes", []),
221
- __metadata("design:returntype", void 0)
222
- ], ProblemDecorator.prototype, "init", null);
223
- ProblemDecorator = ProblemDecorator_1 = __decorate([
224
- (0, inversify_1.injectable)(),
225
- __param(0, (0, inversify_1.inject)(problem_manager_1.ProblemManager)),
226
- __metadata("design:paramtypes", [problem_manager_1.ProblemManager])
227
- ], ProblemDecorator);
228
- exports.ProblemDecorator = ProblemDecorator;
229
- (function (ProblemDecorator) {
230
- // Highest severities (errors) come first, then the others. Undefined severities treated as the last ones.
231
- ProblemDecorator.severityCompare = problem_utils_1.ProblemUtils.severityCompareMarker;
232
- })(ProblemDecorator = exports.ProblemDecorator || (exports.ProblemDecorator = {}));
233
- exports.ProblemDecorator = ProblemDecorator;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2018 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
+ var __param = (this && this.__param) || function (paramIndex, decorator) {
27
+ return function (target, key) { decorator(target, key, paramIndex); }
28
+ };
29
+ var ProblemDecorator_1;
30
+ Object.defineProperty(exports, "__esModule", { value: true });
31
+ exports.ProblemDecorator = void 0;
32
+ const inversify_1 = require("@theia/core/shared/inversify");
33
+ const vscode_languageserver_protocol_1 = require("@theia/core/shared/vscode-languageserver-protocol");
34
+ const event_1 = require("@theia/core/lib/common/event");
35
+ const tree_iterator_1 = require("@theia/core/lib/browser/tree/tree-iterator");
36
+ const tree_decorator_1 = require("@theia/core/lib/browser/tree/tree-decorator");
37
+ const browser_1 = require("@theia/filesystem/lib/browser");
38
+ const problem_manager_1 = require("./problem-manager");
39
+ const problem_preferences_1 = require("./problem-preferences");
40
+ const problem_utils_1 = require("./problem-utils");
41
+ const browser_2 = require("@theia/core/lib/browser");
42
+ const browser_3 = require("@theia/workspace/lib/browser");
43
+ /**
44
+ * @deprecated since 1.25.0
45
+ * URI-based decorators should implement `DecorationsProvider` and contribute decorations via the `DecorationsService`.
46
+ */
47
+ let ProblemDecorator = ProblemDecorator_1 = class ProblemDecorator {
48
+ constructor(problemManager) {
49
+ this.problemManager = problemManager;
50
+ this.id = 'theia-problem-decorator';
51
+ this.emitter = new event_1.Emitter();
52
+ this.problemManager.onDidChangeMarkers(() => this.fireDidChangeDecorations((tree) => this.collectDecorators(tree)));
53
+ }
54
+ init() {
55
+ this.problemPreferences.onPreferenceChanged(event => {
56
+ if (event.preferenceName === 'problems.decorations.enabled') {
57
+ this.fireDidChangeDecorations(tree => this.collectDecorators(tree));
58
+ }
59
+ });
60
+ this.workspaceService.onWorkspaceChanged(() => {
61
+ this.fireDidChangeDecorations((tree) => this.collectDecorators(tree));
62
+ });
63
+ this.workspaceService.onWorkspaceLocationChanged(() => {
64
+ this.fireDidChangeDecorations((tree) => this.collectDecorators(tree));
65
+ });
66
+ }
67
+ async decorations(tree) {
68
+ return this.collectDecorators(tree);
69
+ }
70
+ get onDidChangeDecorations() {
71
+ return this.emitter.event;
72
+ }
73
+ fireDidChangeDecorations(event) {
74
+ this.emitter.fire(event);
75
+ }
76
+ collectDecorators(tree) {
77
+ const decorations = new Map();
78
+ // If the tree root is undefined or the preference for the decorations is disabled, return an empty result map.
79
+ if (!tree.root || !this.problemPreferences['problems.decorations.enabled']) {
80
+ return decorations;
81
+ }
82
+ const baseDecorations = this.collectMarkers(tree);
83
+ for (const node of new tree_iterator_1.DepthFirstTreeIterator(tree.root)) {
84
+ const nodeUri = this.getUriFromNode(node);
85
+ if (nodeUri) {
86
+ const decorator = baseDecorations.get(nodeUri);
87
+ if (decorator) {
88
+ this.appendContainerMarkers(node, decorator, decorations);
89
+ }
90
+ if (decorator) {
91
+ decorations.set(node.id, decorator);
92
+ }
93
+ }
94
+ }
95
+ return decorations;
96
+ }
97
+ generateCaptionSuffix(nodeURI) {
98
+ var _a;
99
+ const workspaceRoots = this.workspaceService.tryGetRoots();
100
+ const parentWorkspace = this.workspaceService.getWorkspaceRootUri(nodeURI);
101
+ let workspacePrefixString = '';
102
+ let separator = '';
103
+ let filePathString = '';
104
+ const nodeURIDir = nodeURI.parent;
105
+ if (parentWorkspace) {
106
+ const relativeDirFromWorkspace = parentWorkspace.relative(nodeURIDir);
107
+ workspacePrefixString = workspaceRoots.length > 1 ? this.labelProvider.getName(parentWorkspace) : '';
108
+ filePathString = (_a = relativeDirFromWorkspace === null || relativeDirFromWorkspace === void 0 ? void 0 : relativeDirFromWorkspace.fsPath()) !== null && _a !== void 0 ? _a : '';
109
+ separator = filePathString && workspacePrefixString ? ' \u2022 ' : ''; // add a bullet point between workspace and path
110
+ }
111
+ else {
112
+ workspacePrefixString = nodeURIDir.path.fsPath();
113
+ }
114
+ return `${workspacePrefixString}${separator}${filePathString}`;
115
+ }
116
+ /**
117
+ * Traverses up the tree from the given node and attaches decorations to any parents.
118
+ */
119
+ appendContainerMarkers(node, decoration, decorations) {
120
+ let parent = node === null || node === void 0 ? void 0 : node.parent;
121
+ while (parent) {
122
+ const existing = decorations.get(parent.id);
123
+ // Make sure the highest diagnostic severity (smaller number) will be propagated to the container directory.
124
+ if (existing === undefined || this.compareDecorators(existing, decoration) < 0) {
125
+ decorations.set(parent.id, decoration);
126
+ parent = parent.parent;
127
+ }
128
+ else {
129
+ break;
130
+ }
131
+ }
132
+ }
133
+ /**
134
+ * @returns a map matching stringified URI's to a decoration whose features reflect the highest-severity problem found
135
+ * and the number of problems found (based on {@link ProblemDecorator.toDecorator })
136
+ */
137
+ collectMarkers(tree) {
138
+ const decorationsForUri = new Map();
139
+ const compare = this.compare.bind(this);
140
+ const filter = this.filterMarker.bind(this);
141
+ for (const [, markers] of this.problemManager.getMarkersByUri()) {
142
+ const relevant = markers.findMarkers({}).filter(filter).sort(compare);
143
+ if (relevant.length) {
144
+ decorationsForUri.set(relevant[0].uri, this.toDecorator(relevant));
145
+ }
146
+ }
147
+ return decorationsForUri;
148
+ }
149
+ toDecorator(markers) {
150
+ const color = this.getColor(markers[0]);
151
+ const priority = this.getPriority(markers[0]);
152
+ return {
153
+ priority,
154
+ fontData: {
155
+ color,
156
+ },
157
+ tailDecorations: [{
158
+ color,
159
+ data: markers.length.toString(),
160
+ }],
161
+ };
162
+ }
163
+ getColor(marker) {
164
+ const { severity } = marker.data;
165
+ switch (severity) {
166
+ case 1: return 'var(--theia-list-errorForeground)';
167
+ case 2: return 'var(--theia-list-warningForeground)';
168
+ default: return 'var(--theia-successBackground)';
169
+ }
170
+ }
171
+ /**
172
+ * Get the decoration for a given marker diagnostic.
173
+ * Markers with higher severity have a higher priority and should be displayed.
174
+ * @param marker the diagnostic marker.
175
+ */
176
+ getPriority(marker) {
177
+ const { severity } = marker.data;
178
+ switch (severity) {
179
+ case 1: return 30; // Errors.
180
+ case 2: return 20; // Warnings.
181
+ case 3: return 10; // Infos.
182
+ default: return 0;
183
+ }
184
+ }
185
+ /**
186
+ * Returns `true` if the diagnostic (`data`) of the marker argument has `Error`, `Warning`, or `Information` severity.
187
+ * Otherwise, returns `false`.
188
+ */
189
+ filterMarker(marker) {
190
+ const { severity } = marker.data;
191
+ return severity === vscode_languageserver_protocol_1.DiagnosticSeverity.Error
192
+ || severity === vscode_languageserver_protocol_1.DiagnosticSeverity.Warning
193
+ || severity === vscode_languageserver_protocol_1.DiagnosticSeverity.Information;
194
+ }
195
+ getUriFromNode(node) {
196
+ return browser_1.FileStatNode.getUri(node);
197
+ }
198
+ compare(left, right) {
199
+ return ProblemDecorator_1.severityCompare(left, right);
200
+ }
201
+ compareDecorators(left, right) {
202
+ return tree_decorator_1.TreeDecoration.Data.comparePriority(left, right);
203
+ }
204
+ };
205
+ __decorate([
206
+ (0, inversify_1.inject)(problem_preferences_1.ProblemPreferences),
207
+ __metadata("design:type", Object)
208
+ ], ProblemDecorator.prototype, "problemPreferences", void 0);
209
+ __decorate([
210
+ (0, inversify_1.inject)(browser_3.WorkspaceService),
211
+ __metadata("design:type", browser_3.WorkspaceService)
212
+ ], ProblemDecorator.prototype, "workspaceService", void 0);
213
+ __decorate([
214
+ (0, inversify_1.inject)(browser_2.LabelProvider),
215
+ __metadata("design:type", browser_2.LabelProvider)
216
+ ], ProblemDecorator.prototype, "labelProvider", void 0);
217
+ __decorate([
218
+ (0, inversify_1.postConstruct)(),
219
+ __metadata("design:type", Function),
220
+ __metadata("design:paramtypes", []),
221
+ __metadata("design:returntype", void 0)
222
+ ], ProblemDecorator.prototype, "init", null);
223
+ ProblemDecorator = ProblemDecorator_1 = __decorate([
224
+ (0, inversify_1.injectable)(),
225
+ __param(0, (0, inversify_1.inject)(problem_manager_1.ProblemManager)),
226
+ __metadata("design:paramtypes", [problem_manager_1.ProblemManager])
227
+ ], ProblemDecorator);
228
+ exports.ProblemDecorator = ProblemDecorator;
229
+ (function (ProblemDecorator) {
230
+ // Highest severities (errors) come first, then the others. Undefined severities treated as the last ones.
231
+ ProblemDecorator.severityCompare = problem_utils_1.ProblemUtils.severityCompareMarker;
232
+ })(ProblemDecorator = exports.ProblemDecorator || (exports.ProblemDecorator = {}));
233
+ exports.ProblemDecorator = ProblemDecorator;
234
234
  //# sourceMappingURL=problem-decorator.js.map
@@ -1,5 +1,5 @@
1
- import '../../../src/browser/style/index.css';
2
- import { ContainerModule } from '@theia/core/shared/inversify';
3
- declare const _default: ContainerModule;
4
- export default _default;
1
+ import '../../../src/browser/style/index.css';
2
+ import { ContainerModule } from '@theia/core/shared/inversify';
3
+ declare const _default: ContainerModule;
4
+ export default _default;
5
5
  //# sourceMappingURL=problem-frontend-module.d.ts.map
@@ -1,56 +1,56 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
18
- require("../../../src/browser/style/index.css");
19
- const inversify_1 = require("@theia/core/shared/inversify");
20
- const problem_widget_1 = require("./problem-widget");
21
- const problem_contribution_1 = require("./problem-contribution");
22
- const problem_container_1 = require("./problem-container");
23
- const browser_1 = require("@theia/core/lib/browser");
24
- const problem_manager_1 = require("./problem-manager");
25
- const widget_manager_1 = require("@theia/core/lib/browser/widget-manager");
26
- const problem_tabbar_decorator_1 = require("./problem-tabbar-decorator");
27
- const tab_bar_toolbar_1 = require("@theia/core/lib/browser/shell/tab-bar-toolbar");
28
- const problem_layout_migrations_1 = require("./problem-layout-migrations");
29
- const tab_bar_decorator_1 = require("@theia/core/lib/browser/shell/tab-bar-decorator");
30
- const problem_preferences_1 = require("./problem-preferences");
31
- const marker_tree_label_provider_1 = require("../marker-tree-label-provider");
32
- const problem_widget_tab_bar_decorator_1 = require("./problem-widget-tab-bar-decorator");
33
- const problem_decorations_provider_1 = require("./problem-decorations-provider");
34
- exports.default = new inversify_1.ContainerModule(bind => {
35
- (0, problem_preferences_1.bindProblemPreferences)(bind);
36
- bind(problem_manager_1.ProblemManager).toSelf().inSingletonScope();
37
- bind(problem_widget_1.ProblemWidget).toDynamicValue(ctx => (0, problem_container_1.createProblemWidget)(ctx.container));
38
- bind(widget_manager_1.WidgetFactory).toDynamicValue(context => ({
39
- id: problem_widget_1.PROBLEMS_WIDGET_ID,
40
- createWidget: () => context.container.get(problem_widget_1.ProblemWidget)
41
- }));
42
- bind(browser_1.ApplicationShellLayoutMigration).to(problem_layout_migrations_1.ProblemLayoutVersion3Migration).inSingletonScope();
43
- (0, browser_1.bindViewContribution)(bind, problem_contribution_1.ProblemContribution);
44
- bind(browser_1.FrontendApplicationContribution).toService(problem_contribution_1.ProblemContribution);
45
- bind(tab_bar_toolbar_1.TabBarToolbarContribution).toService(problem_contribution_1.ProblemContribution);
46
- bind(problem_decorations_provider_1.ProblemDecorationsProvider).toSelf().inSingletonScope();
47
- bind(problem_tabbar_decorator_1.ProblemTabBarDecorator).toSelf().inSingletonScope();
48
- bind(tab_bar_decorator_1.TabBarDecorator).toService(problem_tabbar_decorator_1.ProblemTabBarDecorator);
49
- bind(problem_decorations_provider_1.ProblemDecorationContribution).toSelf().inSingletonScope();
50
- bind(browser_1.FrontendApplicationContribution).toService(problem_decorations_provider_1.ProblemDecorationContribution);
51
- bind(marker_tree_label_provider_1.MarkerTreeLabelProvider).toSelf().inSingletonScope();
52
- bind(browser_1.LabelProviderContribution).toService(marker_tree_label_provider_1.MarkerTreeLabelProvider);
53
- bind(problem_widget_tab_bar_decorator_1.ProblemWidgetTabBarDecorator).toSelf().inSingletonScope();
54
- bind(tab_bar_decorator_1.TabBarDecorator).toService(problem_widget_tab_bar_decorator_1.ProblemWidgetTabBarDecorator);
55
- });
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
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ require("../../../src/browser/style/index.css");
19
+ const inversify_1 = require("@theia/core/shared/inversify");
20
+ const problem_widget_1 = require("./problem-widget");
21
+ const problem_contribution_1 = require("./problem-contribution");
22
+ const problem_container_1 = require("./problem-container");
23
+ const browser_1 = require("@theia/core/lib/browser");
24
+ const problem_manager_1 = require("./problem-manager");
25
+ const widget_manager_1 = require("@theia/core/lib/browser/widget-manager");
26
+ const problem_tabbar_decorator_1 = require("./problem-tabbar-decorator");
27
+ const tab_bar_toolbar_1 = require("@theia/core/lib/browser/shell/tab-bar-toolbar");
28
+ const problem_layout_migrations_1 = require("./problem-layout-migrations");
29
+ const tab_bar_decorator_1 = require("@theia/core/lib/browser/shell/tab-bar-decorator");
30
+ const problem_preferences_1 = require("./problem-preferences");
31
+ const marker_tree_label_provider_1 = require("../marker-tree-label-provider");
32
+ const problem_widget_tab_bar_decorator_1 = require("./problem-widget-tab-bar-decorator");
33
+ const problem_decorations_provider_1 = require("./problem-decorations-provider");
34
+ exports.default = new inversify_1.ContainerModule(bind => {
35
+ (0, problem_preferences_1.bindProblemPreferences)(bind);
36
+ bind(problem_manager_1.ProblemManager).toSelf().inSingletonScope();
37
+ bind(problem_widget_1.ProblemWidget).toDynamicValue(ctx => (0, problem_container_1.createProblemWidget)(ctx.container));
38
+ bind(widget_manager_1.WidgetFactory).toDynamicValue(context => ({
39
+ id: problem_widget_1.PROBLEMS_WIDGET_ID,
40
+ createWidget: () => context.container.get(problem_widget_1.ProblemWidget)
41
+ }));
42
+ bind(browser_1.ApplicationShellLayoutMigration).to(problem_layout_migrations_1.ProblemLayoutVersion3Migration).inSingletonScope();
43
+ (0, browser_1.bindViewContribution)(bind, problem_contribution_1.ProblemContribution);
44
+ bind(browser_1.FrontendApplicationContribution).toService(problem_contribution_1.ProblemContribution);
45
+ bind(tab_bar_toolbar_1.TabBarToolbarContribution).toService(problem_contribution_1.ProblemContribution);
46
+ bind(problem_decorations_provider_1.ProblemDecorationsProvider).toSelf().inSingletonScope();
47
+ bind(problem_tabbar_decorator_1.ProblemTabBarDecorator).toSelf().inSingletonScope();
48
+ bind(tab_bar_decorator_1.TabBarDecorator).toService(problem_tabbar_decorator_1.ProblemTabBarDecorator);
49
+ bind(problem_decorations_provider_1.ProblemDecorationContribution).toSelf().inSingletonScope();
50
+ bind(browser_1.FrontendApplicationContribution).toService(problem_decorations_provider_1.ProblemDecorationContribution);
51
+ bind(marker_tree_label_provider_1.MarkerTreeLabelProvider).toSelf().inSingletonScope();
52
+ bind(browser_1.LabelProviderContribution).toService(marker_tree_label_provider_1.MarkerTreeLabelProvider);
53
+ bind(problem_widget_tab_bar_decorator_1.ProblemWidgetTabBarDecorator).toSelf().inSingletonScope();
54
+ bind(tab_bar_decorator_1.TabBarDecorator).toService(problem_widget_tab_bar_decorator_1.ProblemWidgetTabBarDecorator);
55
+ });
56
56
  //# sourceMappingURL=problem-frontend-module.js.map
@@ -1,6 +1,6 @@
1
- import { ApplicationShellLayoutMigration, WidgetDescription } from '@theia/core/lib/browser/shell/shell-layout-restorer';
2
- export declare class ProblemLayoutVersion3Migration implements ApplicationShellLayoutMigration {
3
- readonly layoutVersion = 3;
4
- onWillInflateWidget(desc: WidgetDescription): WidgetDescription | undefined;
5
- }
1
+ import { ApplicationShellLayoutMigration, WidgetDescription } from '@theia/core/lib/browser/shell/shell-layout-restorer';
2
+ export declare class ProblemLayoutVersion3Migration implements ApplicationShellLayoutMigration {
3
+ readonly layoutVersion = 3;
4
+ onWillInflateWidget(desc: WidgetDescription): WidgetDescription | undefined;
5
+ }
6
6
  //# sourceMappingURL=problem-layout-migrations.d.ts.map