@codingame/monaco-vscode-editor-service-override 11.1.2 → 12.0.1
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/index.d.ts +8 -2
- package/index.js +159 -2
- package/package.json +31 -7
- package/service-override/tools/editor.d.ts +286 -0
- package/editor.js +0 -156
- package/tools/editor.js +0 -662
- package/tools.js +0 -44
package/tools.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
function unsupported() {
|
|
2
|
-
throw new Error('unsupported');
|
|
3
|
-
}
|
|
4
|
-
function memoized(fct) {
|
|
5
|
-
let v = null;
|
|
6
|
-
return (...args) => {
|
|
7
|
-
if (v == null) {
|
|
8
|
-
v = fct(...args);
|
|
9
|
-
}
|
|
10
|
-
return v;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
function memoizedConstructor(ctor) {
|
|
14
|
-
return new Proxy(ctor, {
|
|
15
|
-
construct: memoized((target, args) => {
|
|
16
|
-
return Reflect.construct(ctor, args);
|
|
17
|
-
})
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
async function sleep(duration) {
|
|
21
|
-
await new Promise((resolve) => setTimeout(resolve, duration));
|
|
22
|
-
}
|
|
23
|
-
function throttle(fct, merge, delay) {
|
|
24
|
-
let lastPromise = Promise.resolve();
|
|
25
|
-
let toConsume = null;
|
|
26
|
-
return async (param) => {
|
|
27
|
-
if (toConsume == null) {
|
|
28
|
-
toConsume = param;
|
|
29
|
-
lastPromise = lastPromise
|
|
30
|
-
.then(async () => await sleep(delay))
|
|
31
|
-
.then(async () => {
|
|
32
|
-
const _toConsume = toConsume;
|
|
33
|
-
toConsume = null;
|
|
34
|
-
await fct(_toConsume);
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
toConsume = merge(toConsume, param);
|
|
39
|
-
}
|
|
40
|
-
await lastPromise;
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export { memoized, memoizedConstructor, sleep, throttle, unsupported };
|