reactive-vscode 0.2.0-beta.4 → 0.2.0-beta.5
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/dist/index.d.ts +8 -0
- package/dist/index.js +57 -52
- package/package.json +2 -2
package/dist/index.d.ts
CHANGED
|
@@ -68,6 +68,10 @@ export declare type ConfigObject<C extends object> = ShallowReactive<C & {
|
|
|
68
68
|
* @see https://code.visualstudio.com/api/references/vscode-api#WorkspaceConfiguration.update
|
|
69
69
|
*/
|
|
70
70
|
$update: (key: keyof C, value: C[keyof C], configurationTarget?: Nullable<ConfigurationTarget>, overrideInLanguage?: boolean) => Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Set the value without updating the workspace.
|
|
73
|
+
*/
|
|
74
|
+
$set: (key: keyof C, value: C[keyof C]) => void;
|
|
71
75
|
}>;
|
|
72
76
|
|
|
73
77
|
export declare interface ConfigRef<T> extends WritableComputedRef<T> {
|
|
@@ -77,6 +81,10 @@ export declare interface ConfigRef<T> extends WritableComputedRef<T> {
|
|
|
77
81
|
* @see https://code.visualstudio.com/api/references/vscode-api#WorkspaceConfiguration.update
|
|
78
82
|
*/
|
|
79
83
|
update: (value: T, configurationTarget?: ConfigurationTarget | boolean | null, overrideInLanguage?: boolean) => Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Set the value without updating the workspace.
|
|
86
|
+
*/
|
|
87
|
+
set: (value: T) => void;
|
|
80
88
|
}
|
|
81
89
|
|
|
82
90
|
export declare interface ConfigType<T> extends ObjectConstructor {
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { getCurrentScope as N, onScopeDispose as F, shallowRef as l, effectScope as q, computed as d, shallowReactive as L, toValue as a, watchEffect as h, watch as C, ref as x, toRaw as J, isRef as K } from "@reactive-vscode/reactivity";
|
|
2
2
|
export * from "@reactive-vscode/reactivity";
|
|
3
|
-
import { workspace as b, commands as E, window as c, debug as y, extensions as k, comments as z, env as
|
|
3
|
+
import { workspace as b, commands as E, window as c, debug as y, extensions as k, comments as z, env as T, EventEmitter as O, tasks as D, Uri as Y, languages as G, ColorThemeKind as V, l10n as A } from "vscode";
|
|
4
4
|
function Q(e) {
|
|
5
5
|
return N() ? (F(e), !0) : !1;
|
|
6
6
|
}
|
|
@@ -21,46 +21,48 @@ function g(e) {
|
|
|
21
21
|
let t;
|
|
22
22
|
return () => t ?? (t = e());
|
|
23
23
|
}
|
|
24
|
-
const
|
|
24
|
+
const $ = [];
|
|
25
25
|
function fe(e) {
|
|
26
|
-
|
|
26
|
+
$.push(e);
|
|
27
27
|
}
|
|
28
28
|
const p = l(null), R = q();
|
|
29
29
|
function ve(e) {
|
|
30
30
|
return {
|
|
31
|
-
activate: (t) => (p.value = t, R.run(() => (
|
|
31
|
+
activate: (t) => (p.value = t, R.run(() => (I.map((n) => n(t)), e()))),
|
|
32
32
|
deactivate: () => {
|
|
33
|
-
|
|
33
|
+
$.map((t) => t()), R.stop();
|
|
34
34
|
}
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
const
|
|
38
|
-
function
|
|
39
|
-
p.value ? e(p.value) :
|
|
37
|
+
const I = [];
|
|
38
|
+
function P(e) {
|
|
39
|
+
p.value ? e(p.value) : I.push(e);
|
|
40
40
|
}
|
|
41
41
|
function X(e, t, n) {
|
|
42
42
|
const r = b.getConfiguration(e, n);
|
|
43
|
-
function i(u,
|
|
44
|
-
const
|
|
45
|
-
get: () =>
|
|
46
|
-
set: (
|
|
47
|
-
|
|
43
|
+
function i(u, v) {
|
|
44
|
+
const f = l(v), m = d({
|
|
45
|
+
get: () => f.value,
|
|
46
|
+
set: (w) => {
|
|
47
|
+
f.value = w, r.update(u, w);
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
|
-
return m.update = async (
|
|
51
|
-
await r.update(u,
|
|
50
|
+
return m.update = async (w, H, U) => {
|
|
51
|
+
await r.update(u, w, H, U), m.value = w;
|
|
52
|
+
}, m.set = (w) => {
|
|
53
|
+
f.value = w;
|
|
52
54
|
}, m;
|
|
53
55
|
}
|
|
54
56
|
const o = Object.fromEntries(
|
|
55
57
|
Object.keys(t).map((u) => [u, i(u, r.get(u))])
|
|
56
58
|
);
|
|
57
|
-
return
|
|
59
|
+
return P(() => {
|
|
58
60
|
s(b.onDidChangeConfiguration((u) => {
|
|
59
61
|
if (!u.affectsConfiguration(e))
|
|
60
62
|
return;
|
|
61
|
-
const
|
|
62
|
-
for (const
|
|
63
|
-
u.affectsConfiguration(`${e}.${
|
|
63
|
+
const v = b.getConfiguration(e);
|
|
64
|
+
for (const f in t)
|
|
65
|
+
u.affectsConfiguration(`${e}.${f}`) && o[f].set(v.get(f));
|
|
64
66
|
}));
|
|
65
67
|
}), o;
|
|
66
68
|
}
|
|
@@ -68,14 +70,17 @@ function ge(e, t, n) {
|
|
|
68
70
|
const r = X(e, t, n);
|
|
69
71
|
return L({
|
|
70
72
|
...r,
|
|
71
|
-
$update(i, o, u,
|
|
72
|
-
return r[i].update(o, u,
|
|
73
|
+
$update(i, o, u, v) {
|
|
74
|
+
return r[i].update(o, u, v);
|
|
75
|
+
},
|
|
76
|
+
$set(i, o) {
|
|
77
|
+
return r[i].set(o);
|
|
73
78
|
}
|
|
74
79
|
});
|
|
75
80
|
}
|
|
76
81
|
function he(e, t) {
|
|
77
82
|
const n = l(null), r = [], i = (o) => (...u) => n.value ? n.value[o](...u) : (r.push([o, u]), null);
|
|
78
|
-
return
|
|
83
|
+
return P(() => {
|
|
79
84
|
n.value = oe(e, t);
|
|
80
85
|
for (const [o, u] of r)
|
|
81
86
|
n.value[o](...u);
|
|
@@ -182,8 +187,8 @@ function Ee(...e) {
|
|
|
182
187
|
function r() {
|
|
183
188
|
return n() ? t.value : t.value = c.createTerminal(...e);
|
|
184
189
|
}
|
|
185
|
-
function i(
|
|
186
|
-
r().sendText(
|
|
190
|
+
function i(v) {
|
|
191
|
+
r().sendText(v);
|
|
187
192
|
}
|
|
188
193
|
function o() {
|
|
189
194
|
r().show();
|
|
@@ -201,8 +206,8 @@ function Ee(...e) {
|
|
|
201
206
|
};
|
|
202
207
|
}
|
|
203
208
|
const ke = g(() => {
|
|
204
|
-
const e = l(
|
|
205
|
-
return s(
|
|
209
|
+
const e = l(T.shell);
|
|
210
|
+
return s(T.onDidChangeShell((t) => {
|
|
206
211
|
e.value = t;
|
|
207
212
|
})), d(() => e.value);
|
|
208
213
|
});
|
|
@@ -278,8 +283,8 @@ function Ae(e, t) {
|
|
|
278
283
|
{
|
|
279
284
|
onDidChangeFoldingRanges: n.event,
|
|
280
285
|
provideFoldingRanges(i, o, u) {
|
|
281
|
-
var
|
|
282
|
-
return (
|
|
286
|
+
var v;
|
|
287
|
+
return (v = r.value) == null ? void 0 : v.call(r, i, o, u);
|
|
283
288
|
}
|
|
284
289
|
}
|
|
285
290
|
));
|
|
@@ -297,8 +302,8 @@ const Fe = g(() => {
|
|
|
297
302
|
const e = _();
|
|
298
303
|
return d(() => e.value.kind === V.Dark || e.value.kind === V.HighContrast);
|
|
299
304
|
}), Le = g(() => {
|
|
300
|
-
const e = l(
|
|
301
|
-
return s(
|
|
305
|
+
const e = l(T.isTelemetryEnabled);
|
|
306
|
+
return s(T.onDidChangeTelemetryEnabled((t) => {
|
|
302
307
|
e.value = t;
|
|
303
308
|
})), d(() => e.value);
|
|
304
309
|
});
|
|
@@ -306,17 +311,17 @@ function Oe(e, ...t) {
|
|
|
306
311
|
return d(() => typeof t[0] == "object" ? A.t(a(e), J(t[0])) : A.t(a(e), ...t.map(a)));
|
|
307
312
|
}
|
|
308
313
|
const We = g(() => {
|
|
309
|
-
const e = l(
|
|
310
|
-
return s(
|
|
314
|
+
const e = l(T.logLevel);
|
|
315
|
+
return s(T.onDidChangeLogLevel((t) => {
|
|
311
316
|
e.value = t;
|
|
312
317
|
})), d(() => e.value);
|
|
313
318
|
});
|
|
314
319
|
function ae(e, t) {
|
|
315
320
|
return s(c.createOutputChannel(e, t));
|
|
316
321
|
}
|
|
317
|
-
function
|
|
318
|
-
const t = /* @__PURE__ */ new Date(), n = String(t.getFullYear()).padStart(4, "0"), r = String(t.getMonth() + 1).padStart(2, "0"), i = String(t.getDate()).padStart(2, "0"), o = String(t.getHours()).padStart(2, "0"), u = String(t.getMinutes()).padStart(2, "0"),
|
|
319
|
-
return `${n}-${r}-${i} ${o}:${u}:${
|
|
322
|
+
function $e(e) {
|
|
323
|
+
const t = /* @__PURE__ */ new Date(), n = String(t.getFullYear()).padStart(4, "0"), r = String(t.getMonth() + 1).padStart(2, "0"), i = String(t.getDate()).padStart(2, "0"), o = String(t.getHours()).padStart(2, "0"), u = String(t.getMinutes()).padStart(2, "0"), v = String(t.getSeconds()).padStart(2, "0"), f = String(t.getMilliseconds()).padStart(3, "0");
|
|
324
|
+
return `${n}-${r}-${i} ${o}:${u}:${v}.${f} [${e}] `;
|
|
320
325
|
}
|
|
321
326
|
function oe(e, t = {}) {
|
|
322
327
|
const n = t.outputChannel ?? ae(e), r = (i) => (...o) => {
|
|
@@ -356,7 +361,7 @@ function ue(e) {
|
|
|
356
361
|
}
|
|
357
362
|
});
|
|
358
363
|
}
|
|
359
|
-
function
|
|
364
|
+
function Ie(e) {
|
|
360
365
|
const t = ue(e);
|
|
361
366
|
return d({
|
|
362
367
|
get() {
|
|
@@ -367,7 +372,7 @@ function Pe(e) {
|
|
|
367
372
|
}
|
|
368
373
|
});
|
|
369
374
|
}
|
|
370
|
-
function
|
|
375
|
+
function Pe(e) {
|
|
371
376
|
var n;
|
|
372
377
|
const t = l(((n = a(e)) == null ? void 0 : n.visibleRanges) ?? []);
|
|
373
378
|
return C(e, () => {
|
|
@@ -512,8 +517,8 @@ const ze = W(
|
|
|
512
517
|
return u.treeItem;
|
|
513
518
|
},
|
|
514
519
|
getChildren(u) {
|
|
515
|
-
var
|
|
516
|
-
return u ? ((
|
|
520
|
+
var v;
|
|
521
|
+
return u ? ((v = u.children) == null || v.forEach((f) => i.set(f, u)), u.children) : a(t);
|
|
517
522
|
},
|
|
518
523
|
getParent(u) {
|
|
519
524
|
return i.get(u);
|
|
@@ -562,8 +567,8 @@ const Ze = W(
|
|
|
562
567
|
s(c.registerWebviewViewProvider(
|
|
563
568
|
e,
|
|
564
569
|
{
|
|
565
|
-
resolveWebviewView(
|
|
566
|
-
r.value =
|
|
570
|
+
resolveWebviewView(f, m) {
|
|
571
|
+
r.value = f, i.value = m, n != null && n.onDidReceiveMessage && f.webview.onDidReceiveMessage(n.onDidReceiveMessage);
|
|
567
572
|
}
|
|
568
573
|
},
|
|
569
574
|
{
|
|
@@ -579,17 +584,17 @@ const Ze = W(
|
|
|
579
584
|
if (h(() => {
|
|
580
585
|
r.value && (r.value.webview.html = `${a(t)}<!--${o.value}-->`);
|
|
581
586
|
}), n != null && n.webviewOptions) {
|
|
582
|
-
const
|
|
587
|
+
const f = n.webviewOptions;
|
|
583
588
|
h(() => {
|
|
584
|
-
r.value && (r.value.webview.options = a(
|
|
589
|
+
r.value && (r.value.webview.options = a(f));
|
|
585
590
|
});
|
|
586
591
|
}
|
|
587
592
|
n != null && n.title && B(r, n.title), n != null && n.badge && j(r, n.badge);
|
|
588
|
-
function f
|
|
593
|
+
function v(f) {
|
|
589
594
|
var m;
|
|
590
|
-
return (m = r.value) == null ? void 0 : m.webview.postMessage(
|
|
595
|
+
return (m = r.value) == null ? void 0 : m.webview.postMessage(f);
|
|
591
596
|
}
|
|
592
|
-
return { view: r, context: i, postMessage:
|
|
597
|
+
return { view: r, context: i, postMessage: v, forceRefresh: u };
|
|
593
598
|
},
|
|
594
599
|
(e) => e
|
|
595
600
|
), _e = g(() => {
|
|
@@ -607,10 +612,10 @@ const Ze = W(
|
|
|
607
612
|
})), d(() => e.value);
|
|
608
613
|
});
|
|
609
614
|
export {
|
|
610
|
-
|
|
615
|
+
I as activateCbs,
|
|
611
616
|
W as createKeyedComposable,
|
|
612
617
|
g as createSingletonComposable,
|
|
613
|
-
|
|
618
|
+
$ as deactivateCbs,
|
|
614
619
|
ge as defineConfigObject,
|
|
615
620
|
X as defineConfigs,
|
|
616
621
|
ve as defineExtension,
|
|
@@ -618,8 +623,8 @@ export {
|
|
|
618
623
|
me as executeCommand,
|
|
619
624
|
p as extensionContext,
|
|
620
625
|
R as extensionScope,
|
|
621
|
-
|
|
622
|
-
|
|
626
|
+
$e as getDefaultLoggerPrefix,
|
|
627
|
+
P as onActivate,
|
|
623
628
|
fe as onDeactivate,
|
|
624
629
|
Q as tryOnScopeDispose,
|
|
625
630
|
be as useAbsolutePath,
|
|
@@ -649,9 +654,9 @@ export {
|
|
|
649
654
|
Oe as useL10nText,
|
|
650
655
|
We as useLogLevel,
|
|
651
656
|
oe as useLogger,
|
|
652
|
-
|
|
657
|
+
Ie as useNotebookEditorSelection,
|
|
653
658
|
ue as useNotebookEditorSelections,
|
|
654
|
-
|
|
659
|
+
Pe as useNotebookEditorVisibleRanges,
|
|
655
660
|
Me as useOpenedTerminals,
|
|
656
661
|
ae as useOutputChannel,
|
|
657
662
|
je as useStatusBarItem,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reactive-vscode",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.0-beta.
|
|
4
|
+
"version": "0.2.0-beta.5",
|
|
5
5
|
"description": "Develop VSCode extension with Vue Reactivity API",
|
|
6
6
|
"author": "_Kerman <kermanx@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"@types/vscode": "^1.89.0"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@reactive-vscode/reactivity": "0.2.0-beta.
|
|
40
|
+
"@reactive-vscode/reactivity": "0.2.0-beta.5"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "^20.14.2",
|