@pstdio/workbench 0.7.1 → 0.9.0
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 +39 -317
- package/dist/extensions.d.ts +1492 -698
- package/dist/extensions.js +1679 -1776
- package/dist/extensions.js.map +1 -1
- package/dist/file-renderer-view-kfJRY3yR.js +515 -0
- package/dist/file-renderer-view-kfJRY3yR.js.map +1 -0
- package/dist/index.d.ts +724 -599
- package/dist/index.js +5151 -2369
- package/dist/index.js.map +1 -1
- package/dist/react.d.ts +673 -550
- package/dist/react.js +3585 -3335
- package/dist/react.js.map +1 -1
- package/dist/storage.d.ts +120 -155
- package/dist/storage.js +135 -149
- package/dist/storage.js.map +1 -1
- package/dist/webview-runtime.d.ts +2 -5
- package/dist/webview-runtime.js +3 -3
- package/dist/webview-runtime.js.map +1 -1
- package/dist/workbench-menu-paths-B_QJzcNU.js +12 -0
- package/dist/workbench-menu-paths-B_QJzcNU.js.map +1 -0
- package/dist/workbench-renderers-DmsrBGC7.js +960 -0
- package/dist/workbench-renderers-DmsrBGC7.js.map +1 -0
- package/dist/workspaces-DJwFj8uq.js +1872 -0
- package/dist/workspaces-DJwFj8uq.js.map +1 -0
- package/package.json +6 -41
- package/dist/composition-resolver-types-CWykPyEK.js +0 -241
- package/dist/composition-resolver-types-CWykPyEK.js.map +0 -1
- package/dist/file-renderer-view-B6_iR4EN.js +0 -496
- package/dist/file-renderer-view-B6_iR4EN.js.map +0 -1
- package/dist/file-section-navigation-CfYqVObc.js +0 -30
- package/dist/file-section-navigation-CfYqVObc.js.map +0 -1
- package/dist/icon-B9XolQG8.js +0 -35
- package/dist/icon-B9XolQG8.js.map +0 -1
- package/dist/layout-types-DMoZz38-.js +0 -100
- package/dist/layout-types-DMoZz38-.js.map +0 -1
- package/dist/surface-map-C1pOTUmF.js +0 -52
- package/dist/surface-map-C1pOTUmF.js.map +0 -1
- package/dist/testing.d.ts +0 -2284
- package/dist/testing.js +0 -58
- package/dist/testing.js.map +0 -1
- package/dist/workbench-built-ins-BncLJfQA.js +0 -1175
- package/dist/workbench-built-ins-BncLJfQA.js.map +0 -1
- package/dist/workbench-menu-paths-Bb0ICxeG.js +0 -20
- package/dist/workbench-menu-paths-Bb0ICxeG.js.map +0 -1
|
@@ -1,1175 +0,0 @@
|
|
|
1
|
-
import { c as m, w as $ } from "./workbench-menu-paths-Bb0ICxeG.js";
|
|
2
|
-
import { w as p, r as Y } from "./layout-types-DMoZz38-.js";
|
|
3
|
-
import { r as ee, l as te, g as ie } from "./surface-map-C1pOTUmF.js";
|
|
4
|
-
import { devtools as ne } from "zustand/middleware";
|
|
5
|
-
import { createStore as oe } from "zustand/vanilla";
|
|
6
|
-
const re = (e, i) => Object.is(e, i), W = (e) => {
|
|
7
|
-
const i = oe()(ne(() => e.initialState, {
|
|
8
|
-
name: e.name ?? "workbench.store"
|
|
9
|
-
})), t = (r, s, n = {}) => {
|
|
10
|
-
const o = n.equalityFn ?? re;
|
|
11
|
-
let a = r(i.getState());
|
|
12
|
-
return n.fireImmediately && s(a, a), i.subscribe((c) => {
|
|
13
|
-
const d = r(c);
|
|
14
|
-
if (o(a, d)) return;
|
|
15
|
-
const g = a;
|
|
16
|
-
a = d, s(d, g);
|
|
17
|
-
});
|
|
18
|
-
};
|
|
19
|
-
return {
|
|
20
|
-
getState: i.getState,
|
|
21
|
-
getInitialState: i.getInitialState,
|
|
22
|
-
subscribe: i.subscribe,
|
|
23
|
-
subscribeSelector: t,
|
|
24
|
-
setState: i.setState,
|
|
25
|
-
api: i
|
|
26
|
-
};
|
|
27
|
-
}, je = (e, i) => {
|
|
28
|
-
for (const t of Object.values(e.regions)) {
|
|
29
|
-
const r = t.widgets.findIndex((s) => s.contributionId === i);
|
|
30
|
-
if (r >= 0) return {
|
|
31
|
-
regionId: t.id,
|
|
32
|
-
index: r,
|
|
33
|
-
placement: t.widgets[r]
|
|
34
|
-
};
|
|
35
|
-
}
|
|
36
|
-
}, Ke = (e, i, t) => {
|
|
37
|
-
for (const r of Object.values(e.regions)) {
|
|
38
|
-
const s = r.widgets.findIndex((n) => n.contributionId === i && n.resourceUri === t);
|
|
39
|
-
if (s >= 0) return {
|
|
40
|
-
regionId: r.id,
|
|
41
|
-
index: s,
|
|
42
|
-
placement: r.widgets[s]
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
}, se = (e, i) => {
|
|
46
|
-
for (const t of Object.values(e.regions)) {
|
|
47
|
-
const r = t.widgets.findIndex((s) => s.widgetId === i);
|
|
48
|
-
if (r >= 0) return {
|
|
49
|
-
regionId: t.id,
|
|
50
|
-
index: r,
|
|
51
|
-
placement: t.widgets[r]
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
}, Ee = (e, i) => {
|
|
55
|
-
const t = new Set(Object.values(e.regions).flatMap((r) => r.widgets.map((s) => s.widgetId)));
|
|
56
|
-
return Y(t, i);
|
|
57
|
-
}, K = (e) => e.widgets.find((i) => i.widgetId === e.activeWidgetId) ?? e.widgets[0], P = (e) => e.role === "location", _ = (e) => e.resourceUri ?? `${e.contributionId}:${e.widgetId}`, E = (e, i, t, r) => {
|
|
58
|
-
if (!i) return e;
|
|
59
|
-
const s = _(i), o = {
|
|
60
|
-
...e.locationSubPanelSelections?.[s] ?? {}
|
|
61
|
-
};
|
|
62
|
-
return r ? o[t] = r : delete o[t], {
|
|
63
|
-
...e,
|
|
64
|
-
locationSubPanelSelections: {
|
|
65
|
-
...e.locationSubPanelSelections,
|
|
66
|
-
[s]: o
|
|
67
|
-
}
|
|
68
|
-
};
|
|
69
|
-
}, F = (e, i) => {
|
|
70
|
-
if (!e.locationSubPanelSelections) return e;
|
|
71
|
-
const t = Object.fromEntries(Object.entries(e.locationSubPanelSelections).map(([r, s]) => [r, Object.fromEntries(Object.entries(s).filter(([, n]) => n !== i))]));
|
|
72
|
-
return {
|
|
73
|
-
...e,
|
|
74
|
-
locationSubPanelSelections: t
|
|
75
|
-
};
|
|
76
|
-
}, k = (e) => {
|
|
77
|
-
const i = e.regions.main.widgets.filter(P);
|
|
78
|
-
return i.find((t) => t.widgetId === e.activeLocationWidgetId) ?? i.at(-1);
|
|
79
|
-
}, $e = (e, i, t) => {
|
|
80
|
-
const r = {
|
|
81
|
-
...e
|
|
82
|
-
};
|
|
83
|
-
return t.resource ? (r.resource = t.resource, r.resourceUri = t.resource.uri, r.title = t.title ?? t.resource.label ?? i.title) : t.title !== void 0 && (r.title = t.title), t.pinned !== void 0 && (r.pinned = t.pinned), t.closable !== void 0 && (r.closable = t.closable), t.mountStrategy !== void 0 && (r.mountStrategy = t.mountStrategy), t.hiddenByDefault !== void 0 && (r.hiddenByDefault = t.hiddenByDefault), t.tabRetention !== void 0 && (r.tabRetention = t.tabRetention), t.tab !== void 0 && (r.tab = t.tab), t.ownerId !== void 0 && (r.ownerId = t.ownerId), t.source !== void 0 && (r.source = t.source), t.role !== void 0 && (r.role = t.role), r;
|
|
84
|
-
}, De = (e, i, t) => ({
|
|
85
|
-
widgetId: e,
|
|
86
|
-
contributionId: i.id,
|
|
87
|
-
ownerId: t.ownerId ?? i.ownerId,
|
|
88
|
-
source: t.source ?? i.source,
|
|
89
|
-
resource: t.resource,
|
|
90
|
-
resourceUri: t.resource?.uri,
|
|
91
|
-
title: t.title ?? t.resource?.label ?? i.title,
|
|
92
|
-
pinned: t.pinned,
|
|
93
|
-
// Tabbed (non-singleton) widgets are closable unless they opt out; singleton
|
|
94
|
-
// panels stay non-closable by default.
|
|
95
|
-
closable: t.closable ?? i.closable ?? !i.singleton,
|
|
96
|
-
mountStrategy: t.mountStrategy ?? i.mountStrategy,
|
|
97
|
-
hiddenByDefault: t.hiddenByDefault ?? i.hiddenByDefault,
|
|
98
|
-
tabRetention: t.tabRetention,
|
|
99
|
-
tab: t.tab ?? i.tab,
|
|
100
|
-
role: t.role ?? "content"
|
|
101
|
-
}), He = (e, i, t, r = {}) => {
|
|
102
|
-
const s = e.regions[i], n = t(s.widgets), o = r.activeWidgetId !== void 0 ? r.activeWidgetId : r.clearActiveWidget ? void 0 : s.activeWidgetId;
|
|
103
|
-
return {
|
|
104
|
-
...e,
|
|
105
|
-
activeLocationWidgetId: i === "main" && !n.some((a) => a.widgetId === e.activeLocationWidgetId) ? n.filter(P).at(-1)?.widgetId : e.activeLocationWidgetId,
|
|
106
|
-
regions: {
|
|
107
|
-
...e.regions,
|
|
108
|
-
[i]: {
|
|
109
|
-
...s,
|
|
110
|
-
widgets: n,
|
|
111
|
-
activeWidgetId: o
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
}, Be = (e, i) => {
|
|
116
|
-
let t = e;
|
|
117
|
-
for (const s of Object.values(e.regions)) {
|
|
118
|
-
const n = s.widgets.filter((c) => c.contributionId === i), o = s.widgets.filter((c) => c.contributionId !== i);
|
|
119
|
-
if (o.length === s.widgets.length) continue;
|
|
120
|
-
const a = s.activeWidgetId && !o.some((c) => c.widgetId === s.activeWidgetId) ? void 0 : s.activeWidgetId;
|
|
121
|
-
t = {
|
|
122
|
-
...t,
|
|
123
|
-
regions: {
|
|
124
|
-
...t.regions,
|
|
125
|
-
[s.id]: {
|
|
126
|
-
...s,
|
|
127
|
-
widgets: o,
|
|
128
|
-
activeWidgetId: a
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
};
|
|
132
|
-
for (const c of n)
|
|
133
|
-
t = F(t, c.widgetId);
|
|
134
|
-
}
|
|
135
|
-
const r = Object.values(t.regions).some((s) => s.widgets.some((n) => n.widgetId === t.activeWidgetId));
|
|
136
|
-
return t.activeWidgetId && (!r || t.activeWidgetId.startsWith(`${i}:`) || t.activeWidgetId === i) && (t = {
|
|
137
|
-
...t,
|
|
138
|
-
activeWidgetId: void 0,
|
|
139
|
-
activeResourceUri: void 0
|
|
140
|
-
}), t.activeLocationWidgetId && !t.regions.main.widgets.some((s) => s.widgetId === t.activeLocationWidgetId) && (t = {
|
|
141
|
-
...t,
|
|
142
|
-
activeLocationWidgetId: t.regions.main.widgets.filter(P).at(-1)?.widgetId
|
|
143
|
-
}), t;
|
|
144
|
-
}, Te = (e, i) => {
|
|
145
|
-
const t = se(e, i);
|
|
146
|
-
if (!t) return;
|
|
147
|
-
const r = e.regions[t.regionId], s = r.widgets.filter((u) => u.widgetId !== i), n = r.activeWidgetId === i || !r.activeWidgetId && t.index === 0, a = (t.placement.role === "sub-panel" ? s.find((u) => u.role === "sub-panel" && u.ownerResourceUri === t.placement.ownerResourceUri) : void 0) ?? (t.placement.role === "sub-panel" && t.regionId === "main" ? k(e) : s[t.index] ?? s[t.index - 1]), c = n ? a?.widgetId : r.activeWidgetId, d = {
|
|
148
|
-
...r,
|
|
149
|
-
widgets: s,
|
|
150
|
-
activeWidgetId: c
|
|
151
|
-
};
|
|
152
|
-
let g = F({
|
|
153
|
-
...e,
|
|
154
|
-
activeLocationWidgetId: e.activeLocationWidgetId === i ? e.regions.main.widgets.filter((u) => u.widgetId !== i && P(u)).at(-1)?.widgetId : e.activeLocationWidgetId,
|
|
155
|
-
regions: {
|
|
156
|
-
...e.regions,
|
|
157
|
-
[r.id]: d
|
|
158
|
-
}
|
|
159
|
-
}, i);
|
|
160
|
-
return n && t.regionId !== "side" && p.includes(t.regionId) && (g = E(g, k(g), t.regionId, a?.role === "sub-panel" ? a.widgetId : void 0)), e.activeWidgetId === i && (g = {
|
|
161
|
-
...g,
|
|
162
|
-
activeWidgetId: a?.widgetId,
|
|
163
|
-
activeResourceUri: a?.resourceUri
|
|
164
|
-
}), {
|
|
165
|
-
regionId: t.regionId,
|
|
166
|
-
closedPlacement: t.placement,
|
|
167
|
-
activePlacement: K(d),
|
|
168
|
-
layout: g
|
|
169
|
-
};
|
|
170
|
-
}, _e = (e, i, t) => {
|
|
171
|
-
const r = e.regions[i];
|
|
172
|
-
if (i === "main" && P(t)) {
|
|
173
|
-
const n = e.locationSubPanelSelections?.[_(t)] ?? {}, o = Object.fromEntries(Object.entries(e.regions).map(([a, c]) => [a, {
|
|
174
|
-
...c,
|
|
175
|
-
widgets: c.widgets.map((d) => !t.resource || d.widgetId === t.widgetId || d.ownerResourceUri !== t.resourceUri || d.resourceUri !== t.resourceUri ? d : {
|
|
176
|
-
...d,
|
|
177
|
-
resource: t.resource
|
|
178
|
-
})
|
|
179
|
-
}]));
|
|
180
|
-
for (const a of p) {
|
|
181
|
-
const c = o[a], d = n[a], g = c.widgets.find((u) => u.widgetId === d && u.role === "sub-panel" && (!u.ownerResourceUri || u.ownerResourceUri === t.resourceUri));
|
|
182
|
-
o[a] = {
|
|
183
|
-
...c,
|
|
184
|
-
activeWidgetId: a === "side" ? c.activeWidgetId : g?.widgetId ?? (a === "main" ? t.widgetId : void 0)
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
return {
|
|
188
|
-
...e,
|
|
189
|
-
activeWidgetId: t.widgetId,
|
|
190
|
-
activeLocationWidgetId: t.widgetId,
|
|
191
|
-
activeResourceUri: t.resourceUri,
|
|
192
|
-
regions: o
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
const s = t.role === "sub-panel" && i !== "side" && p.includes(i) ? E(e, k(e), i, t.widgetId) : e;
|
|
196
|
-
return {
|
|
197
|
-
...s,
|
|
198
|
-
activeWidgetId: t.widgetId,
|
|
199
|
-
activeLocationWidgetId: e.activeLocationWidgetId,
|
|
200
|
-
activeResourceUri: t.resourceUri,
|
|
201
|
-
regions: {
|
|
202
|
-
...s.regions,
|
|
203
|
-
[i]: {
|
|
204
|
-
...r,
|
|
205
|
-
activeWidgetId: t.widgetId
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
};
|
|
209
|
-
}, Fe = (e, i, t) => {
|
|
210
|
-
const r = e.regions[i], s = t ? r.widgets.find((a) => a.widgetId === t) : void 0;
|
|
211
|
-
if (t && !s) throw new Error(`Widget placement not found in ${i}: ${t}`);
|
|
212
|
-
if (r.activeWidgetId === t) return;
|
|
213
|
-
const n = e.activeWidgetId === r.activeWidgetId, o = {
|
|
214
|
-
...e,
|
|
215
|
-
activeWidgetId: n ? s?.widgetId : e.activeWidgetId,
|
|
216
|
-
activeResourceUri: n ? s?.resourceUri : e.activeResourceUri,
|
|
217
|
-
activeLocationWidgetId: i === "main" && s?.role === "location" ? s.widgetId : e.activeLocationWidgetId,
|
|
218
|
-
regions: {
|
|
219
|
-
...e.regions,
|
|
220
|
-
[i]: {
|
|
221
|
-
...r,
|
|
222
|
-
activeWidgetId: s?.widgetId
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
};
|
|
226
|
-
return i === "side" || !p.includes(i) ? o : E(o, k(o), i, s?.role === "sub-panel" ? s.widgetId : void 0);
|
|
227
|
-
}, ce = (e, i) => !(e.resourceKinds?.length && (!i || !e.resourceKinds.includes(i.kind)) || e.canOpen && (!i || !e.canOpen(i))), Ve = (e, i, t, r = {}) => {
|
|
228
|
-
const s = e.regions[i];
|
|
229
|
-
return s.widgets.find((n) => n.widgetId === s.activeWidgetId && n.role === "sub-panel" && (r.ignoreOwnerResourceUri || !n.ownerResourceUri || n.ownerResourceUri === t?.uri));
|
|
230
|
-
}, Ne = (e) => k(e), ae = (e, i, t, r) => {
|
|
231
|
-
const s = e.eligibleLocations;
|
|
232
|
-
return !(!V(e, t) || s?.resourceKinds?.length && (!i || !s.resourceKinds.includes(i.kind)) || s?.resourceIds?.length && (!i?.id || !s.resourceIds.includes(i.id)) || s?.canOpen && (!i || !s.canOpen(i)) || r?.ownerResourceUri && r.ownerResourceUri !== i?.uri);
|
|
233
|
-
}, V = (e, i) => {
|
|
234
|
-
const t = e.eligibleLocations?.modeIds;
|
|
235
|
-
return !t?.length || i !== void 0 && t.includes(i);
|
|
236
|
-
}, qe = (e, i, t, r, s = {}) => ce(e, r?.resource ?? i) ? s.ignoreResourceLocation ? V(e, t) : ae(e, i, t, r) : !1, ze = (e, i) => {
|
|
237
|
-
const t = e.regions.main.widgets.find((r) => r.widgetId === e.regions.main.activeWidgetId) ?? k(e);
|
|
238
|
-
return t ? i.find((r) => r.id === t.contributionId)?.floatingPanels !== "hidden" : !0;
|
|
239
|
-
}, Qe = (e, i) => {
|
|
240
|
-
const t = e.panelMenuOwner ?? {
|
|
241
|
-
level: "panel"
|
|
242
|
-
};
|
|
243
|
-
return t.contributionId ? (i.subPanel ?? i.locationPanel)?.contributionId === t.contributionId : i.subPanel ? t.level === "sub-panel" : t.level === "panel";
|
|
244
|
-
}, de = "workbench.core", N = (e = {}) => ({
|
|
245
|
-
source: e.source ?? "module",
|
|
246
|
-
ownerId: e.ownerId ?? de,
|
|
247
|
-
priority: e.priority ?? 0
|
|
248
|
-
}), O = (e, i) => i.priority - e.priority || e.ownerId.localeCompare(i.ownerId), Ge = (e = {}, i) => {
|
|
249
|
-
const {
|
|
250
|
-
strategy: t,
|
|
251
|
-
...r
|
|
252
|
-
} = e;
|
|
253
|
-
return t ? t.kind === "persistent" ? {
|
|
254
|
-
...r,
|
|
255
|
-
tabPosition: t.position,
|
|
256
|
-
tabRetention: "persistent"
|
|
257
|
-
} : t.kind === "replace-active" ? {
|
|
258
|
-
...r,
|
|
259
|
-
replaceActive: !0
|
|
260
|
-
} : t.kind === "replace-panel" ? {
|
|
261
|
-
...r,
|
|
262
|
-
replaceWidgetId: t.instanceId,
|
|
263
|
-
tabRetention: t.retention
|
|
264
|
-
} : {
|
|
265
|
-
...r,
|
|
266
|
-
tabRetention: "preview",
|
|
267
|
-
tabPosition: t.position
|
|
268
|
-
} : {
|
|
269
|
-
...r,
|
|
270
|
-
tabRetention: i
|
|
271
|
-
};
|
|
272
|
-
}, Je = (e) => ({
|
|
273
|
-
instanceId: e.widgetId,
|
|
274
|
-
panelId: e.contributionId,
|
|
275
|
-
ownerId: e.ownerId,
|
|
276
|
-
source: e.source,
|
|
277
|
-
resource: e.resource,
|
|
278
|
-
resourceUri: e.resourceUri,
|
|
279
|
-
ownerResourceUri: e.ownerResourceUri,
|
|
280
|
-
title: e.title,
|
|
281
|
-
pinned: e.pinned,
|
|
282
|
-
closable: e.closable === !0,
|
|
283
|
-
mountStrategy: e.mountStrategy,
|
|
284
|
-
hiddenByDefault: e.hiddenByDefault,
|
|
285
|
-
tabRetention: e.tabRetention,
|
|
286
|
-
tab: e.tab
|
|
287
|
-
}), Xe = (e) => {
|
|
288
|
-
const {
|
|
289
|
-
closable: i,
|
|
290
|
-
ownedPanelMenuIds: t,
|
|
291
|
-
...r
|
|
292
|
-
} = e;
|
|
293
|
-
return r;
|
|
294
|
-
}, D = (e) => e ? Array.isArray(e) ? [...e] : [e] : [], y = {
|
|
295
|
-
main: ["main-header", "main-left-menu", "main", "main-right-menu"],
|
|
296
|
-
secondary: ["secondary-header", "secondary-left-menu", "secondary", "secondary-right-menu"],
|
|
297
|
-
side: ["side-header", "side-left-menu", "side", "side-right-menu"]
|
|
298
|
-
}, H = Object.values(y).flat(), x = (e) => e.panels ?? p, Ze = (e) => Object.keys(y).find((i) => y[i].some((t) => t === e)), Ye = (e, i) => !e || x(e).includes(i), I = (e, i) => {
|
|
299
|
-
if (i)
|
|
300
|
-
return Object.values(e.regions).flatMap((t) => t.widgets).find((t) => t.widgetId === i);
|
|
301
|
-
}, A = (e, i) => {
|
|
302
|
-
const t = i.find((r) => r && I(e, r.widgetId));
|
|
303
|
-
return {
|
|
304
|
-
...e,
|
|
305
|
-
activeWidgetId: t?.widgetId,
|
|
306
|
-
activeResourceUri: t?.resourceUri
|
|
307
|
-
};
|
|
308
|
-
}, le = (e, i) => {
|
|
309
|
-
if (i.length === 0) return e;
|
|
310
|
-
const t = new Set(Object.keys(y).filter((c) => y[c].some((d) => i.includes(d)))), r = i.some((c) => {
|
|
311
|
-
const d = e.regions[c];
|
|
312
|
-
return d.widgets.length > 0 || d.activeWidgetId !== void 0 || d.visible;
|
|
313
|
-
}), s = Object.values(e.locationSubPanelSelections ?? {}).some((c) => Object.keys(c).some((d) => t.has(d)));
|
|
314
|
-
if (!r && !s) return e;
|
|
315
|
-
const n = {
|
|
316
|
-
...e.regions
|
|
317
|
-
};
|
|
318
|
-
for (const c of i)
|
|
319
|
-
n[c] = {
|
|
320
|
-
...n[c],
|
|
321
|
-
widgets: [],
|
|
322
|
-
activeWidgetId: void 0,
|
|
323
|
-
visible: !1
|
|
324
|
-
};
|
|
325
|
-
const o = Object.fromEntries(Object.entries(e.locationSubPanelSelections ?? {}).map(([c, d]) => [c, Object.fromEntries(Object.entries(d).filter(([g]) => !t.has(g)))])), a = {
|
|
326
|
-
...e,
|
|
327
|
-
regions: n
|
|
328
|
-
};
|
|
329
|
-
return {
|
|
330
|
-
...A(a, [I(a, e.activeWidgetId)]),
|
|
331
|
-
activeLocationWidgetId: I(a, e.activeLocationWidgetId)?.widgetId,
|
|
332
|
-
locationSubPanelSelections: o
|
|
333
|
-
};
|
|
334
|
-
}, U = (e, i) => {
|
|
335
|
-
const t = new Set(i), r = Object.keys(y).filter((s) => !t.has(s)).flatMap((s) => y[s]);
|
|
336
|
-
return le(e, r);
|
|
337
|
-
}, ge = (e, i, t) => {
|
|
338
|
-
if (!i) {
|
|
339
|
-
const a = {
|
|
340
|
-
...e.regions
|
|
341
|
-
};
|
|
342
|
-
for (const d of H) {
|
|
343
|
-
const g = a[d], u = g.widgets.filter((b) => b.role !== "content");
|
|
344
|
-
a[d] = {
|
|
345
|
-
...g,
|
|
346
|
-
widgets: u,
|
|
347
|
-
activeWidgetId: u.some((b) => b.widgetId === g.activeWidgetId) ? g.activeWidgetId : void 0
|
|
348
|
-
};
|
|
349
|
-
}
|
|
350
|
-
const c = {
|
|
351
|
-
...e,
|
|
352
|
-
regions: a
|
|
353
|
-
};
|
|
354
|
-
return U({
|
|
355
|
-
...A(c, [I(c, e.activeWidgetId)]),
|
|
356
|
-
activeLocationWidgetId: I(c, e.activeLocationWidgetId)?.widgetId
|
|
357
|
-
}, t);
|
|
358
|
-
}
|
|
359
|
-
const r = {
|
|
360
|
-
...e.regions
|
|
361
|
-
};
|
|
362
|
-
for (const a of H) r[a] = i.regions[a];
|
|
363
|
-
const s = U({
|
|
364
|
-
...e,
|
|
365
|
-
regions: r
|
|
366
|
-
}, t), n = I(s, i.activeWidgetId), o = I(s, e.activeWidgetId);
|
|
367
|
-
return {
|
|
368
|
-
...A(s, [n, o]),
|
|
369
|
-
activeLocationWidgetId: I(s, i.activeLocationWidgetId)?.widgetId ?? I(s, e.activeLocationWidgetId)?.widgetId,
|
|
370
|
-
locationSubPanelSelections: i.locationSubPanelSelections
|
|
371
|
-
};
|
|
372
|
-
}, C = (e) => {
|
|
373
|
-
for (let i = e.length - 1; i >= 0; i -= 1)
|
|
374
|
-
e[i]?.dispose();
|
|
375
|
-
}, B = (e, i) => {
|
|
376
|
-
i !== e.layout.getLayout() && e.layout.restoreLayout(i);
|
|
377
|
-
for (const t of p) e.panels.setOpen(t, i.regions[t].visible);
|
|
378
|
-
}, et = (e) => {
|
|
379
|
-
const i = W({
|
|
380
|
-
name: "workbench.modes",
|
|
381
|
-
initialState: {
|
|
382
|
-
modes: {},
|
|
383
|
-
activeModeId: void 0
|
|
384
|
-
}
|
|
385
|
-
}), t = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Map();
|
|
386
|
-
let n = [], o, a, c = !1;
|
|
387
|
-
const d = (l) => {
|
|
388
|
-
if (t.has(l.id)) return;
|
|
389
|
-
const f = D(l.activate(e.resolveContext()));
|
|
390
|
-
t.set(l.id, f);
|
|
391
|
-
}, g = (l, f) => {
|
|
392
|
-
let v = !1, h = () => {
|
|
393
|
-
};
|
|
394
|
-
const S = () => {
|
|
395
|
-
if (v) return;
|
|
396
|
-
const w = f.layout.getActivePanel("main");
|
|
397
|
-
if (!w) return;
|
|
398
|
-
const L = f.layout.getLayout().regions.main.widgets.find((Z) => Z.widgetId === w.instanceId);
|
|
399
|
-
L && (L.role === "sub-panel" || L.role === "panel-menu") || (v = !0, h(), e.establishLocation?.(w.instanceId));
|
|
400
|
-
};
|
|
401
|
-
h = f.layout.store.subscribeSelector((w) => w.layout.regions.main, S);
|
|
402
|
-
try {
|
|
403
|
-
l.seed?.(f), S();
|
|
404
|
-
} finally {
|
|
405
|
-
h();
|
|
406
|
-
}
|
|
407
|
-
}, u = (l) => {
|
|
408
|
-
const f = e.resolveContext(), v = `${l.id}\0${f.layout.getPersistenceScope() ?? "unscoped"}`, h = U(f.layout.getLayout(), x(l));
|
|
409
|
-
B(f, h), f.layout.reconcilePanelMenus(), !r.has(v) && !f.layout.enteredWithPersistedLayout() && g(l, f), r.add(v);
|
|
410
|
-
}, b = (l) => {
|
|
411
|
-
u(l), l.reconcile?.(e.resolveContext());
|
|
412
|
-
}, Q = (l) => {
|
|
413
|
-
const f = e.resolveContext(), v = i.getState().activeModeId, h = f.layout.getPersistenceScope() === void 0;
|
|
414
|
-
if (v && h && s.set(v, f.layout.getLayout()), R(), l === void 0) {
|
|
415
|
-
i.setState({
|
|
416
|
-
...i.getState(),
|
|
417
|
-
activeModeId: void 0
|
|
418
|
-
}, !1, "deactivateMode");
|
|
419
|
-
return;
|
|
420
|
-
}
|
|
421
|
-
const S = i.getState().modes[l];
|
|
422
|
-
if (!S) throw new Error(`Workbench mode not registered: ${l}`);
|
|
423
|
-
h && B(f, ge(f.layout.getLayout(), s.get(l), x(S))), G(l, {
|
|
424
|
-
seed: a !== l
|
|
425
|
-
});
|
|
426
|
-
}, R = () => {
|
|
427
|
-
C(n), n = [], o?.dispose(), o = void 0;
|
|
428
|
-
}, G = (l, f) => {
|
|
429
|
-
const v = e.resolveContext(), h = i.getState().modes[l];
|
|
430
|
-
if (!h) throw new Error(`Workbench mode not registered: ${l}`);
|
|
431
|
-
const S = v.context.createScope("workbench.mode");
|
|
432
|
-
S.set("activeWorkbenchMode", l), S.set(`workbenchMode.${l}`, !0), o = S;
|
|
433
|
-
try {
|
|
434
|
-
d(h), i.setState({
|
|
435
|
-
...i.getState(),
|
|
436
|
-
activeModeId: l
|
|
437
|
-
}, !1, "activateMode"), f.seed && u(h), n = D(h.enter?.(v)), f.seed && h.reconcile?.(e.resolveContext());
|
|
438
|
-
} catch (w) {
|
|
439
|
-
throw R(), i.setState({
|
|
440
|
-
...i.getState(),
|
|
441
|
-
activeModeId: void 0
|
|
442
|
-
}, !1, "deactivateMode"), w;
|
|
443
|
-
}
|
|
444
|
-
}, J = e.resolveContext().layout.onDidChangePersistenceScope(() => {
|
|
445
|
-
const l = i.getState().activeModeId;
|
|
446
|
-
if (l === a) return;
|
|
447
|
-
const f = l ? i.getState().modes[l] : void 0;
|
|
448
|
-
f && b(f);
|
|
449
|
-
}), X = m(() => {
|
|
450
|
-
J.dispose(), R();
|
|
451
|
-
for (const l of t.values()) C(l);
|
|
452
|
-
t.clear(), r.clear(), s.clear(), i.setState({
|
|
453
|
-
modes: {},
|
|
454
|
-
activeModeId: void 0
|
|
455
|
-
}, !1, "disposeModes");
|
|
456
|
-
});
|
|
457
|
-
return {
|
|
458
|
-
store: i,
|
|
459
|
-
dispose() {
|
|
460
|
-
X.dispose();
|
|
461
|
-
},
|
|
462
|
-
registerMode(l) {
|
|
463
|
-
const f = i.getState();
|
|
464
|
-
if (f.modes[l.id]) throw new Error(`Workbench mode already registered: ${l.id}`);
|
|
465
|
-
return i.setState({
|
|
466
|
-
...f,
|
|
467
|
-
modes: {
|
|
468
|
-
...f.modes,
|
|
469
|
-
[l.id]: l
|
|
470
|
-
}
|
|
471
|
-
}, !1, "registerMode"), m(() => {
|
|
472
|
-
const v = i.getState();
|
|
473
|
-
if (v.modes[l.id] !== l) return;
|
|
474
|
-
v.activeModeId === l.id && (R(), i.setState({
|
|
475
|
-
...i.getState(),
|
|
476
|
-
activeModeId: void 0
|
|
477
|
-
}, !1, "deactivateMode")), C(t.get(l.id) ?? []), t.delete(l.id), s.delete(l.id);
|
|
478
|
-
for (const w of r)
|
|
479
|
-
w.startsWith(`${l.id}\0`) && r.delete(w);
|
|
480
|
-
const {
|
|
481
|
-
[l.id]: h,
|
|
482
|
-
...S
|
|
483
|
-
} = v.modes;
|
|
484
|
-
i.setState({
|
|
485
|
-
...i.getState(),
|
|
486
|
-
modes: S
|
|
487
|
-
}, !1, "unregisterMode");
|
|
488
|
-
});
|
|
489
|
-
},
|
|
490
|
-
getMode(l) {
|
|
491
|
-
return i.getState().modes[l];
|
|
492
|
-
},
|
|
493
|
-
listModes() {
|
|
494
|
-
return Object.values(i.getState().modes);
|
|
495
|
-
},
|
|
496
|
-
getActiveModeId() {
|
|
497
|
-
return i.getState().activeModeId;
|
|
498
|
-
},
|
|
499
|
-
// A deferred seed is the second half of one transition: the caller rotates the
|
|
500
|
-
// layout persistence scope between the two halves. Observers must not treat the
|
|
501
|
-
// gap as a settled context, so the transition is not over until the seed runs.
|
|
502
|
-
isTransitioning() {
|
|
503
|
-
return c || a !== void 0;
|
|
504
|
-
},
|
|
505
|
-
setActiveMode(l, f = {}) {
|
|
506
|
-
if (l === i.getState().activeModeId) {
|
|
507
|
-
const v = l ? i.getState().modes[l] : void 0;
|
|
508
|
-
v && l !== a && b(v);
|
|
509
|
-
return;
|
|
510
|
-
}
|
|
511
|
-
c = !0, a = f.deferSeed ? l : void 0;
|
|
512
|
-
try {
|
|
513
|
-
Q(l);
|
|
514
|
-
} finally {
|
|
515
|
-
c = !1;
|
|
516
|
-
}
|
|
517
|
-
},
|
|
518
|
-
seedActiveMode() {
|
|
519
|
-
const l = i.getState().activeModeId, f = l ? i.getState().modes[l] : void 0;
|
|
520
|
-
c = !0;
|
|
521
|
-
try {
|
|
522
|
-
f && b(f);
|
|
523
|
-
} finally {
|
|
524
|
-
a = void 0, c = !1;
|
|
525
|
-
}
|
|
526
|
-
},
|
|
527
|
-
onDidChangeActive(l) {
|
|
528
|
-
const f = i.subscribeSelector((v) => v.activeModeId, () => l());
|
|
529
|
-
return m(f);
|
|
530
|
-
}
|
|
531
|
-
};
|
|
532
|
-
}, ue = (e) => Array.isArray(e) ? e : e.trim().split(/\s+/).filter(Boolean), fe = (e) => {
|
|
533
|
-
const i = ue(e);
|
|
534
|
-
return i.length === 1 ? i[0] ?? "" : i;
|
|
535
|
-
}, tt = (e) => {
|
|
536
|
-
const i = W({
|
|
537
|
-
name: "workbench.keybindings",
|
|
538
|
-
initialState: {
|
|
539
|
-
keybindings: []
|
|
540
|
-
}
|
|
541
|
-
});
|
|
542
|
-
return {
|
|
543
|
-
store: i,
|
|
544
|
-
registerKeybinding(t, r) {
|
|
545
|
-
if (!e.commands.getCommand(t.commandId)) throw new Error(`Keybinding command not registered: ${t.commandId}`);
|
|
546
|
-
const s = {
|
|
547
|
-
...N(r),
|
|
548
|
-
...t,
|
|
549
|
-
keybinding: fe(t.keybinding)
|
|
550
|
-
}, n = i.getState();
|
|
551
|
-
return i.setState({
|
|
552
|
-
keybindings: [...n.keybindings, s]
|
|
553
|
-
}, !1, "registerKeybinding"), m(() => {
|
|
554
|
-
const o = i.getState(), a = o.keybindings.filter((c) => c !== s);
|
|
555
|
-
a.length !== o.keybindings.length && i.setState({
|
|
556
|
-
keybindings: a
|
|
557
|
-
}, !1, "unregisterKeybinding");
|
|
558
|
-
});
|
|
559
|
-
},
|
|
560
|
-
listKeybindings() {
|
|
561
|
-
return [...i.getState().keybindings].sort(O);
|
|
562
|
-
},
|
|
563
|
-
listActiveKeybindings() {
|
|
564
|
-
return i.getState().keybindings.filter((t) => e.context.matches(t.when)).sort(O);
|
|
565
|
-
}
|
|
566
|
-
};
|
|
567
|
-
}, it = (e, i) => K(e.regions[ee(i)])?.resource, nt = ({
|
|
568
|
-
layout: e,
|
|
569
|
-
primary: i,
|
|
570
|
-
isInScope: t
|
|
571
|
-
}) => {
|
|
572
|
-
const r = [];
|
|
573
|
-
for (const s of te()) {
|
|
574
|
-
const n = ie(s);
|
|
575
|
-
if (n.role !== "anchor" || n.persistence === "primary") continue;
|
|
576
|
-
const o = K(e.regions[s]);
|
|
577
|
-
if (o?.resource) {
|
|
578
|
-
if (o.role === "sub-panel" && o.ownerResourceUri) {
|
|
579
|
-
r.push({
|
|
580
|
-
region: s,
|
|
581
|
-
action: "keep"
|
|
582
|
-
});
|
|
583
|
-
continue;
|
|
584
|
-
}
|
|
585
|
-
if (n.persistence === "derived") {
|
|
586
|
-
r.push({
|
|
587
|
-
region: s,
|
|
588
|
-
action: "clear"
|
|
589
|
-
});
|
|
590
|
-
continue;
|
|
591
|
-
}
|
|
592
|
-
r.push({
|
|
593
|
-
region: s,
|
|
594
|
-
action: t(o.resource, i) ? "keep" : "clear"
|
|
595
|
-
});
|
|
596
|
-
}
|
|
597
|
-
}
|
|
598
|
-
return r;
|
|
599
|
-
}, M = (e, i) => {
|
|
600
|
-
const {
|
|
601
|
-
[i]: t,
|
|
602
|
-
...r
|
|
603
|
-
} = e;
|
|
604
|
-
return r;
|
|
605
|
-
}, ve = () => {
|
|
606
|
-
if (typeof document > "u")
|
|
607
|
-
throw new Error("workbench.renderers.registerRenderer({ keepAlive: true }): no DOM available. The default host factory uses document.createElement. In a non-browser environment (Bun tests, SSR), pass a custom factory via createWorkbenchCore({ renderers: { createHost: () => myHost } }).");
|
|
608
|
-
const e = document.createElement("div");
|
|
609
|
-
return e.style.display = "contents", e.dataset.workbenchKeepAliveHost = "", e;
|
|
610
|
-
}, ot = (e = {}) => {
|
|
611
|
-
const i = e.createHost ?? ve, t = W({
|
|
612
|
-
name: "workbench.renderers",
|
|
613
|
-
initialState: {
|
|
614
|
-
renderers: {},
|
|
615
|
-
hosts: {},
|
|
616
|
-
claims: {}
|
|
617
|
-
}
|
|
618
|
-
}), r = (n) => {
|
|
619
|
-
const o = t.getState(), a = o.hosts[n], c = a?.attachedTo;
|
|
620
|
-
!a || !c || (c.contains(a.host) && c.removeChild(a.host), t.setState({
|
|
621
|
-
...o,
|
|
622
|
-
hosts: {
|
|
623
|
-
...o.hosts,
|
|
624
|
-
[n]: {
|
|
625
|
-
...a,
|
|
626
|
-
attachedTo: void 0
|
|
627
|
-
}
|
|
628
|
-
},
|
|
629
|
-
claims: M(o.claims, n)
|
|
630
|
-
}, !1, "renderers.detach"));
|
|
631
|
-
}, s = {
|
|
632
|
-
store: t,
|
|
633
|
-
registerRenderer(n) {
|
|
634
|
-
const o = t.getState();
|
|
635
|
-
if (o.renderers[n.id]) throw new Error(`Renderer already registered: ${n.id}`);
|
|
636
|
-
const a = n.keepAlive ? i() : void 0, c = a ? {
|
|
637
|
-
...o.hosts,
|
|
638
|
-
[n.id]: {
|
|
639
|
-
rendererId: n.id,
|
|
640
|
-
host: a
|
|
641
|
-
}
|
|
642
|
-
} : o.hosts;
|
|
643
|
-
return t.setState({
|
|
644
|
-
...o,
|
|
645
|
-
renderers: {
|
|
646
|
-
...o.renderers,
|
|
647
|
-
[n.id]: n
|
|
648
|
-
},
|
|
649
|
-
hosts: c
|
|
650
|
-
}, !1, "registerRenderer"), m(() => {
|
|
651
|
-
if (t.getState().renderers[n.id] !== n) return;
|
|
652
|
-
n.keepAlive && r(n.id);
|
|
653
|
-
const g = t.getState();
|
|
654
|
-
t.setState({
|
|
655
|
-
...g,
|
|
656
|
-
renderers: M(g.renderers, n.id),
|
|
657
|
-
hosts: M(g.hosts, n.id),
|
|
658
|
-
claims: M(g.claims, n.id)
|
|
659
|
-
}, !1, "unregisterRenderer");
|
|
660
|
-
});
|
|
661
|
-
},
|
|
662
|
-
getRenderer(n) {
|
|
663
|
-
return t.getState().renderers[n];
|
|
664
|
-
},
|
|
665
|
-
listRenderers() {
|
|
666
|
-
return Object.values(t.getState().renderers);
|
|
667
|
-
},
|
|
668
|
-
onDidChange(n) {
|
|
669
|
-
const o = t.subscribeSelector((a) => a.renderers, () => n());
|
|
670
|
-
return m(o);
|
|
671
|
-
},
|
|
672
|
-
claim(n, o, a) {
|
|
673
|
-
const c = t.getState(), d = c.renderers[n];
|
|
674
|
-
if (!d) throw new Error(`Renderer is not registered: ${n}`);
|
|
675
|
-
if (!d.keepAlive) throw new Error(`Renderer ${n} is not keep-alive; cannot claim`);
|
|
676
|
-
const g = c.hosts[n];
|
|
677
|
-
if (!g) throw new Error(`Renderer ${n} has no host`);
|
|
678
|
-
if (g.attachedTo === o)
|
|
679
|
-
t.setState({
|
|
680
|
-
...c,
|
|
681
|
-
claims: {
|
|
682
|
-
...c.claims,
|
|
683
|
-
[n]: a
|
|
684
|
-
}
|
|
685
|
-
}, !1, "renderers.updateClaim");
|
|
686
|
-
else {
|
|
687
|
-
r(n);
|
|
688
|
-
const u = t.getState(), b = u.hosts[n];
|
|
689
|
-
o.appendChild(b.host), t.setState({
|
|
690
|
-
...u,
|
|
691
|
-
hosts: {
|
|
692
|
-
...u.hosts,
|
|
693
|
-
[n]: {
|
|
694
|
-
...b,
|
|
695
|
-
attachedTo: o
|
|
696
|
-
}
|
|
697
|
-
},
|
|
698
|
-
claims: {
|
|
699
|
-
...u.claims,
|
|
700
|
-
[n]: a
|
|
701
|
-
}
|
|
702
|
-
}, !1, "renderers.attach");
|
|
703
|
-
}
|
|
704
|
-
return m(() => {
|
|
705
|
-
const b = t.getState().hosts[n];
|
|
706
|
-
!b || b.attachedTo !== o || r(n);
|
|
707
|
-
});
|
|
708
|
-
},
|
|
709
|
-
getHost(n) {
|
|
710
|
-
return t.getState().hosts[n]?.host;
|
|
711
|
-
},
|
|
712
|
-
getClaim(n) {
|
|
713
|
-
return t.getState().claims[n];
|
|
714
|
-
}
|
|
715
|
-
};
|
|
716
|
-
for (const n of e.initialRenderers ?? []) s.registerRenderer(n);
|
|
717
|
-
return s;
|
|
718
|
-
}, rt = {
|
|
719
|
-
project: "folder-root",
|
|
720
|
-
workspace: "computer",
|
|
721
|
-
worktree: "git-pull-request-draft",
|
|
722
|
-
settings: "settings",
|
|
723
|
-
kanbanRenderer: "table-properties"
|
|
724
|
-
}, be = "resource_hierarchy_cycle", q = (e) => [...e].sort((i, t) => t.priority - i.priority || i.id.localeCompare(t.id)), he = (e, i, t) => {
|
|
725
|
-
const r = q(e), s = [i], n = /* @__PURE__ */ new Set([i.uri]);
|
|
726
|
-
let o = i;
|
|
727
|
-
for (; ; ) {
|
|
728
|
-
const c = r.find((d) => d.canResolve(o))?.getParent(o);
|
|
729
|
-
if (!c) break;
|
|
730
|
-
if (n.has(c.uri)) {
|
|
731
|
-
t({
|
|
732
|
-
code: be,
|
|
733
|
-
path: [...s],
|
|
734
|
-
repeatedUri: c.uri
|
|
735
|
-
});
|
|
736
|
-
break;
|
|
737
|
-
}
|
|
738
|
-
s.unshift(c), n.add(c.uri), o = c;
|
|
739
|
-
}
|
|
740
|
-
return s;
|
|
741
|
-
}, me = "workbench.resource.kind", Se = "workbench.resource.id", we = (e) => `workbench.resource.metadata.${e}`, z = "workbench.selectionResourceUri", Ie = (e) => typeof e == "string" || typeof e == "number" || typeof e == "boolean", st = (e) => {
|
|
742
|
-
if (!e) return {};
|
|
743
|
-
const i = {
|
|
744
|
-
[me]: e.kind,
|
|
745
|
-
[Se]: e.id ?? e.uri
|
|
746
|
-
};
|
|
747
|
-
for (const [t, r] of Object.entries(e.metadata ?? {}))
|
|
748
|
-
Ie(r) && (i[we(t)] = r);
|
|
749
|
-
return i;
|
|
750
|
-
}, ct = (e) => ({
|
|
751
|
-
[z]: e.uri
|
|
752
|
-
}), at = (e) => {
|
|
753
|
-
if (!e) return [];
|
|
754
|
-
const i = e.metadata?.[z];
|
|
755
|
-
return typeof i != "string" || i === e.uri ? [e.uri] : [e.uri, i];
|
|
756
|
-
}, T = (e) => [...e].sort((i, t) => t.priority - i.priority || i.id.localeCompare(t.id)), ye = (e) => (typeof e == "object" || typeof e == "function") && e !== null && "then" in e && typeof e.then == "function", dt = (e = {}) => {
|
|
757
|
-
const i = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set(), r = e.establishLocation;
|
|
758
|
-
let s = 0;
|
|
759
|
-
const n = W({
|
|
760
|
-
name: "workbench.resources",
|
|
761
|
-
initialState: {
|
|
762
|
-
kinds: {},
|
|
763
|
-
presenters: {},
|
|
764
|
-
providers: {},
|
|
765
|
-
hierarchyProviders: {}
|
|
766
|
-
}
|
|
767
|
-
});
|
|
768
|
-
return {
|
|
769
|
-
store: n,
|
|
770
|
-
registerKind(o, a) {
|
|
771
|
-
const c = n.getState();
|
|
772
|
-
if (c.kinds[o.kind]) throw new Error(`Resource kind already registered: ${o.kind}`);
|
|
773
|
-
const d = {
|
|
774
|
-
...N(a),
|
|
775
|
-
...o
|
|
776
|
-
};
|
|
777
|
-
return n.setState({
|
|
778
|
-
...c,
|
|
779
|
-
kinds: {
|
|
780
|
-
...c.kinds,
|
|
781
|
-
[o.kind]: d
|
|
782
|
-
}
|
|
783
|
-
}, !1, "registerKind"), m(() => {
|
|
784
|
-
const g = n.getState();
|
|
785
|
-
if (g.kinds[o.kind] !== d) return;
|
|
786
|
-
const {
|
|
787
|
-
[o.kind]: u,
|
|
788
|
-
...b
|
|
789
|
-
} = g.kinds;
|
|
790
|
-
n.setState({
|
|
791
|
-
...g,
|
|
792
|
-
kinds: b
|
|
793
|
-
}, !1, "unregisterKind");
|
|
794
|
-
});
|
|
795
|
-
},
|
|
796
|
-
getKind(o) {
|
|
797
|
-
return n.getState().kinds[o];
|
|
798
|
-
},
|
|
799
|
-
getSurface(o) {
|
|
800
|
-
return n.getState().kinds[o.kind]?.surface;
|
|
801
|
-
},
|
|
802
|
-
listKinds() {
|
|
803
|
-
return Object.values(n.getState().kinds).sort(O);
|
|
804
|
-
},
|
|
805
|
-
registerPresenter(o) {
|
|
806
|
-
const a = n.getState();
|
|
807
|
-
if (a.presenters[o.id]) throw new Error(`Resource presenter already registered: ${o.id}`);
|
|
808
|
-
const c = {
|
|
809
|
-
...o,
|
|
810
|
-
priority: o.priority ?? 0
|
|
811
|
-
};
|
|
812
|
-
return n.setState({
|
|
813
|
-
...a,
|
|
814
|
-
presenters: {
|
|
815
|
-
...a.presenters,
|
|
816
|
-
[o.id]: c
|
|
817
|
-
}
|
|
818
|
-
}, !1, "registerPresenter"), m(() => {
|
|
819
|
-
const d = n.getState();
|
|
820
|
-
if (d.presenters[o.id] !== c) return;
|
|
821
|
-
const {
|
|
822
|
-
[o.id]: g,
|
|
823
|
-
...u
|
|
824
|
-
} = d.presenters;
|
|
825
|
-
n.setState({
|
|
826
|
-
...d,
|
|
827
|
-
presenters: u
|
|
828
|
-
}, !1, "unregisterPresenter");
|
|
829
|
-
});
|
|
830
|
-
},
|
|
831
|
-
listPresenters() {
|
|
832
|
-
return T(Object.values(n.getState().presenters));
|
|
833
|
-
},
|
|
834
|
-
registerProvider(o) {
|
|
835
|
-
const a = n.getState();
|
|
836
|
-
if (a.providers[o.id]) throw new Error(`Resource provider already registered: ${o.id}`);
|
|
837
|
-
return n.setState({
|
|
838
|
-
...a,
|
|
839
|
-
providers: {
|
|
840
|
-
...a.providers,
|
|
841
|
-
[o.id]: o
|
|
842
|
-
}
|
|
843
|
-
}, !1, "registerProvider"), m(() => {
|
|
844
|
-
const c = n.getState();
|
|
845
|
-
if (c.providers[o.id] !== o) return;
|
|
846
|
-
const {
|
|
847
|
-
[o.id]: d,
|
|
848
|
-
...g
|
|
849
|
-
} = c.providers;
|
|
850
|
-
n.setState({
|
|
851
|
-
...c,
|
|
852
|
-
providers: g
|
|
853
|
-
}, !1, "unregisterProvider");
|
|
854
|
-
});
|
|
855
|
-
},
|
|
856
|
-
listProviders() {
|
|
857
|
-
return Object.values(n.getState().providers);
|
|
858
|
-
},
|
|
859
|
-
listResources(o) {
|
|
860
|
-
const a = {
|
|
861
|
-
primary: e.getPrimary?.()
|
|
862
|
-
}, c = [];
|
|
863
|
-
for (const d of Object.values(n.getState().providers))
|
|
864
|
-
c.push(...d.list(o, a));
|
|
865
|
-
return c;
|
|
866
|
-
},
|
|
867
|
-
registerHierarchyProvider(o) {
|
|
868
|
-
const a = n.getState();
|
|
869
|
-
if (a.hierarchyProviders[o.id])
|
|
870
|
-
throw new Error(`Resource hierarchy provider already registered: ${o.id}`);
|
|
871
|
-
const c = {
|
|
872
|
-
...o,
|
|
873
|
-
priority: o.priority ?? 0
|
|
874
|
-
};
|
|
875
|
-
return n.setState({
|
|
876
|
-
...a,
|
|
877
|
-
hierarchyProviders: {
|
|
878
|
-
...a.hierarchyProviders,
|
|
879
|
-
[o.id]: c
|
|
880
|
-
}
|
|
881
|
-
}, !1, "registerHierarchyProvider"), m(() => {
|
|
882
|
-
const d = n.getState();
|
|
883
|
-
if (d.hierarchyProviders[o.id] !== c) return;
|
|
884
|
-
const {
|
|
885
|
-
[o.id]: g,
|
|
886
|
-
...u
|
|
887
|
-
} = d.hierarchyProviders;
|
|
888
|
-
n.setState({
|
|
889
|
-
...d,
|
|
890
|
-
hierarchyProviders: u
|
|
891
|
-
}, !1, "unregisterHierarchyProvider");
|
|
892
|
-
});
|
|
893
|
-
},
|
|
894
|
-
listHierarchyProviders() {
|
|
895
|
-
return q(Object.values(n.getState().hierarchyProviders));
|
|
896
|
-
},
|
|
897
|
-
walkHierarchy(o) {
|
|
898
|
-
return o ? he(Object.values(n.getState().hierarchyProviders), o, (a) => {
|
|
899
|
-
for (const c of t) c(a);
|
|
900
|
-
}) : [];
|
|
901
|
-
},
|
|
902
|
-
onDidDetectHierarchyCycle(o) {
|
|
903
|
-
return t.add(o), m(() => {
|
|
904
|
-
t.delete(o);
|
|
905
|
-
});
|
|
906
|
-
},
|
|
907
|
-
isOpeningResource() {
|
|
908
|
-
return s > 0;
|
|
909
|
-
},
|
|
910
|
-
async openResource(o, a = {}) {
|
|
911
|
-
const c = n.getState();
|
|
912
|
-
if (!c.kinds[o.kind]) throw new Error(`Unknown resource kind: ${o.kind}`);
|
|
913
|
-
const d = T(Object.values(c.presenters)).find((u) => u.canOpen(o));
|
|
914
|
-
if (!d) throw new Error(`No presenter registered for resource kind: ${o.kind}`);
|
|
915
|
-
s += 1;
|
|
916
|
-
let g;
|
|
917
|
-
try {
|
|
918
|
-
const u = d.open(o, a);
|
|
919
|
-
g = ye(u) ? await u : u, g = r?.(g) ?? g, d.afterOpen?.(o, g, a);
|
|
920
|
-
} finally {
|
|
921
|
-
s -= 1;
|
|
922
|
-
}
|
|
923
|
-
for (const u of i) u(o);
|
|
924
|
-
return g;
|
|
925
|
-
},
|
|
926
|
-
onDidOpenResource(o) {
|
|
927
|
-
return i.add(o), m(() => {
|
|
928
|
-
i.delete(o);
|
|
929
|
-
});
|
|
930
|
-
}
|
|
931
|
-
};
|
|
932
|
-
}, pe = (e) => e.replace(/^['"]|['"]$/g, ""), ke = (e, i) => {
|
|
933
|
-
const t = i.trim();
|
|
934
|
-
if (t.length === 0) return !0;
|
|
935
|
-
const r = t.match(/^([A-Za-z0-9_.-]+)\s*(==|!=)\s*(.+)$/);
|
|
936
|
-
if (r) {
|
|
937
|
-
const [, s, n, o] = r, a = e[s ?? ""], c = pe(o ?? "");
|
|
938
|
-
return n === "==" ? String(a) === c : String(a) !== c;
|
|
939
|
-
}
|
|
940
|
-
return t.startsWith("!") ? !e[t.slice(1)] : !!e[t];
|
|
941
|
-
}, We = (e, i) => i ? i.split("||").some((t) => t.split("&&").every((r) => ke(e, r))) : !0, lt = () => {
|
|
942
|
-
const e = W({
|
|
943
|
-
name: "workbench.context",
|
|
944
|
-
initialState: {
|
|
945
|
-
values: {}
|
|
946
|
-
}
|
|
947
|
-
});
|
|
948
|
-
let i = {};
|
|
949
|
-
const t = /* @__PURE__ */ new Map(), r = () => {
|
|
950
|
-
const n = {
|
|
951
|
-
...i
|
|
952
|
-
};
|
|
953
|
-
for (const o of t.values()) Object.assign(n, o);
|
|
954
|
-
return n;
|
|
955
|
-
}, s = (n) => {
|
|
956
|
-
e.setState({
|
|
957
|
-
values: r()
|
|
958
|
-
}, !1, n);
|
|
959
|
-
};
|
|
960
|
-
return {
|
|
961
|
-
store: e,
|
|
962
|
-
set(n, o) {
|
|
963
|
-
i[n] !== o && (i = {
|
|
964
|
-
...i,
|
|
965
|
-
[n]: o
|
|
966
|
-
}, s("setContextKey"));
|
|
967
|
-
},
|
|
968
|
-
get(n) {
|
|
969
|
-
return e.getState().values[n];
|
|
970
|
-
},
|
|
971
|
-
delete(n) {
|
|
972
|
-
if (!(n in i)) return;
|
|
973
|
-
const {
|
|
974
|
-
[n]: o,
|
|
975
|
-
...a
|
|
976
|
-
} = i;
|
|
977
|
-
i = a, s("deleteContextKey");
|
|
978
|
-
},
|
|
979
|
-
createScope(n) {
|
|
980
|
-
t.set(n, t.get(n) ?? {});
|
|
981
|
-
let o = !1;
|
|
982
|
-
const a = () => {
|
|
983
|
-
if (o) throw new Error(`Context key scope disposed: ${n}`);
|
|
984
|
-
};
|
|
985
|
-
return {
|
|
986
|
-
ownerId: n,
|
|
987
|
-
set(c, d) {
|
|
988
|
-
a();
|
|
989
|
-
const g = t.get(n) ?? {};
|
|
990
|
-
g[c] !== d && (t.set(n, {
|
|
991
|
-
...g,
|
|
992
|
-
[c]: d
|
|
993
|
-
}), s("setScopedContextKey"));
|
|
994
|
-
},
|
|
995
|
-
get(c) {
|
|
996
|
-
return a(), t.get(n)?.[c];
|
|
997
|
-
},
|
|
998
|
-
delete(c) {
|
|
999
|
-
a();
|
|
1000
|
-
const d = t.get(n);
|
|
1001
|
-
if (!d || !(c in d)) return;
|
|
1002
|
-
const {
|
|
1003
|
-
[c]: g,
|
|
1004
|
-
...u
|
|
1005
|
-
} = d;
|
|
1006
|
-
t.set(n, u), s("deleteScopedContextKey");
|
|
1007
|
-
},
|
|
1008
|
-
dispose() {
|
|
1009
|
-
o || (o = !0, t.delete(n) && s("disposeContextKeyScope"));
|
|
1010
|
-
}
|
|
1011
|
-
};
|
|
1012
|
-
},
|
|
1013
|
-
deleteOwner(n) {
|
|
1014
|
-
t.delete(n) && s("deleteContextKeyOwner");
|
|
1015
|
-
},
|
|
1016
|
-
snapshot() {
|
|
1017
|
-
return {
|
|
1018
|
-
...e.getState().values
|
|
1019
|
-
};
|
|
1020
|
-
},
|
|
1021
|
-
matches(n) {
|
|
1022
|
-
return We(e.getState().values, n);
|
|
1023
|
-
}
|
|
1024
|
-
};
|
|
1025
|
-
}, Pe = "sidenav", Re = (e, i, t) => {
|
|
1026
|
-
e.panels.setOpen(i, t), e.layout.setRegionVisible(i, t);
|
|
1027
|
-
}, Me = (e, i) => {
|
|
1028
|
-
Re(e, i, !e.panels.isOpen(i));
|
|
1029
|
-
}, Le = [{
|
|
1030
|
-
id: "workbench.toggleCommandPalette",
|
|
1031
|
-
label: "Toggle Command Palette",
|
|
1032
|
-
icon: "Command",
|
|
1033
|
-
keybinding: "Mod+K",
|
|
1034
|
-
execute: (e) => e.commandPalette.toggle()
|
|
1035
|
-
}, {
|
|
1036
|
-
id: "workbench.action.showCommands",
|
|
1037
|
-
label: "Run Command",
|
|
1038
|
-
icon: "Terminal",
|
|
1039
|
-
keybinding: "Alt+Shift+K",
|
|
1040
|
-
execute: (e) => e.commandPalette.open({
|
|
1041
|
-
initialQuery: "> "
|
|
1042
|
-
})
|
|
1043
|
-
}, {
|
|
1044
|
-
id: "workbench.action.changeTheme",
|
|
1045
|
-
label: "Change Theme",
|
|
1046
|
-
icon: "Palette",
|
|
1047
|
-
keybinding: "Alt+Shift+T",
|
|
1048
|
-
execute: (e) => e.commandPalette.open({
|
|
1049
|
-
view: "theme"
|
|
1050
|
-
})
|
|
1051
|
-
}, {
|
|
1052
|
-
id: "workbench.action.navigateBack",
|
|
1053
|
-
label: "Navigate Back",
|
|
1054
|
-
icon: "ArrowLeft",
|
|
1055
|
-
keybinding: "Alt+Shift+ArrowLeft",
|
|
1056
|
-
execute: (e) => {
|
|
1057
|
-
e.history.goBack();
|
|
1058
|
-
}
|
|
1059
|
-
}, {
|
|
1060
|
-
id: "workbench.action.navigateForward",
|
|
1061
|
-
label: "Navigate Forward",
|
|
1062
|
-
icon: "ArrowRight",
|
|
1063
|
-
keybinding: "Alt+Shift+ArrowRight",
|
|
1064
|
-
execute: (e) => {
|
|
1065
|
-
e.history.goForward();
|
|
1066
|
-
}
|
|
1067
|
-
}, {
|
|
1068
|
-
id: "workbench.toggleSideBar",
|
|
1069
|
-
label: "Toggle Sidenav",
|
|
1070
|
-
icon: "PanelLeft",
|
|
1071
|
-
keybinding: "Mod+B",
|
|
1072
|
-
execute: (e) => Me(e, Pe)
|
|
1073
|
-
}], j = "workbench.action.switchMode", gt = (e) => {
|
|
1074
|
-
if (e.kind !== "command" || e.commandId !== j || !e.args || typeof e.args != "object") return;
|
|
1075
|
-
const i = "modeId" in e.args ? e.args.modeId : void 0;
|
|
1076
|
-
return typeof i == "string" && i.trim().length > 0 ? i : void 0;
|
|
1077
|
-
}, ut = (e) => {
|
|
1078
|
-
for (const i of Le)
|
|
1079
|
-
e.commands.registerCommand({
|
|
1080
|
-
id: i.id,
|
|
1081
|
-
label: i.label,
|
|
1082
|
-
category: "Workbench",
|
|
1083
|
-
icon: i.icon,
|
|
1084
|
-
when: "!inputFocus"
|
|
1085
|
-
}, {
|
|
1086
|
-
execute: () => i.execute(e)
|
|
1087
|
-
}), e.keybindings.registerKeybinding({
|
|
1088
|
-
commandId: i.id,
|
|
1089
|
-
keybinding: i.keybinding,
|
|
1090
|
-
when: "!inputFocus"
|
|
1091
|
-
}), e.layout.registerMenuItem($, {
|
|
1092
|
-
commandId: i.id,
|
|
1093
|
-
group: "Workbench"
|
|
1094
|
-
});
|
|
1095
|
-
e.commands.registerCommand({
|
|
1096
|
-
id: j,
|
|
1097
|
-
label: "Switch Mode",
|
|
1098
|
-
category: "Workbench",
|
|
1099
|
-
icon: "PanelTop",
|
|
1100
|
-
when: "!inputFocus"
|
|
1101
|
-
}, {
|
|
1102
|
-
execute: async (i) => {
|
|
1103
|
-
if (!i?.modeId) {
|
|
1104
|
-
e.commandPalette.open({
|
|
1105
|
-
view: "mode"
|
|
1106
|
-
});
|
|
1107
|
-
return;
|
|
1108
|
-
}
|
|
1109
|
-
const t = await e.navigator.open({
|
|
1110
|
-
modeId: i.modeId
|
|
1111
|
-
});
|
|
1112
|
-
!t.ok && t.code === "navigation_mode_missing" && e.notifications.show({
|
|
1113
|
-
level: "error",
|
|
1114
|
-
title: "Mode unavailable",
|
|
1115
|
-
message: t.message
|
|
1116
|
-
});
|
|
1117
|
-
}
|
|
1118
|
-
}), e.layout.registerMenuItem($, {
|
|
1119
|
-
commandId: j,
|
|
1120
|
-
group: "Workbench"
|
|
1121
|
-
});
|
|
1122
|
-
};
|
|
1123
|
-
export {
|
|
1124
|
-
ot as A,
|
|
1125
|
-
dt as B,
|
|
1126
|
-
tt as C,
|
|
1127
|
-
et as D,
|
|
1128
|
-
ut as E,
|
|
1129
|
-
st as F,
|
|
1130
|
-
ct as G,
|
|
1131
|
-
ue as H,
|
|
1132
|
-
gt as I,
|
|
1133
|
-
Ze as J,
|
|
1134
|
-
at as K,
|
|
1135
|
-
We as L,
|
|
1136
|
-
be as M,
|
|
1137
|
-
rt as N,
|
|
1138
|
-
Se as O,
|
|
1139
|
-
me as P,
|
|
1140
|
-
we as Q,
|
|
1141
|
-
z as R,
|
|
1142
|
-
j as S,
|
|
1143
|
-
Ve as T,
|
|
1144
|
-
Ne as U,
|
|
1145
|
-
V,
|
|
1146
|
-
Qe as W,
|
|
1147
|
-
ze as X,
|
|
1148
|
-
He as a,
|
|
1149
|
-
O as b,
|
|
1150
|
-
W as c,
|
|
1151
|
-
F as d,
|
|
1152
|
-
$e as e,
|
|
1153
|
-
Ke as f,
|
|
1154
|
-
K as g,
|
|
1155
|
-
k as h,
|
|
1156
|
-
je as i,
|
|
1157
|
-
Ee as j,
|
|
1158
|
-
De as k,
|
|
1159
|
-
se as l,
|
|
1160
|
-
Te as m,
|
|
1161
|
-
N as n,
|
|
1162
|
-
Ge as o,
|
|
1163
|
-
Xe as p,
|
|
1164
|
-
Fe as q,
|
|
1165
|
-
Be as r,
|
|
1166
|
-
E as s,
|
|
1167
|
-
Je as t,
|
|
1168
|
-
_e as u,
|
|
1169
|
-
Ye as v,
|
|
1170
|
-
qe as w,
|
|
1171
|
-
it as x,
|
|
1172
|
-
nt as y,
|
|
1173
|
-
lt as z
|
|
1174
|
-
};
|
|
1175
|
-
//# sourceMappingURL=workbench-built-ins-BncLJfQA.js.map
|