@theia/markers 1.45.0 → 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,57 +1,57 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2019 Ericsson 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
- exports.bindProblemPreferences = exports.createProblemPreferences = exports.ProblemPreferences = exports.ProblemPreferenceContribution = exports.ProblemConfigSchema = void 0;
19
- const browser_1 = require("@theia/core/lib/browser");
20
- const nls_1 = require("@theia/core/lib/common/nls");
21
- exports.ProblemConfigSchema = {
22
- 'type': 'object',
23
- 'properties': {
24
- 'problems.decorations.enabled': {
25
- 'type': 'boolean',
26
- 'description': nls_1.nls.localizeByDefault('Show Errors & Warnings on files and folder.'),
27
- 'default': true,
28
- },
29
- 'problems.decorations.tabbar.enabled': {
30
- 'type': 'boolean',
31
- 'description': nls_1.nls.localize('theia/markers/tabbarDecorationsEnabled', 'Show problem decorators (diagnostic markers) in the tab bars.'),
32
- 'default': true
33
- },
34
- 'problems.autoReveal': {
35
- 'type': 'boolean',
36
- 'description': nls_1.nls.localizeByDefault('Controls whether Problems view should automatically reveal files when opening them.'),
37
- 'default': true
38
- }
39
- }
40
- };
41
- exports.ProblemPreferenceContribution = Symbol('ProblemPreferenceContribution');
42
- exports.ProblemPreferences = Symbol('ProblemPreferences');
43
- function createProblemPreferences(preferences, schema = exports.ProblemConfigSchema) {
44
- return (0, browser_1.createPreferenceProxy)(preferences, schema);
45
- }
46
- exports.createProblemPreferences = createProblemPreferences;
47
- const bindProblemPreferences = (bind) => {
48
- bind(exports.ProblemPreferences).toDynamicValue(ctx => {
49
- const preferences = ctx.container.get(browser_1.PreferenceService);
50
- const contribution = ctx.container.get(exports.ProblemPreferenceContribution);
51
- return createProblemPreferences(preferences, contribution.schema);
52
- }).inSingletonScope();
53
- bind(exports.ProblemPreferenceContribution).toConstantValue({ schema: exports.ProblemConfigSchema });
54
- bind(browser_1.PreferenceContribution).toService(exports.ProblemPreferenceContribution);
55
- };
56
- exports.bindProblemPreferences = bindProblemPreferences;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2019 Ericsson 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
+ exports.bindProblemPreferences = exports.createProblemPreferences = exports.ProblemPreferences = exports.ProblemPreferenceContribution = exports.ProblemConfigSchema = void 0;
19
+ const browser_1 = require("@theia/core/lib/browser");
20
+ const nls_1 = require("@theia/core/lib/common/nls");
21
+ exports.ProblemConfigSchema = {
22
+ 'type': 'object',
23
+ 'properties': {
24
+ 'problems.decorations.enabled': {
25
+ 'type': 'boolean',
26
+ 'description': nls_1.nls.localizeByDefault('Show Errors & Warnings on files and folder.'),
27
+ 'default': true,
28
+ },
29
+ 'problems.decorations.tabbar.enabled': {
30
+ 'type': 'boolean',
31
+ 'description': nls_1.nls.localize('theia/markers/tabbarDecorationsEnabled', 'Show problem decorators (diagnostic markers) in the tab bars.'),
32
+ 'default': true
33
+ },
34
+ 'problems.autoReveal': {
35
+ 'type': 'boolean',
36
+ 'description': nls_1.nls.localizeByDefault('Controls whether Problems view should automatically reveal files when opening them.'),
37
+ 'default': true
38
+ }
39
+ }
40
+ };
41
+ exports.ProblemPreferenceContribution = Symbol('ProblemPreferenceContribution');
42
+ exports.ProblemPreferences = Symbol('ProblemPreferences');
43
+ function createProblemPreferences(preferences, schema = exports.ProblemConfigSchema) {
44
+ return (0, browser_1.createPreferenceProxy)(preferences, schema);
45
+ }
46
+ exports.createProblemPreferences = createProblemPreferences;
47
+ const bindProblemPreferences = (bind) => {
48
+ bind(exports.ProblemPreferences).toDynamicValue(ctx => {
49
+ const preferences = ctx.container.get(browser_1.PreferenceService);
50
+ const contribution = ctx.container.get(exports.ProblemPreferenceContribution);
51
+ return createProblemPreferences(preferences, contribution.schema);
52
+ }).inSingletonScope();
53
+ bind(exports.ProblemPreferenceContribution).toConstantValue({ schema: exports.ProblemConfigSchema });
54
+ bind(browser_1.PreferenceContribution).toService(exports.ProblemPreferenceContribution);
55
+ };
56
+ exports.bindProblemPreferences = bindProblemPreferences;
57
57
  //# sourceMappingURL=problem-preferences.js.map
