reactive-vscode 0.2.17 → 0.2.18
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 +2 -2
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +167 -164
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ export = defineExtension(() => {
|
|
|
37
37
|
useStatusBarItem({
|
|
38
38
|
alignment: StatusBarAlignment.Right,
|
|
39
39
|
priority: 100,
|
|
40
|
-
text: () =>
|
|
40
|
+
text: () => `Hello ${counter.value}`,
|
|
41
41
|
})
|
|
42
42
|
|
|
43
43
|
useCommands({
|
|
@@ -60,7 +60,7 @@ export function activate(extensionContext: ExtensionContext) {
|
|
|
60
60
|
const item = window.createStatusBarItem(StatusBarAlignment.Right, 100)
|
|
61
61
|
|
|
62
62
|
function updateStatusBar() {
|
|
63
|
-
item.text =
|
|
63
|
+
item.text = `Hello ${counter}`
|
|
64
64
|
item.show()
|
|
65
65
|
}
|
|
66
66
|
|
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 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),D=n.effectScope();function G(e){return{activate:t=>(C.value=t,D.run(()=>(y.map(o=>o(t)),e(t)))),deactivate:()=>{k.map(t=>t()),D.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,l){const f=n.shallowRef(l),h=n.computed({get:()=>f.value,set:w=>{f.value=w,i.update(r,w)}});return h.update=async(w,v,m)=>{await i.update(r,w,v,m),h.value=w},h.set=w=>{f.value=w},h}const u=Object.fromEntries(Object.keys(t).map(r=>[r,c(r,i.get(r))]));return A(()=>{d(s.workspace.onDidChangeConfiguration(a?r=>{const l=s.workspace.getConfiguration();for(const f in t)r.affectsConfiguration(f)&&u[f].set(l.get(f))}:r=>{if(!r.affectsConfiguration(e))return;const l=s.workspace.getConfiguration(e);for(const f in t)r.affectsConfiguration(`${e}.${f}`)&&u[f].set(l.get(f))}))}),u}function J(e,t,o){const a=L(e,t,o),i={},c=n.shallowReactive({$update(u,r,l,f){return a[u].update(r,l,f)},$set(u,r){return a[u].set(r)}});for(const u in t){const r=u.split(".");let l="",f=i,h=c;for(const v of r.slice(0,-1)){l=l?`${l}.${v}`:v;const m=f=f[v]||(f[v]={});if(h[v])h=h[v];else{const O=n.shallowReactive({});Object.defineProperty(h,v,{enumerable:!0,get(){return O},set(z){function W(S,x,p){if(S)for(const T in S)W(S[T],x?`${x}.${T}`:T,p==null?void 0:p[T]);else a[x].value=p}W(m,l,z)}}),h=O}}const w=r[r.length-1];f[w]=null,Object.defineProperty(h,w,{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 d(e){return(n.getCurrentScope()??D).cleanups.push(e.dispose.bind(e)),e}const N=g(()=>{const e=n.shallowRef(s.window.activeColorTheme);return d(s.window.onDidChangeActiveColorTheme(t=>{e.value=t})),e}),te=g(()=>{const e=n.shallowRef(s.debug.activeDebugSession);return d(s.debug.onDidChangeActiveDebugSession(t=>{e.value=t})),n.computed(()=>e.value)}),$=g(()=>{const e=n.shallowRef(s.window.activeTextEditor);return d(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()}),d(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=n.computed(l=>{l==null||l.dispose();const f=n.toValue(t);return"key"in f?f:d(s.window.createTextEditorDecorationType(f))}),u=async()=>{const l=n.toValue(e);l&&l.setDecorations(c.value,typeof o=="function"?await o(l):n.toValue(o))},r=i.includes("documentChanged")?M(()=>{var l;return(l=n.toValue(e))==null?void 0:l.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 d(s.window.onDidChangeActiveNotebookEditor(t=>{e.value=t})),e}),ae=g(()=>{const e=n.shallowRef(s.window.activeTerminal);return d(s.window.onDidChangeActiveTerminal(t=>{e.value=t})),e}),ie=g(()=>{const e=n.shallowRef(s.extensions.all);return d(s.extensions.onDidChange(()=>{e.value=s.extensions.all})),n.computed(()=>e.value)});function B(e,t){d(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 d(s.comments.createCommentController(e,t))}function P(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}),d(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:P(t)}}const re=g(()=>{const e=n.shallowRef(s.env.shell);return d(s.env.onDidChangeShell(t=>{e.value=t})),n.computed(()=>e.value)});function b(e,t){const o=(a,i,c)=>{d(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=d(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)},d(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)}),d(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(),l=n.computed(()=>{const w=n.toValue(e);return Array.isArray(w)?w:w instanceof Set?Array.from(w):[w]});function f(){const w=l.value;for(const[v,m]of i)w.includes(v)||(m.dispose(),i.delete(v));for(const v of w)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 w of i.values())w.dispose();i.clear()}return f(),n.watch(l,f),n.watch(()=>[n.toValue(t),n.toValue(o),n.toValue(a)],()=>{h(),f()}),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 d(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 d(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"),l=String(t.getMilliseconds()).padStart(3,"0");return`${o}-${a}-${i} ${c}:${u}:${r}.${l} [${e}] `}function K(e,t={}){const o=t.outputChannel??H(e,{log:!0}),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 d(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)??[]}),d(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)??[]}),d(s.window.onDidChangeNotebookEditorVisibleRanges(a=>{a.notebookEditor===n.toValue(e)&&(t.value=a.visibleRanges)})),n.computed(()=>t.value)}const Te=g(()=>{const e=n.shallowRef(s.window.terminals);function t(){e.value=s.window.terminals}return d(s.window.onDidOpenTerminal(t)),d(s.window.onDidCloseTerminal(t)),e});function De(e={}){const t=d(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(w=>{e[w]&&n.watchEffect(()=>t[w]=n.toValue(e[w]))}),e.value&&(t.value=e.value);const l=n.shallowRef(t.value);r(w=>l.value=w),e.activeItems&&(t.activeItems=e.activeItems);const f=n.shallowRef(t.activeItems);o(w=>f.value=w),e.selectedItems&&(t.selectedItems=e.selectedItems);const h=n.shallowRef(t.selectedItems);return a(w=>h.value=w),{...t,onDidChangeActive:o,onDidChangeSelection:a,onDidAccept:i,onDidHide:c,onDidTriggerButton:u,onDidChangeValue:r,value:l,activeItems:f,selectedItems:h}}function Ee(e){const t=d(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),e.visible!=null&&n.watchEffect(()=>{n.toValue(e.visible)?t.show():t.hide()}),t}const Se=g(()=>{const e=n.shallowRef(s.tasks.taskExecutions);function t(){e.value=s.tasks.taskExecutions}return d(s.tasks.onDidStartTask(t)),d(s.tasks.onDidEndTask(t)),n.computed(()=>e.value)});function xe(...e){const t=d(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:P(t)}}function Q(e,t){d(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)??[]}),d(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}),d(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)??[]}),d(s.window.onDidChangeTextEditorVisibleRanges(a=>{a.textEditor===n.toValue(e)&&(t.value=a.visibleRanges)})),n.computed(()=>t.value)}function I(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 Pe=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=d(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(l=>i.set(l,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&&I(c,o.badge),c},e=>e);function Ie(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 Oe=g(()=>{const e=n.shallowRef(s.window.visibleNotebookEditors);return d(s.window.onDidChangeVisibleNotebookEditors(t=>{e.value=t})),e}),We=g(()=>{const e=n.shallowRef(s.window.visibleTextEditors);return d(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=d(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 l(){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 f(v){return u.webview.postMessage(v)}const h=n.ref(u.active),w=n.ref(u.visible);return d(u.onDidChangeViewState(()=>{h.value=u.active,w.value=u.visible})),{panel:u,context:c,active:h,visible:w,postMessage:f,forceRefresh:l}}const Ne=R((e,t,o)=>{const a=n.shallowRef(),i=n.shallowRef();d(s.window.registerWebviewViewProvider(e,{resolveWebviewView(l,f){a.value=l,i.value=f,o!=null&&o.onDidReceiveMessage&&l.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 l=o.webviewOptions;n.watchEffect(()=>{a.value&&(a.value.webview.options=n.toValue(l))})}o!=null&&o.title&&E(a,o.title),o!=null&&o.badge&&I(a,o.badge);function r(l){var f;return(f=a.value)==null?void 0:f.webview.postMessage(l)}return{view:a,context:i,postMessage:r,forceRefresh:u}},e=>e),$e=g(()=>{const e=n.shallowRef(s.window.state);return d(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 d(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=D;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=d;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=Te;exports.useOutputChannel=H;exports.useQuickPick=De;exports.useStatusBarItem=Ee;exports.useTaskExecutions=Se;exports.useTerminal=xe;exports.useTerminalState=P;exports.useTextEditorCommand=Q;exports.useTextEditorCommands=Re;exports.useTextEditorSelection=ke;exports.useTextEditorSelections=U;exports.useTextEditorViewColumn=ye;exports.useTextEditorVisibleRanges=Ae;exports.useTreeView=Pe;exports.useViewBadge=I;exports.useViewTitle=E;exports.useViewVisibility=Ie;exports.useVisibleNotebookEditors=Oe;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]})});
|
|
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),D=n.effectScope();function G(e){return{activate:t=>(C.value=t,D.run(()=>(y.map(o=>o(t)),e(t)))),deactivate:()=>{k.map(t=>t()),D.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,l){const f=n.shallowRef(l),h=n.computed({get:()=>f.value,set:w=>{f.value=w,i.update(r,w)}});return h.update=async(w,v,m)=>{await i.update(r,w,v,m),h.value=w},h.set=w=>{f.value=w},h}const u=Object.fromEntries(Object.keys(t).map(r=>[r,c(r,i.get(r))]));return A(()=>{d(s.workspace.onDidChangeConfiguration(a?r=>{const l=s.workspace.getConfiguration();for(const f in t)r.affectsConfiguration(f)&&u[f].set(l.get(f))}:r=>{if(!r.affectsConfiguration(e))return;const l=s.workspace.getConfiguration(e);for(const f in t)r.affectsConfiguration(`${e}.${f}`)&&u[f].set(l.get(f))}))}),u}function J(e,t,o){const a=L(e,t,o),i={},c=n.shallowReactive({$update(u,r,l,f){return a[u].update(r,l,f)},$set(u,r){return a[u].set(r)}});for(const u in t){const r=u.split(".");let l="",f=i,h=c;for(const v of r.slice(0,-1)){l=l?`${l}.${v}`:v;const m=f=f[v]||(f[v]={});if(h[v])h=h[v];else{const O=n.shallowReactive({});Object.defineProperty(h,v,{enumerable:!0,get(){return O},set(z){function W(S,x,p){if(S)for(const T in S)W(S[T],x?`${x}.${T}`:T,p==null?void 0:p[T]);else a[x].value=p}W(m,l,z)}}),h=O}}const w=r[r.length-1];f[w]=null,Object.defineProperty(h,w,{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 d(e){return(n.getCurrentScope()??D).cleanups.push(e.dispose.bind(e)),e}const N=g(()=>{const e=n.shallowRef(s.window.activeColorTheme);return d(s.window.onDidChangeActiveColorTheme(t=>{e.value=t})),e}),te=g(()=>{const e=n.shallowRef(s.debug.activeDebugSession);return d(s.debug.onDidChangeActiveDebugSession(t=>{e.value=t})),n.computed(()=>e.value)}),$=g(()=>{const e=n.shallowRef(s.window.activeTextEditor);return d(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()}),d(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=n.computed(l=>{l==null||l.dispose();const f=n.toValue(t);return"key"in f?f:d(s.window.createTextEditorDecorationType(f))}),u=async()=>{const l=n.toValue(e);l&&l.setDecorations(c.value,typeof o=="function"?await o(l):n.toValue(o))},r=i.includes("documentChanged")?M(()=>{var l;return(l=n.toValue(e))==null?void 0:l.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,o={}){const a=$();return j(a,e,t,o)}const oe=g(()=>{const e=n.shallowRef(s.window.activeNotebookEditor);return d(s.window.onDidChangeActiveNotebookEditor(t=>{e.value=t})),e}),ae=g(()=>{const e=n.shallowRef(s.window.activeTerminal);return d(s.window.onDidChangeActiveTerminal(t=>{e.value=t})),e}),ie=g(()=>{const e=n.shallowRef(s.extensions.all);return d(s.extensions.onDidChange(()=>{e.value=s.extensions.all})),n.computed(()=>e.value)});function B(e,t){d(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 d(s.comments.createCommentController(e,t))}function P(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}),d(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:P(t)}}const re=g(()=>{const e=n.shallowRef(s.env.shell);return d(s.env.onDidChangeShell(t=>{e.value=t})),n.computed(()=>e.value)});function b(e,t){const o=(a,i,c)=>{d(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=d(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)},d(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)}),d(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(),l=n.computed(()=>{const w=n.toValue(e);return Array.isArray(w)?w:w instanceof Set?Array.from(w):[w]});function f(){const w=l.value;for(const[v,m]of i)w.includes(v)||(m.dispose(),i.delete(v));for(const v of w)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 w of i.values())w.dispose();i.clear()}return f(),n.watch(l,f),n.watch(()=>[n.toValue(t),n.toValue(o),n.toValue(a)],()=>{h(),f()}),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 d(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 d(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"),l=String(t.getMilliseconds()).padStart(3,"0");return`${o}-${a}-${i} ${c}:${u}:${r}.${l} [${e}] `}function K(e,t={}){const o=t.outputChannel??H(e,{log:!0}),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 d(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)??[]}),d(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)??[]}),d(s.window.onDidChangeNotebookEditorVisibleRanges(a=>{a.notebookEditor===n.toValue(e)&&(t.value=a.visibleRanges)})),n.computed(()=>t.value)}const Te=g(()=>{const e=n.shallowRef(s.window.terminals);function t(){e.value=s.window.terminals}return d(s.window.onDidOpenTerminal(t)),d(s.window.onDidCloseTerminal(t)),e});function De(e={}){const t=d(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(w=>{e[w]&&n.watchEffect(()=>t[w]=n.toValue(e[w]))}),e.value&&(t.value=e.value);const l=n.shallowRef(t.value);r(w=>l.value=w),e.activeItems&&(t.activeItems=e.activeItems);const f=n.shallowRef(t.activeItems);o(w=>f.value=w),e.selectedItems&&(t.selectedItems=e.selectedItems);const h=n.shallowRef(t.selectedItems);return a(w=>h.value=w),{...t,onDidChangeActive:o,onDidChangeSelection:a,onDidAccept:i,onDidHide:c,onDidTriggerButton:u,onDidChangeValue:r,value:l,activeItems:f,selectedItems:h}}function Ee(e){const t=d(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),e.visible!=null&&n.watchEffect(()=>{n.toValue(e.visible)?t.show():t.hide()}),t}const Se=g(()=>{const e=n.shallowRef(s.tasks.taskExecutions);function t(){e.value=s.tasks.taskExecutions}return d(s.tasks.onDidStartTask(t)),d(s.tasks.onDidEndTask(t)),n.computed(()=>e.value)});function xe(...e){const t=d(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:P(t)}}function Q(e,t){d(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)??[]}),d(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}),d(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)??[]}),d(s.window.onDidChangeTextEditorVisibleRanges(a=>{a.textEditor===n.toValue(e)&&(t.value=a.visibleRanges)})),n.computed(()=>t.value)}function I(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 Pe=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=d(s.window.createTreeView(e,{...o,treeDataProvider:{...o,onDidChangeTreeData:a.event,getTreeItem(u){return u.treeItem},async getChildren(u){if(u){const r=await u.children;return r==null||r.forEach(l=>i.set(l,u)),r}return n.toValue(t)},getParent(u){return i.get(u)}}}));return o!=null&&o.title&&E(c,o.title),o!=null&&o.badge&&I(c,o.badge),c},e=>e);function Ie(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 Oe=g(()=>{const e=n.shallowRef(s.window.visibleNotebookEditors);return d(s.window.onDidChangeVisibleNotebookEditors(t=>{e.value=t})),e}),We=g(()=>{const e=n.shallowRef(s.window.visibleTextEditors);return d(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=d(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 l(){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 f(v){return u.webview.postMessage(v)}const h=n.ref(u.active),w=n.ref(u.visible);return d(u.onDidChangeViewState(()=>{h.value=u.active,w.value=u.visible})),{panel:u,context:c,active:h,visible:w,postMessage:f,forceRefresh:l}}const Ne=R((e,t,o)=>{const a=n.shallowRef(),i=n.shallowRef();d(s.window.registerWebviewViewProvider(e,{resolveWebviewView(l,f){a.value=l,i.value=f,o!=null&&o.onDidReceiveMessage&&l.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 l=o.webviewOptions;n.watchEffect(()=>{a.value&&(a.value.webview.options=n.toValue(l))})}o!=null&&o.title&&E(a,o.title),o!=null&&o.badge&&I(a,o.badge);function r(l){var f;return(f=a.value)==null?void 0:f.webview.postMessage(l)}return{view:a,context:i,postMessage:r,forceRefresh:u}},e=>e),$e=g(()=>{const e=n.shallowRef(s.window.state);return d(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 d(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=D;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=d;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=Te;exports.useOutputChannel=H;exports.useQuickPick=De;exports.useStatusBarItem=Ee;exports.useTaskExecutions=Se;exports.useTerminal=xe;exports.useTerminalState=P;exports.useTextEditorCommand=Q;exports.useTextEditorCommands=Re;exports.useTextEditorSelection=ke;exports.useTextEditorSelections=U;exports.useTextEditorViewColumn=ye;exports.useTextEditorVisibleRanges=Ae;exports.useTreeView=Pe;exports.useViewBadge=I;exports.useViewTitle=E;exports.useViewVisibility=Ie;exports.useVisibleNotebookEditors=Oe;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
|
@@ -328,7 +328,7 @@ declare type ToConfigRefs<C extends object> = {
|
|
|
328
328
|
};
|
|
329
329
|
|
|
330
330
|
export declare interface TreeViewNode {
|
|
331
|
-
readonly children?: this[]
|
|
331
|
+
readonly children?: Awaitable<this[]>;
|
|
332
332
|
readonly treeItem: TreeItem | Thenable<TreeItem>;
|
|
333
333
|
}
|
|
334
334
|
|
|
@@ -362,7 +362,9 @@ export declare const useActiveDebugSession: () => ComputedRef<DebugSession | und
|
|
|
362
362
|
*
|
|
363
363
|
* @category editor
|
|
364
364
|
*/
|
|
365
|
-
export declare function useActiveEditorDecorations(decorationTypeOrOptions: MaybeRefOrGetter<TextEditorDecorationType | DecorationRenderOptions>,
|
|
365
|
+
export declare function useActiveEditorDecorations(decorationTypeOrOptions: MaybeRefOrGetter<TextEditorDecorationType | DecorationRenderOptions>, decorations: MaybeRef<readonly Range[] | readonly DecorationOptions[]> | ((editor: TextEditor) => Awaitable<readonly Range[] | readonly DecorationOptions[]>), options?: UseEditorDecorationsOptions): {
|
|
366
|
+
update: () => Promise<void>;
|
|
367
|
+
};
|
|
366
368
|
|
|
367
369
|
/**
|
|
368
370
|
* @reactive `window.activeNotebookEditor`
|
|
@@ -732,7 +734,7 @@ export declare function useTextEditorVisibleRanges(textEditor: MaybeNullableRefO
|
|
|
732
734
|
*
|
|
733
735
|
* @category view
|
|
734
736
|
*/
|
|
735
|
-
export declare const useTreeView: <T extends TreeViewNode>(viewId: string, treeData: MaybeRefOrGetter<T[]
|
|
737
|
+
export declare const useTreeView: <T extends TreeViewNode>(viewId: string, treeData: MaybeRefOrGetter<Awaitable<T[]>>, options?: UseTreeViewOptions<T> | undefined) => TreeView<T>;
|
|
736
738
|
|
|
737
739
|
export declare type UseTreeViewOptions<T> = Omit<TreeViewOptions<T>, 'treeDataProvider'> & Pick<TreeDataProvider<T>, 'resolveTreeItem'> & {
|
|
738
740
|
title?: MaybeRefOrGetter<string | undefined>;
|
package/dist/index.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import { getCurrentScope as K, onScopeDispose as F, effectScope as Q, shallowRef as g, computed as h, shallowReactive as $, toValue as s, watchEffect as C, watch as D, ref as x, toRaw as ee, isRef as te } from "@reactive-vscode/reactivity";
|
|
2
2
|
export * from "@reactive-vscode/reactivity";
|
|
3
|
-
import { workspace as S, commands as I, window as v, debug as H, extensions as O, comments as ne, env as p, EventEmitter as U, tasks as k, Uri as
|
|
3
|
+
import { workspace as S, commands as I, window as v, debug as H, extensions as O, comments as ne, env as p, EventEmitter as U, tasks as k, Uri as ae, languages as ie, ColorThemeKind as B, l10n as z } from "vscode";
|
|
4
4
|
function re(e) {
|
|
5
5
|
return K() ? (F(e), !0) : !1;
|
|
6
6
|
}
|
|
7
7
|
function q(e, t) {
|
|
8
8
|
const n = /* @__PURE__ */ new Map();
|
|
9
|
-
return (...
|
|
10
|
-
const
|
|
11
|
-
let u = n.get(
|
|
9
|
+
return (...a) => {
|
|
10
|
+
const i = t(...a);
|
|
11
|
+
let u = n.get(i);
|
|
12
12
|
return u ? u.refCount++ : (u = {
|
|
13
|
-
data: e(...
|
|
13
|
+
data: e(...a),
|
|
14
14
|
refCount: 1
|
|
15
|
-
}, n.set(
|
|
16
|
-
--u.refCount === 0 && n.delete(
|
|
15
|
+
}, n.set(i, u)), re(() => {
|
|
16
|
+
--u.refCount === 0 && n.delete(i);
|
|
17
17
|
}), u.data;
|
|
18
18
|
};
|
|
19
19
|
}
|
|
@@ -39,26 +39,26 @@ function J(e) {
|
|
|
39
39
|
R.value ? e(R.value) : G.push(e);
|
|
40
40
|
}
|
|
41
41
|
function se(e, t, n) {
|
|
42
|
-
const
|
|
42
|
+
const a = !e, i = S.getConfiguration(a ? void 0 : e, n);
|
|
43
43
|
function u(c, o) {
|
|
44
44
|
const d = g(o), b = h({
|
|
45
45
|
get: () => d.value,
|
|
46
46
|
set: (f) => {
|
|
47
|
-
d.value = f,
|
|
47
|
+
d.value = f, i.update(c, f);
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
50
|
return b.update = async (f, m, T) => {
|
|
51
|
-
await
|
|
51
|
+
await i.update(c, f, m, T), b.value = f;
|
|
52
52
|
}, b.set = (f) => {
|
|
53
53
|
d.value = f;
|
|
54
54
|
}, b;
|
|
55
55
|
}
|
|
56
56
|
const r = Object.fromEntries(
|
|
57
|
-
Object.keys(t).map((c) => [c, u(c,
|
|
57
|
+
Object.keys(t).map((c) => [c, u(c, i.get(c))])
|
|
58
58
|
);
|
|
59
59
|
return J(() => {
|
|
60
60
|
l(S.onDidChangeConfiguration(
|
|
61
|
-
|
|
61
|
+
a ? (c) => {
|
|
62
62
|
const o = S.getConfiguration();
|
|
63
63
|
for (const d in t)
|
|
64
64
|
c.affectsConfiguration(d) && r[d].set(o.get(d));
|
|
@@ -73,17 +73,17 @@ function se(e, t, n) {
|
|
|
73
73
|
}), r;
|
|
74
74
|
}
|
|
75
75
|
function Se(e, t, n) {
|
|
76
|
-
const
|
|
76
|
+
const a = se(e, t, n), i = {}, u = $({
|
|
77
77
|
$update(r, c, o, d) {
|
|
78
|
-
return
|
|
78
|
+
return a[r].update(c, o, d);
|
|
79
79
|
},
|
|
80
80
|
$set(r, c) {
|
|
81
|
-
return
|
|
81
|
+
return a[r].set(c);
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
84
|
for (const r in t) {
|
|
85
85
|
const c = r.split(".");
|
|
86
|
-
let o = "", d =
|
|
86
|
+
let o = "", d = i, b = u;
|
|
87
87
|
for (const m of c.slice(0, -1)) {
|
|
88
88
|
o = o ? `${o}.${m}` : m;
|
|
89
89
|
const T = d = d[m] || (d[m] = {});
|
|
@@ -102,7 +102,7 @@ function Se(e, t, n) {
|
|
|
102
102
|
for (const V in P)
|
|
103
103
|
j(P[V], W ? `${W}.${V}` : V, y == null ? void 0 : y[V]);
|
|
104
104
|
else
|
|
105
|
-
|
|
105
|
+
a[W].value = y;
|
|
106
106
|
}
|
|
107
107
|
j(T, o, _);
|
|
108
108
|
}
|
|
@@ -113,20 +113,20 @@ function Se(e, t, n) {
|
|
|
113
113
|
d[f] = null, Object.defineProperty(b, f, {
|
|
114
114
|
enumerable: !0,
|
|
115
115
|
get() {
|
|
116
|
-
return
|
|
116
|
+
return a[r].value;
|
|
117
117
|
},
|
|
118
118
|
set(m) {
|
|
119
|
-
|
|
119
|
+
a[r].value = m;
|
|
120
120
|
}
|
|
121
121
|
});
|
|
122
122
|
}
|
|
123
123
|
return u;
|
|
124
124
|
}
|
|
125
125
|
function xe(e, t) {
|
|
126
|
-
const n = g(null),
|
|
126
|
+
const n = g(null), a = [], i = (u) => (...r) => n.value ? n.value[u](...r) : (a.push([u, r]), null);
|
|
127
127
|
return J(() => {
|
|
128
128
|
n.value = ge(e, t);
|
|
129
|
-
for (const [u, r] of
|
|
129
|
+
for (const [u, r] of a)
|
|
130
130
|
n.value[u](...r);
|
|
131
131
|
}), {
|
|
132
132
|
logger: n,
|
|
@@ -134,15 +134,15 @@ function xe(e, t) {
|
|
|
134
134
|
var u;
|
|
135
135
|
return (u = n.value) == null ? void 0 : u.outputChannel;
|
|
136
136
|
}),
|
|
137
|
-
info:
|
|
138
|
-
warn:
|
|
139
|
-
error:
|
|
140
|
-
append:
|
|
141
|
-
appendLine:
|
|
142
|
-
replace:
|
|
143
|
-
clear:
|
|
144
|
-
show:
|
|
145
|
-
hide:
|
|
137
|
+
info: i("info"),
|
|
138
|
+
warn: i("warn"),
|
|
139
|
+
error: i("error"),
|
|
140
|
+
append: i("append"),
|
|
141
|
+
appendLine: i("appendLine"),
|
|
142
|
+
replace: i("replace"),
|
|
143
|
+
clear: i("clear"),
|
|
144
|
+
show: i("show"),
|
|
145
|
+
hide: i("hide")
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
148
|
function Ee(e, ...t) {
|
|
@@ -180,16 +180,16 @@ function le(e) {
|
|
|
180
180
|
var n;
|
|
181
181
|
const t = g((n = s(e)) == null ? void 0 : n.getText());
|
|
182
182
|
return C(() => {
|
|
183
|
-
var
|
|
184
|
-
t.value = (
|
|
185
|
-
}), l(S.onDidChangeTextDocument((
|
|
186
|
-
|
|
183
|
+
var a;
|
|
184
|
+
t.value = (a = s(e)) == null ? void 0 : a.getText();
|
|
185
|
+
}), l(S.onDidChangeTextDocument((a) => {
|
|
186
|
+
a.document === s(e) && (t.value = a.document.getText());
|
|
187
187
|
})), t;
|
|
188
188
|
}
|
|
189
|
-
function de(e, t, n,
|
|
189
|
+
function de(e, t, n, a = {}) {
|
|
190
190
|
const {
|
|
191
|
-
updateOn:
|
|
192
|
-
} =
|
|
191
|
+
updateOn: i = ["effect", "documentChanged"]
|
|
192
|
+
} = a, u = h(
|
|
193
193
|
(o) => {
|
|
194
194
|
o == null || o.dispose();
|
|
195
195
|
const d = s(t);
|
|
@@ -201,11 +201,11 @@ function de(e, t, n, i = {}) {
|
|
|
201
201
|
u.value,
|
|
202
202
|
typeof n == "function" ? await n(o) : s(n)
|
|
203
203
|
);
|
|
204
|
-
}, c =
|
|
204
|
+
}, c = i.includes("documentChanged") ? le(() => {
|
|
205
205
|
var o;
|
|
206
206
|
return (o = s(e)) == null ? void 0 : o.document;
|
|
207
207
|
}) : null;
|
|
208
|
-
return
|
|
208
|
+
return i.includes("effect") ? C(async () => {
|
|
209
209
|
c == null || c.value, await r();
|
|
210
210
|
}) : c && D(c, r), {
|
|
211
211
|
/**
|
|
@@ -214,9 +214,9 @@ function de(e, t, n, i = {}) {
|
|
|
214
214
|
update: r
|
|
215
215
|
};
|
|
216
216
|
}
|
|
217
|
-
function Re(e, t) {
|
|
218
|
-
const
|
|
219
|
-
de(
|
|
217
|
+
function Re(e, t, n = {}) {
|
|
218
|
+
const a = oe();
|
|
219
|
+
return de(a, e, t, n);
|
|
220
220
|
}
|
|
221
221
|
const ye = w(() => {
|
|
222
222
|
const e = g(v.activeNotebookEditor);
|
|
@@ -248,10 +248,10 @@ function X(e) {
|
|
|
248
248
|
var n;
|
|
249
249
|
const t = g((n = s(e)) == null ? void 0 : n.state);
|
|
250
250
|
return D(e, () => {
|
|
251
|
-
var
|
|
252
|
-
t.value = (
|
|
253
|
-
}), l(v.onDidChangeTerminalState((
|
|
254
|
-
|
|
251
|
+
var a;
|
|
252
|
+
t.value = (a = s(e)) == null ? void 0 : a.state;
|
|
253
|
+
}), l(v.onDidChangeTerminalState((a) => {
|
|
254
|
+
a === s(e) && (t.value = a.state);
|
|
255
255
|
})), h(() => t.value);
|
|
256
256
|
}
|
|
257
257
|
function We(...e) {
|
|
@@ -259,14 +259,14 @@ function We(...e) {
|
|
|
259
259
|
function n() {
|
|
260
260
|
return !!t.value && t.value.exitStatus == null;
|
|
261
261
|
}
|
|
262
|
-
function
|
|
262
|
+
function a() {
|
|
263
263
|
return n() ? t.value : t.value = v.createTerminal(...e);
|
|
264
264
|
}
|
|
265
|
-
function
|
|
266
|
-
|
|
265
|
+
function i(c) {
|
|
266
|
+
a().sendText(c);
|
|
267
267
|
}
|
|
268
268
|
function u() {
|
|
269
|
-
|
|
269
|
+
a().show();
|
|
270
270
|
}
|
|
271
271
|
function r() {
|
|
272
272
|
n() && (t.value.sendText(""), t.value.dispose(), t.value = null);
|
|
@@ -275,7 +275,7 @@ function We(...e) {
|
|
|
275
275
|
terminal: t,
|
|
276
276
|
getIsActive: n,
|
|
277
277
|
show: u,
|
|
278
|
-
sendText:
|
|
278
|
+
sendText: i,
|
|
279
279
|
close: r,
|
|
280
280
|
state: X(t)
|
|
281
281
|
};
|
|
@@ -287,90 +287,90 @@ const Oe = w(() => {
|
|
|
287
287
|
})), h(() => e.value);
|
|
288
288
|
});
|
|
289
289
|
function E(e, t) {
|
|
290
|
-
const n = (
|
|
291
|
-
l(e(
|
|
290
|
+
const n = (a, i, u) => {
|
|
291
|
+
l(e(a, i, u));
|
|
292
292
|
};
|
|
293
|
-
return t == null || t.forEach((
|
|
293
|
+
return t == null || t.forEach((a) => n(a)), n;
|
|
294
294
|
}
|
|
295
295
|
function A(e, t = []) {
|
|
296
|
-
const n = Array.isArray(e) ? e : t ?? [],
|
|
296
|
+
const n = Array.isArray(e) ? e : t ?? [], a = l(Array.isArray(e) || e == null ? new U() : e), i = E(a.event, n);
|
|
297
297
|
for (const u of n)
|
|
298
|
-
|
|
298
|
+
i(u);
|
|
299
299
|
return {
|
|
300
|
-
event:
|
|
301
|
-
fire:
|
|
302
|
-
addListener:
|
|
300
|
+
event: a.event,
|
|
301
|
+
fire: a.fire.bind(a),
|
|
302
|
+
addListener: i
|
|
303
303
|
};
|
|
304
304
|
}
|
|
305
305
|
async function $e(e) {
|
|
306
306
|
const t = R.value.secrets, n = x(await t.get(e));
|
|
307
|
-
return n.set = async (
|
|
308
|
-
n.value =
|
|
307
|
+
return n.set = async (a) => {
|
|
308
|
+
n.value = a, await t.store(e, a);
|
|
309
309
|
}, n.remove = async () => {
|
|
310
310
|
n.value = void 0, await t.delete(e);
|
|
311
|
-
}, l(t.onDidChange(async (
|
|
312
|
-
|
|
313
|
-
})), D(n, (
|
|
314
|
-
|
|
311
|
+
}, l(t.onDidChange(async (a) => {
|
|
312
|
+
a.key === e && (n.value = await t.get(e));
|
|
313
|
+
})), D(n, (a) => {
|
|
314
|
+
a === void 0 ? t.delete(e) : t.store(e, a);
|
|
315
315
|
}), n;
|
|
316
316
|
}
|
|
317
317
|
function Me(e) {
|
|
318
318
|
return h(() => k.fetchTasks(s(e)));
|
|
319
319
|
}
|
|
320
320
|
function Fe(e) {
|
|
321
|
-
return h(() =>
|
|
321
|
+
return h(() => ae.file(s(e)));
|
|
322
322
|
}
|
|
323
323
|
function Le(e, t) {
|
|
324
|
-
const n = new U(),
|
|
324
|
+
const n = new U(), a = g();
|
|
325
325
|
C(() => {
|
|
326
|
-
|
|
327
|
-
}), l(
|
|
326
|
+
a.value && n.fire(), a.value = s(t);
|
|
327
|
+
}), l(ie.registerFoldingRangeProvider(
|
|
328
328
|
e,
|
|
329
329
|
{
|
|
330
330
|
onDidChangeFoldingRanges: n.event,
|
|
331
|
-
provideFoldingRanges(
|
|
331
|
+
provideFoldingRanges(i, u, r) {
|
|
332
332
|
var c;
|
|
333
|
-
return (c =
|
|
333
|
+
return (c = a.value) == null ? void 0 : c.call(a, i, u, r);
|
|
334
334
|
}
|
|
335
335
|
}
|
|
336
336
|
));
|
|
337
337
|
}
|
|
338
|
-
function Ne(e, t, n,
|
|
339
|
-
const
|
|
338
|
+
function Ne(e, t, n, a) {
|
|
339
|
+
const i = $(/* @__PURE__ */ new Map()), u = A(), r = A(), c = A(), o = h(() => {
|
|
340
340
|
const f = s(e);
|
|
341
341
|
return Array.isArray(f) ? f : f instanceof Set ? Array.from(f) : [f];
|
|
342
342
|
});
|
|
343
343
|
function d() {
|
|
344
344
|
const f = o.value;
|
|
345
|
-
for (const [m, T] of
|
|
346
|
-
f.includes(m) || (T.dispose(),
|
|
345
|
+
for (const [m, T] of i)
|
|
346
|
+
f.includes(m) || (T.dispose(), i.delete(m));
|
|
347
347
|
for (const m of f)
|
|
348
|
-
if (!
|
|
348
|
+
if (!i.has(m)) {
|
|
349
349
|
const T = S.createFileSystemWatcher(
|
|
350
350
|
m,
|
|
351
351
|
s(t) || !1,
|
|
352
352
|
s(n) || !1,
|
|
353
|
-
s(
|
|
353
|
+
s(a) || !1
|
|
354
354
|
);
|
|
355
|
-
T.onDidCreate(u.fire), T.onDidChange(r.fire), T.onDidDelete(c.fire),
|
|
355
|
+
T.onDidCreate(u.fire), T.onDidChange(r.fire), T.onDidDelete(c.fire), i.set(m, T);
|
|
356
356
|
}
|
|
357
357
|
}
|
|
358
358
|
function b() {
|
|
359
|
-
for (const f of
|
|
359
|
+
for (const f of i.values())
|
|
360
360
|
f.dispose();
|
|
361
|
-
|
|
361
|
+
i.clear();
|
|
362
362
|
}
|
|
363
363
|
return d(), D(o, d), D(
|
|
364
364
|
() => [
|
|
365
365
|
s(t),
|
|
366
366
|
s(n),
|
|
367
|
-
s(
|
|
367
|
+
s(a)
|
|
368
368
|
],
|
|
369
369
|
() => {
|
|
370
370
|
b(), d();
|
|
371
371
|
}
|
|
372
372
|
), F(b), {
|
|
373
|
-
watchers:
|
|
373
|
+
watchers: i,
|
|
374
374
|
onDidCreate: u.event,
|
|
375
375
|
onDidChange: r.event,
|
|
376
376
|
onDidDelete: c.event
|
|
@@ -392,20 +392,20 @@ function ve(e, t) {
|
|
|
392
392
|
return l(v.createOutputChannel(e, t));
|
|
393
393
|
}
|
|
394
394
|
function ze(e) {
|
|
395
|
-
const t = /* @__PURE__ */ new Date(), n = String(t.getFullYear()).padStart(4, "0"),
|
|
396
|
-
return `${n}-${
|
|
395
|
+
const t = /* @__PURE__ */ new Date(), n = String(t.getFullYear()).padStart(4, "0"), a = String(t.getMonth() + 1).padStart(2, "0"), i = String(t.getDate()).padStart(2, "0"), u = String(t.getHours()).padStart(2, "0"), r = String(t.getMinutes()).padStart(2, "0"), c = String(t.getSeconds()).padStart(2, "0"), o = String(t.getMilliseconds()).padStart(3, "0");
|
|
396
|
+
return `${n}-${a}-${i} ${u}:${r}:${c}.${o} [${e}] `;
|
|
397
397
|
}
|
|
398
398
|
function ge(e, t = {}) {
|
|
399
|
-
const n = t.outputChannel ?? ve(e, { log: !0 }),
|
|
399
|
+
const n = t.outputChannel ?? ve(e, { log: !0 }), a = (i) => (...u) => {
|
|
400
400
|
var r;
|
|
401
|
-
n.appendLine((((r = t.getPrefix) == null ? void 0 : r.call(t,
|
|
401
|
+
n.appendLine((((r = t.getPrefix) == null ? void 0 : r.call(t, i)) ?? "") + u.join(" "));
|
|
402
402
|
};
|
|
403
403
|
return {
|
|
404
404
|
outputChannel: n,
|
|
405
|
-
createLoggerFunc:
|
|
406
|
-
info:
|
|
407
|
-
warn:
|
|
408
|
-
error:
|
|
405
|
+
createLoggerFunc: a,
|
|
406
|
+
info: a("INFO"),
|
|
407
|
+
warn: a("WARN"),
|
|
408
|
+
error: a("ERROR"),
|
|
409
409
|
append: n.append.bind(n),
|
|
410
410
|
appendLine: n.appendLine.bind(n),
|
|
411
411
|
replace: n.replace.bind(n),
|
|
@@ -424,18 +424,18 @@ function he(e) {
|
|
|
424
424
|
var n;
|
|
425
425
|
const t = g(((n = s(e)) == null ? void 0 : n.selections) ?? []);
|
|
426
426
|
return D(e, () => {
|
|
427
|
-
var
|
|
428
|
-
t.value = ((
|
|
429
|
-
}), l(v.onDidChangeNotebookEditorSelection((
|
|
430
|
-
|
|
427
|
+
var a;
|
|
428
|
+
t.value = ((a = s(e)) == null ? void 0 : a.selections) ?? [];
|
|
429
|
+
}), l(v.onDidChangeNotebookEditorSelection((a) => {
|
|
430
|
+
a.notebookEditor === s(e) && (t.value = a.selections);
|
|
431
431
|
})), h({
|
|
432
432
|
get() {
|
|
433
433
|
return t.value;
|
|
434
434
|
},
|
|
435
|
-
set(
|
|
436
|
-
t.value =
|
|
437
|
-
const
|
|
438
|
-
|
|
435
|
+
set(a) {
|
|
436
|
+
t.value = a;
|
|
437
|
+
const i = s(e);
|
|
438
|
+
i && (i.selections = a);
|
|
439
439
|
}
|
|
440
440
|
});
|
|
441
441
|
}
|
|
@@ -454,10 +454,10 @@ function Ue(e) {
|
|
|
454
454
|
var n;
|
|
455
455
|
const t = g(((n = s(e)) == null ? void 0 : n.visibleRanges) ?? []);
|
|
456
456
|
return D(e, () => {
|
|
457
|
-
var
|
|
458
|
-
t.value = ((
|
|
459
|
-
}), l(v.onDidChangeNotebookEditorVisibleRanges((
|
|
460
|
-
|
|
457
|
+
var a;
|
|
458
|
+
t.value = ((a = s(e)) == null ? void 0 : a.visibleRanges) ?? [];
|
|
459
|
+
}), l(v.onDidChangeNotebookEditorVisibleRanges((a) => {
|
|
460
|
+
a.notebookEditor === s(e) && (t.value = a.visibleRanges);
|
|
461
461
|
})), h(() => t.value);
|
|
462
462
|
}
|
|
463
463
|
const qe = w(() => {
|
|
@@ -468,7 +468,7 @@ const qe = w(() => {
|
|
|
468
468
|
return l(v.onDidOpenTerminal(t)), l(v.onDidCloseTerminal(t)), e;
|
|
469
469
|
});
|
|
470
470
|
function Ye(e = {}) {
|
|
471
|
-
const t = l(v.createQuickPick()), n = E(t.onDidChangeActive),
|
|
471
|
+
const t = l(v.createQuickPick()), n = E(t.onDidChangeActive), a = E(t.onDidChangeSelection), i = E(t.onDidAccept), u = E(t.onDidHide), r = E(t.onDidTriggerButton), c = E(t.onDidChangeValue);
|
|
472
472
|
[
|
|
473
473
|
"items",
|
|
474
474
|
"buttons",
|
|
@@ -491,11 +491,11 @@ function Ye(e = {}) {
|
|
|
491
491
|
const d = g(t.activeItems);
|
|
492
492
|
n((f) => d.value = f), e.selectedItems && (t.selectedItems = e.selectedItems);
|
|
493
493
|
const b = g(t.selectedItems);
|
|
494
|
-
return
|
|
494
|
+
return a((f) => b.value = f), {
|
|
495
495
|
...t,
|
|
496
496
|
onDidChangeActive: n,
|
|
497
|
-
onDidChangeSelection:
|
|
498
|
-
onDidAccept:
|
|
497
|
+
onDidChangeSelection: a,
|
|
498
|
+
onDidAccept: i,
|
|
499
499
|
onDidHide: u,
|
|
500
500
|
onDidTriggerButton: r,
|
|
501
501
|
onDidChangeValue: c,
|
|
@@ -506,9 +506,9 @@ function Ye(e = {}) {
|
|
|
506
506
|
}
|
|
507
507
|
function Ge(e) {
|
|
508
508
|
const t = l(e.id ? v.createStatusBarItem(e.id, e.alignment, e.priority) : v.createStatusBarItem(e.alignment, e.priority));
|
|
509
|
-
function n(
|
|
510
|
-
const
|
|
511
|
-
|
|
509
|
+
function n(a) {
|
|
510
|
+
const i = e[a];
|
|
511
|
+
i != null && C(() => t[a] = s(i));
|
|
512
512
|
}
|
|
513
513
|
return [
|
|
514
514
|
"name",
|
|
@@ -562,22 +562,22 @@ function Ze(e) {
|
|
|
562
562
|
me(t, n);
|
|
563
563
|
}
|
|
564
564
|
function be(e, t) {
|
|
565
|
-
var
|
|
566
|
-
const n = g(((
|
|
565
|
+
var a;
|
|
566
|
+
const n = g(((a = s(e)) == null ? void 0 : a.selections) ?? []);
|
|
567
567
|
return D(e, () => {
|
|
568
|
-
var
|
|
569
|
-
n.value = ((
|
|
570
|
-
}), l(v.onDidChangeTextEditorSelection((
|
|
568
|
+
var i;
|
|
569
|
+
n.value = ((i = s(e)) == null ? void 0 : i.selections) ?? [];
|
|
570
|
+
}), l(v.onDidChangeTextEditorSelection((i) => {
|
|
571
571
|
const u = s(e), r = s(t);
|
|
572
|
-
|
|
572
|
+
i.textEditor === u && (!r || r.includes(i.kind)) && (n.value = i.selections);
|
|
573
573
|
})), h({
|
|
574
574
|
get() {
|
|
575
575
|
return n.value;
|
|
576
576
|
},
|
|
577
|
-
set(
|
|
578
|
-
n.value =
|
|
577
|
+
set(i) {
|
|
578
|
+
n.value = i;
|
|
579
579
|
const u = s(e);
|
|
580
|
-
u && (u.selections =
|
|
580
|
+
u && (u.selections = i);
|
|
581
581
|
}
|
|
582
582
|
});
|
|
583
583
|
}
|
|
@@ -587,8 +587,8 @@ function _e(e, t) {
|
|
|
587
587
|
get() {
|
|
588
588
|
return n.value[0];
|
|
589
589
|
},
|
|
590
|
-
set(
|
|
591
|
-
n.value = n.value.toSpliced(0, 1,
|
|
590
|
+
set(a) {
|
|
591
|
+
n.value = n.value.toSpliced(0, 1, a);
|
|
592
592
|
}
|
|
593
593
|
});
|
|
594
594
|
}
|
|
@@ -596,20 +596,20 @@ function et(e) {
|
|
|
596
596
|
var n;
|
|
597
597
|
const t = g((n = s(e)) == null ? void 0 : n.viewColumn);
|
|
598
598
|
return D(e, () => {
|
|
599
|
-
var
|
|
600
|
-
t.value = (
|
|
601
|
-
}), l(v.onDidChangeTextEditorViewColumn((
|
|
602
|
-
|
|
599
|
+
var a;
|
|
600
|
+
t.value = (a = s(e)) == null ? void 0 : a.viewColumn;
|
|
601
|
+
}), l(v.onDidChangeTextEditorViewColumn((a) => {
|
|
602
|
+
a.textEditor === s(e) && (t.value = a.viewColumn);
|
|
603
603
|
})), h(() => t.value);
|
|
604
604
|
}
|
|
605
605
|
function tt(e) {
|
|
606
606
|
var n;
|
|
607
607
|
const t = g(((n = s(e)) == null ? void 0 : n.visibleRanges) ?? []);
|
|
608
608
|
return D(e, () => {
|
|
609
|
-
var
|
|
610
|
-
t.value = ((
|
|
611
|
-
}), l(v.onDidChangeTextEditorVisibleRanges((
|
|
612
|
-
|
|
609
|
+
var a;
|
|
610
|
+
t.value = ((a = s(e)) == null ? void 0 : a.visibleRanges) ?? [];
|
|
611
|
+
}), l(v.onDidChangeTextEditorVisibleRanges((a) => {
|
|
612
|
+
a.textEditor === s(e) && (t.value = a.visibleRanges);
|
|
613
613
|
})), h(() => t.value);
|
|
614
614
|
}
|
|
615
615
|
function Z(e, t) {
|
|
@@ -626,22 +626,25 @@ function L(e, t) {
|
|
|
626
626
|
}
|
|
627
627
|
const nt = q(
|
|
628
628
|
(e, t, n) => {
|
|
629
|
-
const
|
|
630
|
-
D(t, () =>
|
|
631
|
-
const
|
|
629
|
+
const a = A();
|
|
630
|
+
D(t, () => a.fire()), n != null && n.watchSource && D(n.watchSource, () => a.fire());
|
|
631
|
+
const i = /* @__PURE__ */ new WeakMap(), u = l(v.createTreeView(e, {
|
|
632
632
|
...n,
|
|
633
633
|
treeDataProvider: {
|
|
634
634
|
...n,
|
|
635
|
-
onDidChangeTreeData:
|
|
635
|
+
onDidChangeTreeData: a.event,
|
|
636
636
|
getTreeItem(r) {
|
|
637
637
|
return r.treeItem;
|
|
638
638
|
},
|
|
639
|
-
getChildren(r) {
|
|
640
|
-
|
|
641
|
-
|
|
639
|
+
async getChildren(r) {
|
|
640
|
+
if (r) {
|
|
641
|
+
const c = await r.children;
|
|
642
|
+
return c == null || c.forEach((o) => i.set(o, r)), c;
|
|
643
|
+
}
|
|
644
|
+
return s(t);
|
|
642
645
|
},
|
|
643
646
|
getParent(r) {
|
|
644
|
-
return
|
|
647
|
+
return i.get(r);
|
|
645
648
|
}
|
|
646
649
|
}
|
|
647
650
|
}));
|
|
@@ -649,22 +652,22 @@ const nt = q(
|
|
|
649
652
|
},
|
|
650
653
|
(e) => e
|
|
651
654
|
);
|
|
652
|
-
function
|
|
653
|
-
var
|
|
654
|
-
const t = x((
|
|
655
|
+
function at(e) {
|
|
656
|
+
var a;
|
|
657
|
+
const t = x((a = s(e)) == null ? void 0 : a.visible);
|
|
655
658
|
function n() {
|
|
656
|
-
var
|
|
657
|
-
t.value = (
|
|
659
|
+
var i;
|
|
660
|
+
t.value = (i = s(e)) == null ? void 0 : i.visible;
|
|
658
661
|
}
|
|
659
|
-
return C((
|
|
662
|
+
return C((i) => {
|
|
660
663
|
const u = s(e);
|
|
661
664
|
if (u) {
|
|
662
665
|
const r = u.onDidChangeVisibility(n);
|
|
663
|
-
|
|
666
|
+
i(() => r.dispose());
|
|
664
667
|
}
|
|
665
668
|
}), C(n), h(() => !!t.value);
|
|
666
669
|
}
|
|
667
|
-
const
|
|
670
|
+
const it = w(() => {
|
|
668
671
|
const e = g(v.visibleNotebookEditors);
|
|
669
672
|
return l(v.onDidChangeVisibleNotebookEditors((t) => {
|
|
670
673
|
e.value = t;
|
|
@@ -676,31 +679,31 @@ const at = w(() => {
|
|
|
676
679
|
})), e;
|
|
677
680
|
});
|
|
678
681
|
function st(e, t, n = !0) {
|
|
679
|
-
const
|
|
682
|
+
const a = te(t) ? t : typeof t == "function" ? h(t) : x(t);
|
|
680
683
|
return C(() => {
|
|
681
|
-
s(n) && I.executeCommand("setContext", e,
|
|
682
|
-
}),
|
|
684
|
+
s(n) && I.executeCommand("setContext", e, a.value);
|
|
685
|
+
}), a;
|
|
683
686
|
}
|
|
684
|
-
function ut(e, t, n,
|
|
687
|
+
function ut(e, t, n, a, i) {
|
|
685
688
|
const u = g(), r = l(v.createWebviewPanel(
|
|
686
689
|
e,
|
|
687
690
|
s(t),
|
|
688
|
-
|
|
691
|
+
a,
|
|
689
692
|
{
|
|
690
|
-
enableFindWidget:
|
|
691
|
-
retainContextWhenHidden:
|
|
692
|
-
...s(
|
|
693
|
+
enableFindWidget: i == null ? void 0 : i.enableFindWidget,
|
|
694
|
+
retainContextWhenHidden: i == null ? void 0 : i.retainContextWhenHidden,
|
|
695
|
+
...s(i == null ? void 0 : i.webviewOptions)
|
|
693
696
|
}
|
|
694
697
|
));
|
|
695
|
-
|
|
698
|
+
i != null && i.onDidReceiveMessage && r.webview.onDidReceiveMessage(i.onDidReceiveMessage);
|
|
696
699
|
const c = x(0);
|
|
697
700
|
function o() {
|
|
698
701
|
c.value++;
|
|
699
702
|
}
|
|
700
703
|
if (C(() => {
|
|
701
704
|
r.webview.html = `${s(n)}<!--${c.value}-->`;
|
|
702
|
-
}),
|
|
703
|
-
const m =
|
|
705
|
+
}), i != null && i.webviewOptions) {
|
|
706
|
+
const m = i.webviewOptions;
|
|
704
707
|
C(() => {
|
|
705
708
|
r.webview.options = s(m);
|
|
706
709
|
});
|
|
@@ -716,12 +719,12 @@ function ut(e, t, n, i, a) {
|
|
|
716
719
|
}
|
|
717
720
|
const ct = q(
|
|
718
721
|
(e, t, n) => {
|
|
719
|
-
const
|
|
722
|
+
const a = g(), i = g();
|
|
720
723
|
l(v.registerWebviewViewProvider(
|
|
721
724
|
e,
|
|
722
725
|
{
|
|
723
726
|
resolveWebviewView(o, d) {
|
|
724
|
-
|
|
727
|
+
a.value = o, i.value = d, n != null && n.onDidReceiveMessage && o.webview.onDidReceiveMessage(n.onDidReceiveMessage);
|
|
725
728
|
}
|
|
726
729
|
},
|
|
727
730
|
{
|
|
@@ -735,19 +738,19 @@ const ct = q(
|
|
|
735
738
|
u.value++;
|
|
736
739
|
}
|
|
737
740
|
if (C(() => {
|
|
738
|
-
|
|
741
|
+
a.value && (a.value.webview.html = `${s(t)}<!--${u.value}-->`);
|
|
739
742
|
}), n != null && n.webviewOptions) {
|
|
740
743
|
const o = n.webviewOptions;
|
|
741
744
|
C(() => {
|
|
742
|
-
|
|
745
|
+
a.value && (a.value.webview.options = s(o));
|
|
743
746
|
});
|
|
744
747
|
}
|
|
745
|
-
n != null && n.title && L(
|
|
748
|
+
n != null && n.title && L(a, n.title), n != null && n.badge && Z(a, n.badge);
|
|
746
749
|
function c(o) {
|
|
747
750
|
var d;
|
|
748
|
-
return (d =
|
|
751
|
+
return (d = a.value) == null ? void 0 : d.webview.postMessage(o);
|
|
749
752
|
}
|
|
750
|
-
return { view:
|
|
753
|
+
return { view: a, context: i, postMessage: c, forceRefresh: r };
|
|
751
754
|
},
|
|
752
755
|
(e) => e
|
|
753
756
|
), ot = w(() => {
|
|
@@ -827,8 +830,8 @@ export {
|
|
|
827
830
|
nt as useTreeView,
|
|
828
831
|
Z as useViewBadge,
|
|
829
832
|
L as useViewTitle,
|
|
830
|
-
|
|
831
|
-
|
|
833
|
+
at as useViewVisibility,
|
|
834
|
+
it as useVisibleNotebookEditors,
|
|
832
835
|
rt as useVisibleTextEditors,
|
|
833
836
|
st as useVscodeContext,
|
|
834
837
|
ut as useWebviewPanel,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "reactive-vscode",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.18",
|
|
5
5
|
"description": "Develop VSCode extension with Vue Reactivity API",
|
|
6
6
|
"author": "_Kerman <kermanx@qq.com>",
|
|
7
7
|
"license": "MIT",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"@types/vscode": "^1.89.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@reactive-vscode/reactivity": "0.2.
|
|
41
|
+
"@reactive-vscode/reactivity": "0.2.18"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/node": "^20.17.45",
|