@theia/markers 1.53.0-next.5 → 1.53.0-next.55

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 (29) hide show
  1. package/README.md +33 -33
  2. package/package.json +6 -6
  3. package/src/browser/index.ts +18 -18
  4. package/src/browser/marker-manager.ts +205 -205
  5. package/src/browser/marker-tree-label-provider.spec.ts +245 -245
  6. package/src/browser/marker-tree-label-provider.ts +75 -75
  7. package/src/browser/marker-tree-model.ts +47 -47
  8. package/src/browser/marker-tree.ts +154 -154
  9. package/src/browser/problem/problem-composite-tree-node.spec.ts +277 -277
  10. package/src/browser/problem/problem-composite-tree-node.ts +86 -86
  11. package/src/browser/problem/problem-container.ts +47 -47
  12. package/src/browser/problem/problem-contribution.ts +247 -247
  13. package/src/browser/problem/problem-decorations-provider.ts +72 -72
  14. package/src/browser/problem/problem-decorator.ts +222 -222
  15. package/src/browser/problem/problem-frontend-module.ts +64 -64
  16. package/src/browser/problem/problem-layout-migrations.ts +32 -32
  17. package/src/browser/problem/problem-manager.spec.ts +216 -216
  18. package/src/browser/problem/problem-manager.ts +51 -51
  19. package/src/browser/problem/problem-preferences.ts +64 -64
  20. package/src/browser/problem/problem-selection.ts +45 -45
  21. package/src/browser/problem/problem-tabbar-decorator.ts +151 -151
  22. package/src/browser/problem/problem-tree-model.spec.ts +189 -189
  23. package/src/browser/problem/problem-tree-model.ts +133 -133
  24. package/src/browser/problem/problem-utils.ts +90 -90
  25. package/src/browser/problem/problem-widget-tab-bar-decorator.ts +55 -55
  26. package/src/browser/problem/problem-widget.tsx +246 -246
  27. package/src/browser/style/index.css +92 -92
  28. package/src/common/marker.ts +53 -53
  29. package/src/common/problem-marker.ts +30 -30
package/README.md CHANGED
@@ -1,33 +1,33 @@
1
- <div align='center'>
2
-
3
- <br />
4
-
5
- <img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
6
-
7
- <h2>ECLIPSE THEIA - MARKERS EXTENSION</h2>
8
-
9
- <hr />
10
-
11
- </div>
12
-
13
- ## Description
14
-
15
- The `@theia/markers` adds support for file markers (diagnostic markers (`errors`, `warnings`, `infos`, `hint`)) for a given file.
16
- The extension contributes, the following:
17
- - `problems view`: a dedicated view to viewing diagnostic markers contributed by language-servers, linters, task problem matchers for the workspace
18
- - `marker decoration`: ability to decorate different components of the application based on markers (ex: file explorer)
19
-
20
- ## Additional Information
21
-
22
- - [API documentation for `@theia/markers`](https://eclipse-theia.github.io/theia/docs/next/modules/markers.html)
23
- - [Theia - GitHub](https://github.com/eclipse-theia/theia)
24
- - [Theia - Website](https://theia-ide.org/)
25
-
26
- ## License
27
-
28
- - [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
29
- - [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
30
-
31
- ## Trademark
32
- "Theia" is a trademark of the Eclipse Foundation
33
- https://www.eclipse.org/theia
1
+ <div align='center'>
2
+
3
+ <br />
4
+
5
+ <img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
6
+
7
+ <h2>ECLIPSE THEIA - MARKERS EXTENSION</h2>
8
+
9
+ <hr />
10
+
11
+ </div>
12
+
13
+ ## Description
14
+
15
+ The `@theia/markers` adds support for file markers (diagnostic markers (`errors`, `warnings`, `infos`, `hint`)) for a given file.
16
+ The extension contributes, the following:
17
+ - `problems view`: a dedicated view to viewing diagnostic markers contributed by language-servers, linters, task problem matchers for the workspace
18
+ - `marker decoration`: ability to decorate different components of the application based on markers (ex: file explorer)
19
+
20
+ ## Additional Information
21
+
22
+ - [API documentation for `@theia/markers`](https://eclipse-theia.github.io/theia/docs/next/modules/markers.html)
23
+ - [Theia - GitHub](https://github.com/eclipse-theia/theia)
24
+ - [Theia - Website](https://theia-ide.org/)
25
+
26
+ ## License
27
+
28
+ - [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
29
+ - [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
30
+
31
+ ## Trademark
32
+ "Theia" is a trademark of the Eclipse Foundation
33
+ https://www.eclipse.org/theia
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@theia/markers",
3
- "version": "1.53.0-next.5+1e5fb536d",
3
+ "version": "1.53.0-next.55+d1a989a68c",
4
4
  "description": "Theia - Markers Extension",
5
5
  "dependencies": {
6
- "@theia/core": "1.53.0-next.5+1e5fb536d",
7
- "@theia/filesystem": "1.53.0-next.5+1e5fb536d",
8
- "@theia/workspace": "1.53.0-next.5+1e5fb536d",
6
+ "@theia/core": "1.53.0-next.55+d1a989a68c",
7
+ "@theia/filesystem": "1.53.0-next.55+d1a989a68c",
8
+ "@theia/workspace": "1.53.0-next.55+d1a989a68c",
9
9
  "tslib": "^2.6.2"
10
10
  },
11
11
  "publishConfig": {
@@ -41,10 +41,10 @@
41
41
  "watch": "theiaext watch"
42
42
  },
43
43
  "devDependencies": {
44
- "@theia/ext-scripts": "1.52.0"
44
+ "@theia/ext-scripts": "1.53.0"
45
45
  },
46
46
  "nyc": {
47
47
  "extends": "../../configs/nyc.json"
48
48
  },
49
- "gitHead": "1e5fb536d65550ad8fa0fefcec731645b2afc74a"
49
+ "gitHead": "d1a989a68c1b5ec1f9098e9126653c6346844769"
50
50
  }
@@ -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
+ }