@@ -1,13 +1,13 @@
1
- import { SelectionService } from '@theia/core/lib/common/selection-service';
2
- import { SelectionCommandHandler } from '@theia/core/lib/common/selection-command-handler';
3
- import { Marker } from '../../common/marker';
4
- export interface ProblemSelection {
5
- marker: Marker<object>;
6
- }
7
- export declare namespace ProblemSelection {
8
- function is(arg: unknown): arg is ProblemSelection;
9
- class CommandHandler extends SelectionCommandHandler<ProblemSelection> {
10
- constructor(selectionService: SelectionService, options: SelectionCommandHandler.Options<ProblemSelection>);
11
- }
12
- }
1
+ import { SelectionService } from '@theia/core/lib/common/selection-service';
2
+ import { SelectionCommandHandler } from '@theia/core/lib/common/selection-command-handler';
3
+ import { Marker } from '../../common/marker';
4
+ export interface ProblemSelection {
5
+ marker: Marker<object>;
6
+ }
7
+ export declare namespace ProblemSelection {
8
+ function is(arg: unknown): arg is ProblemSelection;
9
+ class CommandHandler extends SelectionCommandHandler<ProblemSelection> {
10
+ constructor(selectionService: SelectionService, options: SelectionCommandHandler.Options<ProblemSelection>);
11
+ }
12
+ }
13
13
  //# sourceMappingURL=problem-selection.d.ts.map
@@ -1,35 +1,35 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2019 Ericsson 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
- exports.ProblemSelection = void 0;
19
- const selection_command_handler_1 = require("@theia/core/lib/common/selection-command-handler");
20
- const common_1 = require("@theia/core/lib/common");
21
- const problem_marker_1 = require("../../common/problem-marker");
22
- var ProblemSelection;
23
- (function (ProblemSelection) {
24
- function is(arg) {
25
- return (0, common_1.isObject)(arg) && problem_marker_1.ProblemMarker.is(arg.marker);
26
- }
27
- ProblemSelection.is = is;
28
- class CommandHandler extends selection_command_handler_1.SelectionCommandHandler {
29
- constructor(selectionService, options) {
30
- super(selectionService, arg => ProblemSelection.is(arg) ? arg : undefined, options);
31
- }
32
- }
33
- ProblemSelection.CommandHandler = CommandHandler;
34
- })(ProblemSelection = exports.ProblemSelection || (exports.ProblemSelection = {}));
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2019 Ericsson 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
+ exports.ProblemSelection = void 0;
19
+ const selection_command_handler_1 = require("@theia/core/lib/common/selection-command-handler");
20
+ const common_1 = require("@theia/core/lib/common");
21
+ const problem_marker_1 = require("../../common/problem-marker");
22
+ var ProblemSelection;
23
+ (function (ProblemSelection) {
24
+ function is(arg) {
25
+ return (0, common_1.isObject)(arg) && problem_marker_1.ProblemMarker.is(arg.marker);
26
+ }
27
+ ProblemSelection.is = is;
28
+ class CommandHandler extends selection_command_handler_1.SelectionCommandHandler {
29
+ constructor(selectionService, options) {
30
+ super(selectionService, arg => ProblemSelection.is(arg) ? arg : undefined, options);
31
+ }
32
+ }
33
+ ProblemSelection.CommandHandler = CommandHandler;
34
+ })(ProblemSelection = exports.ProblemSelection || (exports.ProblemSelection = {}));
35
35
  //# sourceMappingURL=problem-selection.js.map
