reactive-vscode 0.2.0-beta.3 → 0.2.0-beta.4
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/README.md +62 -1
- package/dist/index.d.ts +41 -10
- package/dist/index.js +233 -222
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -5,9 +5,70 @@
|
|
|
5
5
|
[![License][license-src]][license-href]
|
|
6
6
|
|
|
7
7
|

|
|
8
|
+
|
|
8
9
|
**Develop VSCode extension with Vue Reactivity API**
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
- [**Documentation**](https://kermanx.github.io/reactive-vscode/)
|
|
12
|
+
- [**Why reactive-vscode**](https://kermanx.github.io/reactive-vscode/guide/why)
|
|
13
|
+
- [**All Functions**](https://kermanx.github.io/reactive-vscode/functions/)
|
|
14
|
+
|
|
15
|
+
### Counter Example
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { defineExtension, ref, useCommands, useStatusBarItem } from 'reactive-vscode'
|
|
19
|
+
import { StatusBarAlignment } from 'vscode'
|
|
20
|
+
|
|
21
|
+
export = defineExtension(() => {
|
|
22
|
+
const counter = ref(0)
|
|
23
|
+
|
|
24
|
+
useStatusBarItem({
|
|
25
|
+
alignment: StatusBarAlignment.Right,
|
|
26
|
+
priority: 100,
|
|
27
|
+
text: () => `$(megaphone) Hello*${counter.value}`,
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
useCommands({
|
|
31
|
+
'extension.sayHello': () => counter.value++,
|
|
32
|
+
'extension.sayGoodbye': () => counter.value--,
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
<details>
|
|
38
|
+
<summary> Implementation with original VSCode API </summary>
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import type { ExtensionContext } from 'vscode'
|
|
42
|
+
import { StatusBarAlignment, commands, window } from 'vscode'
|
|
43
|
+
|
|
44
|
+
export function activate(extensionContext: ExtensionContext) {
|
|
45
|
+
let counter = 0
|
|
46
|
+
|
|
47
|
+
const item = window.createStatusBarItem(StatusBarAlignment.Right, 100)
|
|
48
|
+
|
|
49
|
+
function updateStatusBar() {
|
|
50
|
+
item.text = `$(megaphone) Hello*${counter}`
|
|
51
|
+
item.show()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
updateStatusBar()
|
|
55
|
+
|
|
56
|
+
extensionContext.subscriptions.push(
|
|
57
|
+
commands.registerCommand('extension.sayHello', () => {
|
|
58
|
+
counter++
|
|
59
|
+
updateStatusBar()
|
|
60
|
+
}),
|
|
61
|
+
commands.registerCommand('extension.sayGoodbye', () => {
|
|
62
|
+
counter--
|
|
63
|
+
updateStatusBar()
|
|
64
|
+
}),
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
</details>
|
|
70
|
+
|
|
71
|
+
[More examples](https://kermanx.github.io/reactive-vscode/examples/).
|
|
11
72
|
|
|
12
73
|
## License
|
|
13
74
|
|
package/dist/index.d.ts
CHANGED
|
@@ -61,7 +61,21 @@ export declare interface Commands extends Record<string, (...args: any[]) => any
|
|
|
61
61
|
'vscode.open': (uri: Uri) => void;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
export declare
|
|
64
|
+
export declare type ConfigObject<C extends object> = ShallowReactive<C & {
|
|
65
|
+
/**
|
|
66
|
+
* Write the configuration value to the workspace.
|
|
67
|
+
*
|
|
68
|
+
* @see https://code.visualstudio.com/api/references/vscode-api#WorkspaceConfiguration.update
|
|
69
|
+
*/
|
|
70
|
+
$update: (key: keyof C, value: C[keyof C], configurationTarget?: Nullable<ConfigurationTarget>, overrideInLanguage?: boolean) => Promise<void>;
|
|
71
|
+
}>;
|
|
72
|
+
|
|
73
|
+
export declare interface ConfigRef<T> extends WritableComputedRef<T> {
|
|
74
|
+
/**
|
|
75
|
+
* Write the configuration value to the workspace.
|
|
76
|
+
*
|
|
77
|
+
* @see https://code.visualstudio.com/api/references/vscode-api#WorkspaceConfiguration.update
|
|
78
|
+
*/
|
|
65
79
|
update: (value: T, configurationTarget?: ConfigurationTarget | boolean | null, overrideInLanguage?: boolean) => Promise<void>;
|
|
66
80
|
}
|
|
67
81
|
|
|
@@ -69,11 +83,11 @@ export declare interface ConfigType<T> extends ObjectConstructor {
|
|
|
69
83
|
[ConfigTypeSymbol]: T;
|
|
70
84
|
}
|
|
71
85
|
|
|
72
|
-
|
|
86
|
+
/* Excluded from this release type: ConfigTypeOptions */
|
|
73
87
|
|
|
74
88
|
declare type ConfigTypeRaw<T> = ConfigTypeSingle<T> | ConfigTypeSingle<T>[];
|
|
75
89
|
|
|
76
|
-
declare type ConfigTypeSingle<T> =
|
|
90
|
+
declare type ConfigTypeSingle<T> = typeof String | typeof Number | typeof Boolean | typeof Array | typeof Object | null | ConfigType<T>;
|
|
77
91
|
|
|
78
92
|
declare const ConfigTypeSymbol: unique symbol;
|
|
79
93
|
|
|
@@ -96,17 +110,32 @@ export declare function createSingletonComposable<T>(fn: () => T): () => T;
|
|
|
96
110
|
/**
|
|
97
111
|
* Define configurations of an extension. See `vscode::workspace.getConfiguration`.
|
|
98
112
|
*
|
|
113
|
+
* You can use this function with [vscode-ext-gen](https://github.com/antfu/vscode-ext-gen).
|
|
114
|
+
*
|
|
99
115
|
* @category lifecycle
|
|
100
116
|
*/
|
|
101
|
-
export declare function
|
|
117
|
+
export declare function defineConfigObject<const C extends ConfigTypeOptions>(section: string, configs: C, scope?: Nullable<ConfigurationScope>): ConfigObject<ParseConfigTypeOptions<C>>;
|
|
118
|
+
|
|
119
|
+
export declare function defineConfigObject<C extends object>(section: string, configs: C, scope?: Nullable<ConfigurationScope>): ConfigObject<C>;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Define configurations of an extension. See `vscode::workspace.getConfiguration`.
|
|
123
|
+
*
|
|
124
|
+
* You can use this function with [vscode-ext-gen](https://github.com/antfu/vscode-ext-gen).
|
|
125
|
+
*
|
|
126
|
+
* @category lifecycle
|
|
127
|
+
*/
|
|
128
|
+
export declare function defineConfigs<const C extends ConfigTypeOptions>(section: string, configs: C, scope?: Nullable<ConfigurationScope>): ToConfigRefs<ParseConfigTypeOptions<C>>;
|
|
129
|
+
|
|
130
|
+
export declare function defineConfigs<C extends object>(section: string, configs: C, scope?: Nullable<ConfigurationScope>): ToConfigRefs<C>;
|
|
102
131
|
|
|
103
132
|
/**
|
|
104
133
|
* Define a new extension.
|
|
105
134
|
*
|
|
106
135
|
* @category lifecycle
|
|
107
136
|
*/
|
|
108
|
-
export declare function defineExtension(setup: () =>
|
|
109
|
-
activate: (extCtx: ExtensionContext) =>
|
|
137
|
+
export declare function defineExtension<T>(setup: () => T): {
|
|
138
|
+
activate: (extCtx: ExtensionContext) => T | undefined;
|
|
110
139
|
deactivate: () => void;
|
|
111
140
|
};
|
|
112
141
|
|
|
@@ -179,14 +208,16 @@ export declare function onDeactivate(fn: OnDeactivateCb): void;
|
|
|
179
208
|
|
|
180
209
|
declare type OnDeactivateCb = () => void;
|
|
181
210
|
|
|
182
|
-
declare type ParseConfigType<C extends ConfigTypeRaw<any>> = C extends
|
|
211
|
+
declare type ParseConfigType<C extends ConfigTypeRaw<any>> = C extends (infer C1)[] ? (C1 extends ConfigTypeSingle<any> ? ParseConfigType<C1> : never) : C extends ConfigType<infer T> ? T : (C extends typeof String ? string : C extends typeof Number ? number : C extends typeof Boolean ? boolean : C extends typeof Array ? any[] : C extends typeof Object ? Record<string | number, any> : C extends null ? null : never);
|
|
183
212
|
|
|
184
|
-
|
|
185
|
-
[K in keyof C]: ConfigRef<ParseConfigType<C[K]>>;
|
|
186
|
-
};
|
|
213
|
+
/* Excluded from this release type: ParseConfigTypeOptions */
|
|
187
214
|
|
|
188
215
|
export declare type TextEditorCommandCallback = (textEditor: TextEditor, edit: TextEditorEdit, ...args: any[]) => void;
|
|
189
216
|
|
|
217
|
+
declare type ToConfigRefs<C extends object> = {
|
|
218
|
+
[K in keyof C]: ConfigRef<C[K]>;
|
|
219
|
+
};
|
|
220
|
+
|
|
190
221
|
export declare interface TreeViewNode {
|
|
191
222
|
readonly children?: this[];
|
|
192
223
|
readonly treeItem: TreeItem | Thenable<TreeItem>;
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { getCurrentScope as
|
|
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
|
|
4
|
-
function
|
|
5
|
-
return
|
|
3
|
+
import { workspace as b, commands as E, window as c, debug as y, extensions as k, comments as z, env as w, EventEmitter as O, tasks as D, Uri as Y, languages as G, ColorThemeKind as V, l10n as A } from "vscode";
|
|
4
|
+
function Q(e) {
|
|
5
|
+
return N() ? (F(e), !0) : !1;
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function W(e, t) {
|
|
8
8
|
const n = /* @__PURE__ */ new Map();
|
|
9
9
|
return (...r) => {
|
|
10
10
|
const i = t(...r);
|
|
@@ -12,61 +12,71 @@ function L(e, t) {
|
|
|
12
12
|
return o ? o.refCount++ : (o = {
|
|
13
13
|
data: e(...r),
|
|
14
14
|
refCount: 1
|
|
15
|
-
}, n.set(i, o)),
|
|
15
|
+
}, n.set(i, o)), Q(() => {
|
|
16
16
|
--o.refCount === 0 && n.delete(i);
|
|
17
17
|
}), o.data;
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
|
-
function
|
|
20
|
+
function g(e) {
|
|
21
21
|
let t;
|
|
22
22
|
return () => t ?? (t = e());
|
|
23
23
|
}
|
|
24
|
-
const
|
|
25
|
-
function
|
|
26
|
-
|
|
24
|
+
const I = [];
|
|
25
|
+
function fe(e) {
|
|
26
|
+
I.push(e);
|
|
27
27
|
}
|
|
28
|
-
const
|
|
29
|
-
function
|
|
28
|
+
const p = l(null), R = q();
|
|
29
|
+
function ve(e) {
|
|
30
30
|
return {
|
|
31
|
-
activate: (t) =>
|
|
32
|
-
S.value = t, k.run(() => {
|
|
33
|
-
I.map((n) => n(t)), e();
|
|
34
|
-
});
|
|
35
|
-
},
|
|
31
|
+
activate: (t) => (p.value = t, R.run(() => (P.map((n) => n(t)), e()))),
|
|
36
32
|
deactivate: () => {
|
|
37
|
-
|
|
33
|
+
I.map((t) => t()), R.stop();
|
|
38
34
|
}
|
|
39
35
|
};
|
|
40
36
|
}
|
|
41
|
-
const
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
function
|
|
46
|
-
const r =
|
|
47
|
-
function i(u,
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
37
|
+
const P = [];
|
|
38
|
+
function $(e) {
|
|
39
|
+
p.value ? e(p.value) : P.push(e);
|
|
40
|
+
}
|
|
41
|
+
function X(e, t, n) {
|
|
42
|
+
const r = b.getConfiguration(e, n);
|
|
43
|
+
function i(u, f) {
|
|
44
|
+
const v = l(f), m = d({
|
|
45
|
+
get: () => v.value,
|
|
46
|
+
set: (T) => {
|
|
47
|
+
v.value = T, r.update(u, T);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
return m.update = async (T, H, U) => {
|
|
51
|
+
await r.update(u, T, H, U), m.value = T;
|
|
52
|
+
}, m;
|
|
52
53
|
}
|
|
53
54
|
const o = Object.fromEntries(
|
|
54
55
|
Object.keys(t).map((u) => [u, i(u, r.get(u))])
|
|
55
56
|
);
|
|
56
|
-
return
|
|
57
|
-
s(
|
|
57
|
+
return $(() => {
|
|
58
|
+
s(b.onDidChangeConfiguration((u) => {
|
|
58
59
|
if (!u.affectsConfiguration(e))
|
|
59
60
|
return;
|
|
60
|
-
const
|
|
61
|
-
for (const
|
|
62
|
-
u.affectsConfiguration(`${e}.${
|
|
61
|
+
const f = b.getConfiguration(e);
|
|
62
|
+
for (const v in t)
|
|
63
|
+
u.affectsConfiguration(`${e}.${v}`) && (o[v].value = f.get(v));
|
|
63
64
|
}));
|
|
64
65
|
}), o;
|
|
65
66
|
}
|
|
66
|
-
function
|
|
67
|
+
function ge(e, t, n) {
|
|
68
|
+
const r = X(e, t, n);
|
|
69
|
+
return L({
|
|
70
|
+
...r,
|
|
71
|
+
$update(i, o, u, f) {
|
|
72
|
+
return r[i].update(o, u, f);
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function he(e, t) {
|
|
67
77
|
const n = l(null), r = [], i = (o) => (...u) => n.value ? n.value[o](...u) : (r.push([o, u]), null);
|
|
68
|
-
return
|
|
69
|
-
n.value =
|
|
78
|
+
return $(() => {
|
|
79
|
+
n.value = oe(e, t);
|
|
70
80
|
for (const [o, u] of r)
|
|
71
81
|
n.value[o](...u);
|
|
72
82
|
}), {
|
|
@@ -86,85 +96,85 @@ function ve(e, t) {
|
|
|
86
96
|
hide: i("hide")
|
|
87
97
|
};
|
|
88
98
|
}
|
|
89
|
-
function
|
|
99
|
+
function me(e, ...t) {
|
|
90
100
|
return E.executeCommand(e, ...t);
|
|
91
101
|
}
|
|
92
|
-
function
|
|
93
|
-
const n =
|
|
102
|
+
function Z(e, t = !1) {
|
|
103
|
+
const n = p.value;
|
|
94
104
|
if (!n && !t)
|
|
95
105
|
throw new Error("Cannot get absolute path because the extension is not activated yet");
|
|
96
106
|
return n == null ? void 0 : n.asAbsolutePath(e);
|
|
97
107
|
}
|
|
98
|
-
function
|
|
99
|
-
return d(() =>
|
|
108
|
+
function be(e, t = !1) {
|
|
109
|
+
return d(() => Z(a(e), t));
|
|
100
110
|
}
|
|
101
111
|
function s(e) {
|
|
102
|
-
return (
|
|
112
|
+
return (N() ?? R).cleanups.push(e.dispose.bind(e)), e;
|
|
103
113
|
}
|
|
104
|
-
const
|
|
114
|
+
const _ = g(() => {
|
|
105
115
|
const e = l(c.activeColorTheme);
|
|
106
116
|
return s(c.onDidChangeActiveColorTheme((t) => {
|
|
107
117
|
e.value = t;
|
|
108
118
|
})), e;
|
|
109
|
-
}),
|
|
119
|
+
}), Ce = g(() => {
|
|
110
120
|
const e = l(y.activeDebugSession);
|
|
111
121
|
return s(y.onDidChangeActiveDebugSession((t) => {
|
|
112
122
|
e.value = t;
|
|
113
123
|
})), d(() => e.value);
|
|
114
|
-
}),
|
|
124
|
+
}), ee = g(() => {
|
|
115
125
|
const e = l(c.activeTextEditor);
|
|
116
126
|
return s(c.onDidChangeActiveTextEditor((t) => {
|
|
117
127
|
e.value = t;
|
|
118
128
|
})), e;
|
|
119
129
|
});
|
|
120
|
-
function
|
|
130
|
+
function te(e, t, n) {
|
|
121
131
|
const r = "key" in t ? t : c.createTextEditorDecorationType(t);
|
|
122
132
|
h(() => {
|
|
123
133
|
var i;
|
|
124
134
|
(i = a(e)) == null || i.setDecorations(r, a(n));
|
|
125
135
|
});
|
|
126
136
|
}
|
|
127
|
-
function
|
|
128
|
-
const n =
|
|
129
|
-
|
|
137
|
+
function we(e, t) {
|
|
138
|
+
const n = ee();
|
|
139
|
+
te(n, e, t);
|
|
130
140
|
}
|
|
131
|
-
const
|
|
141
|
+
const Te = g(() => {
|
|
132
142
|
const e = l(c.activeNotebookEditor);
|
|
133
143
|
return s(c.onDidChangeActiveNotebookEditor((t) => {
|
|
134
144
|
e.value = t;
|
|
135
145
|
})), e;
|
|
136
|
-
}),
|
|
146
|
+
}), De = g(() => {
|
|
137
147
|
const e = l(c.activeTerminal);
|
|
138
148
|
return s(c.onDidChangeActiveTerminal((t) => {
|
|
139
149
|
e.value = t;
|
|
140
150
|
})), e;
|
|
141
|
-
}),
|
|
142
|
-
const e = l(
|
|
143
|
-
return s(
|
|
144
|
-
e.value =
|
|
151
|
+
}), Se = g(() => {
|
|
152
|
+
const e = l(k.all);
|
|
153
|
+
return s(k.onDidChange(() => {
|
|
154
|
+
e.value = k.all;
|
|
145
155
|
})), d(() => e.value);
|
|
146
156
|
});
|
|
147
|
-
function
|
|
157
|
+
function ne(e, t) {
|
|
148
158
|
s(E.registerCommand(e, t));
|
|
149
159
|
}
|
|
150
|
-
function
|
|
160
|
+
function pe(e) {
|
|
151
161
|
for (const [t, n] of Object.entries(e))
|
|
152
|
-
n &&
|
|
162
|
+
n && ne(t, n);
|
|
153
163
|
}
|
|
154
|
-
function
|
|
155
|
-
return s(
|
|
164
|
+
function xe(e, t) {
|
|
165
|
+
return s(z.createCommentController(e, t));
|
|
156
166
|
}
|
|
157
|
-
function
|
|
167
|
+
function M(e) {
|
|
158
168
|
var n;
|
|
159
169
|
const t = l((n = a(e)) == null ? void 0 : n.state);
|
|
160
|
-
return
|
|
170
|
+
return C(e, () => {
|
|
161
171
|
var r;
|
|
162
172
|
t.value = (r = a(e)) == null ? void 0 : r.state;
|
|
163
173
|
}), s(c.onDidChangeTerminalState((r) => {
|
|
164
174
|
r === a(e) && (t.value = r.state);
|
|
165
175
|
})), d(() => t.value);
|
|
166
176
|
}
|
|
167
|
-
function
|
|
177
|
+
function Ee(...e) {
|
|
168
178
|
const t = x(null);
|
|
169
179
|
function n() {
|
|
170
180
|
return !!t.value && t.value.exitStatus == null;
|
|
@@ -172,8 +182,8 @@ function xe(...e) {
|
|
|
172
182
|
function r() {
|
|
173
183
|
return n() ? t.value : t.value = c.createTerminal(...e);
|
|
174
184
|
}
|
|
175
|
-
function i(
|
|
176
|
-
r().sendText(
|
|
185
|
+
function i(f) {
|
|
186
|
+
r().sendText(f);
|
|
177
187
|
}
|
|
178
188
|
function o() {
|
|
179
189
|
r().show();
|
|
@@ -181,39 +191,39 @@ function xe(...e) {
|
|
|
181
191
|
function u() {
|
|
182
192
|
n() && (t.value.sendText(""), t.value.dispose(), t.value = null);
|
|
183
193
|
}
|
|
184
|
-
return
|
|
194
|
+
return F(u), {
|
|
185
195
|
terminal: t,
|
|
186
196
|
getIsActive: n,
|
|
187
197
|
show: o,
|
|
188
198
|
sendText: i,
|
|
189
199
|
close: u,
|
|
190
|
-
state:
|
|
200
|
+
state: M(t)
|
|
191
201
|
};
|
|
192
202
|
}
|
|
193
|
-
const
|
|
203
|
+
const ke = g(() => {
|
|
194
204
|
const e = l(w.shell);
|
|
195
205
|
return s(w.onDidChangeShell((t) => {
|
|
196
206
|
e.value = t;
|
|
197
207
|
})), d(() => e.value);
|
|
198
208
|
});
|
|
199
|
-
function
|
|
209
|
+
function Re(e) {
|
|
200
210
|
var n;
|
|
201
211
|
const t = l((n = a(e)) == null ? void 0 : n.getText());
|
|
202
212
|
return h(() => {
|
|
203
213
|
var r;
|
|
204
214
|
t.value = (r = a(e)) == null ? void 0 : r.getText();
|
|
205
|
-
}), s(
|
|
215
|
+
}), s(b.onDidChangeTextDocument((r) => {
|
|
206
216
|
r.document === a(e) && (t.value = r.document.getText());
|
|
207
217
|
})), t;
|
|
208
218
|
}
|
|
209
|
-
function
|
|
219
|
+
function S(e, t = []) {
|
|
210
220
|
const n = (r, i, o) => s(e(r, i, o));
|
|
211
221
|
for (const r of t)
|
|
212
222
|
n(r);
|
|
213
223
|
return n;
|
|
214
224
|
}
|
|
215
|
-
function
|
|
216
|
-
const n = Array.isArray(e) ? e : t ?? [], r = s(Array.isArray(e) || e == null ? new
|
|
225
|
+
function re(e, t = []) {
|
|
226
|
+
const n = Array.isArray(e) ? e : t ?? [], r = s(Array.isArray(e) || e == null ? new O() : e), i = S(r.event, n);
|
|
217
227
|
for (const o of n)
|
|
218
228
|
i(o);
|
|
219
229
|
return {
|
|
@@ -222,11 +232,11 @@ function te(e, t = []) {
|
|
|
222
232
|
addListener: i
|
|
223
233
|
};
|
|
224
234
|
}
|
|
225
|
-
function
|
|
226
|
-
return d(() =>
|
|
235
|
+
function ye(e) {
|
|
236
|
+
return d(() => D.fetchTasks(a(e)));
|
|
227
237
|
}
|
|
228
|
-
function
|
|
229
|
-
return
|
|
238
|
+
function ie(e) {
|
|
239
|
+
return L({
|
|
230
240
|
get scheme() {
|
|
231
241
|
return a(e).scheme;
|
|
232
242
|
},
|
|
@@ -256,60 +266,60 @@ function ne(e) {
|
|
|
256
266
|
}
|
|
257
267
|
});
|
|
258
268
|
}
|
|
259
|
-
function
|
|
260
|
-
return
|
|
269
|
+
function Ve(e) {
|
|
270
|
+
return ie(() => Y.file(a(e)));
|
|
261
271
|
}
|
|
262
|
-
function
|
|
263
|
-
const n = new
|
|
272
|
+
function Ae(e, t) {
|
|
273
|
+
const n = new O(), r = l();
|
|
264
274
|
h(() => {
|
|
265
275
|
r.value && n.fire(), r.value = a(t);
|
|
266
|
-
}), s(
|
|
276
|
+
}), s(G.registerFoldingRangeProvider(
|
|
267
277
|
e,
|
|
268
278
|
{
|
|
269
279
|
onDidChangeFoldingRanges: n.event,
|
|
270
280
|
provideFoldingRanges(i, o, u) {
|
|
271
|
-
var
|
|
272
|
-
return (
|
|
281
|
+
var f;
|
|
282
|
+
return (f = r.value) == null ? void 0 : f.call(r, i, o, u);
|
|
273
283
|
}
|
|
274
284
|
}
|
|
275
285
|
));
|
|
276
286
|
}
|
|
277
|
-
function
|
|
278
|
-
const i = s(
|
|
287
|
+
function Ne(e, t, n, r) {
|
|
288
|
+
const i = s(b.createFileSystemWatcher(e, t, n, r));
|
|
279
289
|
return {
|
|
280
290
|
...i,
|
|
281
|
-
onDidCreate:
|
|
282
|
-
onDidChange:
|
|
283
|
-
onDidDelete:
|
|
291
|
+
onDidCreate: S(i.onDidCreate),
|
|
292
|
+
onDidChange: S(i.onDidChange),
|
|
293
|
+
onDidDelete: S(i.onDidDelete)
|
|
284
294
|
};
|
|
285
295
|
}
|
|
286
|
-
const
|
|
287
|
-
const e =
|
|
288
|
-
return d(() => e.value.kind ===
|
|
289
|
-
}),
|
|
296
|
+
const Fe = g(() => {
|
|
297
|
+
const e = _();
|
|
298
|
+
return d(() => e.value.kind === V.Dark || e.value.kind === V.HighContrast);
|
|
299
|
+
}), Le = g(() => {
|
|
290
300
|
const e = l(w.isTelemetryEnabled);
|
|
291
301
|
return s(w.onDidChangeTelemetryEnabled((t) => {
|
|
292
302
|
e.value = t;
|
|
293
303
|
})), d(() => e.value);
|
|
294
304
|
});
|
|
295
|
-
function
|
|
296
|
-
return d(() => typeof t[0] == "object" ?
|
|
305
|
+
function Oe(e, ...t) {
|
|
306
|
+
return d(() => typeof t[0] == "object" ? A.t(a(e), J(t[0])) : A.t(a(e), ...t.map(a)));
|
|
297
307
|
}
|
|
298
|
-
const
|
|
308
|
+
const We = g(() => {
|
|
299
309
|
const e = l(w.logLevel);
|
|
300
310
|
return s(w.onDidChangeLogLevel((t) => {
|
|
301
311
|
e.value = t;
|
|
302
312
|
})), d(() => e.value);
|
|
303
313
|
});
|
|
304
|
-
function
|
|
314
|
+
function ae(e, t) {
|
|
305
315
|
return s(c.createOutputChannel(e, t));
|
|
306
316
|
}
|
|
307
|
-
function
|
|
308
|
-
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"),
|
|
309
|
-
return `${n}-${r}-${i} ${o}:${u}:${
|
|
317
|
+
function Ie(e) {
|
|
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"), f = String(t.getSeconds()).padStart(2, "0"), v = String(t.getMilliseconds()).padStart(3, "0");
|
|
319
|
+
return `${n}-${r}-${i} ${o}:${u}:${f}.${v} [${e}] `;
|
|
310
320
|
}
|
|
311
|
-
function
|
|
312
|
-
const n = t.outputChannel ??
|
|
321
|
+
function oe(e, t = {}) {
|
|
322
|
+
const n = t.outputChannel ?? ae(e), r = (i) => (...o) => {
|
|
313
323
|
var u;
|
|
314
324
|
n.appendLine((((u = t.getPrefix) == null ? void 0 : u.call(t, i)) ?? "") + o.join(" "));
|
|
315
325
|
};
|
|
@@ -327,10 +337,10 @@ function ie(e, t = {}) {
|
|
|
327
337
|
hide: n.hide.bind(n)
|
|
328
338
|
};
|
|
329
339
|
}
|
|
330
|
-
function
|
|
340
|
+
function ue(e) {
|
|
331
341
|
var n;
|
|
332
342
|
const t = l(((n = a(e)) == null ? void 0 : n.selections) ?? []);
|
|
333
|
-
return
|
|
343
|
+
return C(e, () => {
|
|
334
344
|
var r;
|
|
335
345
|
t.value = ((r = a(e)) == null ? void 0 : r.selections) ?? [];
|
|
336
346
|
}), s(c.onDidChangeNotebookEditorSelection((r) => {
|
|
@@ -346,8 +356,8 @@ function ae(e) {
|
|
|
346
356
|
}
|
|
347
357
|
});
|
|
348
358
|
}
|
|
349
|
-
function
|
|
350
|
-
const t =
|
|
359
|
+
function Pe(e) {
|
|
360
|
+
const t = ue(e);
|
|
351
361
|
return d({
|
|
352
362
|
get() {
|
|
353
363
|
return t.value[0];
|
|
@@ -357,24 +367,24 @@ function Ie(e) {
|
|
|
357
367
|
}
|
|
358
368
|
});
|
|
359
369
|
}
|
|
360
|
-
function
|
|
370
|
+
function $e(e) {
|
|
361
371
|
var n;
|
|
362
372
|
const t = l(((n = a(e)) == null ? void 0 : n.visibleRanges) ?? []);
|
|
363
|
-
return
|
|
373
|
+
return C(e, () => {
|
|
364
374
|
var r;
|
|
365
375
|
t.value = ((r = a(e)) == null ? void 0 : r.visibleRanges) ?? [];
|
|
366
376
|
}), s(c.onDidChangeNotebookEditorVisibleRanges((r) => {
|
|
367
377
|
r.notebookEditor === a(e) && (t.value = r.visibleRanges);
|
|
368
378
|
})), d(() => t.value);
|
|
369
379
|
}
|
|
370
|
-
const
|
|
380
|
+
const Me = g(() => {
|
|
371
381
|
const e = l(c.terminals);
|
|
372
382
|
function t() {
|
|
373
383
|
e.value = c.terminals;
|
|
374
384
|
}
|
|
375
385
|
return s(c.onDidOpenTerminal(t)), s(c.onDidCloseTerminal(t)), e;
|
|
376
386
|
});
|
|
377
|
-
function
|
|
387
|
+
function je(e) {
|
|
378
388
|
const t = s(e.id ? c.createStatusBarItem(e.id, e.alignment, e.priority) : c.createStatusBarItem(e.alignment, e.priority));
|
|
379
389
|
function n(r) {
|
|
380
390
|
const i = e[r];
|
|
@@ -390,14 +400,14 @@ function $e(e) {
|
|
|
390
400
|
"accessibilityInformation"
|
|
391
401
|
].forEach(n), t;
|
|
392
402
|
}
|
|
393
|
-
const
|
|
394
|
-
const e = l(
|
|
403
|
+
const Be = g(() => {
|
|
404
|
+
const e = l(D.taskExecutions);
|
|
395
405
|
function t() {
|
|
396
|
-
e.value =
|
|
406
|
+
e.value = D.taskExecutions;
|
|
397
407
|
}
|
|
398
|
-
return s(
|
|
408
|
+
return s(D.onDidStartTask(t)), s(D.onDidEndTask(t)), d(() => e.value);
|
|
399
409
|
});
|
|
400
|
-
function
|
|
410
|
+
function He(...e) {
|
|
401
411
|
const t = s(c.createTerminal(...e));
|
|
402
412
|
return {
|
|
403
413
|
terminal: t,
|
|
@@ -416,20 +426,20 @@ function je(...e) {
|
|
|
416
426
|
sendText: t.sendText.bind(t),
|
|
417
427
|
show: t.show.bind(t),
|
|
418
428
|
hide: t.hide.bind(t),
|
|
419
|
-
state:
|
|
429
|
+
state: M(t)
|
|
420
430
|
};
|
|
421
431
|
}
|
|
422
|
-
function
|
|
432
|
+
function se(e, t) {
|
|
423
433
|
s(E.registerTextEditorCommand(e, t));
|
|
424
434
|
}
|
|
425
|
-
function
|
|
435
|
+
function Ue(e) {
|
|
426
436
|
for (const [t, n] of Object.entries(e))
|
|
427
|
-
|
|
437
|
+
se(t, n);
|
|
428
438
|
}
|
|
429
|
-
function
|
|
439
|
+
function ce(e, t) {
|
|
430
440
|
var r;
|
|
431
441
|
const n = l(((r = a(e)) == null ? void 0 : r.selections) ?? []);
|
|
432
|
-
return
|
|
442
|
+
return C(e, () => {
|
|
433
443
|
var i;
|
|
434
444
|
n.value = ((i = a(e)) == null ? void 0 : i.selections) ?? [];
|
|
435
445
|
}), s(c.onDidChangeTextEditorSelection((i) => {
|
|
@@ -446,8 +456,8 @@ function ue(e, t) {
|
|
|
446
456
|
}
|
|
447
457
|
});
|
|
448
458
|
}
|
|
449
|
-
function
|
|
450
|
-
const n =
|
|
459
|
+
function qe(e, t) {
|
|
460
|
+
const n = ce(e, t);
|
|
451
461
|
return d({
|
|
452
462
|
get() {
|
|
453
463
|
return n.value[0];
|
|
@@ -457,42 +467,42 @@ function He(e, t) {
|
|
|
457
467
|
}
|
|
458
468
|
});
|
|
459
469
|
}
|
|
460
|
-
function
|
|
470
|
+
function Je(e) {
|
|
461
471
|
var n;
|
|
462
472
|
const t = l((n = a(e)) == null ? void 0 : n.viewColumn);
|
|
463
|
-
return
|
|
473
|
+
return C(e, () => {
|
|
464
474
|
var r;
|
|
465
475
|
t.value = (r = a(e)) == null ? void 0 : r.viewColumn;
|
|
466
476
|
}), s(c.onDidChangeTextEditorViewColumn((r) => {
|
|
467
477
|
r.textEditor === a(e) && (t.value = r.viewColumn);
|
|
468
478
|
})), d(() => t.value);
|
|
469
479
|
}
|
|
470
|
-
function
|
|
480
|
+
function Ke(e) {
|
|
471
481
|
var n;
|
|
472
482
|
const t = l(((n = a(e)) == null ? void 0 : n.visibleRanges) ?? []);
|
|
473
|
-
return
|
|
483
|
+
return C(e, () => {
|
|
474
484
|
var r;
|
|
475
485
|
t.value = ((r = a(e)) == null ? void 0 : r.visibleRanges) ?? [];
|
|
476
486
|
}), s(c.onDidChangeTextEditorVisibleRanges((r) => {
|
|
477
487
|
r.textEditor === a(e) && (t.value = r.visibleRanges);
|
|
478
488
|
})), d(() => t.value);
|
|
479
489
|
}
|
|
480
|
-
function
|
|
490
|
+
function j(e, t) {
|
|
481
491
|
h(() => {
|
|
482
492
|
const n = a(e);
|
|
483
493
|
n && (n.badge = a(t));
|
|
484
494
|
});
|
|
485
495
|
}
|
|
486
|
-
function
|
|
496
|
+
function B(e, t) {
|
|
487
497
|
h(() => {
|
|
488
498
|
const n = a(e);
|
|
489
499
|
n && (n.title = a(t));
|
|
490
500
|
});
|
|
491
501
|
}
|
|
492
|
-
const
|
|
502
|
+
const ze = W(
|
|
493
503
|
(e, t, n) => {
|
|
494
|
-
const r =
|
|
495
|
-
|
|
504
|
+
const r = re();
|
|
505
|
+
C(t, () => r.fire()), n != null && n.watchSource && C(n.watchSource, () => r.fire());
|
|
496
506
|
const i = /* @__PURE__ */ new WeakMap(), o = s(c.createTreeView(e, {
|
|
497
507
|
...n,
|
|
498
508
|
treeDataProvider: {
|
|
@@ -502,19 +512,19 @@ const Je = L(
|
|
|
502
512
|
return u.treeItem;
|
|
503
513
|
},
|
|
504
514
|
getChildren(u) {
|
|
505
|
-
var
|
|
506
|
-
return u ? ((
|
|
515
|
+
var f;
|
|
516
|
+
return u ? ((f = u.children) == null || f.forEach((v) => i.set(v, u)), u.children) : a(t);
|
|
507
517
|
},
|
|
508
518
|
getParent(u) {
|
|
509
519
|
return i.get(u);
|
|
510
520
|
}
|
|
511
521
|
}
|
|
512
522
|
}));
|
|
513
|
-
return n != null && n.title &&
|
|
523
|
+
return n != null && n.title && B(o, n.title), n != null && n.badge && j(o, n.badge), o;
|
|
514
524
|
},
|
|
515
525
|
(e) => e
|
|
516
526
|
);
|
|
517
|
-
function
|
|
527
|
+
function Ye(e) {
|
|
518
528
|
var r;
|
|
519
529
|
const t = x((r = a(e)) == null ? void 0 : r.visible);
|
|
520
530
|
function n() {
|
|
@@ -529,31 +539,31 @@ function Ke(e) {
|
|
|
529
539
|
}
|
|
530
540
|
}), h(n), d(() => !!t.value);
|
|
531
541
|
}
|
|
532
|
-
const
|
|
542
|
+
const Ge = g(() => {
|
|
533
543
|
const e = l(c.visibleNotebookEditors);
|
|
534
544
|
return s(c.onDidChangeVisibleNotebookEditors((t) => {
|
|
535
545
|
e.value = t;
|
|
536
546
|
})), e;
|
|
537
|
-
}),
|
|
547
|
+
}), Qe = g(() => {
|
|
538
548
|
const e = l(c.visibleTextEditors);
|
|
539
549
|
return s(c.onDidChangeVisibleTextEditors((t) => {
|
|
540
550
|
e.value = t;
|
|
541
551
|
})), e;
|
|
542
552
|
});
|
|
543
|
-
function
|
|
544
|
-
const r =
|
|
553
|
+
function Xe(e, t, n = !0) {
|
|
554
|
+
const r = K(t) ? t : typeof t == "function" ? d(t) : x(t);
|
|
545
555
|
return h(() => {
|
|
546
556
|
a(n) && E.executeCommand("setContext", e, r.value);
|
|
547
557
|
}), r;
|
|
548
558
|
}
|
|
549
|
-
const
|
|
559
|
+
const Ze = W(
|
|
550
560
|
(e, t, n) => {
|
|
551
561
|
const r = l(), i = l();
|
|
552
562
|
s(c.registerWebviewViewProvider(
|
|
553
563
|
e,
|
|
554
564
|
{
|
|
555
|
-
resolveWebviewView(
|
|
556
|
-
r.value =
|
|
565
|
+
resolveWebviewView(v, m) {
|
|
566
|
+
r.value = v, i.value = m, n != null && n.onDidReceiveMessage && v.webview.onDidReceiveMessage(n.onDidReceiveMessage);
|
|
557
567
|
}
|
|
558
568
|
},
|
|
559
569
|
{
|
|
@@ -569,20 +579,20 @@ const Qe = L(
|
|
|
569
579
|
if (h(() => {
|
|
570
580
|
r.value && (r.value.webview.html = `${a(t)}<!--${o.value}-->`);
|
|
571
581
|
}), n != null && n.webviewOptions) {
|
|
572
|
-
const
|
|
582
|
+
const v = n.webviewOptions;
|
|
573
583
|
h(() => {
|
|
574
|
-
r.value && (r.value.webview.options = a(
|
|
584
|
+
r.value && (r.value.webview.options = a(v));
|
|
575
585
|
});
|
|
576
586
|
}
|
|
577
|
-
n != null && n.title &&
|
|
578
|
-
function
|
|
579
|
-
var
|
|
580
|
-
return (
|
|
587
|
+
n != null && n.title && B(r, n.title), n != null && n.badge && j(r, n.badge);
|
|
588
|
+
function f(v) {
|
|
589
|
+
var m;
|
|
590
|
+
return (m = r.value) == null ? void 0 : m.webview.postMessage(v);
|
|
581
591
|
}
|
|
582
|
-
return { view: r, context: i, postMessage:
|
|
592
|
+
return { view: r, context: i, postMessage: f, forceRefresh: u };
|
|
583
593
|
},
|
|
584
594
|
(e) => e
|
|
585
|
-
),
|
|
595
|
+
), _e = g(() => {
|
|
586
596
|
const e = l(c.state);
|
|
587
597
|
return s(c.onDidChangeWindowState((t) => {
|
|
588
598
|
e.value = t;
|
|
@@ -590,78 +600,79 @@ const Qe = L(
|
|
|
590
600
|
focused: d(() => e.value.focused),
|
|
591
601
|
active: d(() => e.value.active)
|
|
592
602
|
};
|
|
593
|
-
}),
|
|
594
|
-
const e = l(
|
|
595
|
-
return s(
|
|
596
|
-
e.value =
|
|
603
|
+
}), et = g(() => {
|
|
604
|
+
const e = l(b.workspaceFolders);
|
|
605
|
+
return s(b.onDidChangeWorkspaceFolders(() => {
|
|
606
|
+
e.value = b.workspaceFolders;
|
|
597
607
|
})), d(() => e.value);
|
|
598
608
|
});
|
|
599
609
|
export {
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
ve as
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
xe as
|
|
626
|
-
Ee as
|
|
610
|
+
P as activateCbs,
|
|
611
|
+
W as createKeyedComposable,
|
|
612
|
+
g as createSingletonComposable,
|
|
613
|
+
I as deactivateCbs,
|
|
614
|
+
ge as defineConfigObject,
|
|
615
|
+
X as defineConfigs,
|
|
616
|
+
ve as defineExtension,
|
|
617
|
+
he as defineLogger,
|
|
618
|
+
me as executeCommand,
|
|
619
|
+
p as extensionContext,
|
|
620
|
+
R as extensionScope,
|
|
621
|
+
Ie as getDefaultLoggerPrefix,
|
|
622
|
+
$ as onActivate,
|
|
623
|
+
fe as onDeactivate,
|
|
624
|
+
Q as tryOnScopeDispose,
|
|
625
|
+
be as useAbsolutePath,
|
|
626
|
+
_ as useActiveColorTheme,
|
|
627
|
+
Ce as useActiveDebugSession,
|
|
628
|
+
we as useActiveEditorDecorations,
|
|
629
|
+
Te as useActiveNotebookEditor,
|
|
630
|
+
De as useActiveTerminal,
|
|
631
|
+
ee as useActiveTextEditor,
|
|
632
|
+
Se as useAllExtensions,
|
|
633
|
+
ne as useCommand,
|
|
634
|
+
pe as useCommands,
|
|
635
|
+
xe as useCommentController,
|
|
636
|
+
Ee as useControlledTerminal,
|
|
637
|
+
ke as useDefaultShell,
|
|
627
638
|
s as useDisposable,
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
639
|
+
Re as useDocumentText,
|
|
640
|
+
te as useEditorDecorations,
|
|
641
|
+
S as useEvent,
|
|
642
|
+
re as useEventEmitter,
|
|
643
|
+
ye as useFetchTasks,
|
|
644
|
+
Ve as useFileUri,
|
|
645
|
+
Ae as useFoldingRangeProvider,
|
|
646
|
+
Ne as useFsWatcher,
|
|
647
|
+
Fe as useIsDarkTheme,
|
|
648
|
+
Le as useIsTelemetryEnabled,
|
|
649
|
+
Oe as useL10nText,
|
|
650
|
+
We as useLogLevel,
|
|
651
|
+
oe as useLogger,
|
|
652
|
+
Pe as useNotebookEditorSelection,
|
|
653
|
+
ue as useNotebookEditorSelections,
|
|
654
|
+
$e as useNotebookEditorVisibleRanges,
|
|
655
|
+
Me as useOpenedTerminals,
|
|
656
|
+
ae as useOutputChannel,
|
|
657
|
+
je as useStatusBarItem,
|
|
658
|
+
Be as useTaskExecutions,
|
|
659
|
+
He as useTerminal,
|
|
660
|
+
M as useTerminalState,
|
|
661
|
+
se as useTextEditorCommand,
|
|
662
|
+
Ue as useTextEditorCommands,
|
|
663
|
+
qe as useTextEditorSelection,
|
|
664
|
+
ce as useTextEditorSelections,
|
|
665
|
+
Je as useTextEditorViewColumn,
|
|
666
|
+
Ke as useTextEditorVisibleRanges,
|
|
667
|
+
ze as useTreeView,
|
|
668
|
+
ie as useUri,
|
|
669
|
+
j as useViewBadge,
|
|
670
|
+
B as useViewTitle,
|
|
671
|
+
Ye as useViewVisibility,
|
|
672
|
+
Ge as useVisibleNotebookEditors,
|
|
673
|
+
Qe as useVisibleTextEditors,
|
|
674
|
+
Xe as useVscodeContext,
|
|
675
|
+
Ze as useWebviewView,
|
|
676
|
+
_e as useWindowState,
|
|
677
|
+
et as useWorkspaceFolders
|
|
667
678
|
};
|
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.4",
|
|
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.4"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@types/node": "^20.14.2",
|