@theia/markers 1.34.3 → 1.34.4

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 (82) hide show
  1. package/LICENSE +641 -641
  2. package/README.md +33 -33
  3. package/lib/browser/index.d.ts +2 -2
  4. package/lib/browser/index.js +29 -29
  5. package/lib/browser/marker-manager.d.ts +47 -47
  6. package/lib/browser/marker-manager.js +187 -187
  7. package/lib/browser/marker-tree-label-provider.d.ts +15 -15
  8. package/lib/browser/marker-tree-label-provider.js +84 -84
  9. package/lib/browser/marker-tree-label-provider.spec.d.ts +1 -1
  10. package/lib/browser/marker-tree-label-provider.spec.js +201 -201
  11. package/lib/browser/marker-tree-model.d.ts +12 -12
  12. package/lib/browser/marker-tree-model.js +60 -60
  13. package/lib/browser/marker-tree.d.ts +42 -42
  14. package/lib/browser/marker-tree.js +143 -143
  15. package/lib/browser/problem/problem-composite-tree-node.d.ts +8 -8
  16. package/lib/browser/problem/problem-composite-tree-node.js +68 -68
  17. package/lib/browser/problem/problem-composite-tree-node.spec.d.ts +1 -1
  18. package/lib/browser/problem/problem-composite-tree-node.spec.js +216 -216
  19. package/lib/browser/problem/problem-container.d.ts +8 -8
  20. package/lib/browser/problem/problem-container.js +42 -42
  21. package/lib/browser/problem/problem-contribution.d.ts +51 -51
  22. package/lib/browser/problem/problem-contribution.js +247 -247
  23. package/lib/browser/problem/problem-decorations-provider.d.ts +18 -18
  24. package/lib/browser/problem/problem-decorations-provider.js +92 -92
  25. package/lib/browser/problem/problem-decorator.d.ts +57 -57
  26. package/lib/browser/problem/problem-decorator.js +233 -233
  27. package/lib/browser/problem/problem-frontend-module.d.ts +4 -4
  28. package/lib/browser/problem/problem-frontend-module.js +55 -55
  29. package/lib/browser/problem/problem-layout-migrations.d.ts +5 -5
  30. package/lib/browser/problem/problem-layout-migrations.js +43 -43
  31. package/lib/browser/problem/problem-manager.d.ts +11 -11
  32. package/lib/browser/problem/problem-manager.js +53 -53
  33. package/lib/browser/problem/problem-manager.spec.d.ts +1 -1
  34. package/lib/browser/problem/problem-manager.spec.js +167 -167
  35. package/lib/browser/problem/problem-preferences.d.ts +13 -13
  36. package/lib/browser/problem/problem-preferences.js +56 -56
  37. package/lib/browser/problem/problem-selection.d.ts +12 -12
  38. package/lib/browser/problem/problem-selection.js +34 -34
  39. package/lib/browser/problem/problem-tabbar-decorator.d.ts +42 -42
  40. package/lib/browser/problem/problem-tabbar-decorator.js +160 -160
  41. package/lib/browser/problem/problem-tree-model.d.ts +26 -26
  42. package/lib/browser/problem/problem-tree-model.js +122 -122
  43. package/lib/browser/problem/problem-tree-model.spec.d.ts +1 -1
  44. package/lib/browser/problem/problem-tree-model.spec.js +172 -172
  45. package/lib/browser/problem/problem-utils.d.ts +44 -44
  46. package/lib/browser/problem/problem-utils.js +84 -84
  47. package/lib/browser/problem/problem-widget-tab-bar-decorator.d.ts +14 -14
  48. package/lib/browser/problem/problem-widget-tab-bar-decorator.js +69 -69
  49. package/lib/browser/problem/problem-widget.d.ts +45 -45
  50. package/lib/browser/problem/problem-widget.js +231 -231
  51. package/lib/common/marker.d.ts +16 -16
  52. package/lib/common/marker.js +31 -31
  53. package/lib/common/problem-marker.d.ts +9 -9
  54. package/lib/common/problem-marker.js +27 -27
  55. package/package.json +6 -6
  56. package/src/browser/index.ts +18 -18
  57. package/src/browser/marker-manager.ts +205 -205
  58. package/src/browser/marker-tree-label-provider.spec.ts +245 -245
  59. package/src/browser/marker-tree-label-provider.ts +75 -75
  60. package/src/browser/marker-tree-model.ts +47 -47
  61. package/src/browser/marker-tree.ts +154 -154
  62. package/src/browser/problem/problem-composite-tree-node.spec.ts +255 -255
  63. package/src/browser/problem/problem-composite-tree-node.ts +68 -68
  64. package/src/browser/problem/problem-container.ts +47 -47
  65. package/src/browser/problem/problem-contribution.ts +247 -247
  66. package/src/browser/problem/problem-decorations-provider.ts +67 -67
  67. package/src/browser/problem/problem-decorator.ts +222 -222
  68. package/src/browser/problem/problem-frontend-module.ts +64 -64
  69. package/src/browser/problem/problem-layout-migrations.ts +32 -32
  70. package/src/browser/problem/problem-manager.spec.ts +216 -216
  71. package/src/browser/problem/problem-manager.ts +51 -51
  72. package/src/browser/problem/problem-preferences.ts +64 -64
  73. package/src/browser/problem/problem-selection.ts +45 -45
  74. package/src/browser/problem/problem-tabbar-decorator.ts +151 -151
  75. package/src/browser/problem/problem-tree-model.spec.ts +189 -189
  76. package/src/browser/problem/problem-tree-model.ts +113 -113
  77. package/src/browser/problem/problem-utils.ts +90 -90
  78. package/src/browser/problem/problem-widget-tab-bar-decorator.ts +55 -55
  79. package/src/browser/problem/problem-widget.tsx +241 -241
  80. package/src/browser/style/index.css +92 -92
  81. package/src/common/marker.ts +53 -53
  82. package/src/common/problem-marker.ts +30 -30
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@theia/markers",
3
- "version": "1.34.3",
3
+ "version": "1.34.4",
4
4
  "description": "Theia - Markers Extension",
