@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,28 +1,28 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2017 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.ProblemMarker = exports.PROBLEM_KIND = void 0;
19
- const marker_1 = require("./marker");
20
- exports.PROBLEM_KIND = 'problem';
21
- var ProblemMarker;
22
- (function (ProblemMarker) {
23
- function is(node) {
24
- return marker_1.Marker.is(node) && node.kind === exports.PROBLEM_KIND;
25
- }
26
- ProblemMarker.is = is;
27
- })(ProblemMarker = exports.ProblemMarker || (exports.ProblemMarker = {}));
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2017 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.ProblemMarker = exports.PROBLEM_KIND = void 0;
19
+ const marker_1 = require("./marker");
20
+ exports.PROBLEM_KIND = 'problem';
21
+ var ProblemMarker;
22
+ (function (ProblemMarker) {
23
+ function is(node) {
24
+ return marker_1.Marker.is(node) && node.kind === exports.PROBLEM_KIND;
25
+ }
26
+ ProblemMarker.is = is;
27
+ })(ProblemMarker = exports.ProblemMarker || (exports.ProblemMarker = {}));
28
28
  //# sourceMappingURL=problem-marker.js.map
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@theia/markers",
3
- "version": "1.45.0",
3
+ "version": "1.46.0-next.72+4a275b29d",
4
4
  "description": "Theia - Markers Extension",
5
5
  "dependencies": {
6
- "@theia/core": "1.45.0",
7
- "@theia/filesystem": "1.45.0",
8
- "@theia/workspace": "1.45.0"
6
+ "@theia/core": "1.46.0-next.72+4a275b29d",
7
+ "@theia/filesystem": "1.46.0-next.72+4a275b29d",
8
+ "@theia/workspace": "1.46.0-next.72+4a275b29d"
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.45.0"
43
+ "@theia/ext-scripts": "1.46.0"
44
44
  },
45
45
  "nyc": {
46
46
  "extends": "../../configs/nyc.json"
47
47
  },
48
- "gitHead": "2b20a60a0f9b54b19838a0f71760989a19622495"
48
+ "gitHead": "4a275b29d0db6c81190488c7f76cb667da05ef19"
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-only 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-only 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-only 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-only 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
+ }