reactive-vscode 0.2.19 → 0.2.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1 -1
- package/dist/index.js +280 -275
- package/package.json +2 -2
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,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]})});
|
|
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,f){const l=n.shallowRef(f),v=n.computed({get:()=>l.value,set:w=>{l.value=w,i.update(r,w)}});return v.update=async(w,h,m)=>{await i.update(r,w,h,m),v.value=w},v.set=w=>{l.value=w},v}const u=Object.fromEntries(Object.keys(t).map(r=>[r,c(r,i.get(r))]));return A(()=>{d(s.workspace.onDidChangeConfiguration(a?r=>{const f=s.workspace.getConfiguration();for(const l in t)r.affectsConfiguration(l)&&u[l].set(f.get(l))}:r=>{if(!r.affectsConfiguration(e))return;const f=s.workspace.getConfiguration(e);for(const l in t)r.affectsConfiguration(`${e}.${l}`)&&u[l].set(f.get(l))}))}),u}function J(e,t,o){const a=L(e,t,o),i={},c=n.shallowReactive({$update(u,r,f,l){return a[u].update(r,f,l)},$set(u,r){return a[u].set(r)}});for(const u in t){const r=u.split(".");let f="",l=i,v=c;for(const h of r.slice(0,-1)){f=f?`${f}.${h}`:h;const m=l=l[h]||(l[h]={});if(v[h])v=v[h];else{const I=n.shallowReactive({});Object.defineProperty(v,h,{enumerable:!0,get(){return I},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,f,z)}}),v=I}}const w=r[r.length-1];l[w]=null,Object.defineProperty(v,w,{enumerable:!0,get(){return a[u].value},set(h){a[u].value=h}})}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;let c;const u=n.computed(()=>{c==null||c.dispose(),c=void 0;const l=n.toValue(t);if("key"in l)return l;const v=s.window.createTextEditorDecorationType(l);return c=d(v),v}),r=async()=>{const l=n.toValue(e);l&&l.setDecorations(u.value,typeof o=="function"?await o(l):n.toValue(o))},f=i.includes("documentChanged")?M(()=>{var l;return(l=n.toValue(e))==null?void 0:l.document}):null;return i.includes("effect")?n.watchEffect(async()=>{f==null||f.value,await r()}):f&&n.watch(f,r),{update:r}}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 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}),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:O(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(),f=n.computed(()=>{const w=n.toValue(e);return Array.isArray(w)?w:w instanceof Set?Array.from(w):[w]});function l(){const w=f.value;for(const[h,m]of i)w.includes(h)||(m.dispose(),i.delete(h));for(const h of w)if(!i.has(h)){const m=s.workspace.createFileSystemWatcher(h,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(h,m)}}function v(){for(const w of i.values())w.dispose();i.clear()}return l(),n.watch(f,l),n.watch(()=>[n.toValue(t),n.toValue(o),n.toValue(a)],()=>{v(),l()}),n.onScopeDispose(v),{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"),f=String(t.getMilliseconds()).padStart(3,"0");return`${o}-${a}-${i} ${c}:${u}:${r}.${f} [${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 f=n.shallowRef(t.value);r(w=>f.value=w),e.activeItems&&(t.activeItems=e.activeItems);const l=n.shallowRef(t.activeItems);o(w=>l.value=w),e.selectedItems&&(t.selectedItems=e.selectedItems);const v=n.shallowRef(t.selectedItems);return a(w=>v.value=w),{...t,onDidChangeActive:o,onDidChangeSelection:a,onDidAccept:i,onDidHide:c,onDidTriggerButton:u,onDidChangeValue:r,value:f,activeItems:l,selectedItems:v}}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:O(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 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=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(f=>i.set(f,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&&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 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 f(){r.value++}if(n.watchEffect(()=>{u.webview.html=`${n.toValue(o)}<!--${r.value}-->`}),i!=null&&i.webviewOptions){const h=i.webviewOptions;n.watchEffect(()=>{u.webview.options=n.toValue(h)})}E(u,t);function l(h){return u.webview.postMessage(h)}const v=n.ref(u.active),w=n.ref(u.visible);return d(u.onDidChangeViewState(()=>{v.value=u.active,w.value=u.visible})),{panel:u,context:c,active:v,visible:w,postMessage:l,forceRefresh:f}}const Ne=R((e,t,o)=>{const a=n.shallowRef(),i=n.shallowRef();d(s.window.registerWebviewViewProvider(e,{resolveWebviewView(f,l){a.value=f,i.value=l,o!=null&&o.onDidReceiveMessage&&f.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 f=o.webviewOptions;n.watchEffect(()=>{a.value&&(a.value.webview.options=n.toValue(f))})}o!=null&&o.title&&E(a,o.title),o!=null&&o.badge&&P(a,o.badge);function r(f){var l;return(l=a.value)==null?void 0:l.webview.postMessage(f)}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=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.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
|
|
3
|
+
import { workspace as S, commands as O, window as v, debug as H, extensions as W, comments as ne, env as p, EventEmitter as U, tasks as k, Uri as ie, languages as ae, 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 (...i) => {
|
|
10
|
+
const a = t(...i);
|
|
11
|
+
let u = n.get(a);
|
|
12
12
|
return u ? u.refCount++ : (u = {
|
|
13
|
-
data: e(...
|
|
13
|
+
data: e(...i),
|
|
14
14
|
refCount: 1
|
|
15
|
-
}, n.set(
|
|
16
|
-
--u.refCount === 0 && n.delete(
|
|
15
|
+
}, n.set(a, u)), re(() => {
|
|
16
|
+
--u.refCount === 0 && n.delete(a);
|
|
17
17
|
}), u.data;
|
|
18
18
|
};
|
|
19
19
|
}
|
|
@@ -25,10 +25,10 @@ const Y = [];
|
|
|
25
25
|
function De(e) {
|
|
26
26
|
Y.push(e);
|
|
27
27
|
}
|
|
28
|
-
const
|
|
28
|
+
const y = g(null), M = Q();
|
|
29
29
|
function Te(e) {
|
|
30
30
|
return {
|
|
31
|
-
activate: (t) => (
|
|
31
|
+
activate: (t) => (y.value = t, M.run(() => (G.map((n) => n(t)), e(t)))),
|
|
32
32
|
deactivate: () => {
|
|
33
33
|
Y.map((t) => t()), M.stop();
|
|
34
34
|
}
|
|
@@ -36,97 +36,97 @@ function Te(e) {
|
|
|
36
36
|
}
|
|
37
37
|
const G = [];
|
|
38
38
|
function J(e) {
|
|
39
|
-
|
|
39
|
+
y.value ? e(y.value) : G.push(e);
|
|
40
40
|
}
|
|
41
41
|
function se(e, t, n) {
|
|
42
|
-
const
|
|
43
|
-
function u(
|
|
44
|
-
const
|
|
45
|
-
get: () =>
|
|
42
|
+
const i = !e, a = S.getConfiguration(i ? void 0 : e, n);
|
|
43
|
+
function u(o, d) {
|
|
44
|
+
const c = g(d), m = h({
|
|
45
|
+
get: () => c.value,
|
|
46
46
|
set: (f) => {
|
|
47
|
-
|
|
47
|
+
c.value = f, a.update(o, f);
|
|
48
48
|
}
|
|
49
49
|
});
|
|
50
|
-
return
|
|
51
|
-
await
|
|
52
|
-
},
|
|
53
|
-
|
|
54
|
-
},
|
|
50
|
+
return m.update = async (f, b, T) => {
|
|
51
|
+
await a.update(o, f, b, T), m.value = f;
|
|
52
|
+
}, m.set = (f) => {
|
|
53
|
+
c.value = f;
|
|
54
|
+
}, m;
|
|
55
55
|
}
|
|
56
56
|
const r = Object.fromEntries(
|
|
57
|
-
Object.keys(t).map((
|
|
57
|
+
Object.keys(t).map((o) => [o, u(o, a.get(o))])
|
|
58
58
|
);
|
|
59
59
|
return J(() => {
|
|
60
60
|
l(S.onDidChangeConfiguration(
|
|
61
|
-
|
|
62
|
-
const
|
|
63
|
-
for (const
|
|
64
|
-
|
|
65
|
-
} : (
|
|
66
|
-
if (!
|
|
61
|
+
i ? (o) => {
|
|
62
|
+
const d = S.getConfiguration();
|
|
63
|
+
for (const c in t)
|
|
64
|
+
o.affectsConfiguration(c) && r[c].set(d.get(c));
|
|
65
|
+
} : (o) => {
|
|
66
|
+
if (!o.affectsConfiguration(e))
|
|
67
67
|
return;
|
|
68
|
-
const
|
|
69
|
-
for (const
|
|
70
|
-
|
|
68
|
+
const d = S.getConfiguration(e);
|
|
69
|
+
for (const c in t)
|
|
70
|
+
o.affectsConfiguration(`${e}.${c}`) && r[c].set(d.get(c));
|
|
71
71
|
}
|
|
72
72
|
));
|
|
73
73
|
}), r;
|
|
74
74
|
}
|
|
75
75
|
function Se(e, t, n) {
|
|
76
|
-
const
|
|
77
|
-
$update(r,
|
|
78
|
-
return
|
|
76
|
+
const i = se(e, t, n), a = {}, u = $({
|
|
77
|
+
$update(r, o, d, c) {
|
|
78
|
+
return i[r].update(o, d, c);
|
|
79
79
|
},
|
|
80
|
-
$set(r,
|
|
81
|
-
return
|
|
80
|
+
$set(r, o) {
|
|
81
|
+
return i[r].set(o);
|
|
82
82
|
}
|
|
83
83
|
});
|
|
84
84
|
for (const r in t) {
|
|
85
|
-
const
|
|
86
|
-
let
|
|
87
|
-
for (const
|
|
88
|
-
|
|
89
|
-
const T =
|
|
90
|
-
if (b
|
|
91
|
-
|
|
85
|
+
const o = r.split(".");
|
|
86
|
+
let d = "", c = a, m = u;
|
|
87
|
+
for (const b of o.slice(0, -1)) {
|
|
88
|
+
d = d ? `${d}.${b}` : b;
|
|
89
|
+
const T = c = c[b] || (c[b] = {});
|
|
90
|
+
if (m[b])
|
|
91
|
+
m = m[b];
|
|
92
92
|
else {
|
|
93
93
|
const N = $({});
|
|
94
|
-
Object.defineProperty(
|
|
94
|
+
Object.defineProperty(m, b, {
|
|
95
95
|
enumerable: !0,
|
|
96
96
|
get() {
|
|
97
97
|
return N;
|
|
98
98
|
},
|
|
99
99
|
set(_) {
|
|
100
|
-
function j(
|
|
101
|
-
if (
|
|
102
|
-
for (const V in
|
|
103
|
-
j(
|
|
100
|
+
function j(I, P, R) {
|
|
101
|
+
if (I)
|
|
102
|
+
for (const V in I)
|
|
103
|
+
j(I[V], P ? `${P}.${V}` : V, R == null ? void 0 : R[V]);
|
|
104
104
|
else
|
|
105
|
-
|
|
105
|
+
i[P].value = R;
|
|
106
106
|
}
|
|
107
|
-
j(T,
|
|
107
|
+
j(T, d, _);
|
|
108
108
|
}
|
|
109
|
-
}),
|
|
109
|
+
}), m = N;
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
const f =
|
|
113
|
-
|
|
112
|
+
const f = o[o.length - 1];
|
|
113
|
+
c[f] = null, Object.defineProperty(m, f, {
|
|
114
114
|
enumerable: !0,
|
|
115
115
|
get() {
|
|
116
|
-
return
|
|
116
|
+
return i[r].value;
|
|
117
117
|
},
|
|
118
|
-
set(
|
|
119
|
-
|
|
118
|
+
set(b) {
|
|
119
|
+
i[r].value = b;
|
|
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), i = [], a = (u) => (...r) => n.value ? n.value[u](...r) : (i.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 i)
|
|
130
130
|
n.value[u](...r);
|
|
131
131
|
}), {
|
|
132
132
|
logger: n,
|
|
@@ -134,22 +134,22 @@ 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: a("info"),
|
|
138
|
+
warn: a("warn"),
|
|
139
|
+
error: a("error"),
|
|
140
|
+
append: a("append"),
|
|
141
|
+
appendLine: a("appendLine"),
|
|
142
|
+
replace: a("replace"),
|
|
143
|
+
clear: a("clear"),
|
|
144
|
+
show: a("show"),
|
|
145
|
+
hide: a("hide")
|
|
146
146
|
};
|
|
147
147
|
}
|
|
148
148
|
function Ee(e, ...t) {
|
|
149
|
-
return
|
|
149
|
+
return O.executeCommand(e, ...t);
|
|
150
150
|
}
|
|
151
151
|
function ue(e, t = !1) {
|
|
152
|
-
const n =
|
|
152
|
+
const n = y.value;
|
|
153
153
|
if (!n && !t)
|
|
154
154
|
throw new Error("Cannot get absolute path because the extension is not activated yet");
|
|
155
155
|
return n == null ? void 0 : n.asAbsolutePath(e);
|
|
@@ -160,7 +160,7 @@ function pe(e, t = !1) {
|
|
|
160
160
|
function l(e) {
|
|
161
161
|
return (K() ?? M).cleanups.push(e.dispose.bind(e)), e;
|
|
162
162
|
}
|
|
163
|
-
const
|
|
163
|
+
const oe = w(() => {
|
|
164
164
|
const e = g(v.activeColorTheme);
|
|
165
165
|
return l(v.onDidChangeActiveColorTheme((t) => {
|
|
166
166
|
e.value = t;
|
|
@@ -170,7 +170,7 @@ const ce = w(() => {
|
|
|
170
170
|
return l(H.onDidChangeActiveDebugSession((t) => {
|
|
171
171
|
e.value = t;
|
|
172
172
|
})), h(() => e.value);
|
|
173
|
-
}),
|
|
173
|
+
}), ce = w(() => {
|
|
174
174
|
const e = g(v.activeTextEditor);
|
|
175
175
|
return l(v.onDidChangeActiveTextEditor((t) => {
|
|
176
176
|
e.value = t;
|
|
@@ -180,45 +180,50 @@ 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 i;
|
|
184
|
+
t.value = (i = s(e)) == null ? void 0 : i.getText();
|
|
185
|
+
}), l(S.onDidChangeTextDocument((i) => {
|
|
186
|
+
i.document === s(e) && (t.value = i.document.getText());
|
|
187
187
|
})), t;
|
|
188
188
|
}
|
|
189
|
-
function de(e, t, n,
|
|
189
|
+
function de(e, t, n, i = {}) {
|
|
190
190
|
const {
|
|
191
|
-
updateOn:
|
|
192
|
-
} =
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
191
|
+
updateOn: a = ["effect", "documentChanged"]
|
|
192
|
+
} = i;
|
|
193
|
+
let u;
|
|
194
|
+
const r = h(
|
|
195
|
+
() => {
|
|
196
|
+
u == null || u.dispose(), u = void 0;
|
|
197
|
+
const c = s(t);
|
|
198
|
+
if ("key" in c)
|
|
199
|
+
return c;
|
|
200
|
+
const m = v.createTextEditorDecorationType(c);
|
|
201
|
+
return u = l(m), m;
|
|
197
202
|
}
|
|
198
|
-
),
|
|
199
|
-
const
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
typeof n == "function" ? await n(
|
|
203
|
+
), o = async () => {
|
|
204
|
+
const c = s(e);
|
|
205
|
+
c && c.setDecorations(
|
|
206
|
+
r.value,
|
|
207
|
+
typeof n == "function" ? await n(c) : s(n)
|
|
203
208
|
);
|
|
204
|
-
},
|
|
205
|
-
var
|
|
206
|
-
return (
|
|
209
|
+
}, d = a.includes("documentChanged") ? le(() => {
|
|
210
|
+
var c;
|
|
211
|
+
return (c = s(e)) == null ? void 0 : c.document;
|
|
207
212
|
}) : null;
|
|
208
|
-
return
|
|
209
|
-
|
|
210
|
-
}) :
|
|
213
|
+
return a.includes("effect") ? C(async () => {
|
|
214
|
+
d == null || d.value, await o();
|
|
215
|
+
}) : d && D(d, o), {
|
|
211
216
|
/**
|
|
212
217
|
* Manually trigger the decoration update.
|
|
213
218
|
*/
|
|
214
|
-
update:
|
|
219
|
+
update: o
|
|
215
220
|
};
|
|
216
221
|
}
|
|
217
|
-
function
|
|
218
|
-
const
|
|
219
|
-
return de(
|
|
222
|
+
function ye(e, t, n = {}) {
|
|
223
|
+
const i = ce();
|
|
224
|
+
return de(i, e, t, n);
|
|
220
225
|
}
|
|
221
|
-
const
|
|
226
|
+
const Re = w(() => {
|
|
222
227
|
const e = g(v.activeNotebookEditor);
|
|
223
228
|
return l(v.onDidChangeActiveNotebookEditor((t) => {
|
|
224
229
|
e.value = t;
|
|
@@ -229,44 +234,44 @@ const ye = w(() => {
|
|
|
229
234
|
e.value = t;
|
|
230
235
|
})), e;
|
|
231
236
|
}), Ae = w(() => {
|
|
232
|
-
const e = g(
|
|
233
|
-
return l(
|
|
234
|
-
e.value =
|
|
237
|
+
const e = g(W.all);
|
|
238
|
+
return l(W.onDidChange(() => {
|
|
239
|
+
e.value = W.all;
|
|
235
240
|
})), h(() => e.value);
|
|
236
241
|
});
|
|
237
242
|
function fe(e, t) {
|
|
238
|
-
l(
|
|
243
|
+
l(O.registerCommand(e, t));
|
|
239
244
|
}
|
|
240
|
-
function
|
|
245
|
+
function Oe(e) {
|
|
241
246
|
for (const [t, n] of Object.entries(e))
|
|
242
247
|
n && fe(t, n);
|
|
243
248
|
}
|
|
244
|
-
function
|
|
249
|
+
function Ie(e, t) {
|
|
245
250
|
return l(ne.createCommentController(e, t));
|
|
246
251
|
}
|
|
247
252
|
function X(e) {
|
|
248
253
|
var n;
|
|
249
254
|
const t = g((n = s(e)) == null ? void 0 : n.state);
|
|
250
255
|
return D(e, () => {
|
|
251
|
-
var
|
|
252
|
-
t.value = (
|
|
253
|
-
}), l(v.onDidChangeTerminalState((
|
|
254
|
-
|
|
256
|
+
var i;
|
|
257
|
+
t.value = (i = s(e)) == null ? void 0 : i.state;
|
|
258
|
+
}), l(v.onDidChangeTerminalState((i) => {
|
|
259
|
+
i === s(e) && (t.value = i.state);
|
|
255
260
|
})), h(() => t.value);
|
|
256
261
|
}
|
|
257
|
-
function
|
|
262
|
+
function Pe(...e) {
|
|
258
263
|
const t = x(null);
|
|
259
264
|
function n() {
|
|
260
265
|
return !!t.value && t.value.exitStatus == null;
|
|
261
266
|
}
|
|
262
|
-
function
|
|
267
|
+
function i() {
|
|
263
268
|
return n() ? t.value : t.value = v.createTerminal(...e);
|
|
264
269
|
}
|
|
265
|
-
function
|
|
266
|
-
|
|
270
|
+
function a(o) {
|
|
271
|
+
i().sendText(o);
|
|
267
272
|
}
|
|
268
273
|
function u() {
|
|
269
|
-
|
|
274
|
+
i().show();
|
|
270
275
|
}
|
|
271
276
|
function r() {
|
|
272
277
|
n() && (t.value.sendText(""), t.value.dispose(), t.value = null);
|
|
@@ -275,109 +280,109 @@ function We(...e) {
|
|
|
275
280
|
terminal: t,
|
|
276
281
|
getIsActive: n,
|
|
277
282
|
show: u,
|
|
278
|
-
sendText:
|
|
283
|
+
sendText: a,
|
|
279
284
|
close: r,
|
|
280
285
|
state: X(t)
|
|
281
286
|
};
|
|
282
287
|
}
|
|
283
|
-
const
|
|
288
|
+
const We = w(() => {
|
|
284
289
|
const e = g(p.shell);
|
|
285
290
|
return l(p.onDidChangeShell((t) => {
|
|
286
291
|
e.value = t;
|
|
287
292
|
})), h(() => e.value);
|
|
288
293
|
});
|
|
289
294
|
function E(e, t) {
|
|
290
|
-
const n = (
|
|
291
|
-
l(e(
|
|
295
|
+
const n = (i, a, u) => {
|
|
296
|
+
l(e(i, a, u));
|
|
292
297
|
};
|
|
293
|
-
return t == null || t.forEach((
|
|
298
|
+
return t == null || t.forEach((i) => n(i)), n;
|
|
294
299
|
}
|
|
295
300
|
function A(e, t = []) {
|
|
296
|
-
const n = Array.isArray(e) ? e : t ?? [],
|
|
301
|
+
const n = Array.isArray(e) ? e : t ?? [], i = l(Array.isArray(e) || e == null ? new U() : e), a = E(i.event, n);
|
|
297
302
|
for (const u of n)
|
|
298
|
-
|
|
303
|
+
a(u);
|
|
299
304
|
return {
|
|
300
|
-
event:
|
|
301
|
-
fire:
|
|
302
|
-
addListener:
|
|
305
|
+
event: i.event,
|
|
306
|
+
fire: i.fire.bind(i),
|
|
307
|
+
addListener: a
|
|
303
308
|
};
|
|
304
309
|
}
|
|
305
310
|
async function $e(e) {
|
|
306
|
-
const t =
|
|
307
|
-
return n.set = async (
|
|
308
|
-
n.value =
|
|
311
|
+
const t = y.value.secrets, n = x(await t.get(e));
|
|
312
|
+
return n.set = async (i) => {
|
|
313
|
+
n.value = i, await t.store(e, i);
|
|
309
314
|
}, n.remove = async () => {
|
|
310
315
|
n.value = void 0, await t.delete(e);
|
|
311
|
-
}, l(t.onDidChange(async (
|
|
312
|
-
|
|
313
|
-
})), D(n, (
|
|
314
|
-
|
|
316
|
+
}, l(t.onDidChange(async (i) => {
|
|
317
|
+
i.key === e && (n.value = await t.get(e));
|
|
318
|
+
})), D(n, (i) => {
|
|
319
|
+
i === void 0 ? t.delete(e) : t.store(e, i);
|
|
315
320
|
}), n;
|
|
316
321
|
}
|
|
317
322
|
function Me(e) {
|
|
318
323
|
return h(() => k.fetchTasks(s(e)));
|
|
319
324
|
}
|
|
320
325
|
function Fe(e) {
|
|
321
|
-
return h(() =>
|
|
326
|
+
return h(() => ie.file(s(e)));
|
|
322
327
|
}
|
|
323
328
|
function Le(e, t) {
|
|
324
|
-
const n = new U(),
|
|
329
|
+
const n = new U(), i = g();
|
|
325
330
|
C(() => {
|
|
326
|
-
|
|
327
|
-
}), l(
|
|
331
|
+
i.value && n.fire(), i.value = s(t);
|
|
332
|
+
}), l(ae.registerFoldingRangeProvider(
|
|
328
333
|
e,
|
|
329
334
|
{
|
|
330
335
|
onDidChangeFoldingRanges: n.event,
|
|
331
|
-
provideFoldingRanges(
|
|
332
|
-
var
|
|
333
|
-
return (
|
|
336
|
+
provideFoldingRanges(a, u, r) {
|
|
337
|
+
var o;
|
|
338
|
+
return (o = i.value) == null ? void 0 : o.call(i, a, u, r);
|
|
334
339
|
}
|
|
335
340
|
}
|
|
336
341
|
));
|
|
337
342
|
}
|
|
338
|
-
function Ne(e, t, n,
|
|
339
|
-
const
|
|
343
|
+
function Ne(e, t, n, i) {
|
|
344
|
+
const a = $(/* @__PURE__ */ new Map()), u = A(), r = A(), o = A(), d = h(() => {
|
|
340
345
|
const f = s(e);
|
|
341
346
|
return Array.isArray(f) ? f : f instanceof Set ? Array.from(f) : [f];
|
|
342
347
|
});
|
|
343
|
-
function
|
|
344
|
-
const f =
|
|
345
|
-
for (const [
|
|
346
|
-
f.includes(
|
|
347
|
-
for (const
|
|
348
|
-
if (!
|
|
348
|
+
function c() {
|
|
349
|
+
const f = d.value;
|
|
350
|
+
for (const [b, T] of a)
|
|
351
|
+
f.includes(b) || (T.dispose(), a.delete(b));
|
|
352
|
+
for (const b of f)
|
|
353
|
+
if (!a.has(b)) {
|
|
349
354
|
const T = S.createFileSystemWatcher(
|
|
350
|
-
|
|
355
|
+
b,
|
|
351
356
|
s(t) || !1,
|
|
352
357
|
s(n) || !1,
|
|
353
|
-
s(
|
|
358
|
+
s(i) || !1
|
|
354
359
|
);
|
|
355
|
-
T.onDidCreate(u.fire), T.onDidChange(r.fire), T.onDidDelete(
|
|
360
|
+
T.onDidCreate(u.fire), T.onDidChange(r.fire), T.onDidDelete(o.fire), a.set(b, T);
|
|
356
361
|
}
|
|
357
362
|
}
|
|
358
|
-
function
|
|
359
|
-
for (const f of
|
|
363
|
+
function m() {
|
|
364
|
+
for (const f of a.values())
|
|
360
365
|
f.dispose();
|
|
361
|
-
|
|
366
|
+
a.clear();
|
|
362
367
|
}
|
|
363
|
-
return
|
|
368
|
+
return c(), D(d, c), D(
|
|
364
369
|
() => [
|
|
365
370
|
s(t),
|
|
366
371
|
s(n),
|
|
367
|
-
s(
|
|
372
|
+
s(i)
|
|
368
373
|
],
|
|
369
374
|
() => {
|
|
370
|
-
|
|
375
|
+
m(), c();
|
|
371
376
|
}
|
|
372
|
-
), F(
|
|
373
|
-
watchers:
|
|
377
|
+
), F(m), {
|
|
378
|
+
watchers: a,
|
|
374
379
|
onDidCreate: u.event,
|
|
375
380
|
onDidChange: r.event,
|
|
376
|
-
onDidDelete:
|
|
381
|
+
onDidDelete: o.event
|
|
377
382
|
};
|
|
378
383
|
}
|
|
379
384
|
const je = w(() => {
|
|
380
|
-
const e =
|
|
385
|
+
const e = oe();
|
|
381
386
|
return h(() => e.value.kind === B.Dark || e.value.kind === B.HighContrast);
|
|
382
387
|
}), He = w(() => {
|
|
383
388
|
const e = g(p.isTelemetryEnabled);
|
|
@@ -392,20 +397,20 @@ function ve(e, t) {
|
|
|
392
397
|
return l(v.createOutputChannel(e, t));
|
|
393
398
|
}
|
|
394
399
|
function ze(e) {
|
|
395
|
-
const t = /* @__PURE__ */ new Date(), n = String(t.getFullYear()).padStart(4, "0"),
|
|
396
|
-
return `${n}-${
|
|
400
|
+
const t = /* @__PURE__ */ new Date(), n = String(t.getFullYear()).padStart(4, "0"), i = String(t.getMonth() + 1).padStart(2, "0"), a = String(t.getDate()).padStart(2, "0"), u = String(t.getHours()).padStart(2, "0"), r = String(t.getMinutes()).padStart(2, "0"), o = String(t.getSeconds()).padStart(2, "0"), d = String(t.getMilliseconds()).padStart(3, "0");
|
|
401
|
+
return `${n}-${i}-${a} ${u}:${r}:${o}.${d} [${e}] `;
|
|
397
402
|
}
|
|
398
403
|
function ge(e, t = {}) {
|
|
399
|
-
const n = t.outputChannel ?? ve(e, { log: !0 }),
|
|
404
|
+
const n = t.outputChannel ?? ve(e, { log: !0 }), i = (a) => (...u) => {
|
|
400
405
|
var r;
|
|
401
|
-
n.appendLine((((r = t.getPrefix) == null ? void 0 : r.call(t,
|
|
406
|
+
n.appendLine((((r = t.getPrefix) == null ? void 0 : r.call(t, a)) ?? "") + u.join(" "));
|
|
402
407
|
};
|
|
403
408
|
return {
|
|
404
409
|
outputChannel: n,
|
|
405
|
-
createLoggerFunc:
|
|
406
|
-
info:
|
|
407
|
-
warn:
|
|
408
|
-
error:
|
|
410
|
+
createLoggerFunc: i,
|
|
411
|
+
info: i("INFO"),
|
|
412
|
+
warn: i("WARN"),
|
|
413
|
+
error: i("ERROR"),
|
|
409
414
|
append: n.append.bind(n),
|
|
410
415
|
appendLine: n.appendLine.bind(n),
|
|
411
416
|
replace: n.replace.bind(n),
|
|
@@ -424,18 +429,18 @@ function he(e) {
|
|
|
424
429
|
var n;
|
|
425
430
|
const t = g(((n = s(e)) == null ? void 0 : n.selections) ?? []);
|
|
426
431
|
return D(e, () => {
|
|
427
|
-
var
|
|
428
|
-
t.value = ((
|
|
429
|
-
}), l(v.onDidChangeNotebookEditorSelection((
|
|
430
|
-
|
|
432
|
+
var i;
|
|
433
|
+
t.value = ((i = s(e)) == null ? void 0 : i.selections) ?? [];
|
|
434
|
+
}), l(v.onDidChangeNotebookEditorSelection((i) => {
|
|
435
|
+
i.notebookEditor === s(e) && (t.value = i.selections);
|
|
431
436
|
})), h({
|
|
432
437
|
get() {
|
|
433
438
|
return t.value;
|
|
434
439
|
},
|
|
435
|
-
set(
|
|
436
|
-
t.value =
|
|
437
|
-
const
|
|
438
|
-
|
|
440
|
+
set(i) {
|
|
441
|
+
t.value = i;
|
|
442
|
+
const a = s(e);
|
|
443
|
+
a && (a.selections = i);
|
|
439
444
|
}
|
|
440
445
|
});
|
|
441
446
|
}
|
|
@@ -454,10 +459,10 @@ function Ue(e) {
|
|
|
454
459
|
var n;
|
|
455
460
|
const t = g(((n = s(e)) == null ? void 0 : n.visibleRanges) ?? []);
|
|
456
461
|
return D(e, () => {
|
|
457
|
-
var
|
|
458
|
-
t.value = ((
|
|
459
|
-
}), l(v.onDidChangeNotebookEditorVisibleRanges((
|
|
460
|
-
|
|
462
|
+
var i;
|
|
463
|
+
t.value = ((i = s(e)) == null ? void 0 : i.visibleRanges) ?? [];
|
|
464
|
+
}), l(v.onDidChangeNotebookEditorVisibleRanges((i) => {
|
|
465
|
+
i.notebookEditor === s(e) && (t.value = i.visibleRanges);
|
|
461
466
|
})), h(() => t.value);
|
|
462
467
|
}
|
|
463
468
|
const qe = w(() => {
|
|
@@ -468,7 +473,7 @@ const qe = w(() => {
|
|
|
468
473
|
return l(v.onDidOpenTerminal(t)), l(v.onDidCloseTerminal(t)), e;
|
|
469
474
|
});
|
|
470
475
|
function Ye(e = {}) {
|
|
471
|
-
const t = l(v.createQuickPick()), n = E(t.onDidChangeActive),
|
|
476
|
+
const t = l(v.createQuickPick()), n = E(t.onDidChangeActive), i = E(t.onDidChangeSelection), a = E(t.onDidAccept), u = E(t.onDidHide), r = E(t.onDidTriggerButton), o = E(t.onDidChangeValue);
|
|
472
477
|
[
|
|
473
478
|
"items",
|
|
474
479
|
"buttons",
|
|
@@ -486,29 +491,29 @@ function Ye(e = {}) {
|
|
|
486
491
|
].forEach((f) => {
|
|
487
492
|
e[f] && C(() => t[f] = s(e[f]));
|
|
488
493
|
}), e.value && (t.value = e.value);
|
|
489
|
-
const
|
|
490
|
-
|
|
491
|
-
const
|
|
492
|
-
n((f) =>
|
|
493
|
-
const
|
|
494
|
-
return
|
|
494
|
+
const d = g(t.value);
|
|
495
|
+
o((f) => d.value = f), e.activeItems && (t.activeItems = e.activeItems);
|
|
496
|
+
const c = g(t.activeItems);
|
|
497
|
+
n((f) => c.value = f), e.selectedItems && (t.selectedItems = e.selectedItems);
|
|
498
|
+
const m = g(t.selectedItems);
|
|
499
|
+
return i((f) => m.value = f), {
|
|
495
500
|
...t,
|
|
496
501
|
onDidChangeActive: n,
|
|
497
|
-
onDidChangeSelection:
|
|
498
|
-
onDidAccept:
|
|
502
|
+
onDidChangeSelection: i,
|
|
503
|
+
onDidAccept: a,
|
|
499
504
|
onDidHide: u,
|
|
500
505
|
onDidTriggerButton: r,
|
|
501
|
-
onDidChangeValue:
|
|
502
|
-
value:
|
|
503
|
-
activeItems:
|
|
504
|
-
selectedItems:
|
|
506
|
+
onDidChangeValue: o,
|
|
507
|
+
value: d,
|
|
508
|
+
activeItems: c,
|
|
509
|
+
selectedItems: m
|
|
505
510
|
};
|
|
506
511
|
}
|
|
507
512
|
function Ge(e) {
|
|
508
513
|
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
|
-
|
|
514
|
+
function n(i) {
|
|
515
|
+
const a = e[i];
|
|
516
|
+
a != null && C(() => t[i] = s(a));
|
|
512
517
|
}
|
|
513
518
|
return [
|
|
514
519
|
"name",
|
|
@@ -555,29 +560,29 @@ function Xe(...e) {
|
|
|
555
560
|
};
|
|
556
561
|
}
|
|
557
562
|
function me(e, t) {
|
|
558
|
-
l(
|
|
563
|
+
l(O.registerTextEditorCommand(e, t));
|
|
559
564
|
}
|
|
560
565
|
function Ze(e) {
|
|
561
566
|
for (const [t, n] of Object.entries(e))
|
|
562
567
|
me(t, n);
|
|
563
568
|
}
|
|
564
569
|
function be(e, t) {
|
|
565
|
-
var
|
|
566
|
-
const n = g(((
|
|
570
|
+
var i;
|
|
571
|
+
const n = g(((i = s(e)) == null ? void 0 : i.selections) ?? []);
|
|
567
572
|
return D(e, () => {
|
|
568
|
-
var
|
|
569
|
-
n.value = ((
|
|
570
|
-
}), l(v.onDidChangeTextEditorSelection((
|
|
573
|
+
var a;
|
|
574
|
+
n.value = ((a = s(e)) == null ? void 0 : a.selections) ?? [];
|
|
575
|
+
}), l(v.onDidChangeTextEditorSelection((a) => {
|
|
571
576
|
const u = s(e), r = s(t);
|
|
572
|
-
|
|
577
|
+
a.textEditor === u && (!r || r.includes(a.kind)) && (n.value = a.selections);
|
|
573
578
|
})), h({
|
|
574
579
|
get() {
|
|
575
580
|
return n.value;
|
|
576
581
|
},
|
|
577
|
-
set(
|
|
578
|
-
n.value =
|
|
582
|
+
set(a) {
|
|
583
|
+
n.value = a;
|
|
579
584
|
const u = s(e);
|
|
580
|
-
u && (u.selections =
|
|
585
|
+
u && (u.selections = a);
|
|
581
586
|
}
|
|
582
587
|
});
|
|
583
588
|
}
|
|
@@ -587,8 +592,8 @@ function _e(e, t) {
|
|
|
587
592
|
get() {
|
|
588
593
|
return n.value[0];
|
|
589
594
|
},
|
|
590
|
-
set(
|
|
591
|
-
n.value = n.value.toSpliced(0, 1,
|
|
595
|
+
set(i) {
|
|
596
|
+
n.value = n.value.toSpliced(0, 1, i);
|
|
592
597
|
}
|
|
593
598
|
});
|
|
594
599
|
}
|
|
@@ -596,20 +601,20 @@ function et(e) {
|
|
|
596
601
|
var n;
|
|
597
602
|
const t = g((n = s(e)) == null ? void 0 : n.viewColumn);
|
|
598
603
|
return D(e, () => {
|
|
599
|
-
var
|
|
600
|
-
t.value = (
|
|
601
|
-
}), l(v.onDidChangeTextEditorViewColumn((
|
|
602
|
-
|
|
604
|
+
var i;
|
|
605
|
+
t.value = (i = s(e)) == null ? void 0 : i.viewColumn;
|
|
606
|
+
}), l(v.onDidChangeTextEditorViewColumn((i) => {
|
|
607
|
+
i.textEditor === s(e) && (t.value = i.viewColumn);
|
|
603
608
|
})), h(() => t.value);
|
|
604
609
|
}
|
|
605
610
|
function tt(e) {
|
|
606
611
|
var n;
|
|
607
612
|
const t = g(((n = s(e)) == null ? void 0 : n.visibleRanges) ?? []);
|
|
608
613
|
return D(e, () => {
|
|
609
|
-
var
|
|
610
|
-
t.value = ((
|
|
611
|
-
}), l(v.onDidChangeTextEditorVisibleRanges((
|
|
612
|
-
|
|
614
|
+
var i;
|
|
615
|
+
t.value = ((i = s(e)) == null ? void 0 : i.visibleRanges) ?? [];
|
|
616
|
+
}), l(v.onDidChangeTextEditorVisibleRanges((i) => {
|
|
617
|
+
i.textEditor === s(e) && (t.value = i.visibleRanges);
|
|
613
618
|
})), h(() => t.value);
|
|
614
619
|
}
|
|
615
620
|
function Z(e, t) {
|
|
@@ -626,25 +631,25 @@ function L(e, t) {
|
|
|
626
631
|
}
|
|
627
632
|
const nt = q(
|
|
628
633
|
(e, t, n) => {
|
|
629
|
-
const
|
|
630
|
-
D(t, () =>
|
|
631
|
-
const
|
|
634
|
+
const i = A();
|
|
635
|
+
D(t, () => i.fire()), n != null && n.watchSource && D(n.watchSource, () => i.fire());
|
|
636
|
+
const a = /* @__PURE__ */ new WeakMap(), u = l(v.createTreeView(e, {
|
|
632
637
|
...n,
|
|
633
638
|
treeDataProvider: {
|
|
634
639
|
...n,
|
|
635
|
-
onDidChangeTreeData:
|
|
640
|
+
onDidChangeTreeData: i.event,
|
|
636
641
|
getTreeItem(r) {
|
|
637
642
|
return r.treeItem;
|
|
638
643
|
},
|
|
639
644
|
async getChildren(r) {
|
|
640
645
|
if (r) {
|
|
641
|
-
const
|
|
642
|
-
return
|
|
646
|
+
const o = await r.children;
|
|
647
|
+
return o == null || o.forEach((d) => a.set(d, r)), o;
|
|
643
648
|
}
|
|
644
649
|
return s(t);
|
|
645
650
|
},
|
|
646
651
|
getParent(r) {
|
|
647
|
-
return
|
|
652
|
+
return a.get(r);
|
|
648
653
|
}
|
|
649
654
|
}
|
|
650
655
|
}));
|
|
@@ -652,22 +657,22 @@ const nt = q(
|
|
|
652
657
|
},
|
|
653
658
|
(e) => e
|
|
654
659
|
);
|
|
655
|
-
function
|
|
656
|
-
var
|
|
657
|
-
const t = x((
|
|
660
|
+
function it(e) {
|
|
661
|
+
var i;
|
|
662
|
+
const t = x((i = s(e)) == null ? void 0 : i.visible);
|
|
658
663
|
function n() {
|
|
659
|
-
var
|
|
660
|
-
t.value = (
|
|
664
|
+
var a;
|
|
665
|
+
t.value = (a = s(e)) == null ? void 0 : a.visible;
|
|
661
666
|
}
|
|
662
|
-
return C((
|
|
667
|
+
return C((a) => {
|
|
663
668
|
const u = s(e);
|
|
664
669
|
if (u) {
|
|
665
670
|
const r = u.onDidChangeVisibility(n);
|
|
666
|
-
|
|
671
|
+
a(() => r.dispose());
|
|
667
672
|
}
|
|
668
673
|
}), C(n), h(() => !!t.value);
|
|
669
674
|
}
|
|
670
|
-
const
|
|
675
|
+
const at = w(() => {
|
|
671
676
|
const e = g(v.visibleNotebookEditors);
|
|
672
677
|
return l(v.onDidChangeVisibleNotebookEditors((t) => {
|
|
673
678
|
e.value = t;
|
|
@@ -679,52 +684,52 @@ const it = w(() => {
|
|
|
679
684
|
})), e;
|
|
680
685
|
});
|
|
681
686
|
function st(e, t, n = !0) {
|
|
682
|
-
const
|
|
687
|
+
const i = te(t) ? t : typeof t == "function" ? h(t) : x(t);
|
|
683
688
|
return C(() => {
|
|
684
|
-
s(n) &&
|
|
685
|
-
}),
|
|
689
|
+
s(n) && O.executeCommand("setContext", e, i.value);
|
|
690
|
+
}), i;
|
|
686
691
|
}
|
|
687
|
-
function ut(e, t, n,
|
|
692
|
+
function ut(e, t, n, i, a) {
|
|
688
693
|
const u = g(), r = l(v.createWebviewPanel(
|
|
689
694
|
e,
|
|
690
695
|
s(t),
|
|
691
|
-
|
|
696
|
+
i,
|
|
692
697
|
{
|
|
693
|
-
enableFindWidget:
|
|
694
|
-
retainContextWhenHidden:
|
|
695
|
-
...s(
|
|
698
|
+
enableFindWidget: a == null ? void 0 : a.enableFindWidget,
|
|
699
|
+
retainContextWhenHidden: a == null ? void 0 : a.retainContextWhenHidden,
|
|
700
|
+
...s(a == null ? void 0 : a.webviewOptions)
|
|
696
701
|
}
|
|
697
702
|
));
|
|
698
|
-
|
|
699
|
-
const
|
|
700
|
-
function
|
|
701
|
-
|
|
703
|
+
a != null && a.onDidReceiveMessage && r.webview.onDidReceiveMessage(a.onDidReceiveMessage);
|
|
704
|
+
const o = x(0);
|
|
705
|
+
function d() {
|
|
706
|
+
o.value++;
|
|
702
707
|
}
|
|
703
708
|
if (C(() => {
|
|
704
|
-
r.webview.html = `${s(n)}<!--${
|
|
705
|
-
}),
|
|
706
|
-
const
|
|
709
|
+
r.webview.html = `${s(n)}<!--${o.value}-->`;
|
|
710
|
+
}), a != null && a.webviewOptions) {
|
|
711
|
+
const b = a.webviewOptions;
|
|
707
712
|
C(() => {
|
|
708
|
-
r.webview.options = s(
|
|
713
|
+
r.webview.options = s(b);
|
|
709
714
|
});
|
|
710
715
|
}
|
|
711
716
|
L(r, t);
|
|
712
|
-
function
|
|
713
|
-
return r.webview.postMessage(
|
|
717
|
+
function c(b) {
|
|
718
|
+
return r.webview.postMessage(b);
|
|
714
719
|
}
|
|
715
|
-
const
|
|
720
|
+
const m = x(r.active), f = x(r.visible);
|
|
716
721
|
return l(r.onDidChangeViewState(() => {
|
|
717
|
-
|
|
718
|
-
})), { panel: r, context: u, active:
|
|
722
|
+
m.value = r.active, f.value = r.visible;
|
|
723
|
+
})), { panel: r, context: u, active: m, visible: f, postMessage: c, forceRefresh: d };
|
|
719
724
|
}
|
|
720
|
-
const
|
|
725
|
+
const ot = q(
|
|
721
726
|
(e, t, n) => {
|
|
722
|
-
const
|
|
727
|
+
const i = g(), a = g();
|
|
723
728
|
l(v.registerWebviewViewProvider(
|
|
724
729
|
e,
|
|
725
730
|
{
|
|
726
|
-
resolveWebviewView(
|
|
727
|
-
|
|
731
|
+
resolveWebviewView(d, c) {
|
|
732
|
+
i.value = d, a.value = c, n != null && n.onDidReceiveMessage && d.webview.onDidReceiveMessage(n.onDidReceiveMessage);
|
|
728
733
|
}
|
|
729
734
|
},
|
|
730
735
|
{
|
|
@@ -738,22 +743,22 @@ const ct = q(
|
|
|
738
743
|
u.value++;
|
|
739
744
|
}
|
|
740
745
|
if (C(() => {
|
|
741
|
-
|
|
746
|
+
i.value && (i.value.webview.html = `${s(t)}<!--${u.value}-->`);
|
|
742
747
|
}), n != null && n.webviewOptions) {
|
|
743
|
-
const
|
|
748
|
+
const d = n.webviewOptions;
|
|
744
749
|
C(() => {
|
|
745
|
-
|
|
750
|
+
i.value && (i.value.webview.options = s(d));
|
|
746
751
|
});
|
|
747
752
|
}
|
|
748
|
-
n != null && n.title && L(
|
|
749
|
-
function
|
|
750
|
-
var
|
|
751
|
-
return (
|
|
753
|
+
n != null && n.title && L(i, n.title), n != null && n.badge && Z(i, n.badge);
|
|
754
|
+
function o(d) {
|
|
755
|
+
var c;
|
|
756
|
+
return (c = i.value) == null ? void 0 : c.webview.postMessage(d);
|
|
752
757
|
}
|
|
753
|
-
return { view:
|
|
758
|
+
return { view: i, context: a, postMessage: o, forceRefresh: r };
|
|
754
759
|
},
|
|
755
760
|
(e) => e
|
|
756
|
-
),
|
|
761
|
+
), ct = w(() => {
|
|
757
762
|
const e = g(v.state);
|
|
758
763
|
return l(v.onDidChangeWindowState((t) => {
|
|
759
764
|
e.value = t;
|
|
@@ -777,25 +782,25 @@ export {
|
|
|
777
782
|
Te as defineExtension,
|
|
778
783
|
xe as defineLogger,
|
|
779
784
|
Ee as executeCommand,
|
|
780
|
-
|
|
785
|
+
y as extensionContext,
|
|
781
786
|
M as extensionScope,
|
|
782
787
|
ze as getDefaultLoggerPrefix,
|
|
783
788
|
J as onActivate,
|
|
784
789
|
De as onDeactivate,
|
|
785
790
|
re as tryOnScopeDispose,
|
|
786
791
|
pe as useAbsolutePath,
|
|
787
|
-
|
|
792
|
+
oe as useActiveColorTheme,
|
|
788
793
|
ke as useActiveDebugSession,
|
|
789
|
-
|
|
790
|
-
|
|
794
|
+
ye as useActiveEditorDecorations,
|
|
795
|
+
Re as useActiveNotebookEditor,
|
|
791
796
|
Ve as useActiveTerminal,
|
|
792
|
-
|
|
797
|
+
ce as useActiveTextEditor,
|
|
793
798
|
Ae as useAllExtensions,
|
|
794
799
|
fe as useCommand,
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
800
|
+
Oe as useCommands,
|
|
801
|
+
Ie as useCommentController,
|
|
802
|
+
Pe as useControlledTerminal,
|
|
803
|
+
We as useDefaultShell,
|
|
799
804
|
l as useDisposable,
|
|
800
805
|
le as useDocumentText,
|
|
801
806
|
de as useEditorDecorations,
|
|
@@ -830,12 +835,12 @@ export {
|
|
|
830
835
|
nt as useTreeView,
|
|
831
836
|
Z as useViewBadge,
|
|
832
837
|
L as useViewTitle,
|
|
833
|
-
|
|
834
|
-
|
|
838
|
+
it as useViewVisibility,
|
|
839
|
+
at as useVisibleNotebookEditors,
|
|
835
840
|
rt as useVisibleTextEditors,
|
|
836
841
|
st as useVscodeContext,
|
|
837
842
|
ut as useWebviewPanel,
|
|
838
|
-
|
|
839
|
-
|
|
843
|
+
ot as useWebviewView,
|
|
844
|
+
ct as useWindowState,
|
|
840
845
|
lt as useWorkspaceFolders
|
|
841
846
|
};
|
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.20",
|
|
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.20"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
44
|
"@types/node": "^20.17.45",
|