@@ -1,43 +1,43 @@
1
- import { Diagnostic } from '@theia/core/shared/vscode-languageserver-protocol';
2
- import { Event, Emitter } from '@theia/core/lib/common/event';
3
- import { Title, Widget } from '@theia/core/shared/@phosphor/widgets';
4
- import { WidgetDecoration } from '@theia/core/lib/browser/widget-decoration';
5
- import { TabBarDecorator } from '@theia/core/lib/browser/shell/tab-bar-decorator';
6
- import { Marker } from '../../common/marker';
7
- import { ProblemManager } from './problem-manager';
8
- import { ProblemPreferences, ProblemConfiguration } from './problem-preferences';
9
- import { PreferenceChangeEvent } from '@theia/core/lib/browser';
10
- export declare class ProblemTabBarDecorator implements TabBarDecorator {
11
- readonly id = "theia-problem-tabbar-decorator";
12
- protected readonly emitter: Emitter<void>;
13
- protected readonly preferences: ProblemPreferences;
14
- protected readonly problemManager: ProblemManager;
15
- protected init(): void;
16
- decorate(title: Title<Widget>): WidgetDecoration.Data[];
17
- get onDidChangeDecorations(): Event<void>;
18
- protected fireDidChangeDecorations(): void;
19
- /**
20
- * Handle changes in preference.
21
- * @param {PreferenceChangeEvent<ProblemConfiguration>} event The event of the changes in preference.
22
- */
23
- protected handlePreferenceChange(event: PreferenceChangeEvent<ProblemConfiguration>): Promise<void>;
24
- /**
25
- * Convert a diagnostic marker to a decorator.
26
- * @param {Marker<Diagnostic>} marker A diagnostic marker.
27
- * @returns {WidgetDecoration.Data} The decoration data.
28
- */
29
- protected toDecorator(marker: Marker<Diagnostic>): WidgetDecoration.Data;
30
- /**
31
- * Get the appropriate overlay icon for decoration.
32
- * @param {Marker<Diagnostic>} marker A diagnostic marker.
33
- * @returns {string} A string representing the overlay icon class.
34
- */
35
- protected getOverlayIcon(marker: Marker<Diagnostic>): string;
36
- /**
37
- * Get the appropriate overlay icon color for decoration.
38
- * @param {Marker<Diagnostic>} marker A diagnostic marker.
39
- * @returns {WidgetDecoration.Color} The decoration color.
40
- */
41
- protected getOverlayIconColor(marker: Marker<Diagnostic>): WidgetDecoration.Color;
42
- }
1
+ import { Diagnostic } from '@theia/core/shared/vscode-languageserver-protocol';
2
+ import { Event, Emitter } from '@theia/core/lib/common/event';
3
+ import { Title, Widget } from '@theia/core/shared/@phosphor/widgets';
4
+ import { WidgetDecoration } from '@theia/core/lib/browser/widget-decoration';
5
+ import { TabBarDecorator } from '@theia/core/lib/browser/shell/tab-bar-decorator';
6
+ import { Marker } from '../../common/marker';
7
+ import { ProblemManager } from './problem-manager';
8
+ import { ProblemPreferences, ProblemConfiguration } from './problem-preferences';
9
+ import { PreferenceChangeEvent } from '@theia/core/lib/browser';
10
+ export declare class ProblemTabBarDecorator implements TabBarDecorator {
11
+ readonly id = "theia-problem-tabbar-decorator";
12
+ protected readonly emitter: Emitter<void>;
13
+ protected readonly preferences: ProblemPreferences;
14
+ protected readonly problemManager: ProblemManager;
15
+ protected init(): void;
16
+ decorate(title: Title<Widget>): WidgetDecoration.Data[];
17
+ get onDidChangeDecorations(): Event<void>;
18
+ protected fireDidChangeDecorations(): void;
19
+ /**
20
+ * Handle changes in preference.
21
+ * @param {PreferenceChangeEvent<ProblemConfiguration>} event The event of the changes in preference.
22
+ */
23
+ protected handlePreferenceChange(event: PreferenceChangeEvent<ProblemConfiguration>): Promise<void>;
24
+ /**
25
+ * Convert a diagnostic marker to a decorator.
26
+ * @param {Marker<Diagnostic>} marker A diagnostic marker.
27
+ * @returns {WidgetDecoration.Data} The decoration data.
28
+ */
29
+ protected toDecorator(marker: Marker<Diagnostic>): WidgetDecoration.Data;
30
+ /**
31
+ * Get the appropriate overlay icon for decoration.
32
+ * @param {Marker<Diagnostic>} marker A diagnostic marker.
33
+ * @returns {string} A string representing the overlay icon class.
34
+ */
35
+ protected getOverlayIcon(marker: Marker<Diagnostic>): string;
36
+ /**
37
+ * Get the appropriate overlay icon color for decoration.
38
+ * @param {Marker<Diagnostic>} marker A diagnostic marker.
39
+ * @returns {WidgetDecoration.Color} The decoration color.
40
+ */
41
+ protected getOverlayIconColor(marker: Marker<Diagnostic>): WidgetDecoration.Color;
42
+ }
43
43
  //# sourceMappingURL=problem-tabbar-decorator.d.ts.map
