@theia/plugin-ext 1.76.0-next.0 → 1.76.0-next.10
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.
- package/lib/main/browser/decorations/decorations-main.d.ts +1 -1
- package/lib/main/browser/decorations/decorations-main.d.ts.map +1 -1
- package/lib/main/browser/decorations/decorations-main.js +1 -1
- package/lib/main/browser/decorations/decorations-main.js.map +1 -1
- package/lib/plugin/decorations.d.ts.map +1 -1
- package/lib/plugin/decorations.js +6 -33
- package/lib/plugin/decorations.js.map +1 -1
- package/lib/plugin/decorations.spec.d.ts +2 -0
- package/lib/plugin/decorations.spec.d.ts.map +1 -0
- package/lib/plugin/decorations.spec.js +78 -0
- package/lib/plugin/decorations.spec.js.map +1 -0
- package/package.json +31 -31
- package/src/main/browser/decorations/decorations-main.ts +4 -4
- package/src/plugin/decorations.spec.ts +87 -0
- package/src/plugin/decorations.ts +6 -33
|
@@ -10,7 +10,7 @@ export declare class DecorationsMainImpl implements DecorationsMain, Disposable
|
|
|
10
10
|
constructor(rpc: RPCProtocol, container: interfaces.Container);
|
|
11
11
|
dispose(): void;
|
|
12
12
|
$registerDecorationProvider(handle: number): Promise<void>;
|
|
13
|
-
$onDidChange(handle: number, resources: UriComponents[]): void;
|
|
13
|
+
$onDidChange(handle: number, resources: UriComponents[] | null): void;
|
|
14
14
|
$unregisterDecorationProvider(handle: number): void;
|
|
15
15
|
}
|
|
16
16
|
//# sourceMappingURL=decorations-main.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorations-main.d.ts","sourceRoot":"","sources":["../../../../src/main/browser/decorations/decorations-main.ts"],"names":[],"mappings":"AAeA,OAAO,EAIH,eAAe,EAElB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAgE/D,qBAAa,mBAAoB,YAAW,eAAe,EAAE,UAAU;IAEnE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiB;IACvC,OAAO,CAAC,QAAQ,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"decorations-main.d.ts","sourceRoot":"","sources":["../../../../src/main/browser/decorations/decorations-main.ts"],"names":[],"mappings":"AAeA,OAAO,EAIH,eAAe,EAElB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAE1D,OAAO,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAC/D,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAgE/D,qBAAa,mBAAoB,YAAW,eAAe,EAAE,UAAU;IAEnE,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAiB;IACvC,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA+D;IACzF,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAqB;gBAE5C,GAAG,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,CAAC,SAAS;IAK7D,OAAO,IAAI,IAAI;IAKT,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAuBhE,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,aAAa,EAAE,GAAG,IAAI,GAAG,IAAI;IAQrE,6BAA6B,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;CAOtD"}
|
|
@@ -105,7 +105,7 @@ class DecorationsMainImpl {
|
|
|
105
105
|
const providerSet = this.providers.get(handle);
|
|
106
106
|
if (providerSet) {
|
|
107
107
|
const [emitter] = providerSet;
|
|
108
|
-
emitter.fire(resources
|
|
108
|
+
emitter.fire(resources ? resources.map(r => new uri_1.default(vscode_uri_1.URI.revive(r).toString())) : undefined);
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
$unregisterDecorationProvider(handle) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorations-main.js","sourceRoot":"","sources":["../../../../src/main/browser/decorations/decorations-main.ts"],"names":[],"mappings":";;;AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;AAChF,mEAMwC;AAGxC,wDAAuD;AAIvD,8DAAiE;AACjE,sEAAwE;AACxE,oDAA6C;AAC7C,qFAA6F;AAE7F;;;gGAGgG;AAChG,+IAA+I;AAE/I,MAAM,uBAAuB;IASzB,YACqB,KAAqB,EACrB,MAAc;QADd,UAAK,GAAL,KAAK,CAAgB;QACrB,WAAM,GAAN,MAAM,CAAQ;QAT3B,WAAM,GAAG,CAAC,CAAC;QACX,aAAQ,GAAG,IAAI,GAAG,EAA6B,CAAC;QAChD,aAAQ,GAAG,IAAI,GAAG,EAA0C,CAAC;IASrE,CAAC;IAED,OAAO,CAAC,GAAQ,EAAE,KAAwB;QACtC,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,MAAM,CAAC;QACzB,MAAM,MAAM,GAAG,IAAI,OAAO,CAAiB,OAAO,CAAC,EAAE;YACjD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,gBAAS,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC,CAAC;YACpE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC;YAC/B,IAAI,CAAC,YAAY,EAAE,CAAC;QAC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AAG,WAAW,CAAC;YAC9B,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,IAAI,aAAG,CAAC,gBAAS,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;QACtG,CAAC;IACL,CAAC;IAED,6BAA6B,CAAC,MAAc;QACxC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAC5C,IAAI,QAAQ,EAAE,CAAC;YACX,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;YACnC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;QAClC,CAAC;IACL,CAAC;CACJ;AAtDD,kDAsDC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorations.d.ts","sourceRoot":"","sources":["../../src/plugin/decorations.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,OAAO,EAEH,eAAe,EACf,iBAAiB,EACjB,cAAc,EAEM,UAAU,EACjC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"decorations.d.ts","sourceRoot":"","sources":["../../src/plugin/decorations.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,KAAK,MAAM,eAAe,CAAC;AACvC,OAAO,EAEH,eAAe,EACf,iBAAiB,EACjB,cAAc,EAEM,UAAU,EACjC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAc3D,qBAAa,kBAAmB,YAAW,cAAc;IAQzC,QAAQ,CAAC,GAAG,EAAE,WAAW;IAPrC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAK;IAC1B,OAAO,CAAC,MAAM,CAAC,YAAY,CAAO;IAElC,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA4B;IACzD,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAkB;IACxC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAe;gBAEjB,GAAG,EAAE,WAAW;IAMrC,8BAA8B,CAAC,QAAQ,EAAE,KAAK,CAAC,sBAAsB,EAAE,UAAU,EAAE,UAAU,GAAG,KAAK,CAAC,UAAU;IA+B1G,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,iBAAiB,EAAE,EAAE,KAAK,EAAE,iBAAiB,GAAG,OAAO,CAAC,eAAe,CAAC;CA6B/H"}
|
|
@@ -18,7 +18,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
18
18
|
exports.DecorationsExtImpl = void 0;
|
|
19
19
|
const plugin_api_rpc_1 = require("../common/plugin-api-rpc");
|
|
20
20
|
const types_impl_1 = require("./types-impl");
|
|
21
|
-
const path_1 = require("path");
|
|
22
21
|
const logger_1 = require("./logger");
|
|
23
22
|
class DecorationsExtImpl {
|
|
24
23
|
static { this.handle = 0; }
|
|
@@ -43,44 +42,18 @@ class DecorationsExtImpl {
|
|
|
43
42
|
this.proxy.$onDidChange(handle, array);
|
|
44
43
|
return;
|
|
45
44
|
}
|
|
46
|
-
// too many resources per event
|
|
47
|
-
//
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
let lastDirname;
|
|
53
|
-
for (const obj of uris) {
|
|
54
|
-
const myDirname = (0, path_1.dirname)(obj.uri.path);
|
|
55
|
-
if (lastDirname !== myDirname) {
|
|
56
|
-
lastDirname = myDirname;
|
|
57
|
-
if (picked.push(obj.uri) >= DecorationsExtImpl.maxEventSize) {
|
|
58
|
-
break outer;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
this.proxy.$onDidChange(handle, picked);
|
|
45
|
+
// too many resources per event: send a flush instead, so that the renderer
|
|
46
|
+
// drops cached data for this provider and re-fetches the decorations it
|
|
47
|
+
// displays on demand. Truncating the event (as upstream VS Code does by
|
|
48
|
+
// picking one resource per folder) loses decorations for the dropped
|
|
49
|
+
// resources, see https://github.com/eclipse-theia/theia/issues/17507
|
|
50
|
+
this.proxy.$onDidChange(handle, null);
|
|
64
51
|
});
|
|
65
52
|
return new types_impl_1.Disposable(() => {
|
|
66
53
|
listener?.dispose();
|
|
67
54
|
this.proxy.$unregisterDecorationProvider(handle);
|
|
68
55
|
this.providersMap.delete(handle);
|
|
69
56
|
});
|
|
70
|
-
function groupBy(data, compareFn) {
|
|
71
|
-
const result = [];
|
|
72
|
-
let currentGroup = undefined;
|
|
73
|
-
for (const element of data.slice(0).sort(compareFn)) {
|
|
74
|
-
if (!currentGroup || compareFn(currentGroup[0], element) !== 0) {
|
|
75
|
-
currentGroup = [element];
|
|
76
|
-
result.push(currentGroup);
|
|
77
|
-
}
|
|
78
|
-
else {
|
|
79
|
-
currentGroup.push(element);
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
return result;
|
|
83
|
-
}
|
|
84
57
|
}
|
|
85
58
|
async $provideDecorations(handle, requests, token) {
|
|
86
59
|
if (!this.providersMap.has(handle)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorations.js","sourceRoot":"","sources":["../../src/plugin/decorations.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,+CAA+C;AAC/C,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAA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AC3C,IAAI,CAAC;gBACD,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,OAAO,CAAC;gBAC5B,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAAC,gBAAG,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC;gBAC3F,IAAI,CAAC,IAAI,EAAE,CAAC;oBACR,OAAO;gBACX,CAAC;gBACD,IAAI,CAAC;oBACD,2BAAc,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;oBAC9B,MAAM,CAAC,EAAE,CAAC,GAAmB,CAAC,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,OAAO,EAAE,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;gBACxF,CAAC;gBAAC,OAAO,CAAC,EAAE,CAAC;oBACT,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,sCAAsC,UAAU,CAAC,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC;gBACrF,CAAC;YACL,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACX,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;YAC3B,CAAC;QACL,CAAC,CAAC,CAAC,CAAC;QAEJ,OAAO,MAAM,CAAC;IAClB,CAAC;;AAzEL,gDA0EC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorations.spec.d.ts","sourceRoot":"","sources":["../../src/plugin/decorations.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2026 Safi Seid-Ahmad, K2view 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
|
+
const event_1 = require("@theia/core/lib/common/event");
|
|
19
|
+
const chai = require("chai");
|
|
20
|
+
const plugin_api_rpc_1 = require("../common/plugin-api-rpc");
|
|
21
|
+
const decorations_1 = require("./decorations");
|
|
22
|
+
const types_impl_1 = require("./types-impl");
|
|
23
|
+
const expect = chai.expect;
|
|
24
|
+
describe('DecorationsExtImpl', () => {
|
|
25
|
+
let onDidChangeCalls;
|
|
26
|
+
let decorationsExt;
|
|
27
|
+
let onDidChangeFileDecorationsEmitter;
|
|
28
|
+
beforeEach(() => {
|
|
29
|
+
onDidChangeCalls = [];
|
|
30
|
+
const decorationsMainMock = {
|
|
31
|
+
$registerDecorationProvider: async () => undefined,
|
|
32
|
+
$unregisterDecorationProvider: () => undefined,
|
|
33
|
+
$onDidChange: (handle, resources) => {
|
|
34
|
+
onDidChangeCalls.push(resources);
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
const rpcMock = {
|
|
38
|
+
getProxy(proxyId) {
|
|
39
|
+
return (proxyId.id === plugin_api_rpc_1.PLUGIN_RPC_CONTEXT.DECORATIONS_MAIN.id
|
|
40
|
+
? decorationsMainMock
|
|
41
|
+
: new Proxy({}, { get: () => () => undefined }));
|
|
42
|
+
},
|
|
43
|
+
set(_identifier, instance) {
|
|
44
|
+
return instance;
|
|
45
|
+
},
|
|
46
|
+
dispose() { }
|
|
47
|
+
};
|
|
48
|
+
decorationsExt = new decorations_1.DecorationsExtImpl(rpcMock);
|
|
49
|
+
onDidChangeFileDecorationsEmitter = new event_1.Emitter();
|
|
50
|
+
decorationsExt.registerFileDecorationProvider({
|
|
51
|
+
onDidChangeFileDecorations: onDidChangeFileDecorationsEmitter.event,
|
|
52
|
+
provideFileDecoration: () => undefined
|
|
53
|
+
}, { id: 'test.plugin', name: 'test' });
|
|
54
|
+
});
|
|
55
|
+
it('forwards small change events unchanged', () => {
|
|
56
|
+
const uris = [1, 2, 3].map(i => types_impl_1.URI.parse(`file:///project/f${i}.ts`));
|
|
57
|
+
onDidChangeFileDecorationsEmitter.fire(uris);
|
|
58
|
+
expect(onDidChangeCalls).to.have.lengthOf(1);
|
|
59
|
+
expect(onDidChangeCalls[0]).to.have.lengthOf(3);
|
|
60
|
+
});
|
|
61
|
+
it('forwards undefined change events as a flush', () => {
|
|
62
|
+
onDidChangeFileDecorationsEmitter.fire(undefined);
|
|
63
|
+
expect(onDidChangeCalls).to.have.lengthOf(1);
|
|
64
|
+
// eslint-disable-next-line no-null/no-null
|
|
65
|
+
expect(onDidChangeCalls[0]).to.equal(null);
|
|
66
|
+
});
|
|
67
|
+
it('sends a flush instead of truncating events exceeding the max event size', () => {
|
|
68
|
+
const uris = [];
|
|
69
|
+
for (let i = 0; i < 300; i++) {
|
|
70
|
+
uris.push(types_impl_1.URI.parse(`file:///project/folder${i % 30}/f${i}.ts`));
|
|
71
|
+
}
|
|
72
|
+
onDidChangeFileDecorationsEmitter.fire(uris);
|
|
73
|
+
expect(onDidChangeCalls).to.have.lengthOf(1);
|
|
74
|
+
// eslint-disable-next-line no-null/no-null
|
|
75
|
+
expect(onDidChangeCalls[0]).to.equal(null);
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
//# sourceMappingURL=decorations.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"decorations.spec.js","sourceRoot":"","sources":["../../src/plugin/decorations.spec.ts"],"names":[],"mappings":";AAAA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AAE,CAAC,GAAG,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;YAC3B,IAAI,CAAC,IAAI,CAAC,gBAAG,CAAC,KAAK,CAAC,yBAAyB,CAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;QACrE,CAAC;QACD,iCAAiC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC7C,MAAM,CAAC,gBAAgB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;QAC7C,2CAA2C;QAC3C,MAAM,CAAC,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AAEP,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/plugin-ext",
|
|
3
|
-
"version": "1.76.0-next.
|
|
3
|
+
"version": "1.76.0-next.10+c8926e4df",
|
|
4
4
|
"description": "Theia - Plugin Extension",
|
|
5
5
|
"main": "lib/common/index.js",
|
|
6
6
|
"typings": "lib/common/index.d.ts",
|
|
7
7
|
"dependencies": {
|
|
8
|
-
"@theia/ai-core": "1.76.0-next.
|
|
9
|
-
"@theia/ai-mcp": "1.76.0-next.
|
|
10
|
-
"@theia/bulk-edit": "1.76.0-next.
|
|
11
|
-
"@theia/callhierarchy": "1.76.0-next.
|
|
12
|
-
"@theia/console": "1.76.0-next.
|
|
13
|
-
"@theia/core": "1.76.0-next.
|
|
14
|
-
"@theia/debug": "1.76.0-next.
|
|
15
|
-
"@theia/editor": "1.76.0-next.
|
|
16
|
-
"@theia/editor-preview": "1.76.0-next.
|
|
17
|
-
"@theia/file-search": "1.76.0-next.
|
|
18
|
-
"@theia/filesystem": "1.76.0-next.
|
|
19
|
-
"@theia/markers": "1.76.0-next.
|
|
20
|
-
"@theia/messages": "1.76.0-next.
|
|
21
|
-
"@theia/monaco": "1.76.0-next.
|
|
8
|
+
"@theia/ai-core": "1.76.0-next.10+c8926e4df",
|
|
9
|
+
"@theia/ai-mcp": "1.76.0-next.10+c8926e4df",
|
|
10
|
+
"@theia/bulk-edit": "1.76.0-next.10+c8926e4df",
|
|
11
|
+
"@theia/callhierarchy": "1.76.0-next.10+c8926e4df",
|
|
12
|
+
"@theia/console": "1.76.0-next.10+c8926e4df",
|
|
13
|
+
"@theia/core": "1.76.0-next.10+c8926e4df",
|
|
14
|
+
"@theia/debug": "1.76.0-next.10+c8926e4df",
|
|
15
|
+
"@theia/editor": "1.76.0-next.10+c8926e4df",
|
|
16
|
+
"@theia/editor-preview": "1.76.0-next.10+c8926e4df",
|
|
17
|
+
"@theia/file-search": "1.76.0-next.10+c8926e4df",
|
|
18
|
+
"@theia/filesystem": "1.76.0-next.10+c8926e4df",
|
|
19
|
+
"@theia/markers": "1.76.0-next.10+c8926e4df",
|
|
20
|
+
"@theia/messages": "1.76.0-next.10+c8926e4df",
|
|
21
|
+
"@theia/monaco": "1.76.0-next.10+c8926e4df",
|
|
22
22
|
"@theia/monaco-editor-core": "1.108.201",
|
|
23
|
-
"@theia/navigator": "1.76.0-next.
|
|
24
|
-
"@theia/notebook": "1.76.0-next.
|
|
25
|
-
"@theia/output": "1.76.0-next.
|
|
26
|
-
"@theia/plugin": "1.76.0-next.
|
|
27
|
-
"@theia/plugin-utils": "1.76.0-next.
|
|
28
|
-
"@theia/preferences": "1.76.0-next.
|
|
29
|
-
"@theia/scm": "1.76.0-next.
|
|
30
|
-
"@theia/search-in-workspace": "1.76.0-next.
|
|
31
|
-
"@theia/task": "1.76.0-next.
|
|
32
|
-
"@theia/terminal": "1.76.0-next.
|
|
33
|
-
"@theia/test": "1.76.0-next.
|
|
34
|
-
"@theia/timeline": "1.76.0-next.
|
|
35
|
-
"@theia/typehierarchy": "1.76.0-next.
|
|
36
|
-
"@theia/variable-resolver": "1.76.0-next.
|
|
37
|
-
"@theia/workspace": "1.76.0-next.
|
|
23
|
+
"@theia/navigator": "1.76.0-next.10+c8926e4df",
|
|
24
|
+
"@theia/notebook": "1.76.0-next.10+c8926e4df",
|
|
25
|
+
"@theia/output": "1.76.0-next.10+c8926e4df",
|
|
26
|
+
"@theia/plugin": "1.76.0-next.10+c8926e4df",
|
|
27
|
+
"@theia/plugin-utils": "1.76.0-next.10+c8926e4df",
|
|
28
|
+
"@theia/preferences": "1.76.0-next.10+c8926e4df",
|
|
29
|
+
"@theia/scm": "1.76.0-next.10+c8926e4df",
|
|
30
|
+
"@theia/search-in-workspace": "1.76.0-next.10+c8926e4df",
|
|
31
|
+
"@theia/task": "1.76.0-next.10+c8926e4df",
|
|
32
|
+
"@theia/terminal": "1.76.0-next.10+c8926e4df",
|
|
33
|
+
"@theia/test": "1.76.0-next.10+c8926e4df",
|
|
34
|
+
"@theia/timeline": "1.76.0-next.10+c8926e4df",
|
|
35
|
+
"@theia/typehierarchy": "1.76.0-next.10+c8926e4df",
|
|
36
|
+
"@theia/variable-resolver": "1.76.0-next.10+c8926e4df",
|
|
37
|
+
"@theia/workspace": "1.76.0-next.10+c8926e4df",
|
|
38
38
|
"@types/mime": "^2.0.3",
|
|
39
39
|
"@vscode/debugprotocol": "^1.68.0",
|
|
40
40
|
"@vscode/proxy-agent": "^0.13.2",
|
|
@@ -99,5 +99,5 @@
|
|
|
99
99
|
"nyc": {
|
|
100
100
|
"extends": "../../configs/nyc.json"
|
|
101
101
|
},
|
|
102
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "c8926e4df55986ad77d1f24c297873f1656fc9cb"
|
|
103
103
|
}
|
|
@@ -92,7 +92,7 @@ class DecorationRequestsQueue {
|
|
|
92
92
|
export class DecorationsMainImpl implements DecorationsMain, Disposable {
|
|
93
93
|
|
|
94
94
|
private readonly proxy: DecorationsExt;
|
|
95
|
-
private readonly providers = new Map<number, [Emitter<URI[]>, Disposable]>();
|
|
95
|
+
private readonly providers = new Map<number, [Emitter<URI[] | undefined>, Disposable]>();
|
|
96
96
|
private readonly decorationsService: DecorationsService;
|
|
97
97
|
|
|
98
98
|
constructor(rpc: RPCProtocol, container: interfaces.Container) {
|
|
@@ -106,7 +106,7 @@ export class DecorationsMainImpl implements DecorationsMain, Disposable {
|
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
async $registerDecorationProvider(handle: number): Promise<void> {
|
|
109
|
-
const emitter = new Emitter<URI[]>();
|
|
109
|
+
const emitter = new Emitter<URI[] | undefined>();
|
|
110
110
|
const queue = new DecorationRequestsQueue(this.proxy, handle);
|
|
111
111
|
const registration = this.decorationsService.registerDecorationsProvider({
|
|
112
112
|
onDidChange: emitter.event,
|
|
@@ -128,11 +128,11 @@ export class DecorationsMainImpl implements DecorationsMain, Disposable {
|
|
|
128
128
|
this.providers.set(handle, [emitter, registration]);
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
-
$onDidChange(handle: number, resources: UriComponents[]): void {
|
|
131
|
+
$onDidChange(handle: number, resources: UriComponents[] | null): void {
|
|
132
132
|
const providerSet = this.providers.get(handle);
|
|
133
133
|
if (providerSet) {
|
|
134
134
|
const [emitter] = providerSet;
|
|
135
|
-
emitter.fire(resources
|
|
135
|
+
emitter.fire(resources ? resources.map(r => new URI(VSCodeURI.revive(r).toString())) : undefined);
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2026 Safi Seid-Ahmad, K2view 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 { Emitter } from '@theia/core/lib/common/event';
|
|
18
|
+
import * as chai from 'chai';
|
|
19
|
+
import * as theia from '@theia/plugin';
|
|
20
|
+
import { PLUGIN_RPC_CONTEXT } from '../common/plugin-api-rpc';
|
|
21
|
+
import { ProxyIdentifier, RPCProtocol } from '../common/rpc-protocol';
|
|
22
|
+
import { DecorationsExtImpl } from './decorations';
|
|
23
|
+
import { URI } from './types-impl';
|
|
24
|
+
|
|
25
|
+
const expect = chai.expect;
|
|
26
|
+
|
|
27
|
+
describe('DecorationsExtImpl', () => {
|
|
28
|
+
|
|
29
|
+
let onDidChangeCalls: (URI[] | null)[];
|
|
30
|
+
let decorationsExt: DecorationsExtImpl;
|
|
31
|
+
let onDidChangeFileDecorationsEmitter: Emitter<theia.Uri | theia.Uri[] | undefined>;
|
|
32
|
+
|
|
33
|
+
beforeEach(() => {
|
|
34
|
+
onDidChangeCalls = [];
|
|
35
|
+
const decorationsMainMock = {
|
|
36
|
+
$registerDecorationProvider: async () => undefined,
|
|
37
|
+
$unregisterDecorationProvider: () => undefined,
|
|
38
|
+
$onDidChange: (handle: number, resources: URI[] | null) => {
|
|
39
|
+
onDidChangeCalls.push(resources);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const rpcMock = {
|
|
43
|
+
getProxy<T>(proxyId: ProxyIdentifier<T>): T {
|
|
44
|
+
return (proxyId.id === PLUGIN_RPC_CONTEXT.DECORATIONS_MAIN.id
|
|
45
|
+
? decorationsMainMock
|
|
46
|
+
: new Proxy({}, { get: () => () => undefined })) as unknown as T;
|
|
47
|
+
},
|
|
48
|
+
set<T, R extends T>(_identifier: ProxyIdentifier<T>, instance: R): R {
|
|
49
|
+
return instance;
|
|
50
|
+
},
|
|
51
|
+
dispose(): void { }
|
|
52
|
+
} as RPCProtocol;
|
|
53
|
+
|
|
54
|
+
decorationsExt = new DecorationsExtImpl(rpcMock);
|
|
55
|
+
onDidChangeFileDecorationsEmitter = new Emitter<theia.Uri | theia.Uri[] | undefined>();
|
|
56
|
+
decorationsExt.registerFileDecorationProvider({
|
|
57
|
+
onDidChangeFileDecorations: onDidChangeFileDecorationsEmitter.event,
|
|
58
|
+
provideFileDecoration: () => undefined
|
|
59
|
+
}, { id: 'test.plugin', name: 'test' });
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it('forwards small change events unchanged', () => {
|
|
63
|
+
const uris = [1, 2, 3].map(i => URI.parse(`file:///project/f${i}.ts`));
|
|
64
|
+
onDidChangeFileDecorationsEmitter.fire(uris);
|
|
65
|
+
expect(onDidChangeCalls).to.have.lengthOf(1);
|
|
66
|
+
expect(onDidChangeCalls[0]).to.have.lengthOf(3);
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it('forwards undefined change events as a flush', () => {
|
|
70
|
+
onDidChangeFileDecorationsEmitter.fire(undefined);
|
|
71
|
+
expect(onDidChangeCalls).to.have.lengthOf(1);
|
|
72
|
+
// eslint-disable-next-line no-null/no-null
|
|
73
|
+
expect(onDidChangeCalls[0]).to.equal(null);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('sends a flush instead of truncating events exceeding the max event size', () => {
|
|
77
|
+
const uris = [];
|
|
78
|
+
for (let i = 0; i < 300; i++) {
|
|
79
|
+
uris.push(URI.parse(`file:///project/folder${i % 30}/f${i}.ts`));
|
|
80
|
+
}
|
|
81
|
+
onDidChangeFileDecorationsEmitter.fire(uris);
|
|
82
|
+
expect(onDidChangeCalls).to.have.lengthOf(1);
|
|
83
|
+
// eslint-disable-next-line no-null/no-null
|
|
84
|
+
expect(onDidChangeCalls[0]).to.equal(null);
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
});
|
|
@@ -26,7 +26,6 @@ import {
|
|
|
26
26
|
import { RPCProtocol } from '../common/rpc-protocol';
|
|
27
27
|
import { Disposable, FileDecoration, URI } from './types-impl';
|
|
28
28
|
import { CancellationToken } from '@theia/core/lib/common';
|
|
29
|
-
import { dirname } from 'path';
|
|
30
29
|
import { PluginLogger } from './logger';
|
|
31
30
|
|
|
32
31
|
/*---------------------------------------------------------------------------------------------
|
|
@@ -70,24 +69,12 @@ export class DecorationsExtImpl implements DecorationsExt {
|
|
|
70
69
|
return;
|
|
71
70
|
}
|
|
72
71
|
|
|
73
|
-
// too many resources per event
|
|
74
|
-
//
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
let lastDirname: string | undefined;
|
|
80
|
-
for (const obj of uris) {
|
|
81
|
-
const myDirname = dirname(obj.uri.path);
|
|
82
|
-
if (lastDirname !== myDirname) {
|
|
83
|
-
lastDirname = myDirname;
|
|
84
|
-
if (picked.push(obj.uri) >= DecorationsExtImpl.maxEventSize) {
|
|
85
|
-
break outer;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
this.proxy.$onDidChange(handle, picked);
|
|
72
|
+
// too many resources per event: send a flush instead, so that the renderer
|
|
73
|
+
// drops cached data for this provider and re-fetches the decorations it
|
|
74
|
+
// displays on demand. Truncating the event (as upstream VS Code does by
|
|
75
|
+
// picking one resource per folder) loses decorations for the dropped
|
|
76
|
+
// resources, see https://github.com/eclipse-theia/theia/issues/17507
|
|
77
|
+
this.proxy.$onDidChange(handle, null);
|
|
91
78
|
});
|
|
92
79
|
|
|
93
80
|
return new Disposable(() => {
|
|
@@ -95,20 +82,6 @@ export class DecorationsExtImpl implements DecorationsExt {
|
|
|
95
82
|
this.proxy.$unregisterDecorationProvider(handle);
|
|
96
83
|
this.providersMap.delete(handle);
|
|
97
84
|
});
|
|
98
|
-
|
|
99
|
-
function groupBy<T>(data: ReadonlyArray<T>, compareFn: (a: T, b: T) => number): T[][] {
|
|
100
|
-
const result: T[][] = [];
|
|
101
|
-
let currentGroup: T[] | undefined = undefined;
|
|
102
|
-
for (const element of data.slice(0).sort(compareFn)) {
|
|
103
|
-
if (!currentGroup || compareFn(currentGroup[0], element) !== 0) {
|
|
104
|
-
currentGroup = [element];
|
|
105
|
-
result.push(currentGroup);
|
|
106
|
-
} else {
|
|
107
|
-
currentGroup.push(element);
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
return result;
|
|
111
|
-
}
|
|
112
85
|
}
|
|
113
86
|
|
|
114
87
|
async $provideDecorations(handle: number, requests: DecorationRequest[], token: CancellationToken): Promise<DecorationReply> {
|