reactive-vscode 0.2.6 → 0.2.7-beta.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/README.md CHANGED
@@ -1,108 +1,108 @@
1
- # reactive-vscode
2
-
3
- [![npm version][npm-version-src]][npm-version-href]
4
- [![npm downloads][npm-downloads-src]][npm-downloads-href]
5
- [![License][license-src]][license-href]
6
-
7
- <img src="./docs/public/header.png" width="60%" />
8
-
9
- **Develop VSCode extension with Vue Reactivity API**
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
- - [**Examples**](https://kermanx.github.io/reactive-vscode/examples/)
15
-
16
- ### Project Status
17
-
18
- Currently, most of the VSCode APIs are covered, and this project has been used in:
19
-
20
- - [Slidev for VSCode <sub><sub>![downloads](https://img.shields.io/visual-studio-marketplace/d/antfu.slidev.svg)</sub></sub>](https://github.com/slidevjs/slidev/tree/main/packages/vscode)
21
- - [Iconify IntelliSense <sub><sub>![downloads](https://img.shields.io/visual-studio-marketplace/d/antfu.iconify.svg)</sub></sub>](https://github.com/antfu/vscode-iconify)
22
-
23
- The [documentation](https://kermanx.github.io/reactive-vscode/) is complete, and the [VueUse integration](https://kermanx.github.io/reactive-vscode/guide/vueuse.html) is also available.
24
-
25
- However, the project is still in beta and may have minor API changes. If you encounter any problems, please feel free to [open an issue](https://github.com/KermanX/reactive-vscode/issues/new).
26
-
27
- ### Counter Example
28
-
29
- ```ts
30
- import { defineExtension, ref, useCommands, useStatusBarItem } from 'reactive-vscode'
31
- import { StatusBarAlignment } from 'vscode'
32
-
33
- export = defineExtension(() => {
34
- const counter = ref(0)
35
-
36
- useStatusBarItem({
37
- alignment: StatusBarAlignment.Right,
38
- priority: 100,
39
- text: () => `$(megaphone) Hello*${counter.value}`,
40
- })
41
-
42
- useCommands({
43
- 'extension.sayHello': () => counter.value++,
44
- 'extension.sayGoodbye': () => counter.value--,
45
- })
46
- })
47
- ```
48
-
49
- <details>
50
- <summary> Implementation with original VSCode API </summary>
51
-
52
- ```ts
53
- import type { ExtensionContext } from 'vscode'
54
- import { commands, StatusBarAlignment, window } from 'vscode'
55
-
56
- export function activate(extensionContext: ExtensionContext) {
57
- let counter = 0
58
-
59
- const item = window.createStatusBarItem(StatusBarAlignment.Right, 100)
60
-
61
- function updateStatusBar() {
62
- item.text = `$(megaphone) Hello*${counter}`
63
- item.show()
64
- }
65
-
66
- updateStatusBar()
67
-
68
- extensionContext.subscriptions.push(
69
- commands.registerCommand('extension.sayHello', () => {
70
- counter++
71
- updateStatusBar()
72
- }),
73
- commands.registerCommand('extension.sayGoodbye', () => {
74
- counter--
75
- updateStatusBar()
76
- }),
77
- )
78
- }
79
- ```
80
-
81
- </details>
82
-
83
- [More examples](https://kermanx.github.io/reactive-vscode/examples/).
84
-
85
- ### License
86
-
87
- [MIT](./LICENSE) License © 2024-PRESENT [_Kerman](https://github.com/KermanX)
88
-
89
- Source code in [the `./packages/reactivity` directory](https://github.com/KermanX/reactive-vscode/blob/main/packages/core/src/reactivity) is ported from [`@vue/runtime-core`](https://github.com/vuejs/core/blob/main/packages/runtime-core). Licensed under a [MIT License](https://github.com/vueuse/vueuse/blob/main/LICENSE).
90
-
91
- Source code in [the `./packages/mock` directory](https://github.com/KermanX/reactive-vscode/blob/main/packages/core/src/mock) references the implementation of [`VSCode`](https://github.com/microsoft/vscode). Licensed under a [MIT License](https://github.com/microsoft/vscode/blob/main/LICENSE.txt).
92
-
93
- The logo <img src="https://kermanx.github.io/reactive-vscode/logo.svg" width="14"> is modified from [Vue Reactity Artworks](https://github.com/vue-reactivity/art). Licensed under a [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-nc-sa/4.0/).
94
-
95
- Part of the docs website is ported from [VueUse](https://github.com/vueuse/vueuse). Licensed under a [MIT License](https://github.com/vueuse/vueuse/blob/main/LICENSE).
96
-
97
- <!-- Badges -->
98
-
99
- [npm-version-src]: https://img.shields.io/npm/v/reactive-vscode?style=flat&colorA=080f12&colorB=1fa669
100
- [npm-version-href]: https://npmjs.com/package/reactive-vscode
101
- [npm-downloads-src]: https://img.shields.io/npm/dm/reactive-vscode?style=flat&colorA=080f12&colorB=1fa669
102
- [npm-downloads-href]: https://npmjs.com/package/reactive-vscode
103
- [bundle-src]: https://img.shields.io/bundlephobia/minzip/reactive-vscode?style=flat&colorA=080f12&colorB=1fa669&label=minzip
104
- [bundle-href]: https://bundlephobia.com/result?p=reactive-vscode
105
- [license-src]: https://img.shields.io/github/license/KermanX/reactive-vscode.svg?style=flat&colorA=080f12&colorB=1fa669
106
- [license-href]: https://github.com/KermanX/reactive-vscode/blob/main/LICENSE
107
- [jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat&colorA=080f12&colorB=1fa669
108
- [jsdocs-href]: https://www.jsdocs.io/package/reactive-vscode
1
+ # reactive-vscode
2
+
3
+ [![npm version][npm-version-src]][npm-version-href]
4
+ [![npm downloads][npm-downloads-src]][npm-downloads-href]
5
+ [![License][license-src]][license-href]
6
+
7
+ <img src="./docs/public/header.png" width="60%" />
8
+
9
+ **Develop VSCode extension with Vue Reactivity API**
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
+ - [**Examples**](https://kermanx.github.io/reactive-vscode/examples/)
15
+
16
+ ### Project Status
17
+
18
+ Currently, most of the VSCode APIs are covered, and this project has been used in:
19
+
20
+ - [Slidev for VSCode <sub><sub>![downloads](https://img.shields.io/visual-studio-marketplace/d/antfu.slidev.svg)</sub></sub>](https://github.com/slidevjs/slidev/tree/main/packages/vscode)
21
+ - [Iconify IntelliSense <sub><sub>![downloads](https://img.shields.io/visual-studio-marketplace/d/antfu.iconify.svg)</sub></sub>](https://github.com/antfu/vscode-iconify)
22
+
23
+ The [documentation](https://kermanx.github.io/reactive-vscode/) is complete, and the [VueUse integration](https://kermanx.github.io/reactive-vscode/guide/vueuse.html) is also available.
24
+
25
+ However, the project is still in beta and may have minor API changes. If you encounter any problems, please feel free to [open an issue](https://github.com/KermanX/reactive-vscode/issues/new).
26
+
27
+ ### Counter Example
28
+
29
+ ```ts
30
+ import { defineExtension, ref, useCommands, useStatusBarItem } from 'reactive-vscode'
31
+ import { StatusBarAlignment } from 'vscode'
32
+
33
+ export = defineExtension(() => {
34
+ const counter = ref(0)
35
+
36
+ useStatusBarItem({
37
+ alignment: StatusBarAlignment.Right,
38
+ priority: 100,
39
+ text: () => `$(megaphone) Hello*${counter.value}`,
40
+ })
41
+
42
+ useCommands({
43
+ 'extension.sayHello': () => counter.value++,
44
+ 'extension.sayGoodbye': () => counter.value--,
45
+ })
46
+ })
47
+ ```
48
+
49
+ <details>
50
+ <summary> Implementation with original VSCode API </summary>
51
+
52
+ ```ts
53
+ import type { ExtensionContext } from 'vscode'
54
+ import { commands, StatusBarAlignment, window } from 'vscode'
55
+
56
+ export function activate(extensionContext: ExtensionContext) {
57
+ let counter = 0
58
+
59
+ const item = window.createStatusBarItem(StatusBarAlignment.Right, 100)
60
+
61
+ function updateStatusBar() {
62
+ item.text = `$(megaphone) Hello*${counter}`
63
+ item.show()
64
+ }
65
+
66
+ updateStatusBar()
67
+
68
+ extensionContext.subscriptions.push(
69
+ commands.registerCommand('extension.sayHello', () => {
70
+ counter++
71
+ updateStatusBar()
72
+ }),
73
+ commands.registerCommand('extension.sayGoodbye', () => {
74
+ counter--
75
+ updateStatusBar()
76
+ }),
77
+ )
78
+ }
79
+ ```
80
+
81
+ </details>
82
+
83
+ [More examples](https://kermanx.github.io/reactive-vscode/examples/).
84
+
85
+ ### License
86
+
87
+ [MIT](./LICENSE) License © 2024-PRESENT [_Kerman](https://github.com/KermanX)
88
+
89
+ Source code in [the `./packages/reactivity` directory](https://github.com/KermanX/reactive-vscode/blob/main/packages/core/src/reactivity) is ported from [`@vue/runtime-core`](https://github.com/vuejs/core/blob/main/packages/runtime-core). Licensed under a [MIT License](https://github.com/vueuse/vueuse/blob/main/LICENSE).
90
+
91
+ Source code in [the `./packages/mock` directory](https://github.com/KermanX/reactive-vscode/blob/main/packages/core/src/mock) references the implementation of [`VSCode`](https://github.com/microsoft/vscode). Licensed under a [MIT License](https://github.com/microsoft/vscode/blob/main/LICENSE.txt).
92
+
93
+ The logo <img src="https://kermanx.github.io/reactive-vscode/logo.svg" width="14"> is modified from [Vue Reactity Artworks](https://github.com/vue-reactivity/art). Licensed under a [Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License](https://creativecommons.org/licenses/by-nc-sa/4.0/).
94
+
95
+ Part of the docs website is ported from [VueUse](https://github.com/vueuse/vueuse). Licensed under a [MIT License](https://github.com/vueuse/vueuse/blob/main/LICENSE).
96
+
97
+ <!-- Badges -->
98
+
99
+ [npm-version-src]: https://img.shields.io/npm/v/reactive-vscode?style=flat&colorA=080f12&colorB=1fa669
100
+ [npm-version-href]: https://npmjs.com/package/reactive-vscode
101
+ [npm-downloads-src]: https://img.shields.io/npm/dm/reactive-vscode?style=flat&colorA=080f12&colorB=1fa669
102
+ [npm-downloads-href]: https://npmjs.com/package/reactive-vscode
103
+ [bundle-src]: https://img.shields.io/bundlephobia/minzip/reactive-vscode?style=flat&colorA=080f12&colorB=1fa669&label=minzip
104
+ [bundle-href]: https://bundlephobia.com/result?p=reactive-vscode
105
+ [license-src]: https://img.shields.io/github/license/KermanX/reactive-vscode.svg?style=flat&colorA=080f12&colorB=1fa669
106
+ [license-href]: https://github.com/KermanX/reactive-vscode/blob/main/LICENSE
107
+ [jsdocs-src]: https://img.shields.io/badge/jsdocs-reference-080f12?style=flat&colorA=080f12&colorB=1fa669
108
+ [jsdocs-href]: https://www.jsdocs.io/package/reactive-vscode
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("@reactive-vscode/reactivity"),s=require("vscode");function y(e){return n.getCurrentScope()?(n.onScopeDispose(e),!0):!1}function p(e,t){const a=new Map;return(...o)=>{const i=t(...o);let c=a.get(i);return c?c.refCount++:(c={data:e(...o),refCount:1},a.set(i,c)),y(()=>{--c.refCount===0&&a.delete(i)}),c.data}}function v(e){let t;return()=>t??(t=e())}const E=[];function B(e){E.push(e)}const C=n.shallowRef(null),T=n.effectScope();function H(e){return{activate:t=>(C.value=t,T.run(()=>(S.map(a=>a(t)),e()))),deactivate:()=>{E.map(t=>t()),T.stop()}}}const S=[];function x(e){C.value?e(C.value):S.push(e)}function A(e,t,a){const o=!e,i=s.workspace.getConfiguration(o?void 0:e,a);function c(l,d){const w=n.shallowRef(d),h=n.computed({get:()=>w.value,set:f=>{w.value=f,i.update(l,f)}});return h.update=async(f,g,m)=>{await i.update(l,f,g,m),h.value=f},h.set=f=>{w.value=f},h}const u=Object.fromEntries(Object.keys(t).map(l=>[l,c(l,i.get(l))]));return x(()=>{r(s.workspace.onDidChangeConfiguration(o?l=>{const d=s.workspace.getConfiguration();for(const w in t)l.affectsConfiguration(w)&&u[w].set(d.get(w))}:l=>{if(!l.affectsConfiguration(e))return;const d=s.workspace.getConfiguration(e);for(const w in t)l.affectsConfiguration(`${e}.${w}`)&&u[w].set(d.get(w))}))}),u}function K(e,t,a){const o=A(e,t,a);return n.reactive({...o,$update(i,c,u,l){return o[i].update(c,u,l)},$set(i,c){return o[i].set(c)}})}function q(e,t){const a=n.shallowRef(null),o=[],i=c=>(...u)=>a.value?a.value[c](...u):(o.push([c,u]),null);return x(()=>{a.value=N(e,t);for(const[c,u]of o)a.value[c](...u)}),{logger:a,outputChannel:n.computed(()=>{var c;return(c=a.value)==null?void 0:c.outputChannel}),info:i("info"),warn:i("warn"),error:i("error"),append:i("append"),appendLine:i("appendLine"),replace:i("replace"),clear:i("clear"),show:i("show"),hide:i("hide")}}function Q(e,...t){return s.commands.executeCommand(e,...t)}function U(e,t=!1){const a=C.value;if(!a&&!t)throw new Error("Cannot get absolute path because the extension is not activated yet");return a==null?void 0:a.asAbsolutePath(e)}function z(e,t=!1){return n.computed(()=>U(n.toValue(e),t))}function r(e){return(n.getCurrentScope()??T).cleanups.push(e.dispose.bind(e)),e}const I=v(()=>{const e=n.shallowRef(s.window.activeColorTheme);return r(s.window.onDidChangeActiveColorTheme(t=>{e.value=t})),e}),Y=v(()=>{const e=n.shallowRef(s.debug.activeDebugSession);return r(s.debug.onDidChangeActiveDebugSession(t=>{e.value=t})),n.computed(()=>e.value)}),O=v(()=>{const e=n.shallowRef(s.window.activeTextEditor);return r(s.window.onDidChangeActiveTextEditor(t=>{e.value=t})),e});function P(e){var a;const t=n.shallowRef((a=n.toValue(e))==null?void 0:a.getText());return n.watchEffect(()=>{var o;t.value=(o=n.toValue(e))==null?void 0:o.getText()}),r(s.workspace.onDidChangeTextDocument(o=>{o.document===n.toValue(e)&&(t.value=o.document.getText())})),t}function W(e,t,a,o={}){const{updateOn:i=["effect","documentChanged"]}=o,c="key"in t?t:r(s.window.createTextEditorDecorationType(t)),u=async()=>{const d=n.toValue(e);d&&d.setDecorations(c,typeof a=="function"?await a(d):n.toValue(a))},l=i.includes("documentChanged")?P(()=>{var d;return(d=n.toValue(e))==null?void 0:d.document}):null;return i.includes("effect")?n.watchEffect(async()=>{l==null||l.value,await u()}):l&&n.watch(l,u),{update:u}}function G(e,t){const a=O();W(a,e,t)}const J=v(()=>{const e=n.shallowRef(s.window.activeNotebookEditor);return r(s.window.onDidChangeActiveNotebookEditor(t=>{e.value=t})),e}),X=v(()=>{const e=n.shallowRef(s.window.activeTerminal);return r(s.window.onDidChangeActiveTerminal(t=>{e.value=t})),e}),Z=v(()=>{const e=n.shallowRef(s.extensions.all);return r(s.extensions.onDidChange(()=>{e.value=s.extensions.all})),n.computed(()=>e.value)});function F(e,t){r(s.commands.registerCommand(e,t))}function _(e){for(const[t,a]of Object.entries(e))a&&F(t,a)}function ee(e,t){return r(s.comments.createCommentController(e,t))}function R(e){var a;const t=n.shallowRef((a=n.toValue(e))==null?void 0:a.state);return n.watch(e,()=>{var o;t.value=(o=n.toValue(e))==null?void 0:o.state}),r(s.window.onDidChangeTerminalState(o=>{o===n.toValue(e)&&(t.value=o.state)})),n.computed(()=>t.value)}function te(...e){const t=n.ref(null);function a(){return!!t.value&&t.value.exitStatus==null}function o(){return a()?t.value:t.value=s.window.createTerminal(...e)}function i(l){o().sendText(l)}function c(){o().show()}function u(){a()&&(t.value.sendText(""),t.value.dispose(),t.value=null)}return n.onScopeDispose(u),{terminal:t,getIsActive:a,show:c,sendText:i,close:u,state:R(t)}}const ne=v(()=>{const e=n.shallowRef(s.env.shell);return r(s.env.onDidChangeShell(t=>{e.value=t})),n.computed(()=>e.value)});function b(e,t){const a=(o,i,c)=>{r(e(o,i,c))};return t==null||t.forEach(o=>a(o)),a}function V(e,t=[]){const a=Array.isArray(e)?e:t??[],o=r(Array.isArray(e)||e==null?new s.EventEmitter:e),i=b(o.event,a);for(const c of a)i(c);return{event:o.event,fire:o.fire.bind(o),addListener:i}}async function ae(e){const t=C.value.secrets,a=n.ref(await t.get(e));return a.set=async o=>{a.value=o,await t.store(e,o)},a.remove=async()=>{a.value=void 0,await t.delete(e)},r(t.onDidChange(async o=>{o.key===e&&(a.value=await t.get(e))})),n.watch(a,o=>{o===void 0?t.delete(e):t.store(e,o)}),a}function oe(e){return n.computed(()=>s.tasks.fetchTasks(n.toValue(e)))}function ie(e){return n.computed(()=>s.Uri.file(n.toValue(e)))}function se(e,t){const a=new s.EventEmitter,o=n.shallowRef();n.watchEffect(()=>{o.value&&a.fire(),o.value=n.toValue(t)}),r(s.languages.registerFoldingRangeProvider(e,{onDidChangeFoldingRanges:a.event,provideFoldingRanges(i,c,u){var l;return(l=o.value)==null?void 0:l.call(o,i,c,u)}}))}function ue(e,t,a,o){const i=n.shallowReactive(new Map),c=V(),u=V(),l=V(),d=n.computed(()=>{const f=n.toValue(e);return Array.isArray(f)?f:f instanceof Set?Array.from(f):[f]});function w(){const f=d.value;for(const[g,m]of i)f.includes(g)||(m.dispose(),i.delete(g));for(const g of f)if(!i.has(g)){const m=s.workspace.createFileSystemWatcher(g,n.toValue(t)||!1,n.toValue(a)||!1,n.toValue(o)||!1);m.onDidCreate(c.fire),m.onDidChange(u.fire),m.onDidDelete(l.fire),i.set(g,m)}}function h(){for(const f of i.values())f.dispose();i.clear()}return w(),n.watch(d,w),n.watch(()=>[n.toValue(t),n.toValue(a),n.toValue(o)],()=>{h(),w()}),n.onScopeDispose(h),{watchers:i,onDidCreate:c.event,onDidChange:u.event,onDidDelete:l.event}}const ce=v(()=>{const e=I();return n.computed(()=>e.value.kind===s.ColorThemeKind.Dark||e.value.kind===s.ColorThemeKind.HighContrast)}),re=v(()=>{const e=n.shallowRef(s.env.isTelemetryEnabled);return r(s.env.onDidChangeTelemetryEnabled(t=>{e.value=t})),n.computed(()=>e.value)});function le(e,...t){return n.computed(()=>typeof t[0]=="object"?s.l10n.t(n.toValue(e),n.toRaw(t[0])):s.l10n.t(n.toValue(e),...t.map(n.toValue)))}function L(e,t){return r(s.window.createOutputChannel(e,t))}function de(e){const t=new Date,a=String(t.getFullYear()).padStart(4,"0"),o=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),c=String(t.getHours()).padStart(2,"0"),u=String(t.getMinutes()).padStart(2,"0"),l=String(t.getSeconds()).padStart(2,"0"),d=String(t.getMilliseconds()).padStart(3,"0");return`${a}-${o}-${i} ${c}:${u}:${l}.${d} [${e}] `}function N(e,t={}){const a=t.outputChannel??L(e),o=i=>(...c)=>{var u;a.appendLine((((u=t.getPrefix)==null?void 0:u.call(t,i))??"")+c.join(" "))};return{outputChannel:a,createLoggerFunc:o,info:o("INFO"),warn:o("WARN"),error:o("ERROR"),append:a.append.bind(a),appendLine:a.appendLine.bind(a),replace:a.replace.bind(a),clear:a.clear.bind(a),show:a.show.bind(a),hide:a.hide.bind(a)}}const fe=v(()=>{const e=n.shallowRef(s.env.logLevel);return r(s.env.onDidChangeLogLevel(t=>{e.value=t})),n.computed(()=>e.value)});function M(e){var a;const t=n.shallowRef(((a=n.toValue(e))==null?void 0:a.selections)??[]);return n.watch(e,()=>{var o;t.value=((o=n.toValue(e))==null?void 0:o.selections)??[]}),r(s.window.onDidChangeNotebookEditorSelection(o=>{o.notebookEditor===n.toValue(e)&&(t.value=o.selections)})),n.computed({get(){return t.value},set(o){t.value=o;const i=n.toValue(e);i&&(i.selections=o)}})}function we(e){const t=M(e);return n.computed({get(){return t.value[0]},set(a){t.value=t.value.toSpliced(0,1,a)}})}function ve(e){var a;const t=n.shallowRef(((a=n.toValue(e))==null?void 0:a.visibleRanges)??[]);return n.watch(e,()=>{var o;t.value=((o=n.toValue(e))==null?void 0:o.visibleRanges)??[]}),r(s.window.onDidChangeNotebookEditorVisibleRanges(o=>{o.notebookEditor===n.toValue(e)&&(t.value=o.visibleRanges)})),n.computed(()=>t.value)}const he=v(()=>{const e=n.shallowRef(s.window.terminals);function t(){e.value=s.window.terminals}return r(s.window.onDidOpenTerminal(t)),r(s.window.onDidCloseTerminal(t)),e});function ge(e={}){const t=r(s.window.createQuickPick()),a=b(t.onDidChangeActive),o=b(t.onDidChangeSelection),i=b(t.onDidAccept),c=b(t.onDidHide),u=b(t.onDidTriggerButton),l=b(t.onDidChangeValue);["items","buttons","title","step","totalSteps","enabled","busy","ignoreFocusOut","placeholder","canSelectMany","matchOnDescription","matchOnDetail","keepScrollPosition"].forEach(f=>{e[f]&&n.watchEffect(()=>t[f]=n.toValue(e[f]))}),e.value&&(t.value=e.value);const d=n.shallowRef(t.value);l(f=>d.value=f),e.activeItems&&(t.activeItems=e.activeItems);const w=n.shallowRef(t.activeItems);a(f=>w.value=f),e.selectedItems&&(t.selectedItems=e.selectedItems);const h=n.shallowRef(t.selectedItems);return o(f=>h.value=f),{...t,onDidChangeActive:a,onDidChangeSelection:o,onDidAccept:i,onDidHide:c,onDidTriggerButton:u,onDidChangeValue:l,value:d,activeItems:w,selectedItems:h}}function me(e){const t=r(e.id?s.window.createStatusBarItem(e.id,e.alignment,e.priority):s.window.createStatusBarItem(e.alignment,e.priority));function a(o){const i=e[o];i!=null&&n.watchEffect(()=>t[o]=n.toValue(i))}return["name","text","tooltip","color","backgroundColor","command","accessibilityInformation"].forEach(a),t}const be=v(()=>{const e=n.shallowRef(s.tasks.taskExecutions);function t(){e.value=s.tasks.taskExecutions}return r(s.tasks.onDidStartTask(t)),r(s.tasks.onDidEndTask(t)),n.computed(()=>e.value)});function Ce(...e){const t=r(s.window.createTerminal(...e));return{terminal:t,get name(){return t.name},get processId(){return t.processId},get creationOptions(){return t.creationOptions},get exitStatus(){return t.exitStatus},get shellIntegration(){return t.shellIntegration},sendText:t.sendText.bind(t),show:t.show.bind(t),hide:t.hide.bind(t),state:R(t)}}function $(e,t){r(s.commands.registerTextEditorCommand(e,t))}function Ve(e){for(const[t,a]of Object.entries(e))$(t,a)}function j(e,t){var o;const a=n.shallowRef(((o=n.toValue(e))==null?void 0:o.selections)??[]);return n.watch(e,()=>{var i;a.value=((i=n.toValue(e))==null?void 0:i.selections)??[]}),r(s.window.onDidChangeTextEditorSelection(i=>{const c=n.toValue(e),u=n.toValue(t);i.textEditor===c&&(!u||u.includes(i.kind))&&(a.value=i.selections)})),n.computed({get(){return a.value},set(i){a.value=i;const c=n.toValue(e);c&&(c.selections=i)}})}function Te(e,t){const a=j(e,t);return n.computed({get(){return a.value[0]},set(o){a.value=a.value.toSpliced(0,1,o)}})}function De(e){var a;const t=n.shallowRef((a=n.toValue(e))==null?void 0:a.viewColumn);return n.watch(e,()=>{var o;t.value=(o=n.toValue(e))==null?void 0:o.viewColumn}),r(s.window.onDidChangeTextEditorViewColumn(o=>{o.textEditor===n.toValue(e)&&(t.value=o.viewColumn)})),n.computed(()=>t.value)}function pe(e){var a;const t=n.shallowRef(((a=n.toValue(e))==null?void 0:a.visibleRanges)??[]);return n.watch(e,()=>{var o;t.value=((o=n.toValue(e))==null?void 0:o.visibleRanges)??[]}),r(s.window.onDidChangeTextEditorVisibleRanges(o=>{o.textEditor===n.toValue(e)&&(t.value=o.visibleRanges)})),n.computed(()=>t.value)}function k(e,t){n.watchEffect(()=>{const a=n.toValue(e);a&&(a.badge=n.toValue(t))})}function D(e,t){n.watchEffect(()=>{const a=n.toValue(e);a&&(a.title=n.toValue(t))})}const Ee=p((e,t,a)=>{const o=V();n.watch(t,()=>o.fire()),a!=null&&a.watchSource&&n.watch(a.watchSource,()=>o.fire());const i=new WeakMap,c=r(s.window.createTreeView(e,{...a,treeDataProvider:{...a,onDidChangeTreeData:o.event,getTreeItem(u){return u.treeItem},getChildren(u){var l;return u?((l=u.children)==null||l.forEach(d=>i.set(d,u)),u.children):n.toValue(t)},getParent(u){return i.get(u)}}}));return a!=null&&a.title&&D(c,a.title),a!=null&&a.badge&&k(c,a.badge),c},e=>e);function Se(e){var o;const t=n.ref((o=n.toValue(e))==null?void 0:o.visible);function a(){var i;t.value=(i=n.toValue(e))==null?void 0:i.visible}return n.watchEffect(i=>{const c=n.toValue(e);if(c){const u=c.onDidChangeVisibility(a);i(()=>u.dispose())}}),n.watchEffect(a),n.computed(()=>!!t.value)}const xe=v(()=>{const e=n.shallowRef(s.window.visibleNotebookEditors);return r(s.window.onDidChangeVisibleNotebookEditors(t=>{e.value=t})),e}),Re=v(()=>{const e=n.shallowRef(s.window.visibleTextEditors);return r(s.window.onDidChangeVisibleTextEditors(t=>{e.value=t})),e});function ke(e,t,a=!0){const o=n.isRef(t)?t:typeof t=="function"?n.computed(t):n.ref(t);return n.watchEffect(()=>{n.toValue(a)&&s.commands.executeCommand("setContext",e,o.value)}),o}function ye(e,t,a,o,i){const c=n.shallowRef(),u=r(s.window.createWebviewPanel(e,n.toValue(t),o,{enableFindWidget:i==null?void 0:i.enableFindWidget,retainContextWhenHidden:i==null?void 0:i.retainContextWhenHidden,...n.toValue(i==null?void 0:i.webviewOptions)}));i!=null&&i.onDidReceiveMessage&&u.webview.onDidReceiveMessage(i.onDidReceiveMessage);const l=n.ref(0);function d(){l.value++}if(n.watchEffect(()=>{u.webview.html=`${n.toValue(a)}<!--${l.value}-->`}),i!=null&&i.webviewOptions){const g=i.webviewOptions;n.watchEffect(()=>{u.webview.options=n.toValue(g)})}D(u,t);function w(g){return u.webview.postMessage(g)}const h=n.ref(u.active),f=n.ref(u.visible);return r(u.onDidChangeViewState(()=>{h.value=u.active,f.value=u.visible})),{panel:u,context:c,active:h,visible:f,postMessage:w,forceRefresh:d}}const Ae=p((e,t,a)=>{const o=n.shallowRef(),i=n.shallowRef();r(s.window.registerWebviewViewProvider(e,{resolveWebviewView(d,w){o.value=d,i.value=w,a!=null&&a.onDidReceiveMessage&&d.webview.onDidReceiveMessage(a.onDidReceiveMessage)}},{webviewOptions:{retainContextWhenHidden:a==null?void 0:a.retainContextWhenHidden}}));const c=n.ref(0);function u(){c.value++}if(n.watchEffect(()=>{o.value&&(o.value.webview.html=`${n.toValue(t)}<!--${c.value}-->`)}),a!=null&&a.webviewOptions){const d=a.webviewOptions;n.watchEffect(()=>{o.value&&(o.value.webview.options=n.toValue(d))})}a!=null&&a.title&&D(o,a.title),a!=null&&a.badge&&k(o,a.badge);function l(d){var w;return(w=o.value)==null?void 0:w.webview.postMessage(d)}return{view:o,context:i,postMessage:l,forceRefresh:u}},e=>e),Ie=v(()=>{const e=n.shallowRef(s.window.state);return r(s.window.onDidChangeWindowState(t=>{e.value=t})),{focused:n.computed(()=>e.value.focused),active:n.computed(()=>e.value.active)}}),Oe=v(()=>{const e=n.shallowRef(s.workspace.workspaceFolders);return r(s.workspace.onDidChangeWorkspaceFolders(()=>{e.value=s.workspace.workspaceFolders})),n.computed(()=>e.value)});exports.activateCbs=S;exports.createKeyedComposable=p;exports.createSingletonComposable=v;exports.deactivateCbs=E;exports.defineConfigObject=K;exports.defineConfigs=A;exports.defineExtension=H;exports.defineLogger=q;exports.executeCommand=Q;exports.extensionContext=C;exports.extensionScope=T;exports.getDefaultLoggerPrefix=de;exports.onActivate=x;exports.onDeactivate=B;exports.tryOnScopeDispose=y;exports.useAbsolutePath=z;exports.useActiveColorTheme=I;exports.useActiveDebugSession=Y;exports.useActiveEditorDecorations=G;exports.useActiveNotebookEditor=J;exports.useActiveTerminal=X;exports.useActiveTextEditor=O;exports.useAllExtensions=Z;exports.useCommand=F;exports.useCommands=_;exports.useCommentController=ee;exports.useControlledTerminal=te;exports.useDefaultShell=ne;exports.useDisposable=r;exports.useDocumentText=P;exports.useEditorDecorations=W;exports.useEvent=b;exports.useEventEmitter=V;exports.useExtensionSecret=ae;exports.useFetchTasks=oe;exports.useFileUri=ie;exports.useFoldingRangeProvider=se;exports.useFsWatcher=ue;exports.useIsDarkTheme=ce;exports.useIsTelemetryEnabled=re;exports.useL10nText=le;exports.useLogLevel=fe;exports.useLogger=N;exports.useNotebookEditorSelection=we;exports.useNotebookEditorSelections=M;exports.useNotebookEditorVisibleRanges=ve;exports.useOpenedTerminals=he;exports.useOutputChannel=L;exports.useQuickPick=ge;exports.useStatusBarItem=me;exports.useTaskExecutions=be;exports.useTerminal=Ce;exports.useTerminalState=R;exports.useTextEditorCommand=$;exports.useTextEditorCommands=Ve;exports.useTextEditorSelection=Te;exports.useTextEditorSelections=j;exports.useTextEditorViewColumn=De;exports.useTextEditorVisibleRanges=pe;exports.useTreeView=Ee;exports.useViewBadge=k;exports.useViewTitle=D;exports.useViewVisibility=Se;exports.useVisibleNotebookEditors=xe;exports.useVisibleTextEditors=Re;exports.useVscodeContext=ke;exports.useWebviewPanel=ye;exports.useWebviewView=Ae;exports.useWindowState=Ie;exports.useWorkspaceFolders=Oe;Object.keys(n).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>n[e]})});
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("@reactive-vscode/reactivity"),s=require("vscode");function F(e){return n.getCurrentScope()?(n.onScopeDispose(e),!0):!1}function R(e,t){const o=new Map;return(...a)=>{const i=t(...a);let c=o.get(i);return c?c.refCount++:(c={data:e(...a),refCount:1},o.set(i,c)),F(()=>{--c.refCount===0&&o.delete(i)}),c.data}}function g(e){let t;return()=>t!==void 0?t:t=n.effectScope(!0).run(e)}const k=[];function Y(e){k.push(e)}const C=n.shallowRef(null),T=n.effectScope();function G(e){return{activate:t=>(C.value=t,T.run(()=>(y.map(o=>o(t)),e(t)))),deactivate:()=>{k.map(t=>t()),T.stop()}}}const y=[];function A(e){C.value?e(C.value):y.push(e)}function L(e,t,o){const a=!e,i=s.workspace.getConfiguration(a?void 0:e,o);function c(r,d){const w=n.shallowRef(d),h=n.computed({get:()=>w.value,set:f=>{w.value=f,i.update(r,f)}});return h.update=async(f,v,m)=>{await i.update(r,f,v,m),h.value=f},h.set=f=>{w.value=f},h}const u=Object.fromEntries(Object.keys(t).map(r=>[r,c(r,i.get(r))]));return A(()=>{l(s.workspace.onDidChangeConfiguration(a?r=>{const d=s.workspace.getConfiguration();for(const w in t)r.affectsConfiguration(w)&&u[w].set(d.get(w))}:r=>{if(!r.affectsConfiguration(e))return;const d=s.workspace.getConfiguration(e);for(const w in t)r.affectsConfiguration(`${e}.${w}`)&&u[w].set(d.get(w))}))}),u}function J(e,t,o){const a=L(e,t,o),i={},c={$update(u,r,d,w){return a[u].update(r,d,w)},$set(u,r){return a[u].set(r)}};for(const u in t){const r=u.split(".");let d="",w=i,h=c;for(const v of r.slice(0,-1)){d=d?`${d}.${v}`:v;const m=w=w[v]||(w[v]={});if(h[v])h=h[v];else{const I={};Object.defineProperty(h,v,{enumerable:!0,get(){return I},set(z){function W(S,x,p){if(S)for(const D in S)W(S[D],x?`${x}.${D}`:D,p==null?void 0:p[D]);else a[x].value=p}W(m,d,z)}}),h=I}}const f=r[r.length-1];w[f]=null,Object.defineProperty(h,f,{enumerable:!0,get(){return a[u].value},set(v){a[u].value=v}})}return c}function X(e,t){const o=n.shallowRef(null),a=[],i=c=>(...u)=>o.value?o.value[c](...u):(a.push([c,u]),null);return A(()=>{o.value=K(e,t);for(const[c,u]of a)o.value[c](...u)}),{logger:o,outputChannel:n.computed(()=>{var c;return(c=o.value)==null?void 0:c.outputChannel}),info:i("info"),warn:i("warn"),error:i("error"),append:i("append"),appendLine:i("appendLine"),replace:i("replace"),clear:i("clear"),show:i("show"),hide:i("hide")}}function Z(e,...t){return s.commands.executeCommand(e,...t)}function _(e,t=!1){const o=C.value;if(!o&&!t)throw new Error("Cannot get absolute path because the extension is not activated yet");return o==null?void 0:o.asAbsolutePath(e)}function ee(e,t=!1){return n.computed(()=>_(n.toValue(e),t))}function l(e){return(n.getCurrentScope()??T).cleanups.push(e.dispose.bind(e)),e}const N=g(()=>{const e=n.shallowRef(s.window.activeColorTheme);return l(s.window.onDidChangeActiveColorTheme(t=>{e.value=t})),e}),te=g(()=>{const e=n.shallowRef(s.debug.activeDebugSession);return l(s.debug.onDidChangeActiveDebugSession(t=>{e.value=t})),n.computed(()=>e.value)}),$=g(()=>{const e=n.shallowRef(s.window.activeTextEditor);return l(s.window.onDidChangeActiveTextEditor(t=>{e.value=t})),e});function M(e){var o;const t=n.shallowRef((o=n.toValue(e))==null?void 0:o.getText());return n.watchEffect(()=>{var a;t.value=(a=n.toValue(e))==null?void 0:a.getText()}),l(s.workspace.onDidChangeTextDocument(a=>{a.document===n.toValue(e)&&(t.value=a.document.getText())})),t}function j(e,t,o,a={}){const{updateOn:i=["effect","documentChanged"]}=a,c="key"in t?t:l(s.window.createTextEditorDecorationType(t)),u=async()=>{const d=n.toValue(e);d&&d.setDecorations(c,typeof o=="function"?await o(d):n.toValue(o))},r=i.includes("documentChanged")?M(()=>{var d;return(d=n.toValue(e))==null?void 0:d.document}):null;return i.includes("effect")?n.watchEffect(async()=>{r==null||r.value,await u()}):r&&n.watch(r,u),{update:u}}function ne(e,t){const o=$();j(o,e,t)}const oe=g(()=>{const e=n.shallowRef(s.window.activeNotebookEditor);return l(s.window.onDidChangeActiveNotebookEditor(t=>{e.value=t})),e}),ae=g(()=>{const e=n.shallowRef(s.window.activeTerminal);return l(s.window.onDidChangeActiveTerminal(t=>{e.value=t})),e}),ie=g(()=>{const e=n.shallowRef(s.extensions.all);return l(s.extensions.onDidChange(()=>{e.value=s.extensions.all})),n.computed(()=>e.value)});function B(e,t){l(s.commands.registerCommand(e,t))}function se(e){for(const[t,o]of Object.entries(e))o&&B(t,o)}function ue(e,t){return l(s.comments.createCommentController(e,t))}function O(e){var o;const t=n.shallowRef((o=n.toValue(e))==null?void 0:o.state);return n.watch(e,()=>{var a;t.value=(a=n.toValue(e))==null?void 0:a.state}),l(s.window.onDidChangeTerminalState(a=>{a===n.toValue(e)&&(t.value=a.state)})),n.computed(()=>t.value)}function ce(...e){const t=n.ref(null);function o(){return!!t.value&&t.value.exitStatus==null}function a(){return o()?t.value:t.value=s.window.createTerminal(...e)}function i(r){a().sendText(r)}function c(){a().show()}function u(){o()&&(t.value.sendText(""),t.value.dispose(),t.value=null)}return n.onScopeDispose(u),{terminal:t,getIsActive:o,show:c,sendText:i,close:u,state:O(t)}}const re=g(()=>{const e=n.shallowRef(s.env.shell);return l(s.env.onDidChangeShell(t=>{e.value=t})),n.computed(()=>e.value)});function b(e,t){const o=(a,i,c)=>{l(e(a,i,c))};return t==null||t.forEach(a=>o(a)),o}function V(e,t=[]){const o=Array.isArray(e)?e:t??[],a=l(Array.isArray(e)||e==null?new s.EventEmitter:e),i=b(a.event,o);for(const c of o)i(c);return{event:a.event,fire:a.fire.bind(a),addListener:i}}async function le(e){const t=C.value.secrets,o=n.ref(await t.get(e));return o.set=async a=>{o.value=a,await t.store(e,a)},o.remove=async()=>{o.value=void 0,await t.delete(e)},l(t.onDidChange(async a=>{a.key===e&&(o.value=await t.get(e))})),n.watch(o,a=>{a===void 0?t.delete(e):t.store(e,a)}),o}function de(e){return n.computed(()=>s.tasks.fetchTasks(n.toValue(e)))}function fe(e){return n.computed(()=>s.Uri.file(n.toValue(e)))}function we(e,t){const o=new s.EventEmitter,a=n.shallowRef();n.watchEffect(()=>{a.value&&o.fire(),a.value=n.toValue(t)}),l(s.languages.registerFoldingRangeProvider(e,{onDidChangeFoldingRanges:o.event,provideFoldingRanges(i,c,u){var r;return(r=a.value)==null?void 0:r.call(a,i,c,u)}}))}function ve(e,t,o,a){const i=n.shallowReactive(new Map),c=V(),u=V(),r=V(),d=n.computed(()=>{const f=n.toValue(e);return Array.isArray(f)?f:f instanceof Set?Array.from(f):[f]});function w(){const f=d.value;for(const[v,m]of i)f.includes(v)||(m.dispose(),i.delete(v));for(const v of f)if(!i.has(v)){const m=s.workspace.createFileSystemWatcher(v,n.toValue(t)||!1,n.toValue(o)||!1,n.toValue(a)||!1);m.onDidCreate(c.fire),m.onDidChange(u.fire),m.onDidDelete(r.fire),i.set(v,m)}}function h(){for(const f of i.values())f.dispose();i.clear()}return w(),n.watch(d,w),n.watch(()=>[n.toValue(t),n.toValue(o),n.toValue(a)],()=>{h(),w()}),n.onScopeDispose(h),{watchers:i,onDidCreate:c.event,onDidChange:u.event,onDidDelete:r.event}}const he=g(()=>{const e=N();return n.computed(()=>e.value.kind===s.ColorThemeKind.Dark||e.value.kind===s.ColorThemeKind.HighContrast)}),ge=g(()=>{const e=n.shallowRef(s.env.isTelemetryEnabled);return l(s.env.onDidChangeTelemetryEnabled(t=>{e.value=t})),n.computed(()=>e.value)});function me(e,...t){return n.computed(()=>typeof t[0]=="object"?s.l10n.t(n.toValue(e),n.toRaw(t[0])):s.l10n.t(n.toValue(e),...t.map(n.toValue)))}function H(e,t){return l(s.window.createOutputChannel(e,t))}function be(e){const t=new Date,o=String(t.getFullYear()).padStart(4,"0"),a=String(t.getMonth()+1).padStart(2,"0"),i=String(t.getDate()).padStart(2,"0"),c=String(t.getHours()).padStart(2,"0"),u=String(t.getMinutes()).padStart(2,"0"),r=String(t.getSeconds()).padStart(2,"0"),d=String(t.getMilliseconds()).padStart(3,"0");return`${o}-${a}-${i} ${c}:${u}:${r}.${d} [${e}] `}function K(e,t={}){const o=t.outputChannel??H(e),a=i=>(...c)=>{var u;o.appendLine((((u=t.getPrefix)==null?void 0:u.call(t,i))??"")+c.join(" "))};return{outputChannel:o,createLoggerFunc:a,info:a("INFO"),warn:a("WARN"),error:a("ERROR"),append:o.append.bind(o),appendLine:o.appendLine.bind(o),replace:o.replace.bind(o),clear:o.clear.bind(o),show:o.show.bind(o),hide:o.hide.bind(o)}}const Ce=g(()=>{const e=n.shallowRef(s.env.logLevel);return l(s.env.onDidChangeLogLevel(t=>{e.value=t})),n.computed(()=>e.value)});function q(e){var o;const t=n.shallowRef(((o=n.toValue(e))==null?void 0:o.selections)??[]);return n.watch(e,()=>{var a;t.value=((a=n.toValue(e))==null?void 0:a.selections)??[]}),l(s.window.onDidChangeNotebookEditorSelection(a=>{a.notebookEditor===n.toValue(e)&&(t.value=a.selections)})),n.computed({get(){return t.value},set(a){t.value=a;const i=n.toValue(e);i&&(i.selections=a)}})}function Ve(e){const t=q(e);return n.computed({get(){return t.value[0]},set(o){t.value=t.value.toSpliced(0,1,o)}})}function pe(e){var o;const t=n.shallowRef(((o=n.toValue(e))==null?void 0:o.visibleRanges)??[]);return n.watch(e,()=>{var a;t.value=((a=n.toValue(e))==null?void 0:a.visibleRanges)??[]}),l(s.window.onDidChangeNotebookEditorVisibleRanges(a=>{a.notebookEditor===n.toValue(e)&&(t.value=a.visibleRanges)})),n.computed(()=>t.value)}const De=g(()=>{const e=n.shallowRef(s.window.terminals);function t(){e.value=s.window.terminals}return l(s.window.onDidOpenTerminal(t)),l(s.window.onDidCloseTerminal(t)),e});function Te(e={}){const t=l(s.window.createQuickPick()),o=b(t.onDidChangeActive),a=b(t.onDidChangeSelection),i=b(t.onDidAccept),c=b(t.onDidHide),u=b(t.onDidTriggerButton),r=b(t.onDidChangeValue);["items","buttons","title","step","totalSteps","enabled","busy","ignoreFocusOut","placeholder","canSelectMany","matchOnDescription","matchOnDetail","keepScrollPosition"].forEach(f=>{e[f]&&n.watchEffect(()=>t[f]=n.toValue(e[f]))}),e.value&&(t.value=e.value);const d=n.shallowRef(t.value);r(f=>d.value=f),e.activeItems&&(t.activeItems=e.activeItems);const w=n.shallowRef(t.activeItems);o(f=>w.value=f),e.selectedItems&&(t.selectedItems=e.selectedItems);const h=n.shallowRef(t.selectedItems);return a(f=>h.value=f),{...t,onDidChangeActive:o,onDidChangeSelection:a,onDidAccept:i,onDidHide:c,onDidTriggerButton:u,onDidChangeValue:r,value:d,activeItems:w,selectedItems:h}}function Ee(e){const t=l(e.id?s.window.createStatusBarItem(e.id,e.alignment,e.priority):s.window.createStatusBarItem(e.alignment,e.priority));function o(a){const i=e[a];i!=null&&n.watchEffect(()=>t[a]=n.toValue(i))}return["name","text","tooltip","color","backgroundColor","command","accessibilityInformation"].forEach(o),t}const Se=g(()=>{const e=n.shallowRef(s.tasks.taskExecutions);function t(){e.value=s.tasks.taskExecutions}return l(s.tasks.onDidStartTask(t)),l(s.tasks.onDidEndTask(t)),n.computed(()=>e.value)});function xe(...e){const t=l(s.window.createTerminal(...e));return{terminal:t,get name(){return t.name},get processId(){return t.processId},get creationOptions(){return t.creationOptions},get exitStatus(){return t.exitStatus},get shellIntegration(){return t.shellIntegration},sendText:t.sendText.bind(t),show:t.show.bind(t),hide:t.hide.bind(t),state:O(t)}}function Q(e,t){l(s.commands.registerTextEditorCommand(e,t))}function Re(e){for(const[t,o]of Object.entries(e))Q(t,o)}function U(e,t){var a;const o=n.shallowRef(((a=n.toValue(e))==null?void 0:a.selections)??[]);return n.watch(e,()=>{var i;o.value=((i=n.toValue(e))==null?void 0:i.selections)??[]}),l(s.window.onDidChangeTextEditorSelection(i=>{const c=n.toValue(e),u=n.toValue(t);i.textEditor===c&&(!u||u.includes(i.kind))&&(o.value=i.selections)})),n.computed({get(){return o.value},set(i){o.value=i;const c=n.toValue(e);c&&(c.selections=i)}})}function ke(e,t){const o=U(e,t);return n.computed({get(){return o.value[0]},set(a){o.value=o.value.toSpliced(0,1,a)}})}function ye(e){var o;const t=n.shallowRef((o=n.toValue(e))==null?void 0:o.viewColumn);return n.watch(e,()=>{var a;t.value=(a=n.toValue(e))==null?void 0:a.viewColumn}),l(s.window.onDidChangeTextEditorViewColumn(a=>{a.textEditor===n.toValue(e)&&(t.value=a.viewColumn)})),n.computed(()=>t.value)}function Ae(e){var o;const t=n.shallowRef(((o=n.toValue(e))==null?void 0:o.visibleRanges)??[]);return n.watch(e,()=>{var a;t.value=((a=n.toValue(e))==null?void 0:a.visibleRanges)??[]}),l(s.window.onDidChangeTextEditorVisibleRanges(a=>{a.textEditor===n.toValue(e)&&(t.value=a.visibleRanges)})),n.computed(()=>t.value)}function P(e,t){n.watchEffect(()=>{const o=n.toValue(e);o&&(o.badge=n.toValue(t))})}function E(e,t){n.watchEffect(()=>{const o=n.toValue(e);o&&(o.title=n.toValue(t))})}const Oe=R((e,t,o)=>{const a=V();n.watch(t,()=>a.fire()),o!=null&&o.watchSource&&n.watch(o.watchSource,()=>a.fire());const i=new WeakMap,c=l(s.window.createTreeView(e,{...o,treeDataProvider:{...o,onDidChangeTreeData:a.event,getTreeItem(u){return u.treeItem},getChildren(u){var r;return u?((r=u.children)==null||r.forEach(d=>i.set(d,u)),u.children):n.toValue(t)},getParent(u){return i.get(u)}}}));return o!=null&&o.title&&E(c,o.title),o!=null&&o.badge&&P(c,o.badge),c},e=>e);function Pe(e){var a;const t=n.ref((a=n.toValue(e))==null?void 0:a.visible);function o(){var i;t.value=(i=n.toValue(e))==null?void 0:i.visible}return n.watchEffect(i=>{const c=n.toValue(e);if(c){const u=c.onDidChangeVisibility(o);i(()=>u.dispose())}}),n.watchEffect(o),n.computed(()=>!!t.value)}const Ie=g(()=>{const e=n.shallowRef(s.window.visibleNotebookEditors);return l(s.window.onDidChangeVisibleNotebookEditors(t=>{e.value=t})),e}),We=g(()=>{const e=n.shallowRef(s.window.visibleTextEditors);return l(s.window.onDidChangeVisibleTextEditors(t=>{e.value=t})),e});function Fe(e,t,o=!0){const a=n.isRef(t)?t:typeof t=="function"?n.computed(t):n.ref(t);return n.watchEffect(()=>{n.toValue(o)&&s.commands.executeCommand("setContext",e,a.value)}),a}function Le(e,t,o,a,i){const c=n.shallowRef(),u=l(s.window.createWebviewPanel(e,n.toValue(t),a,{enableFindWidget:i==null?void 0:i.enableFindWidget,retainContextWhenHidden:i==null?void 0:i.retainContextWhenHidden,...n.toValue(i==null?void 0:i.webviewOptions)}));i!=null&&i.onDidReceiveMessage&&u.webview.onDidReceiveMessage(i.onDidReceiveMessage);const r=n.ref(0);function d(){r.value++}if(n.watchEffect(()=>{u.webview.html=`${n.toValue(o)}<!--${r.value}-->`}),i!=null&&i.webviewOptions){const v=i.webviewOptions;n.watchEffect(()=>{u.webview.options=n.toValue(v)})}E(u,t);function w(v){return u.webview.postMessage(v)}const h=n.ref(u.active),f=n.ref(u.visible);return l(u.onDidChangeViewState(()=>{h.value=u.active,f.value=u.visible})),{panel:u,context:c,active:h,visible:f,postMessage:w,forceRefresh:d}}const Ne=R((e,t,o)=>{const a=n.shallowRef(),i=n.shallowRef();l(s.window.registerWebviewViewProvider(e,{resolveWebviewView(d,w){a.value=d,i.value=w,o!=null&&o.onDidReceiveMessage&&d.webview.onDidReceiveMessage(o.onDidReceiveMessage)}},{webviewOptions:{retainContextWhenHidden:o==null?void 0:o.retainContextWhenHidden}}));const c=n.ref(0);function u(){c.value++}if(n.watchEffect(()=>{a.value&&(a.value.webview.html=`${n.toValue(t)}<!--${c.value}-->`)}),o!=null&&o.webviewOptions){const d=o.webviewOptions;n.watchEffect(()=>{a.value&&(a.value.webview.options=n.toValue(d))})}o!=null&&o.title&&E(a,o.title),o!=null&&o.badge&&P(a,o.badge);function r(d){var w;return(w=a.value)==null?void 0:w.webview.postMessage(d)}return{view:a,context:i,postMessage:r,forceRefresh:u}},e=>e),$e=g(()=>{const e=n.shallowRef(s.window.state);return l(s.window.onDidChangeWindowState(t=>{e.value=t})),{focused:n.computed(()=>e.value.focused),active:n.computed(()=>e.value.active)}}),Me=g(()=>{const e=n.shallowRef(s.workspace.workspaceFolders);return l(s.workspace.onDidChangeWorkspaceFolders(()=>{e.value=s.workspace.workspaceFolders})),n.computed(()=>e.value)});exports.activateCbs=y;exports.createKeyedComposable=R;exports.createSingletonComposable=g;exports.deactivateCbs=k;exports.defineConfigObject=J;exports.defineConfigs=L;exports.defineExtension=G;exports.defineLogger=X;exports.executeCommand=Z;exports.extensionContext=C;exports.extensionScope=T;exports.getDefaultLoggerPrefix=be;exports.onActivate=A;exports.onDeactivate=Y;exports.tryOnScopeDispose=F;exports.useAbsolutePath=ee;exports.useActiveColorTheme=N;exports.useActiveDebugSession=te;exports.useActiveEditorDecorations=ne;exports.useActiveNotebookEditor=oe;exports.useActiveTerminal=ae;exports.useActiveTextEditor=$;exports.useAllExtensions=ie;exports.useCommand=B;exports.useCommands=se;exports.useCommentController=ue;exports.useControlledTerminal=ce;exports.useDefaultShell=re;exports.useDisposable=l;exports.useDocumentText=M;exports.useEditorDecorations=j;exports.useEvent=b;exports.useEventEmitter=V;exports.useExtensionSecret=le;exports.useFetchTasks=de;exports.useFileUri=fe;exports.useFoldingRangeProvider=we;exports.useFsWatcher=ve;exports.useIsDarkTheme=he;exports.useIsTelemetryEnabled=ge;exports.useL10nText=me;exports.useLogLevel=Ce;exports.useLogger=K;exports.useNotebookEditorSelection=Ve;exports.useNotebookEditorSelections=q;exports.useNotebookEditorVisibleRanges=pe;exports.useOpenedTerminals=De;exports.useOutputChannel=H;exports.useQuickPick=Te;exports.useStatusBarItem=Ee;exports.useTaskExecutions=Se;exports.useTerminal=xe;exports.useTerminalState=O;exports.useTextEditorCommand=Q;exports.useTextEditorCommands=Re;exports.useTextEditorSelection=ke;exports.useTextEditorSelections=U;exports.useTextEditorViewColumn=ye;exports.useTextEditorVisibleRanges=Ae;exports.useTreeView=Oe;exports.useViewBadge=P;exports.useViewTitle=E;exports.useViewVisibility=Pe;exports.useVisibleNotebookEditors=Ie;exports.useVisibleTextEditors=We;exports.useVscodeContext=Fe;exports.useWebviewPanel=Le;exports.useWebviewView=Ne;exports.useWindowState=$e;exports.useWorkspaceFolders=Me;Object.keys(n).forEach(e=>{e!=="default"&&!Object.prototype.hasOwnProperty.call(exports,e)&&Object.defineProperty(exports,e,{enumerable:!0,get:()=>n[e]})});
package/dist/index.d.ts CHANGED
@@ -133,7 +133,7 @@ export declare function createSingletonComposable<T>(fn: () => T): () => T;
133
133
  */
134
134
  export declare function defineConfigObject<const C extends ConfigTypeOptions>(section: Nullable<string>, configs: C, scope?: Nullable<ConfigurationScope>): ConfigObject<ParseConfigTypeOptions<C>>;
135
135
 
136
- export declare function defineConfigObject<C extends object>(section: Nullable<string>, configs: C, scope?: Nullable<ConfigurationScope>): ConfigObject<C>;
136
+ export declare function defineConfigObject<C extends object>(section: Nullable<string>, configs: Record<string, any>, scope?: Nullable<ConfigurationScope>): ConfigObject<C>;
137
137
 
138
138
  /**
139
139
  * Define configurations of an extension. See `vscode::workspace.getConfiguration`.
@@ -151,8 +151,8 @@ export declare function defineConfigs<C extends object>(section: Nullable<string
151
151
  *
152
152
  * @category lifecycle
153
153
  */
154
- export declare function defineExtension<T>(setup: () => T): {
155
- activate: (extCtx: ExtensionContext) => T | undefined;
154
+ export declare function defineExtension<T>(setup: (context: ExtensionContext) => T): {
155
+ activate: (context: ExtensionContext) => T | undefined;
156
156
  deactivate: () => void;
157
157
  };
158
158