@@ -1,161 +1,161 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2019 Ericsson 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.ProblemTabBarDecorator = void 0;
28
- const inversify_1 = require("@theia/core/shared/inversify");
29
- const vscode_languageserver_protocol_1 = require("@theia/core/shared/vscode-languageserver-protocol");
30
- const event_1 = require("@theia/core/lib/common/event");
31
- const widget_decoration_1 = require("@theia/core/lib/browser/widget-decoration");
32
- const problem_manager_1 = require("./problem-manager");
33
- const problem_preferences_1 = require("./problem-preferences");
34
- const browser_1 = require("@theia/core/lib/browser");
35
- let ProblemTabBarDecorator = class ProblemTabBarDecorator {
36
- constructor() {
37
- this.id = 'theia-problem-tabbar-decorator';
38
- this.emitter = new event_1.Emitter();
39
- }
40
- init() {
41
- this.problemManager.onDidChangeMarkers(() => this.fireDidChangeDecorations());
42
- this.preferences.onPreferenceChanged(event => this.handlePreferenceChange(event));
43
- }
44
- decorate(title) {
45
- if (!this.preferences['problems.decorations.tabbar.enabled']) {
46
- return [];
47
- }
48
- const widget = title.owner;
49
- if (browser_1.Navigatable.is(widget)) {
50
- const resourceUri = widget.getResourceUri();
51
- if (resourceUri) {
52
- // Get the list of problem markers for the given resource URI.
53
- const markers = this.problemManager.findMarkers({ uri: resourceUri });
54
- // If no markers are available, return early.
55
- if (markers.length === 0) {
56
- return [];
57
- }
58
- // Store the marker with the highest severity.
59
- let maxSeverity;
60
- // Iterate over available markers to determine that which has the highest severity.
61
- // Only display a decoration if an error or warning marker is available.
62
- for (const marker of markers) {
63
- // Break early if an error marker is present, since it represents the highest severity.
64
- if (marker.data.severity === vscode_languageserver_protocol_1.DiagnosticSeverity.Error) {
65
- maxSeverity = marker;
66
- break;
67
- }
68
- else if (marker.data.severity === vscode_languageserver_protocol_1.DiagnosticSeverity.Warning) {
69
- maxSeverity = marker;
70
- }
71
- }
72
- // Decorate the tabbar with the highest marker severity if available.
73
- return maxSeverity ? [this.toDecorator(maxSeverity)] : [];
74
- }
75
- }
76
- return [];
77
- }
78
- get onDidChangeDecorations() {
79
- return this.emitter.event;
80
- }
81
- fireDidChangeDecorations() {
82
- this.emitter.fire(undefined);
83
- }
84
- /**
85
- * Handle changes in preference.
86
- * @param {PreferenceChangeEvent<ProblemConfiguration>} event The event of the changes in preference.
87
- */
88
- async handlePreferenceChange(event) {
89
- const { preferenceName } = event;
90
- if (preferenceName === 'problems.decorations.tabbar.enabled') {
91
- this.fireDidChangeDecorations();
92
- }
93
- }
94
- /**
95
- * Convert a diagnostic marker to a decorator.
96
- * @param {Marker<Diagnostic>} marker A diagnostic marker.
97
- * @returns {WidgetDecoration.Data} The decoration data.
98
- */
99
- toDecorator(marker) {
100
- const position = widget_decoration_1.WidgetDecoration.IconOverlayPosition.BOTTOM_RIGHT;
101
- const icon = this.getOverlayIcon(marker);
102
- const color = this.getOverlayIconColor(marker);
103
- return {
104
- iconOverlay: {
105
- position,
106
- icon,
107
- color,
108
- background: {
109
- shape: 'circle',
110
- color: 'transparent'
111
- }
112
- }
113
- };
114
- }
115
- /**
116
- * Get the appropriate overlay icon for decoration.
117
- * @param {Marker<Diagnostic>} marker A diagnostic marker.
118
- * @returns {string} A string representing the overlay icon class.
119
- */
120
- getOverlayIcon(marker) {
121
- const { severity } = marker.data;
122
- switch (severity) {
123
- case 1: return 'times-circle';
124
- case 2: return 'exclamation-circle';
125
- case 3: return 'info-circle';
126
- default: return 'hand-o-up';
127
- }
128
- }
129
- /**
130
- * Get the appropriate overlay icon color for decoration.
131
- * @param {Marker<Diagnostic>} marker A diagnostic marker.
132
- * @returns {WidgetDecoration.Color} The decoration color.
133
- */
134
- getOverlayIconColor(marker) {
135
- const { severity } = marker.data;
136
- switch (severity) {
137
- case 1: return 'var(--theia-list-errorForeground)';
138
- case 2: return 'var(--theia-list-warningForeground)';
139
- default: return 'var(--theia-successBackground)';
140
- }
141
- }
142
- };
143
- __decorate([
144
- (0, inversify_1.inject)(problem_preferences_1.ProblemPreferences),
145
- __metadata("design:type", Object)
146
- ], ProblemTabBarDecorator.prototype, "preferences", void 0);
147
- __decorate([
148
- (0, inversify_1.inject)(problem_manager_1.ProblemManager),
149
- __metadata("design:type", problem_manager_1.ProblemManager)
150
- ], ProblemTabBarDecorator.prototype, "problemManager", void 0);
151
- __decorate([
152
- (0, inversify_1.postConstruct)(),
153
- __metadata("design:type", Function),
154
- __metadata("design:paramtypes", []),
155
- __metadata("design:returntype", void 0)
156
- ], ProblemTabBarDecorator.prototype, "init", null);
157
- ProblemTabBarDecorator = __decorate([
158
- (0, inversify_1.injectable)()
159
- ], ProblemTabBarDecorator);
160
- exports.ProblemTabBarDecorator = ProblemTabBarDecorator;
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2019 Ericsson 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.ProblemTabBarDecorator = void 0;
28
+ const inversify_1 = require("@theia/core/shared/inversify");
29
+ const vscode_languageserver_protocol_1 = require("@theia/core/shared/vscode-languageserver-protocol");
30
+ const event_1 = require("@theia/core/lib/common/event");
31
+ const widget_decoration_1 = require("@theia/core/lib/browser/widget-decoration");
32
+ const problem_manager_1 = require("./problem-manager");
33
+ const problem_preferences_1 = require("./problem-preferences");
34
+ const browser_1 = require("@theia/core/lib/browser");
35
+ let ProblemTabBarDecorator = class ProblemTabBarDecorator {
36
+ constructor() {
37
+ this.id = 'theia-problem-tabbar-decorator';
38
+ this.emitter = new event_1.Emitter();
39
+ }
40
+ init() {
41
+ this.problemManager.onDidChangeMarkers(() => this.fireDidChangeDecorations());
42
+ this.preferences.onPreferenceChanged(event => this.handlePreferenceChange(event));
43
+ }
44
+ decorate(title) {
45
+ if (!this.preferences['problems.decorations.tabbar.enabled']) {
46
+ return [];
47
+ }
48
+ const widget = title.owner;
49
+ if (browser_1.Navigatable.is(widget)) {
50
+ const resourceUri = widget.getResourceUri();
51
+ if (resourceUri) {
52
+ // Get the list of problem markers for the given resource URI.
53
+ const markers = this.problemManager.findMarkers({ uri: resourceUri });
54
+ // If no markers are available, return early.
55
+ if (markers.length === 0) {
56
+ return [];
57
+ }
58
+ // Store the marker with the highest severity.
59
+ let maxSeverity;
60
+ // Iterate over available markers to determine that which has the highest severity.
61
+ // Only display a decoration if an error or warning marker is available.
62
+ for (const marker of markers) {
63
+ // Break early if an error marker is present, since it represents the highest severity.
64
+ if (marker.data.severity === vscode_languageserver_protocol_1.DiagnosticSeverity.Error) {
65
+ maxSeverity = marker;
66
+ break;
67
+ }
68
+ else if (marker.data.severity === vscode_languageserver_protocol_1.DiagnosticSeverity.Warning) {
69
+ maxSeverity = marker;
70
+ }
71
+ }
72
+ // Decorate the tabbar with the highest marker severity if available.
73
+ return maxSeverity ? [this.toDecorator(maxSeverity)] : [];
74
+ }
75
+ }
76
+ return [];
77
+ }
78
+ get onDidChangeDecorations() {
79
+ return this.emitter.event;
80
+ }
81
+ fireDidChangeDecorations() {
82
+ this.emitter.fire(undefined);
83
+ }
84
+ /**
85
+ * Handle changes in preference.
86
+ * @param {PreferenceChangeEvent<ProblemConfiguration>} event The event of the changes in preference.
87
+ */
88
+ async handlePreferenceChange(event) {
89
+ const { preferenceName } = event;
90
+ if (preferenceName === 'problems.decorations.tabbar.enabled') {
91
+ this.fireDidChangeDecorations();
92
+ }
93
+ }
94
+ /**
95
+ * Convert a diagnostic marker to a decorator.
96
+ * @param {Marker<Diagnostic>} marker A diagnostic marker.
97
+ * @returns {WidgetDecoration.Data} The decoration data.
98
+ */
99
+ toDecorator(marker) {
100
+ const position = widget_decoration_1.WidgetDecoration.IconOverlayPosition.BOTTOM_RIGHT;
101
+ const icon = this.getOverlayIcon(marker);
102
+ const color = this.getOverlayIconColor(marker);
103
+ return {
104
+ iconOverlay: {
105
+ position,
106
+ icon,
107
+ color,
108
+ background: {
109
+ shape: 'circle',
110
+ color: 'transparent'
111
+ }
112
+ }
113
+ };
114
+ }
115
+ /**
116
+ * Get the appropriate overlay icon for decoration.
117
+ * @param {Marker<Diagnostic>} marker A diagnostic marker.
118
+ * @returns {string} A string representing the overlay icon class.
119
+ */
120
+ getOverlayIcon(marker) {
121
+ const { severity } = marker.data;
122
+ switch (severity) {
123
+ case 1: return 'times-circle';
124
+ case 2: return 'exclamation-circle';
125
+ case 3: return 'info-circle';
126
+ default: return 'hand-o-up';
127
+ }
128
+ }
129
+ /**
130
+ * Get the appropriate overlay icon color for decoration.
131
+ * @param {Marker<Diagnostic>} marker A diagnostic marker.
132
+ * @returns {WidgetDecoration.Color} The decoration color.
133
+ */
134
+ getOverlayIconColor(marker) {
135
+ const { severity } = marker.data;
136
+ switch (severity) {
137
+ case 1: return 'var(--theia-list-errorForeground)';
138
+ case 2: return 'var(--theia-list-warningForeground)';
139
+ default: return 'var(--theia-successBackground)';
140
+ }
141
+ }
142
+ };
143
+ __decorate([
144
+ (0, inversify_1.inject)(problem_preferences_1.ProblemPreferences),
145
+ __metadata("design:type", Object)
146
+ ], ProblemTabBarDecorator.prototype, "preferences", void 0);
147
+ __decorate([
148
+ (0, inversify_1.inject)(problem_manager_1.ProblemManager),
149
+ __metadata("design:type", problem_manager_1.ProblemManager)
150
+ ], ProblemTabBarDecorator.prototype, "problemManager", void 0);
151
+ __decorate([
152
+ (0, inversify_1.postConstruct)(),
153
+ __metadata("design:type", Function),
154
+ __metadata("design:paramtypes", []),
155
+ __metadata("design:returntype", void 0)
156
+ ], ProblemTabBarDecorator.prototype, "init", null);
157
+ ProblemTabBarDecorator = __decorate([
158
+ (0, inversify_1.injectable)()
159
+ ], ProblemTabBarDecorator);
160
+ exports.ProblemTabBarDecorator = ProblemTabBarDecorator;
161
161
  //# sourceMappingURL=problem-tabbar-decorator.js.map