5
5
  "dependencies": {
6
- "@theia/core": "1.34.3",
7
- "@theia/filesystem": "1.34.3",
8
- "@theia/workspace": "1.34.3"
6
+ "@theia/core": "1.34.4",
7
+ "@theia/filesystem": "1.34.4",
8
+ "@theia/workspace": "1.34.4"
9
9
  },
10
10
  "publishConfig": {
11
11
  "access": "public"
@@ -40,10 +40,10 @@
40
40
  "watch": "theiaext watch"
41
41
  },
42
42
  "devDependencies": {
43
- "@theia/ext-scripts": "1.34.3"
43
+ "@theia/ext-scripts": "1.34.4"
44
44
  },
45
45
  "nyc": {
46
46
  "extends": "../../configs/nyc.json"
47
47
  },
48
- "gitHead": "a6cf9fe96b1624d6e27a11dce2ebdeae820478e5"
48
+ "gitHead": "aa496bdc8cefaa76fe123cd0b233d816246d58a8"
49
49
  }
@@ -1,18 +1,18 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2017 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- export * from './marker-manager';
18
- export * from './problem/problem-manager';
1
+ // *****************************************************************************
2
+ // Copyright (C) 2017 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ export * from './marker-manager';
18
+ export * from './problem/problem-manager';
@@ -1,205 +1,205 @@
1
- // *****************************************************************************
2
- // Copyright (C) 2017 TypeFox and others.
3
- //
4
- // This program and the accompanying materials are made available under the
5
- // terms of the Eclipse Public License v. 2.0 which is available at
6
- // http://www.eclipse.org/legal/epl-2.0.
7
- //
8
- // This Source Code may also be made available under the following Secondary
9
- // Licenses when the conditions for such availability set forth in the Eclipse
10
- // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
- // with the GNU Classpath Exception which is available at
12
- // https://www.gnu.org/software/classpath/license.html.
13
- //
14
- // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
- // *****************************************************************************
16
-
17
- import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
18
- import { Event, Emitter } from '@theia/core/lib/common';
19
- import URI from '@theia/core/lib/common/uri';
20
- import { Marker } from '../common/marker';
21
- import { FileService } from '@theia/filesystem/lib/browser/file-service';
22
- import { FileChangesEvent, FileChangeType } from '@theia/filesystem/lib/common/files';
23
-
24
- /*
25
- * argument to the `findMarkers` method.
26
- */
27
- export interface SearchFilter<D> {
28
- uri?: URI,
29
- owner?: string,
30
- dataFilter?: (data: D) => boolean
31
- }
32
-
33
- export class MarkerCollection<T> {
34
-
35
- protected readonly owner2Markers = new Map<string, Readonly<Marker<T>>[]>();
36
-
37
- constructor(
38
- public readonly uri: URI,
39
- public readonly kind: string
40
- ) { }
41
-
42
- get empty(): boolean {
43
- return !this.owner2Markers.size;
44
- }
45
-
46
- getOwners(): string[] {
47
- return Array.from(this.owner2Markers.keys());
48
- }
49
-
50
- getMarkers(owner: string): Readonly<Marker<T>>[] {
51
- return this.owner2Markers.get(owner) || [];
52
- }
53
-
54
- setMarkers(owner: string, markerData: T[]): Marker<T>[] {
55
- const before = this.owner2Markers.get(owner);
56
- if (markerData.length > 0) {
57
- this.owner2Markers.set(owner, markerData.map(data => this.createMarker(owner, data)));
58
- } else {
59
- this.owner2Markers.delete(owner);
60
- }
61
- return before || [];
62
- }
63
-
64
- protected createMarker(owner: string, data: T): Readonly<Marker<T>> {
65
- return Object.freeze({
66
- uri: this.uri.toString(),
67
- kind: this.kind,
68
- owner: owner,
69
- data
70
- });
71
- }
72
-
73
- findMarkers(filter: SearchFilter<T>): Marker<T>[] {
74
- if (filter.owner) {
75
- if (this.owner2Markers.has(filter.owner)) {
76
- return this.filterMarkers(filter, this.owner2Markers.get(filter.owner));
77
- }
78
- return [];
79
- } else {
80
- const result: Marker<T>[] = [];
81
- for (const markers of this.owner2Markers.values()) {
82
- result.push(...this.filterMarkers(filter, markers));
83
- }
84
- return result;
85
- }
86
- }
87
-
88
- protected filterMarkers(filter: SearchFilter<T>, toFilter?: Marker<T>[]): Marker<T>[] {
89
- if (!toFilter) {
90
- return [];
91
- }
92
- if (filter.dataFilter) {
93
- return toFilter.filter(d => filter.dataFilter!(d.data));
94
- } else {
95
- return toFilter;
96
- }
97
- }
98
-
99
- }
100
-
101
- export interface Uri2MarkerEntry {
102
- uri: string
103
- markers: Owner2MarkerEntry[]
104
- }
105
-
106
- export interface Owner2MarkerEntry {
107
- owner: string
108
- markerData: object[];
109
- }
110
-
111
- @injectable()
112
- export abstract class MarkerManager<D extends object> {
113
-
114
- public abstract getKind(): string;
115
-
116
- protected readonly uri2MarkerCollection = new Map<string, MarkerCollection<D>>();
117
- protected readonly onDidChangeMarkersEmitter = new Emitter<URI>();
118
-
119
- @inject(FileService)
120
- protected readonly fileService: FileService;
121
-
122
- @postConstruct()
123
- protected init(): void {
124
- this.fileService.onDidFilesChange(event => {
125
- if (event.gotDeleted()) {
126
- this.cleanMarkers(event);
127
- }
128
- });
129
- }
130
-
131
- protected cleanMarkers(event: FileChangesEvent): void {
132
- for (const uriString of this.uri2MarkerCollection.keys()) {
133
- const uri = new URI(uriString);
134
- if (event.contains(uri, FileChangeType.DELETED)) {
135
- this.cleanAllMarkers(uri);
136
- }
137
- }
138
- }
139
-
140
- get onDidChangeMarkers(): Event<URI> {
141
- return this.onDidChangeMarkersEmitter.event;
142
- }
143
-
144
- protected fireOnDidChangeMarkers(uri: URI): void {
145
- this.onDidChangeMarkersEmitter.fire(uri);
146
- }
147
-
148
- /*
149
- * replaces the current markers for the given uri and owner with the given data.
150
- */
151
- setMarkers(uri: URI, owner: string, data: D[]): Marker<D>[] {
152
- const uriString = uri.toString();
153
- const collection = this.uri2MarkerCollection.get(uriString) || new MarkerCollection<D>(uri, this.getKind());
154
- const oldMarkers = collection.setMarkers(owner, data);
155
- if (collection.empty) {
156
- this.uri2MarkerCollection.delete(uri.toString());
157
- } else {
158
- this.uri2MarkerCollection.set(uriString, collection);
159
- }
160
- this.fireOnDidChangeMarkers(uri);
161
- return oldMarkers;
162
- }
163
-
164
- /*
165
- * returns all markers that satisfy the given filter.
166
- */
167
- findMarkers(filter: SearchFilter<D> = {}): Marker<D>[] {
168
- if (filter.uri) {
169
- const collection = this.uri2MarkerCollection.get(filter.uri.toString());
170
- return collection ? collection.findMarkers(filter) : [];
171
- }
172
- const result: Marker<D>[] = [];
173
- for (const uri of this.getUris()) {
174
- result.push(...this.uri2MarkerCollection.get(uri)!.findMarkers(filter));
175
- }
176
- return result;
177
- }
178
-
179
- getMarkersByUri(): IterableIterator<[string, MarkerCollection<D>]> {
180
- return this.uri2MarkerCollection.entries();
181
- }
182
-
183
- getUris(): IterableIterator<string> {
184
- return this.uri2MarkerCollection.keys();
185
- }
186
-
187
- cleanAllMarkers(uri?: URI): void {
188
- if (uri) {
189
- this.doCleanAllMarkers(uri);
190
- } else {
191
- for (const uriString of this.getUris()) {
192
- this.doCleanAllMarkers(new URI(uriString));
193
- }
194
- }
195
- }
196
- protected doCleanAllMarkers(uri: URI): void {
197
- const uriString = uri.toString();
198
- const collection = this.uri2MarkerCollection.get(uriString);
199
- if (collection !== undefined) {
200
- this.uri2MarkerCollection.delete(uriString);
201
- this.fireOnDidChangeMarkers(uri);
202
- }
203
- }
204
-
205
- }
1
+ // *****************************************************************************
2
+ // Copyright (C) 2017 TypeFox and others.
3
+ //
4
+ // This program and the accompanying materials are made available under the
5
+ // terms of the Eclipse Public License v. 2.0 which is available at
6
+ // http://www.eclipse.org/legal/epl-2.0.
7
+ //
8
+ // This Source Code may also be made available under the following Secondary
9
+ // Licenses when the conditions for such availability set forth in the Eclipse
10
+ // Public License v. 2.0 are satisfied: GNU General Public License, version 2
11
+ // with the GNU Classpath Exception which is available at
12
+ // https://www.gnu.org/software/classpath/license.html.
13
+ //
14
+ // SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
+ // *****************************************************************************
16
+
17
+ import { injectable, inject, postConstruct } from '@theia/core/shared/inversify';
18
+ import { Event, Emitter } from '@theia/core/lib/common';
19
+ import URI from '@theia/core/lib/common/uri';
20
+ import { Marker } from '../common/marker';
21
+ import { FileService } from '@theia/filesystem/lib/browser/file-service';
22
+ import { FileChangesEvent, FileChangeType } from '@theia/filesystem/lib/common/files';
23
+
24
+ /*
25
+ * argument to the `findMarkers` method.
26
+ */
27
+ export interface SearchFilter<D> {
28
+ uri?: URI,
29
+ owner?: string,
30
+ dataFilter?: (data: D) => boolean
31
+ }
32
+
33
+ export class MarkerCollection<T> {
34
+
35
+ protected readonly owner2Markers = new Map<string, Readonly<Marker<T>>[]>();
36
+
37
+ constructor(
38
+ public readonly uri: URI,
39
+ public readonly kind: string
40
+ ) { }
41
+
42
+ get empty(): boolean {
43
+ return !this.owner2Markers.size;
44
+ }
45
+
46
+ getOwners(): string[] {
47
+ return Array.from(this.owner2Markers.keys());
48
+ }
49
+
50
+ getMarkers(owner: string): Readonly<Marker<T>>[] {
51
+ return this.owner2Markers.get(owner) || [];
52
+ }
53
+
54
+ setMarkers(owner: string, markerData: T[]): Marker<T>[] {
55
+ const before = this.owner2Markers.get(owner);
56
+ if (markerData.length > 0) {
57
+ this.owner2Markers.set(owner, markerData.map(data => this.createMarker(owner, data)));
58
+ } else {
59
+ this.owner2Markers.delete(owner);
60
+ }
61
+ return before || [];
62
+ }
63
+
64
+ protected createMarker(owner: string, data: T): Readonly<Marker<T>> {
65
+ return Object.freeze({
66
+ uri: this.uri.toString(),
67
+ kind: this.kind,
68
+ owner: owner,
69
+ data
70
+ });
71
+ }
72
+
73
+ findMarkers(filter: SearchFilter<T>): Marker<T>[] {
74
+ if (filter.owner) {
75
+ if (this.owner2Markers.has(filter.owner)) {
76
+ return this.filterMarkers(filter, this.owner2Markers.get(filter.owner));
77
+ }
78
+ return [];
79
+ } else {
80
+ const result: Marker<T>[] = [];
81
+ for (const markers of this.owner2Markers.values()) {
82
+ result.push(...this.filterMarkers(filter, markers));
83
+ }
84
+ return result;
85
+ }
86
+ }
87
+
88
+ protected filterMarkers(filter: SearchFilter<T>, toFilter?: Marker<T>[]): Marker<T>[] {
89
+ if (!toFilter) {
90
+ return [];
91
+ }
92
+ if (filter.dataFilter) {
93
+ return toFilter.filter(d => filter.dataFilter!(d.data));
94
+ } else {
95
+ return toFilter;
96
+ }
97
+ }
98
+
99
+ }
100
+
101
+ export interface Uri2MarkerEntry {
102
+ uri: string
103
+ markers: Owner2MarkerEntry[]
104
+ }
105
+
106
+ export interface Owner2MarkerEntry {
107
+ owner: string
108
+ markerData: object[];
109
+ }
110
+
111
+ @injectable()
112
+ export abstract class MarkerManager<D extends object> {
113
+
114
+ public abstract getKind(): string;
115
+
116
+ protected readonly uri2MarkerCollection = new Map<string, MarkerCollection<D>>();
117
+ protected readonly onDidChangeMarkersEmitter = new Emitter<URI>();
118
+
119
+ @inject(FileService)
120
+ protected readonly fileService: FileService;
121
+
122
+ @postConstruct()
123
+ protected init(): void {
124
+ this.fileService.onDidFilesChange(event => {
125
+ if (event.gotDeleted()) {
126
+ this.cleanMarkers(event);
127
+ }
128
+ });
129
+ }
130
+
131
+ protected cleanMarkers(event: FileChangesEvent): void {
132
+ for (const uriString of this.uri2MarkerCollection.keys()) {
133
+ const uri = new URI(uriString);
134
+ if (event.contains(uri, FileChangeType.DELETED)) {
135
+ this.cleanAllMarkers(uri);
136
+ }
137
+ }
138
+ }
139
+
140
+ get onDidChangeMarkers(): Event<URI> {
141
+ return this.onDidChangeMarkersEmitter.event;
142
+ }
143
+
144
+ protected fireOnDidChangeMarkers(uri: URI): void {
145
+ this.onDidChangeMarkersEmitter.fire(uri);
146
+ }
147
+
148
+ /*
149
+ * replaces the current markers for the given uri and owner with the given data.
150
+ */
151
+ setMarkers(uri: URI, owner: string, data: D[]): Marker<D>[] {
152
+ const uriString = uri.toString();
153
+ const collection = this.uri2MarkerCollection.get(uriString) || new MarkerCollection<D>(uri, this.getKind());
154
+ const oldMarkers = collection.setMarkers(owner, data);
155
+ if (collection.empty) {
156
+ this.uri2MarkerCollection.delete(uri.toString());
157
+ } else {
158
+ this.uri2MarkerCollection.set(uriString, collection);
159
+ }
160
+ this.fireOnDidChangeMarkers(uri);
161
+ return oldMarkers;
162
+ }
163
+
164
+ /*
165
+ * returns all markers that satisfy the given filter.
166
+ */
167
+ findMarkers(filter: SearchFilter<D> = {}): Marker<D>[] {
168
+ if (filter.uri) {
169
+ const collection = this.uri2MarkerCollection.get(filter.uri.toString());
170
+ return collection ? collection.findMarkers(filter) : [];
171
+ }
172
+ const result: Marker<D>[] = [];
173
+ for (const uri of this.getUris()) {
174
+ result.push(...this.uri2MarkerCollection.get(uri)!.findMarkers(filter));
175
+ }
176
+ return result;
177
+ }
178
+
179
+ getMarkersByUri(): IterableIterator<[string, MarkerCollection<D>]> {
180
+ return this.uri2MarkerCollection.entries();
181
+ }
182
+
183
+ getUris(): IterableIterator<string> {
184
+ return this.uri2MarkerCollection.keys();
185
+ }
186
+
187
+ cleanAllMarkers(uri?: URI): void {
188
+ if (uri) {
189
+ this.doCleanAllMarkers(uri);
190
+ } else {
191
+ for (const uriString of this.getUris()) {
192
+ this.doCleanAllMarkers(new URI(uriString));
193
+ }
194
+ }
195
+ }
196
+ protected doCleanAllMarkers(uri: URI): void {
197
+ const uriString = uri.toString();
198
+ const collection = this.uri2MarkerCollection.get(uriString);
199
+ if (collection !== undefined) {
200
+ this.uri2MarkerCollection.delete(uriString);
201
+ this.fireOnDidChangeMarkers(uri);
202
+ }
203
+ }
204
+
205
+ }