@pstdio/workbench 0.2.0 → 0.3.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 +100 -88
- package/dist/context-key-service-W4QEfVdN.js +1031 -0
- package/dist/context-key-service-W4QEfVdN.js.map +1 -0
- package/dist/extensions.d.ts +737 -255
- package/dist/extensions.js +891 -699
- package/dist/extensions.js.map +1 -1
- package/dist/file-renderer-view-DrrhYnb_.js.map +1 -1
- package/dist/index.d.ts +746 -448
- package/dist/index.js +2974 -60
- package/dist/index.js.map +1 -1
- package/dist/layout-types-DMoZz38-.js +100 -0
- package/dist/layout-types-DMoZz38-.js.map +1 -0
- package/dist/react.d.ts +735 -231
- package/dist/react.js +3562 -2584
- package/dist/react.js.map +1 -1
- package/dist/storage.d.ts +109 -14
- package/dist/storage.js +142 -47
- package/dist/storage.js.map +1 -1
- package/dist/surface-map-C1pOTUmF.js +52 -0
- package/dist/surface-map-C1pOTUmF.js.map +1 -0
- package/dist/testing.d.ts +685 -198
- package/dist/testing.js +46 -34
- package/dist/testing.js.map +1 -1
- package/dist/webview-runtime.js +5 -1
- 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/package.json +6 -7
- package/dist/context-key-service-C--cHa0B.js +0 -447
- package/dist/context-key-service-C--cHa0B.js.map +0 -1
- package/dist/core.d.ts +0 -1885
- package/dist/core.js +0 -64
- package/dist/core.js.map +0 -1
- package/dist/surface-reconcile-DkRf01ro.js +0 -260
- package/dist/surface-reconcile-DkRf01ro.js.map +0 -1
- package/dist/workbench-core-DFpwi8Lo.js +0 -2264
- package/dist/workbench-core-DFpwi8Lo.js.map +0 -1
- package/dist/workbench-menu-paths-CQVH6z4_.js +0 -11
- package/dist/workbench-menu-paths-CQVH6z4_.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,64 +1,2978 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { c as L, a as P, g as B, m as Ie, f as $, b as O, n as D, d as j, r as ye, e as A, h as Ce, i as U, j as be, k as ee, l as We, o as ke, p as Q, t as F, q as te, s as re, u as ne, v as Le, w as Ee, x as Te, y as xe, z as Me, A as De, B as Be, C as Oe } from "./context-key-service-W4QEfVdN.js";
|
|
2
|
+
import { D as vr, E as pr, F as Rr, G as wr, H as Pr, I as Ir, J as Cr, K as Wr, L as kr, M as Lr, N as Er, O as Tr } from "./context-key-service-W4QEfVdN.js";
|
|
3
|
+
import { w as K, m as Se, c as Ae, a as se } from "./layout-types-DMoZz38-.js";
|
|
4
|
+
import { r as $e } from "./surface-map-C1pOTUmF.js";
|
|
5
|
+
import { w as oe } from "./workbench-menu-paths-B_QJzcNU.js";
|
|
6
|
+
import { h as Mr, a as Dr, r as Br, b as Or, c as Ar, d as $r, e as Fr } from "./workbench-menu-paths-B_QJzcNU.js";
|
|
7
|
+
const hr = (e, t) => {
|
|
8
|
+
const s = e.walkHierarchy(t);
|
|
9
|
+
return s.map((n, i) => ({
|
|
10
|
+
title: n.label ?? n.id ?? e.getKind(n.kind)?.label ?? n.kind,
|
|
11
|
+
icon: n.icon ?? e.getKind(n.kind)?.icon,
|
|
12
|
+
resource: n,
|
|
13
|
+
...i < s.length - 1 ? {
|
|
14
|
+
onClick: () => {
|
|
15
|
+
e.openResource(n, {
|
|
16
|
+
replaceActive: !0
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
} : {}
|
|
20
|
+
}));
|
|
21
|
+
}, Fe = () => {
|
|
22
|
+
const e = L({
|
|
23
|
+
name: "workbench.breadcrumbs",
|
|
24
|
+
initialState: {
|
|
25
|
+
items: void 0
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
return {
|
|
29
|
+
store: e,
|
|
30
|
+
setItems(t) {
|
|
31
|
+
return e.setState({
|
|
32
|
+
items: t
|
|
33
|
+
}, !1, "setBreadcrumbItems"), P(() => {
|
|
34
|
+
e.getState().items === t && e.setState({
|
|
35
|
+
items: void 0
|
|
36
|
+
}, !1, "clearBreadcrumbItems");
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
clearItems() {
|
|
40
|
+
e.getState().items !== void 0 && e.setState({
|
|
41
|
+
items: void 0
|
|
42
|
+
}, !1, "clearBreadcrumbItems");
|
|
43
|
+
},
|
|
44
|
+
getItems() {
|
|
45
|
+
return e.getState().items;
|
|
46
|
+
},
|
|
47
|
+
onDidChange(t) {
|
|
48
|
+
const s = e.subscribeSelector((n) => n.items, () => t());
|
|
49
|
+
return P(s);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
}, Ne = (e = {}) => {
|
|
53
|
+
const t = L({
|
|
54
|
+
name: "workbench.commandPalette",
|
|
55
|
+
initialState: {
|
|
56
|
+
open: e.initialOpen ?? !1,
|
|
57
|
+
view: "main",
|
|
58
|
+
initialQuery: "",
|
|
59
|
+
paramsRequest: null
|
|
60
|
+
}
|
|
61
|
+
}), s = (n) => {
|
|
62
|
+
const i = t.getState();
|
|
63
|
+
i.open === n.open && i.view === n.view && i.initialQuery === n.initialQuery || t.setState({
|
|
64
|
+
...i,
|
|
65
|
+
...n
|
|
66
|
+
}, !1, "setCommandPaletteState");
|
|
67
|
+
};
|
|
68
|
+
return {
|
|
69
|
+
store: t,
|
|
70
|
+
isOpen() {
|
|
71
|
+
return t.getState().open;
|
|
72
|
+
},
|
|
73
|
+
getView() {
|
|
74
|
+
return t.getState().view;
|
|
75
|
+
},
|
|
76
|
+
getInitialQuery() {
|
|
77
|
+
return t.getState().initialQuery;
|
|
78
|
+
},
|
|
79
|
+
getParamsRequest() {
|
|
80
|
+
return t.getState().paramsRequest;
|
|
81
|
+
},
|
|
82
|
+
open(n = {}) {
|
|
83
|
+
s({
|
|
84
|
+
open: !0,
|
|
85
|
+
view: n.view ?? "main",
|
|
86
|
+
initialQuery: n.initialQuery ?? ""
|
|
87
|
+
});
|
|
88
|
+
},
|
|
89
|
+
close() {
|
|
90
|
+
s({
|
|
91
|
+
open: !1,
|
|
92
|
+
view: "main",
|
|
93
|
+
initialQuery: ""
|
|
94
|
+
});
|
|
95
|
+
},
|
|
96
|
+
toggle() {
|
|
97
|
+
s({
|
|
98
|
+
open: !t.getState().open,
|
|
99
|
+
view: "main",
|
|
100
|
+
initialQuery: ""
|
|
101
|
+
});
|
|
102
|
+
},
|
|
103
|
+
requestParams(n) {
|
|
104
|
+
t.setState({
|
|
105
|
+
...t.getState(),
|
|
106
|
+
paramsRequest: n
|
|
107
|
+
}, !1, "requestCommandParams");
|
|
108
|
+
},
|
|
109
|
+
clearParams() {
|
|
110
|
+
t.getState().paramsRequest && t.setState({
|
|
111
|
+
...t.getState(),
|
|
112
|
+
paramsRequest: null
|
|
113
|
+
}, !1, "clearCommandParams");
|
|
114
|
+
},
|
|
115
|
+
onDidChange(n) {
|
|
116
|
+
const i = t.subscribeSelector((r) => r.open, (r) => n(r));
|
|
117
|
+
return P(i);
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
}, Ke = ["activity", "sidenav", "main", "secondary", "side", "status"], Ue = {
|
|
121
|
+
activity: "activityFocus",
|
|
122
|
+
sidenav: "sidenavFocus",
|
|
123
|
+
main: "mainFocus",
|
|
124
|
+
secondary: "secondaryFocus",
|
|
125
|
+
side: "sideFocus",
|
|
126
|
+
status: "statusFocus"
|
|
127
|
+
}, je = (e) => {
|
|
128
|
+
const t = L({
|
|
129
|
+
name: "workbench.focus",
|
|
130
|
+
initialState: {
|
|
131
|
+
activeRegion: void 0
|
|
132
|
+
}
|
|
133
|
+
}), s = e.context.createScope("workbench.focus"), n = (i) => {
|
|
134
|
+
s.set("workbenchFocus", i !== void 0), s.set("activeWorkbenchFocusRegion", i);
|
|
135
|
+
for (const r of Ke)
|
|
136
|
+
s.set(Ue[r], r === i);
|
|
137
|
+
};
|
|
138
|
+
return n(void 0), {
|
|
139
|
+
store: t,
|
|
140
|
+
setActiveRegion(i) {
|
|
141
|
+
e.isRegionFocusable?.(i) !== !1 && t.getState().activeRegion !== i && (t.setState({
|
|
142
|
+
activeRegion: i
|
|
143
|
+
}, !1, "setActiveWorkbenchFocusRegion"), n(i));
|
|
144
|
+
},
|
|
145
|
+
clearFocus() {
|
|
146
|
+
t.getState().activeRegion !== void 0 && (t.setState({
|
|
147
|
+
activeRegion: void 0
|
|
148
|
+
}, !1, "clearWorkbenchFocusRegion"), n(void 0));
|
|
149
|
+
},
|
|
150
|
+
getActiveRegion() {
|
|
151
|
+
return t.getState().activeRegion;
|
|
152
|
+
},
|
|
153
|
+
onDidChange(i) {
|
|
154
|
+
const r = t.subscribeSelector((o) => o.activeRegion, (o) => i(o));
|
|
155
|
+
return P(r);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
}, X = ["main", "secondary"], Y = (e, t) => t.role ?? e.getWidget(t.contributionId)?.role ?? "content", _e = (e, t) => {
|
|
159
|
+
if (t.instanceKey) {
|
|
160
|
+
const s = $(e.getLayout(), t.instanceKey)?.placement;
|
|
161
|
+
if (s) return s;
|
|
162
|
+
}
|
|
163
|
+
for (const s of K) {
|
|
164
|
+
const n = e.getLayout().regions[s].widgets.find((i) => i.contributionId === t.contributionId && i.resourceUri === t.resourceUri);
|
|
165
|
+
if (n) return n;
|
|
166
|
+
}
|
|
167
|
+
}, He = (e) => ({
|
|
168
|
+
contributionId: e.contributionId,
|
|
169
|
+
resourceUri: e.resourceUri,
|
|
170
|
+
instanceKey: e.widgetId
|
|
171
|
+
}), qe = (e, t) => e?.contributionId === t?.contributionId && e?.resourceUri === t?.resourceUri && e?.instanceKey === t?.instanceKey, Ve = (e, t) => {
|
|
172
|
+
const s = {}, n = B(e.getLayout());
|
|
173
|
+
for (const i of X) {
|
|
174
|
+
const r = e.getLayout().regions[i], o = r.widgets.find((u) => u.widgetId === r.activeWidgetId), c = o ? e.getWidget(o.contributionId) : void 0;
|
|
175
|
+
o && c && Y(e, o) === "sub-panel" && Ie(c, n?.resource, t, o) && (s[i] = He(o));
|
|
176
|
+
}
|
|
177
|
+
return s;
|
|
178
|
+
}, ze = (e) => B(e.getLayout()), Qe = (e, t) => ({
|
|
179
|
+
key: e.resourceUri ? `${t ?? "global"}:resource:${e.resourceUri}` : `${t ?? "global"}:widget:${e.contributionId}:${e.widgetId}`,
|
|
180
|
+
modeId: t,
|
|
181
|
+
resource: e.resource,
|
|
182
|
+
contributionId: e.contributionId,
|
|
183
|
+
instanceKey: e.widgetId,
|
|
184
|
+
title: e.title
|
|
185
|
+
}), Ye = (e) => {
|
|
186
|
+
const t = e.modes?.getActiveModeId(), s = ze(e.layout), n = Date.now(), i = {
|
|
187
|
+
entryId: `history-${n}-${e.counter}`,
|
|
188
|
+
recordedAt: n,
|
|
189
|
+
selectedSubPanels: Ve(e.layout, t)
|
|
190
|
+
};
|
|
191
|
+
if (s)
|
|
192
|
+
return {
|
|
193
|
+
...i,
|
|
194
|
+
location: Qe(s, t),
|
|
195
|
+
kind: s.resource ? "resource" : "widget",
|
|
196
|
+
modeId: t,
|
|
197
|
+
resource: s.resource,
|
|
198
|
+
widgetId: s.widgetId,
|
|
199
|
+
contributionId: s.contributionId,
|
|
200
|
+
title: s.title
|
|
201
|
+
};
|
|
202
|
+
if (t)
|
|
203
|
+
return {
|
|
204
|
+
...i,
|
|
205
|
+
location: {
|
|
206
|
+
key: `mode:${t}`,
|
|
207
|
+
modeId: t,
|
|
208
|
+
title: e.modes?.getMode(t)?.label ?? t
|
|
209
|
+
},
|
|
210
|
+
kind: "mode",
|
|
211
|
+
modeId: t,
|
|
212
|
+
title: e.modes?.getMode(t)?.label ?? t
|
|
213
|
+
};
|
|
214
|
+
}, q = (e, t) => !e || !t || e.location.key !== t.location.key ? !1 : X.every((s) => qe(e.selectedSubPanels[s], t.selectedSubPanels[s])), _ = (e) => {
|
|
215
|
+
const t = [];
|
|
216
|
+
for (const s of e) {
|
|
217
|
+
const n = t.length - 1;
|
|
218
|
+
q(t[n], s) ? t[n] = s : t.push(s);
|
|
219
|
+
}
|
|
220
|
+
return t;
|
|
221
|
+
}, Ge = (e, t) => {
|
|
222
|
+
const s = {
|
|
223
|
+
...e.selectedSubPanels
|
|
224
|
+
};
|
|
225
|
+
for (const n of K) {
|
|
226
|
+
const i = s[n];
|
|
227
|
+
(i?.instanceKey === t.widgetId || i?.contributionId === t.contributionId && i.resourceUri === t.resourceUri) && delete s[n];
|
|
228
|
+
}
|
|
229
|
+
return {
|
|
230
|
+
...e,
|
|
231
|
+
selectedSubPanels: s
|
|
232
|
+
};
|
|
233
|
+
}, Je = (e) => {
|
|
234
|
+
const {
|
|
235
|
+
closedSubPanel: t,
|
|
236
|
+
counter: s,
|
|
237
|
+
current: n,
|
|
238
|
+
modeId: i,
|
|
239
|
+
placement: r
|
|
240
|
+
} = e, o = Date.now();
|
|
241
|
+
return n ? {
|
|
242
|
+
...n,
|
|
243
|
+
entryId: `history-${o}-${s}`,
|
|
244
|
+
recordedAt: o,
|
|
245
|
+
closedSubPanel: t
|
|
246
|
+
} : {
|
|
247
|
+
entryId: `history-${o}-${s}`,
|
|
248
|
+
recordedAt: o,
|
|
249
|
+
location: {
|
|
250
|
+
key: r.resourceUri ? `${i ?? "global"}:resource:${r.resourceUri}` : `${i ?? "global"}:widget:${r.contributionId}:${r.widgetId}`,
|
|
251
|
+
modeId: i,
|
|
252
|
+
resource: r.resource,
|
|
253
|
+
contributionId: r.contributionId,
|
|
254
|
+
instanceKey: r.widgetId,
|
|
255
|
+
title: r.title
|
|
256
|
+
},
|
|
257
|
+
selectedSubPanels: {},
|
|
258
|
+
kind: r.resource ? "resource" : "widget",
|
|
259
|
+
modeId: i,
|
|
260
|
+
resource: r.resource,
|
|
261
|
+
widgetId: r.widgetId,
|
|
262
|
+
contributionId: r.contributionId,
|
|
263
|
+
title: r.title,
|
|
264
|
+
closedSubPanel: t
|
|
265
|
+
};
|
|
266
|
+
}, ve = 1, Z = () => ({
|
|
267
|
+
entries: [],
|
|
268
|
+
cursor: -1,
|
|
269
|
+
recentlyClosed: [],
|
|
270
|
+
hydrating: !1
|
|
271
|
+
}), Xe = (e) => {
|
|
272
|
+
if (e?.version !== ve) return Z();
|
|
273
|
+
const t = _(e.entries);
|
|
274
|
+
return {
|
|
275
|
+
entries: t,
|
|
276
|
+
cursor: Math.min(Math.max(e.cursor, t.length > 0 ? 0 : -1), t.length - 1),
|
|
277
|
+
recentlyClosed: e.recentlyClosed.slice(-20),
|
|
278
|
+
hydrating: !1
|
|
279
|
+
};
|
|
280
|
+
}, ie = (e) => {
|
|
281
|
+
const {
|
|
282
|
+
entry: t,
|
|
283
|
+
layout: s,
|
|
284
|
+
modes: n,
|
|
285
|
+
resources: i
|
|
286
|
+
} = e;
|
|
287
|
+
if (t.closedSubPanel && s.getWidget(t.closedSubPanel.reference.contributionId)?.role !== "sub-panel")
|
|
288
|
+
return;
|
|
289
|
+
const r = t.contributionId ? s.getWidget(t.contributionId) : void 0;
|
|
290
|
+
if (!(t.kind === "mode" ? !!(t.modeId && n?.getMode(t.modeId)) : !!(r && r.role !== "panel-menu" && r.role !== "sub-panel" || t.resource && i.listPresenters().some((u) => u.canOpen(t.resource))))) return;
|
|
291
|
+
const c = Object.fromEntries(Object.entries(t.selectedSubPanels).filter(([, u]) => (u ? s.getWidget(u.contributionId) : void 0)?.role === "sub-panel"));
|
|
292
|
+
return {
|
|
293
|
+
...t,
|
|
294
|
+
selectedSubPanels: c
|
|
295
|
+
};
|
|
296
|
+
}, Ze = (e) => {
|
|
297
|
+
const {
|
|
298
|
+
state: t
|
|
299
|
+
} = e, s = t.entries[t.cursor]?.entryId, n = _(t.entries.map((c) => ie({
|
|
300
|
+
...e,
|
|
301
|
+
entry: c
|
|
302
|
+
})).filter((c) => !!c)), i = s ? n.findIndex((c) => c.entryId === s) : -1, r = i >= 0 ? i : Math.min(t.cursor, n.length - 1), o = t.recentlyClosed.map((c) => ie({
|
|
303
|
+
...e,
|
|
304
|
+
entry: c
|
|
305
|
+
})).filter((c) => !!c);
|
|
306
|
+
return {
|
|
307
|
+
...t,
|
|
308
|
+
entries: n,
|
|
309
|
+
cursor: r,
|
|
310
|
+
recentlyClosed: o
|
|
311
|
+
};
|
|
312
|
+
}, et = 50, tt = 50, rt = (e) => {
|
|
313
|
+
let t;
|
|
314
|
+
const s = () => {
|
|
315
|
+
if (t && clearTimeout(t), t = void 0, !e.persistence) return;
|
|
316
|
+
const {
|
|
317
|
+
hydrating: n,
|
|
318
|
+
...i
|
|
319
|
+
} = e.store.getState();
|
|
320
|
+
e.persistence.setHistory({
|
|
321
|
+
...i,
|
|
322
|
+
version: ve
|
|
323
|
+
}, e.getScope());
|
|
324
|
+
};
|
|
325
|
+
return {
|
|
326
|
+
flush: s,
|
|
327
|
+
schedule() {
|
|
328
|
+
!e.persistence || t || (t = setTimeout(s, tt));
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
}, nt = (e, t, s, n) => n ? s ? t?.kind === "mode" ? !0 : e?.location.resource?.uri === t?.location.resource?.uri : t?.kind !== "mode" : !1, st = (e) => e.entries[e.cursor], ae = (e) => {
|
|
332
|
+
const t = /* @__PURE__ */ new Map();
|
|
333
|
+
for (const s of Object.values(e.getLayout().regions))
|
|
334
|
+
for (const n of s.widgets) t.set(n.widgetId, {
|
|
335
|
+
placement: n,
|
|
336
|
+
region: s.id
|
|
337
|
+
});
|
|
338
|
+
return t;
|
|
339
|
+
}, ot = (e) => {
|
|
340
|
+
const {
|
|
341
|
+
entry: t,
|
|
342
|
+
layout: s,
|
|
343
|
+
placement: n,
|
|
344
|
+
replayCurrentLocation: i,
|
|
345
|
+
replayResource: r,
|
|
346
|
+
resource: o,
|
|
347
|
+
resources: c,
|
|
348
|
+
restoreSelections: u
|
|
349
|
+
} = e, f = Object.values(c.store.getState().presenters).find((a) => a.canOpen(o)), m = B(s.getLayout())?.resourceUri;
|
|
350
|
+
if (f && (i || m !== o.uri))
|
|
351
|
+
return r(t, n === void 0);
|
|
352
|
+
n?.resourceUri === o.uri ? s.activateWidget(n.widgetId) : t.contributionId && s.getWidget(t.contributionId)?.role === "location" ? s.openWidget(t.contributionId, {
|
|
353
|
+
resource: o,
|
|
354
|
+
title: t.title,
|
|
355
|
+
replaceActive: !!n
|
|
356
|
+
}) : n ? s.activateWidget(n.widgetId) : t.contributionId && s.getWidget(t.contributionId) && s.openWidget(t.contributionId, {
|
|
357
|
+
title: t.title
|
|
358
|
+
}), u(t);
|
|
359
|
+
}, it = (e) => {
|
|
360
|
+
const {
|
|
361
|
+
activateEntry: t,
|
|
362
|
+
controllerInput: s,
|
|
363
|
+
finishRestore: n,
|
|
364
|
+
flush: i,
|
|
365
|
+
getPersistenceScope: r,
|
|
366
|
+
moveCursor: o,
|
|
367
|
+
runSilent: c,
|
|
368
|
+
setPersistenceScope: u,
|
|
369
|
+
setState: f,
|
|
370
|
+
store: m
|
|
371
|
+
} = e;
|
|
372
|
+
return {
|
|
373
|
+
store: m,
|
|
374
|
+
goBack: () => o(-1),
|
|
375
|
+
goForward: () => o(1),
|
|
376
|
+
goPrevious() {
|
|
377
|
+
const a = m.getState();
|
|
378
|
+
if (a.hydrating) return;
|
|
379
|
+
const d = a.entries[a.cursor];
|
|
380
|
+
for (let l = a.entries.length - 1; l >= 0; l -= 1) {
|
|
381
|
+
const b = a.entries[l];
|
|
382
|
+
if (!q(b, d))
|
|
383
|
+
return f({
|
|
384
|
+
...a,
|
|
385
|
+
cursor: l
|
|
386
|
+
}, "history.goPrevious"), c(() => t(b)), b;
|
|
387
|
+
}
|
|
388
|
+
},
|
|
389
|
+
recentlyClosed: () => m.getState().recentlyClosed,
|
|
390
|
+
reopenLastClosed() {
|
|
391
|
+
const a = m.getState();
|
|
392
|
+
if (a.hydrating) return;
|
|
393
|
+
const d = a.recentlyClosed.at(-1);
|
|
394
|
+
if (d)
|
|
395
|
+
return f({
|
|
396
|
+
...a,
|
|
397
|
+
recentlyClosed: a.recentlyClosed.slice(0, -1)
|
|
398
|
+
}, "history.reopenClosed"), c(() => {
|
|
399
|
+
const l = t(d), b = () => {
|
|
400
|
+
d.closedSubPanel && s.layout.openWidget(d.closedSubPanel.reference.contributionId, {
|
|
401
|
+
region: d.closedSubPanel.region,
|
|
402
|
+
resource: d.closedSubPanel.resource,
|
|
403
|
+
title: d.closedSubPanel.title,
|
|
404
|
+
closable: !0
|
|
405
|
+
});
|
|
406
|
+
};
|
|
407
|
+
l instanceof Promise ? l.then(b) : b();
|
|
408
|
+
}), d;
|
|
409
|
+
},
|
|
410
|
+
setPersistenceScope: u,
|
|
411
|
+
getPersistenceScope: r,
|
|
412
|
+
restore() {
|
|
413
|
+
const a = Ze({
|
|
414
|
+
state: m.getState(),
|
|
415
|
+
layout: s.layout,
|
|
416
|
+
modes: s.modes,
|
|
417
|
+
resources: s.resources
|
|
418
|
+
});
|
|
419
|
+
f(a, "history.reconcile");
|
|
420
|
+
const d = a.entries[a.cursor], l = r();
|
|
421
|
+
let b;
|
|
422
|
+
return d && c(() => {
|
|
423
|
+
const v = t(d, {
|
|
424
|
+
replayCurrentLocation: !0
|
|
425
|
+
});
|
|
426
|
+
v instanceof Promise && (b = v);
|
|
427
|
+
}), b ? b.then(() => n(l, d?.entryId), () => n(l, d?.entryId)) : n(l, d?.entryId), d;
|
|
428
|
+
},
|
|
429
|
+
flush: i,
|
|
430
|
+
clear() {
|
|
431
|
+
n(), f(Z(), "history.clear");
|
|
432
|
+
}
|
|
433
|
+
};
|
|
434
|
+
}, at = (e) => {
|
|
435
|
+
const t = (s, n) => {
|
|
436
|
+
if (s !== void 0 && s !== e.getScope()) return;
|
|
437
|
+
const i = e.store.getState(), r = i.entries[i.cursor];
|
|
438
|
+
if (n && r && r.entryId !== n) {
|
|
439
|
+
let o;
|
|
440
|
+
e.runSilent(() => {
|
|
441
|
+
const c = e.activateEntry(r);
|
|
442
|
+
c instanceof Promise && (o = c);
|
|
443
|
+
}), o ? o.then(() => t(s, r.entryId), () => t(s, r.entryId)) : t(s, r.entryId);
|
|
444
|
+
return;
|
|
445
|
+
}
|
|
446
|
+
e.onFinish(), i.hydrating && e.setState({
|
|
447
|
+
...i,
|
|
448
|
+
hydrating: !1
|
|
449
|
+
}, "history.finishRestore", !1);
|
|
450
|
+
};
|
|
451
|
+
return t;
|
|
452
|
+
}, ct = (e) => (t) => {
|
|
453
|
+
const s = e.store.getState(), n = s.cursor + t, i = s.entries[n];
|
|
454
|
+
if (i)
|
|
455
|
+
return e.setState({
|
|
456
|
+
...s,
|
|
457
|
+
cursor: n
|
|
458
|
+
}, t < 0 ? "history.goBack" : "history.goForward"), e.flush(), s.hydrating || e.runSilent(() => e.activateEntry(i)), i;
|
|
459
|
+
}, dt = (e) => {
|
|
460
|
+
let t = !1;
|
|
461
|
+
return e.onWillChangePersistenceScope(() => {
|
|
462
|
+
t = !0;
|
|
463
|
+
}), e.onDidChangePersistenceScope(() => {
|
|
464
|
+
t = !1;
|
|
465
|
+
}), () => t;
|
|
466
|
+
}, lt = (e) => {
|
|
467
|
+
const t = L({
|
|
468
|
+
name: "workbench.history",
|
|
469
|
+
initialState: Z()
|
|
470
|
+
});
|
|
471
|
+
let s = 0, n = !1, i = !1;
|
|
472
|
+
const r = dt(e.layout);
|
|
473
|
+
let o;
|
|
474
|
+
const c = /* @__PURE__ */ new Set(), {
|
|
475
|
+
flush: u,
|
|
476
|
+
schedule: f
|
|
477
|
+
} = rt({
|
|
478
|
+
persistence: e.persistence,
|
|
479
|
+
store: t,
|
|
480
|
+
getScope: () => o
|
|
481
|
+
}), m = (g, y, p = !0) => {
|
|
482
|
+
t.setState(g, !1, y), p && f();
|
|
483
|
+
}, a = (g) => {
|
|
484
|
+
if (!g) return;
|
|
485
|
+
const y = t.getState(), p = y.entries[y.cursor];
|
|
486
|
+
if (q(p, g)) return;
|
|
487
|
+
const w = y.entries.slice(0, y.cursor + 1), W = p?.kind === "mode" && g.kind !== "mode" && p.modeId === g.modeId, k = _(W ? [...w.slice(0, -1), g] : [...w, g]), x = k.slice(Math.max(0, k.length - (e.maxEntries ?? et)));
|
|
488
|
+
m({
|
|
489
|
+
...y,
|
|
490
|
+
entries: x,
|
|
491
|
+
cursor: x.length - 1
|
|
492
|
+
}, "history.record");
|
|
493
|
+
}, d = (g = !1, y = !1) => {
|
|
494
|
+
if (n || i || r() || !y && e.resources.isOpeningResource()) return;
|
|
495
|
+
s += 1;
|
|
496
|
+
const w = Ye({
|
|
497
|
+
counter: s,
|
|
498
|
+
layout: e.layout,
|
|
499
|
+
modes: e.modes
|
|
500
|
+
}), W = st(t.getState());
|
|
501
|
+
nt(W, w, g, e.modes?.isTransitioning() ?? !1) || w?.location.resource && c.has(w.location.resource.uri) || a(w);
|
|
502
|
+
};
|
|
503
|
+
let l = ae(e.layout);
|
|
504
|
+
const b = (g) => {
|
|
505
|
+
const y = t.getState(), p = Y(e.layout, g);
|
|
506
|
+
if (p === "location" && e.resources.isOpeningResource()) return;
|
|
507
|
+
if (p !== "sub-panel") {
|
|
508
|
+
if (e.modes?.isTransitioning() || !e.layout.getWidget(g.contributionId)) return;
|
|
509
|
+
const x = _(y.entries.filter((V) => V.widgetId !== g.widgetId));
|
|
510
|
+
if (x.length === y.entries.length) return;
|
|
511
|
+
m({
|
|
512
|
+
...y,
|
|
513
|
+
entries: x,
|
|
514
|
+
cursor: Math.min(y.cursor, x.length - 1)
|
|
515
|
+
}, "history.prune");
|
|
516
|
+
return;
|
|
517
|
+
}
|
|
518
|
+
const w = y.entries[y.cursor]?.entryId, W = _(y.entries.map((x) => Ge(x, g))), k = w ? W.findIndex((x) => x.entryId === w) : -1;
|
|
519
|
+
m({
|
|
520
|
+
...y,
|
|
521
|
+
entries: W,
|
|
522
|
+
cursor: k >= 0 ? k : Math.min(y.cursor, W.length - 1)
|
|
523
|
+
}, "history.removeSubPanel");
|
|
524
|
+
}, v = (g, y) => {
|
|
525
|
+
s += 1;
|
|
526
|
+
const p = t.getState(), w = Y(e.layout, g), W = Je({
|
|
527
|
+
placement: g,
|
|
528
|
+
counter: s,
|
|
529
|
+
current: w === "sub-panel" ? p.entries[p.cursor] : void 0,
|
|
530
|
+
modeId: e.modes?.getActiveModeId(),
|
|
531
|
+
closedSubPanel: w === "sub-panel" && K.includes(y) ? {
|
|
532
|
+
region: y,
|
|
533
|
+
reference: {
|
|
534
|
+
contributionId: g.contributionId,
|
|
535
|
+
resourceUri: g.resourceUri,
|
|
536
|
+
instanceKey: g.widgetId
|
|
537
|
+
},
|
|
538
|
+
resource: g.resource,
|
|
539
|
+
title: g.title
|
|
540
|
+
} : void 0
|
|
541
|
+
}), k = [...p.recentlyClosed.filter((x) => !q(x, W)), W].slice(-20);
|
|
542
|
+
m({
|
|
543
|
+
...p,
|
|
544
|
+
recentlyClosed: k
|
|
545
|
+
}, "history.recordClosed");
|
|
546
|
+
};
|
|
547
|
+
e.layout.store.subscribeSelector((g) => g.layout, () => {
|
|
548
|
+
const g = ae(e.layout);
|
|
549
|
+
if (i || r()) {
|
|
550
|
+
l = g;
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
for (const [y, p] of l)
|
|
554
|
+
g.has(y) || (p.placement.closable && v(p.placement, p.region), b(p.placement));
|
|
555
|
+
l = g, d(!0);
|
|
556
|
+
}), e.modes?.onDidChangeActive(d), e.resources.onDidOpenResource(() => d(!1, !0));
|
|
557
|
+
const I = (g) => {
|
|
558
|
+
for (const y of X) {
|
|
559
|
+
const p = g.selectedSubPanels[y], w = p ? _e(e.layout, p) : void 0;
|
|
560
|
+
if (w) {
|
|
561
|
+
e.layout.activateWidget(w.widgetId);
|
|
562
|
+
continue;
|
|
563
|
+
}
|
|
564
|
+
const W = y === "main" ? e.layout.getLayout().activeLocationWidgetId : void 0;
|
|
565
|
+
e.layout.setRegionActiveWidget(y, W);
|
|
566
|
+
}
|
|
567
|
+
}, S = (g) => {
|
|
568
|
+
e.modes && e.modes.getActiveModeId() !== g.modeId && e.modes.setActiveMode(g.modeId);
|
|
569
|
+
}, h = (g, y, p) => {
|
|
570
|
+
const w = g.resource;
|
|
571
|
+
return c.add(w.uri), e.resources.openResource(w, {
|
|
572
|
+
replaceActive: p
|
|
573
|
+
}).finally(() => {
|
|
574
|
+
y === o && I(g), c.delete(w.uri);
|
|
575
|
+
});
|
|
576
|
+
}, R = (g, y = {}) => {
|
|
577
|
+
const p = o;
|
|
578
|
+
if (S(g), g.kind === "mode") {
|
|
579
|
+
I(g);
|
|
580
|
+
return;
|
|
581
|
+
}
|
|
582
|
+
const w = g.widgetId ? $(e.layout.getLayout(), g.widgetId)?.placement : void 0;
|
|
583
|
+
if (g.kind === "resource" && g.resource)
|
|
584
|
+
return ot({
|
|
585
|
+
entry: g,
|
|
586
|
+
resource: g.resource,
|
|
587
|
+
placement: w,
|
|
588
|
+
layout: e.layout,
|
|
589
|
+
resources: e.resources,
|
|
590
|
+
replayCurrentLocation: y.replayCurrentLocation,
|
|
591
|
+
replayResource: (W, k) => h(W, p, k),
|
|
592
|
+
restoreSelections: I
|
|
593
|
+
});
|
|
594
|
+
w ? e.layout.activateWidget(w.widgetId) : g.contributionId && e.layout.getWidget(g.contributionId) && e.layout.openWidget(g.contributionId, {
|
|
595
|
+
title: g.title
|
|
596
|
+
}), I(g);
|
|
597
|
+
}, C = (g) => {
|
|
598
|
+
n = !0;
|
|
599
|
+
try {
|
|
600
|
+
g();
|
|
601
|
+
} finally {
|
|
602
|
+
n = !1;
|
|
603
|
+
}
|
|
604
|
+
}, T = ct({
|
|
605
|
+
store: t,
|
|
606
|
+
activateEntry: R,
|
|
607
|
+
flush: u,
|
|
608
|
+
runSilent: C,
|
|
609
|
+
setState: m
|
|
610
|
+
}), M = (g) => {
|
|
611
|
+
if (g === o) return;
|
|
612
|
+
u(), o = g;
|
|
613
|
+
const y = Xe(e.persistence?.getHistory(g));
|
|
614
|
+
i = y.entries.length > 0, m({
|
|
615
|
+
...y,
|
|
616
|
+
hydrating: i
|
|
617
|
+
}, "history.setPersistenceScope", !1);
|
|
618
|
+
};
|
|
619
|
+
typeof window < "u" && window.addEventListener("pagehide", u);
|
|
620
|
+
const H = at({
|
|
621
|
+
store: t,
|
|
622
|
+
activateEntry: R,
|
|
623
|
+
getScope: () => o,
|
|
624
|
+
onFinish: () => {
|
|
625
|
+
i = !1;
|
|
626
|
+
},
|
|
627
|
+
runSilent: C,
|
|
628
|
+
setState: m
|
|
629
|
+
});
|
|
630
|
+
return it({
|
|
631
|
+
controllerInput: e,
|
|
632
|
+
store: t,
|
|
633
|
+
finishRestore: H,
|
|
634
|
+
setPersistenceScope: M,
|
|
635
|
+
getPersistenceScope: () => o,
|
|
636
|
+
activateEntry: R,
|
|
637
|
+
moveCursor: T,
|
|
638
|
+
runSilent: C,
|
|
639
|
+
setState: m,
|
|
640
|
+
flush: u
|
|
641
|
+
});
|
|
642
|
+
}, ut = (e) => {
|
|
643
|
+
const t = () => e.persistence?.getLastResource();
|
|
644
|
+
return {
|
|
645
|
+
get: t,
|
|
646
|
+
set: (i) => e.persistence?.setLastResource(i),
|
|
647
|
+
restore: async () => {
|
|
648
|
+
const i = t();
|
|
649
|
+
if (!i) return !1;
|
|
650
|
+
try {
|
|
651
|
+
return await e.openResource(i), !0;
|
|
652
|
+
} catch {
|
|
653
|
+
return !1;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
};
|
|
657
|
+
}, gt = (e = {}) => {
|
|
658
|
+
let t;
|
|
659
|
+
const s = Object.fromEntries(Object.entries(e.defaultOpenByRegionId ?? {}).filter((u) => u[1] !== void 0)), n = e.persistence?.getPanelStates(t), i = (u) => ({
|
|
660
|
+
...s,
|
|
661
|
+
...u?.openByRegionId
|
|
662
|
+
}), r = L({
|
|
663
|
+
name: "workbench.panels",
|
|
664
|
+
initialState: {
|
|
665
|
+
openByRegionId: i(n)
|
|
666
|
+
}
|
|
667
|
+
}), o = () => {
|
|
668
|
+
e.persistence && e.persistence.setPanelStates({
|
|
669
|
+
openByRegionId: r.getState().openByRegionId
|
|
670
|
+
}, t);
|
|
671
|
+
}, c = (u) => r.getState().openByRegionId[u] ?? !0;
|
|
672
|
+
return {
|
|
673
|
+
store: r,
|
|
674
|
+
isOpen: c,
|
|
675
|
+
setOpen(u, f) {
|
|
676
|
+
const m = r.getState();
|
|
677
|
+
(m.openByRegionId[u] ?? !0) !== f && (r.setState({
|
|
678
|
+
openByRegionId: {
|
|
679
|
+
...m.openByRegionId,
|
|
680
|
+
[u]: f
|
|
681
|
+
}
|
|
682
|
+
}, !1, "setPanelOpen"), o());
|
|
683
|
+
},
|
|
684
|
+
toggle(u) {
|
|
685
|
+
this.setOpen(u, !c(u));
|
|
686
|
+
},
|
|
687
|
+
setPersistenceScope(u) {
|
|
688
|
+
if (u === t) return;
|
|
689
|
+
o(), t = u;
|
|
690
|
+
const f = e.persistence?.getPanelStates(t);
|
|
691
|
+
r.setState({
|
|
692
|
+
openByRegionId: i(f)
|
|
693
|
+
}, !1, "setPersistenceScope");
|
|
694
|
+
},
|
|
695
|
+
getPersistenceScope: () => t,
|
|
696
|
+
onDidChange(u) {
|
|
697
|
+
const f = r.subscribe((m) => u(m));
|
|
698
|
+
return P(f);
|
|
699
|
+
}
|
|
700
|
+
};
|
|
701
|
+
}, ft = (e = {}) => {
|
|
702
|
+
const t = L({
|
|
703
|
+
name: "workbench.sidePanel",
|
|
704
|
+
initialState: {
|
|
705
|
+
mode: e.initialMode ?? "floating"
|
|
706
|
+
}
|
|
707
|
+
});
|
|
708
|
+
return {
|
|
709
|
+
store: t,
|
|
710
|
+
getMode() {
|
|
711
|
+
return t.getState().mode;
|
|
712
|
+
},
|
|
713
|
+
setMode(s) {
|
|
714
|
+
t.getState().mode !== s && t.setState({
|
|
715
|
+
mode: s
|
|
716
|
+
}, !1, "setMode");
|
|
717
|
+
},
|
|
718
|
+
onDidChange(s) {
|
|
719
|
+
const n = t.subscribeSelector((i) => i.mode, (i) => s(i));
|
|
720
|
+
return P(n);
|
|
721
|
+
}
|
|
722
|
+
};
|
|
723
|
+
}, mt = "Terminal", ht = 200, yt = () => {
|
|
724
|
+
const e = L({
|
|
725
|
+
name: "workbench.terminal",
|
|
726
|
+
initialState: {
|
|
727
|
+
sessionsById: {}
|
|
728
|
+
}
|
|
729
|
+
});
|
|
730
|
+
let t = null;
|
|
731
|
+
const s = /* @__PURE__ */ new Map(), n = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Map(), r = /* @__PURE__ */ new Set(), o = (a, d, l) => {
|
|
732
|
+
const b = e.getState(), v = b.sessionsById[a];
|
|
733
|
+
v && e.setState({
|
|
734
|
+
sessionsById: {
|
|
735
|
+
...b.sessionsById,
|
|
736
|
+
[a]: {
|
|
737
|
+
...v,
|
|
738
|
+
...d
|
|
739
|
+
}
|
|
740
|
+
}
|
|
741
|
+
}, !1, l);
|
|
742
|
+
}, c = (a) => {
|
|
743
|
+
const d = s.get(a);
|
|
744
|
+
if (!d) throw new Error(`Unknown terminal session: ${a}`);
|
|
745
|
+
return d;
|
|
746
|
+
}, u = (a) => {
|
|
747
|
+
s.delete(a), i.delete(a), r.delete(a);
|
|
748
|
+
const d = n.get(a) ?? [];
|
|
749
|
+
n.delete(a);
|
|
750
|
+
for (const l of d) l();
|
|
751
|
+
}, f = (a, d) => {
|
|
752
|
+
if (r.has(a)) return;
|
|
753
|
+
const l = i.get(a);
|
|
754
|
+
l && (l.push(d), l.length > ht && l.shift());
|
|
755
|
+
}, m = async (a) => {
|
|
756
|
+
await c(a.sessionId).kill(a.signal), o(a.sessionId, {
|
|
757
|
+
status: "killed"
|
|
758
|
+
}, "killTerminalSession"), u(a.sessionId);
|
|
759
|
+
};
|
|
760
|
+
return {
|
|
761
|
+
store: e,
|
|
762
|
+
isAvailable: () => t !== null,
|
|
763
|
+
setSessionOpener(a) {
|
|
764
|
+
t = a;
|
|
765
|
+
},
|
|
766
|
+
async open(a) {
|
|
767
|
+
if (!t) throw new Error("Terminal sessions are not available in this workbench host.");
|
|
768
|
+
const d = await t(a.request);
|
|
769
|
+
s.set(d.id, d), i.set(d.id, []);
|
|
770
|
+
const l = [d.onData((I) => f(d.id, I))], b = d.onTitle?.((I) => o(d.id, {
|
|
771
|
+
title: I
|
|
772
|
+
}, "terminalSessionTitleChanged"));
|
|
773
|
+
b && l.push(b), l.push(d.onExit((I) => {
|
|
774
|
+
e.getState().sessionsById[d.id]?.status === "running" && o(d.id, {
|
|
775
|
+
status: "exited",
|
|
776
|
+
exit: I
|
|
777
|
+
}, "terminalSessionExited"), u(d.id);
|
|
778
|
+
})), n.set(d.id, l);
|
|
779
|
+
const v = e.getState();
|
|
780
|
+
return e.setState({
|
|
781
|
+
sessionsById: {
|
|
782
|
+
...v.sessionsById,
|
|
783
|
+
[d.id]: {
|
|
784
|
+
id: d.id,
|
|
785
|
+
title: a.title ?? mt,
|
|
786
|
+
status: "running"
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
}, !1, "openTerminalSession"), {
|
|
790
|
+
sessionId: d.id
|
|
791
|
+
};
|
|
792
|
+
},
|
|
793
|
+
write(a) {
|
|
794
|
+
c(a.sessionId).write(a.data);
|
|
795
|
+
},
|
|
796
|
+
resize(a) {
|
|
797
|
+
c(a.sessionId).resize(a.cols, a.rows);
|
|
798
|
+
},
|
|
799
|
+
kill: m,
|
|
800
|
+
subscribe(a, d) {
|
|
801
|
+
const l = c(a), b = [];
|
|
802
|
+
if (d.onData) {
|
|
803
|
+
const v = i.get(a) ?? [];
|
|
804
|
+
i.delete(a), r.add(a), b.push(l.onData(d.onData));
|
|
805
|
+
for (const I of v) d.onData(I);
|
|
806
|
+
}
|
|
807
|
+
return b.push(d.onExit ? l.onExit(d.onExit) : void 0, d.onError ? l.onError(d.onError) : void 0), () => {
|
|
808
|
+
for (const v of b) v?.();
|
|
809
|
+
};
|
|
810
|
+
},
|
|
811
|
+
getSession(a) {
|
|
812
|
+
return e.getState().sessionsById[a];
|
|
813
|
+
},
|
|
814
|
+
listSessions() {
|
|
815
|
+
return Object.values(e.getState().sessionsById);
|
|
816
|
+
},
|
|
817
|
+
async dispose() {
|
|
818
|
+
const a = Object.values(e.getState().sessionsById).filter((d) => d.status === "running");
|
|
819
|
+
await Promise.all(a.map((d) => m({
|
|
820
|
+
sessionId: d.id
|
|
821
|
+
})));
|
|
822
|
+
for (const d of Object.values(e.getState().sessionsById)) u(d.id);
|
|
823
|
+
s.clear();
|
|
824
|
+
}
|
|
825
|
+
};
|
|
826
|
+
}, bt = () => {
|
|
827
|
+
const e = L({
|
|
828
|
+
name: "workbench.commandPaletteResources",
|
|
829
|
+
initialState: {
|
|
830
|
+
providers: {},
|
|
831
|
+
refreshToken: 0
|
|
832
|
+
}
|
|
833
|
+
});
|
|
834
|
+
return {
|
|
835
|
+
store: e,
|
|
836
|
+
registerProvider(t) {
|
|
837
|
+
const s = e.getState();
|
|
838
|
+
if (s.providers[t.id])
|
|
839
|
+
throw new Error(`Command palette resource provider already registered: ${t.id}`);
|
|
840
|
+
return e.setState({
|
|
841
|
+
...s,
|
|
842
|
+
providers: {
|
|
843
|
+
...s.providers,
|
|
844
|
+
[t.id]: t
|
|
845
|
+
}
|
|
846
|
+
}, !1, "registerProvider"), P(() => {
|
|
847
|
+
const n = e.getState();
|
|
848
|
+
if (n.providers[t.id] !== t) return;
|
|
849
|
+
const {
|
|
850
|
+
[t.id]: i,
|
|
851
|
+
...r
|
|
852
|
+
} = n.providers;
|
|
853
|
+
e.setState({
|
|
854
|
+
...n,
|
|
855
|
+
providers: r
|
|
856
|
+
}, !1, "unregisterProvider");
|
|
857
|
+
});
|
|
858
|
+
},
|
|
859
|
+
listProviders() {
|
|
860
|
+
return Object.values(e.getState().providers);
|
|
861
|
+
},
|
|
862
|
+
async queryProviders(t) {
|
|
863
|
+
const s = Object.values(e.getState().providers);
|
|
864
|
+
return Promise.all(s.map(async (n) => {
|
|
865
|
+
try {
|
|
866
|
+
const i = await n.query(t);
|
|
867
|
+
return {
|
|
868
|
+
providerId: n.id,
|
|
869
|
+
title: n.title,
|
|
870
|
+
results: i
|
|
871
|
+
};
|
|
872
|
+
} catch {
|
|
873
|
+
return {
|
|
874
|
+
providerId: n.id,
|
|
875
|
+
title: n.title,
|
|
876
|
+
results: []
|
|
877
|
+
};
|
|
878
|
+
}
|
|
879
|
+
}));
|
|
880
|
+
},
|
|
881
|
+
refresh() {
|
|
882
|
+
const t = e.getState();
|
|
883
|
+
e.setState({
|
|
884
|
+
...t,
|
|
885
|
+
refreshToken: t.refreshToken + 1
|
|
886
|
+
}, !1, "refresh");
|
|
887
|
+
}
|
|
888
|
+
};
|
|
889
|
+
}, St = (e = {}) => {
|
|
890
|
+
const t = L({
|
|
891
|
+
name: "workbench.commands",
|
|
892
|
+
initialState: {
|
|
893
|
+
commands: {}
|
|
894
|
+
}
|
|
895
|
+
}), s = /* @__PURE__ */ new Set(), n = (r) => {
|
|
896
|
+
const o = t.getState().commands[r];
|
|
897
|
+
if (!o) throw new Error(`Command not registered: ${r}`);
|
|
898
|
+
return o;
|
|
899
|
+
}, i = (r) => {
|
|
900
|
+
for (const o of s) o(r);
|
|
901
|
+
};
|
|
902
|
+
return {
|
|
903
|
+
store: t,
|
|
904
|
+
registerCommand(r, o, c) {
|
|
905
|
+
const u = t.getState();
|
|
906
|
+
if (u.commands[r.id]) throw new Error(`Command already registered: ${r.id}`);
|
|
907
|
+
const f = {
|
|
908
|
+
...D(c),
|
|
909
|
+
command: r,
|
|
910
|
+
handler: o
|
|
911
|
+
};
|
|
912
|
+
return t.setState({
|
|
913
|
+
commands: {
|
|
914
|
+
...u.commands,
|
|
915
|
+
[r.id]: f
|
|
916
|
+
}
|
|
917
|
+
}, !1, "registerCommand"), P(() => {
|
|
918
|
+
const m = t.getState();
|
|
919
|
+
if (m.commands[r.id] !== f) return;
|
|
920
|
+
const {
|
|
921
|
+
[r.id]: a,
|
|
922
|
+
...d
|
|
923
|
+
} = m.commands;
|
|
924
|
+
t.setState({
|
|
925
|
+
commands: d
|
|
926
|
+
}, !1, "unregisterCommand");
|
|
927
|
+
});
|
|
928
|
+
},
|
|
929
|
+
getCommand(r) {
|
|
930
|
+
return t.getState().commands[r];
|
|
931
|
+
},
|
|
932
|
+
listCommands() {
|
|
933
|
+
return Object.values(t.getState().commands).sort(O);
|
|
934
|
+
},
|
|
935
|
+
isCommandEnabled(r, o) {
|
|
936
|
+
return n(r).handler.isEnabled?.(o) ?? !0;
|
|
937
|
+
},
|
|
938
|
+
isCommandVisible(r, o) {
|
|
939
|
+
const c = n(r);
|
|
940
|
+
return e.context?.matches(c.command.when) ? c.handler.isVisible?.(o) ?? !0 : !1;
|
|
941
|
+
},
|
|
942
|
+
isCommandToggled(r, o) {
|
|
943
|
+
return n(r).handler.isToggled?.(o) ?? !1;
|
|
944
|
+
},
|
|
945
|
+
async executeCommand(r, o, c) {
|
|
946
|
+
const u = n(r);
|
|
947
|
+
if (u.handler.isEnabled?.(o) === !1) {
|
|
948
|
+
const f = new Error(`Command is disabled: ${r}`);
|
|
949
|
+
throw i({
|
|
950
|
+
commandId: r,
|
|
951
|
+
args: o,
|
|
952
|
+
error: f
|
|
953
|
+
}), f;
|
|
954
|
+
}
|
|
955
|
+
try {
|
|
956
|
+
return await u.handler.execute(o, c);
|
|
957
|
+
} catch (f) {
|
|
958
|
+
throw i({
|
|
959
|
+
commandId: r,
|
|
960
|
+
args: o,
|
|
961
|
+
error: f
|
|
962
|
+
}), f;
|
|
963
|
+
}
|
|
964
|
+
},
|
|
965
|
+
onDidExecuteError(r) {
|
|
966
|
+
return s.add(r), P(() => {
|
|
967
|
+
s.delete(r);
|
|
968
|
+
});
|
|
969
|
+
}
|
|
970
|
+
};
|
|
971
|
+
}, vt = (e) => {
|
|
972
|
+
const {
|
|
973
|
+
getLayout: t,
|
|
974
|
+
getWidgets: s,
|
|
975
|
+
getPlaceholder: n
|
|
976
|
+
} = e;
|
|
977
|
+
return {
|
|
978
|
+
getRegionSize(i) {
|
|
979
|
+
const r = t().regions[i].size, o = j(t().regions[i]), c = o ? s()[o.contributionId]?.regionSize : n(i)?.regionSize;
|
|
980
|
+
return r === void 0 ? c : {
|
|
981
|
+
...c,
|
|
982
|
+
defaultPx: r
|
|
983
|
+
};
|
|
984
|
+
},
|
|
985
|
+
getRegionCollapsible(i) {
|
|
986
|
+
const r = j(t().regions[i]);
|
|
987
|
+
return r ? s()[r.contributionId]?.regionCollapsible ?? !0 : n(i)?.regionCollapsible ?? !0;
|
|
988
|
+
},
|
|
989
|
+
getRegionHeaderBorderBottom(i) {
|
|
990
|
+
const r = j(t().regions[i]);
|
|
991
|
+
return r ? s()[r.contributionId]?.headerBorderBottom ?? !0 : !0;
|
|
992
|
+
}
|
|
993
|
+
};
|
|
994
|
+
}, pt = (e) => {
|
|
995
|
+
const {
|
|
996
|
+
getPlaceholders: t,
|
|
997
|
+
getWidgets: s
|
|
998
|
+
} = e;
|
|
999
|
+
return {
|
|
1000
|
+
listPlaceholders: () => Object.values(t()).sort(O),
|
|
1001
|
+
listWidgets: () => Object.values(s()).sort(O)
|
|
1002
|
+
};
|
|
1003
|
+
}, Rt = (e) => {
|
|
1004
|
+
const {
|
|
1005
|
+
store: t,
|
|
1006
|
+
getPlaceholders: s,
|
|
1007
|
+
getWidgets: n,
|
|
1008
|
+
persistLayout: i
|
|
1009
|
+
} = e;
|
|
1010
|
+
return {
|
|
1011
|
+
registerPlaceholder(r, o) {
|
|
1012
|
+
if (s()[r.region])
|
|
1013
|
+
throw new Error(`Placeholder already registered: ${r.region}`);
|
|
1014
|
+
const {
|
|
1015
|
+
priority: c,
|
|
1016
|
+
...u
|
|
1017
|
+
} = r, f = {
|
|
1018
|
+
...u,
|
|
1019
|
+
...D({
|
|
1020
|
+
...o,
|
|
1021
|
+
priority: o?.priority ?? c
|
|
1022
|
+
})
|
|
1023
|
+
}, m = t.getState();
|
|
1024
|
+
return t.setState({
|
|
1025
|
+
...m,
|
|
1026
|
+
placeholders: {
|
|
1027
|
+
...m.placeholders,
|
|
1028
|
+
[r.region]: f
|
|
1029
|
+
}
|
|
1030
|
+
}, !1, "registerPlaceholder"), P(() => {
|
|
1031
|
+
const a = t.getState();
|
|
1032
|
+
if (a.placeholders[r.region] !== f) return;
|
|
1033
|
+
const {
|
|
1034
|
+
[r.region]: d,
|
|
1035
|
+
...l
|
|
1036
|
+
} = a.placeholders;
|
|
1037
|
+
t.setState({
|
|
1038
|
+
...a,
|
|
1039
|
+
placeholders: l
|
|
1040
|
+
}, !1, "unregisterPlaceholder");
|
|
1041
|
+
});
|
|
1042
|
+
},
|
|
1043
|
+
registerWidget(r, o) {
|
|
1044
|
+
if (n()[r.id]) throw new Error(`Widget already registered: ${r.id}`);
|
|
1045
|
+
const {
|
|
1046
|
+
priority: c,
|
|
1047
|
+
reuse: u,
|
|
1048
|
+
singleton: f,
|
|
1049
|
+
...m
|
|
1050
|
+
} = r, a = {
|
|
1051
|
+
...m,
|
|
1052
|
+
role: r.role ?? "content",
|
|
1053
|
+
reuse: u ?? "resource",
|
|
1054
|
+
singleton: f ?? !0,
|
|
1055
|
+
...D({
|
|
1056
|
+
...o,
|
|
1057
|
+
priority: o?.priority ?? c
|
|
1058
|
+
})
|
|
1059
|
+
}, d = t.getState();
|
|
1060
|
+
return t.setState({
|
|
1061
|
+
...d,
|
|
1062
|
+
widgets: {
|
|
1063
|
+
...d.widgets,
|
|
1064
|
+
[r.id]: a
|
|
1065
|
+
}
|
|
1066
|
+
}, !1, "registerWidget"), P(() => {
|
|
1067
|
+
const l = t.getState();
|
|
1068
|
+
if (l.widgets[r.id] !== a) return;
|
|
1069
|
+
const {
|
|
1070
|
+
[r.id]: b,
|
|
1071
|
+
...v
|
|
1072
|
+
} = l.widgets, I = ye(l.layout, r.id);
|
|
1073
|
+
t.setState({
|
|
1074
|
+
widgets: v,
|
|
1075
|
+
layout: I
|
|
1076
|
+
}, !1, "unregisterWidget"), i();
|
|
1077
|
+
});
|
|
1078
|
+
}
|
|
1079
|
+
};
|
|
1080
|
+
}, G = (e, t, s = "end") => {
|
|
1081
|
+
const n = [...e];
|
|
1082
|
+
if (s === "start")
|
|
1083
|
+
return n.unshift(t), n;
|
|
1084
|
+
if (s === "end")
|
|
1085
|
+
return n.push(t), n;
|
|
1086
|
+
const i = "beforeWidgetId" in s ? s.beforeWidgetId : s.afterWidgetId, r = n.findIndex((o) => o.widgetId === i);
|
|
1087
|
+
return r < 0 ? (n.push(t), n) : (n.splice(r + ("afterWidgetId" in s ? 1 : 0), 0, t), n);
|
|
1088
|
+
}, N = (e, t, s) => {
|
|
1089
|
+
if (t.tabRetention !== "preview") return G(e, t, s);
|
|
1090
|
+
const n = e.filter((i) => i.tabRetention !== "preview" && i.widgetId !== t.widgetId);
|
|
1091
|
+
return G(n, t, "start");
|
|
1092
|
+
}, wt = (e, t, s) => {
|
|
1093
|
+
const n = e.find((r) => r.widgetId === t);
|
|
1094
|
+
if (!n) return e;
|
|
1095
|
+
if (n.tabRetention === "preview")
|
|
1096
|
+
throw new Error(`Preview widget cannot be reordered: ${t}`);
|
|
1097
|
+
const i = e.filter((r) => r.widgetId !== t);
|
|
1098
|
+
return G(i, n, s);
|
|
1099
|
+
}, pe = (e, t) => {
|
|
1100
|
+
let s = e;
|
|
1101
|
+
for (const i of Object.values(e.regions)) {
|
|
1102
|
+
const r = i.widgets.filter(t);
|
|
1103
|
+
if (r.length === 0) continue;
|
|
1104
|
+
const o = j(i);
|
|
1105
|
+
s = A(s, i.id, (c) => c.filter((u) => !t(u)), {
|
|
1106
|
+
clearActiveWidget: o ? t(o) : !1
|
|
1107
|
+
});
|
|
1108
|
+
for (const c of r)
|
|
1109
|
+
s = Ce(s, c.widgetId);
|
|
1110
|
+
}
|
|
1111
|
+
return s.activeWidgetId && Object.values(s.regions).flatMap((i) => i.widgets).find((i) => i.widgetId === s.activeWidgetId) || (s = {
|
|
1112
|
+
...s,
|
|
1113
|
+
activeWidgetId: void 0,
|
|
1114
|
+
activeResourceUri: void 0
|
|
1115
|
+
}), s;
|
|
1116
|
+
}, Pt = (e, t) => pe(e, (s) => s.tabRetention === "preview" && (t === void 0 || s.ownerResourceUri !== t)), J = (e) => pe(e, (t) => t.tabRetention === "preview"), It = (e) => ({
|
|
1117
|
+
updateWidgetPlacement(t, s) {
|
|
1118
|
+
const n = e.getLayout();
|
|
1119
|
+
for (const i of Object.values(n.regions)) {
|
|
1120
|
+
const r = i.widgets.findIndex((f) => f.widgetId === t);
|
|
1121
|
+
if (r < 0) continue;
|
|
1122
|
+
const o = e.requireWidget(i.widgets[r].contributionId), c = U(i.widgets[r], o, s), u = A(n, i.id, (f) => f.map((m, a) => a === r ? c : m));
|
|
1123
|
+
return e.setLayout(u), e.persistLayout(), c;
|
|
1124
|
+
}
|
|
1125
|
+
throw new Error(`Widget placement not found: ${t}`);
|
|
1126
|
+
},
|
|
1127
|
+
reorderWidget(t, s) {
|
|
1128
|
+
const n = e.getLayout();
|
|
1129
|
+
for (const i of Object.values(n.regions))
|
|
1130
|
+
if (i.widgets.some((r) => r.widgetId === t)) {
|
|
1131
|
+
e.setLayout(A(n, i.id, (r) => wt(r, t, s))), e.persistLayout();
|
|
1132
|
+
return;
|
|
1133
|
+
}
|
|
1134
|
+
throw new Error(`Widget placement not found: ${t}`);
|
|
1135
|
+
},
|
|
1136
|
+
expirePreviewTabs(t) {
|
|
1137
|
+
e.setLayout(Pt(e.getLayout(), t)), e.persistLayout();
|
|
1138
|
+
},
|
|
1139
|
+
activateWidget(t) {
|
|
1140
|
+
const s = e.getLayout();
|
|
1141
|
+
for (const n of Object.values(s.regions)) {
|
|
1142
|
+
const i = n.widgets.find((r) => r.widgetId === t);
|
|
1143
|
+
if (i) return e.applyAndActivate(s, n.id, i);
|
|
1144
|
+
}
|
|
1145
|
+
throw new Error(`Widget placement not found: ${t}`);
|
|
1146
|
+
}
|
|
1147
|
+
}), Ct = (e, t) => {
|
|
1148
|
+
const s = {
|
|
1149
|
+
...t.regions
|
|
1150
|
+
};
|
|
1151
|
+
for (const n of Object.values(e.regions)) {
|
|
1152
|
+
const i = n.widgets.filter((c) => c.pinned && c.role === "content");
|
|
1153
|
+
if (i.length === 0) continue;
|
|
1154
|
+
const r = new Set(i.map((c) => c.contributionId)), o = t.regions[n.id];
|
|
1155
|
+
s[n.id] = {
|
|
1156
|
+
...o,
|
|
1157
|
+
widgets: [...i, ...o.widgets.filter((c) => !r.has(c.contributionId))],
|
|
1158
|
+
activeWidgetId: o.activeWidgetId ?? i[0]?.widgetId
|
|
1159
|
+
};
|
|
1160
|
+
}
|
|
1161
|
+
return {
|
|
1162
|
+
...t,
|
|
1163
|
+
regions: s
|
|
1164
|
+
};
|
|
1165
|
+
}, Wt = (e, t, s) => {
|
|
1166
|
+
if (s.length === 0) return t;
|
|
1167
|
+
const n = {
|
|
1168
|
+
...t.regions
|
|
1169
|
+
};
|
|
1170
|
+
for (const i of s) n[i] = e.regions[i];
|
|
1171
|
+
return {
|
|
1172
|
+
...t,
|
|
1173
|
+
regions: n
|
|
1174
|
+
};
|
|
1175
|
+
}, ce = (e, t) => t ? Se(J(t), e) : Ae(e), de = () => {
|
|
1176
|
+
const e = /* @__PURE__ */ new Set();
|
|
1177
|
+
return {
|
|
1178
|
+
notify(t) {
|
|
1179
|
+
for (const s of e) s(t);
|
|
1180
|
+
},
|
|
1181
|
+
subscribe(t) {
|
|
1182
|
+
return e.add(t), P(() => e.delete(t));
|
|
1183
|
+
}
|
|
1184
|
+
};
|
|
1185
|
+
}, kt = (e) => {
|
|
1186
|
+
for (const t of e.widget.ownedPanelMenuIds ?? []) {
|
|
1187
|
+
const s = e.requireWidget(t);
|
|
1188
|
+
e.openWidget(t, {
|
|
1189
|
+
pinned: !0,
|
|
1190
|
+
resource: e.placement.resource,
|
|
1191
|
+
title: s.region === "main-left-menu" ? e.placement.resource?.label : s.title
|
|
1192
|
+
});
|
|
1193
|
+
}
|
|
1194
|
+
}, Lt = (e, t, s) => {
|
|
1195
|
+
if (!(!e.singleton && e.reuse === "none")) {
|
|
1196
|
+
if (e.role === "sub-panel" || e.role === "panel-menu") {
|
|
1197
|
+
const n = B(t)?.resourceUri;
|
|
1198
|
+
for (const i of Object.values(t.regions)) {
|
|
1199
|
+
const r = i.widgets.findIndex((o) => o.contributionId === e.id && o.ownerResourceUri === n && (!s.resource || o.resourceUri === s.resource.uri));
|
|
1200
|
+
if (r >= 0) return {
|
|
1201
|
+
regionId: i.id,
|
|
1202
|
+
index: r,
|
|
1203
|
+
placement: i.widgets[r]
|
|
1204
|
+
};
|
|
1205
|
+
}
|
|
1206
|
+
return;
|
|
1207
|
+
}
|
|
1208
|
+
return e.singleton ? ee(t, e.id) : s.resource ? be(t, e.id, s.resource.uri) : ee(t, e.id);
|
|
1209
|
+
}
|
|
1210
|
+
}, Et = (e, t, s, n) => {
|
|
1211
|
+
const i = e.regions[t], r = s.role === "location" ? e.activeLocationWidgetId : i.activeWidgetId;
|
|
1212
|
+
if (n.replaceWidgetId)
|
|
1213
|
+
return i.widgets.findIndex((c) => c.widgetId === n.replaceWidgetId);
|
|
1214
|
+
if (n.tabRetention === "preview")
|
|
1215
|
+
return i.widgets.findIndex((c) => c.tabRetention === "preview");
|
|
1216
|
+
if (!n.replaceActive) return -1;
|
|
1217
|
+
const o = t === "main" && n.resource && e.activeLocationWidgetId ? e.activeLocationWidgetId : r;
|
|
1218
|
+
return i.widgets.findIndex((c) => c.widgetId === o && !c.pinned);
|
|
1219
|
+
}, Tt = (e) => {
|
|
1220
|
+
const {
|
|
1221
|
+
getLayout: t,
|
|
1222
|
+
requireWidget: s,
|
|
1223
|
+
applyAndActivate: n
|
|
1224
|
+
} = e, i = (m, a, d) => a.role !== "sub-panel" && a.role !== "panel-menu" ? m : {
|
|
1225
|
+
...m,
|
|
1226
|
+
ownerResourceUri: B(d)?.resourceUri
|
|
1227
|
+
}, r = (m, a, d) => {
|
|
1228
|
+
const l = i(U(a.placement, m, d), m, t()), b = A(t(), a.regionId, (v) => {
|
|
1229
|
+
const I = v.map((S, h) => h === a.index ? l : S);
|
|
1230
|
+
return d.tabPosition ? N(I.filter((S) => S.widgetId !== l.widgetId), l, d.tabPosition) : I;
|
|
1231
|
+
});
|
|
1232
|
+
return n(b, a.regionId, l);
|
|
1233
|
+
}, o = (m, a, d, l, b) => {
|
|
1234
|
+
const v = i(U(l, m, b), m, t()), I = A(t(), a, (S) => {
|
|
1235
|
+
const h = S.map((R, C) => C === d ? v : R);
|
|
1236
|
+
return v.tabRetention !== "preview" ? h : N(h, v, "start");
|
|
1237
|
+
});
|
|
1238
|
+
return n(I, a, v);
|
|
1239
|
+
}, c = (m, a, d, l, b) => {
|
|
1240
|
+
if (b.tabRetention === "preview" && a.placement.tabRetention !== "preview")
|
|
1241
|
+
return n(t(), a.regionId, a.placement);
|
|
1242
|
+
if (a.regionId !== d) {
|
|
1243
|
+
const S = i(U(a.placement, m, b), m, t()), h = A(t(), a.regionId, (C) => C.filter((T, M) => M !== a.index), {
|
|
1244
|
+
clearActiveWidget: t().regions[a.regionId].activeWidgetId === a.placement.widgetId
|
|
1245
|
+
}), R = A(h, d, (C) => {
|
|
1246
|
+
if (l < 0) return N(C, S, b.tabPosition);
|
|
1247
|
+
const T = [...C];
|
|
1248
|
+
return T.splice(l, 1, S), S.tabRetention === "preview" ? N(T, S, "start") : T;
|
|
1249
|
+
});
|
|
1250
|
+
return n(R, d, S);
|
|
1251
|
+
}
|
|
1252
|
+
if (l < 0 || a.index === l)
|
|
1253
|
+
return r(m, a, b);
|
|
1254
|
+
const v = i(U(a.placement, m, b), m, t()), I = A(t(), d, (S) => N(S.map((h, R) => R === a.index ? v : h).filter((h, R) => R !== l && R !== a.index), v, b.tabPosition));
|
|
1255
|
+
return n(I, d, v);
|
|
1256
|
+
}, u = (m, a, d, l) => {
|
|
1257
|
+
const b = We(t(), m.id), v = i(ke(b, m, l), m, t()), I = A(t(), a, (S) => {
|
|
1258
|
+
if (d < 0) return N(S, v, l.tabPosition);
|
|
1259
|
+
const h = [...S];
|
|
1260
|
+
return h.splice(d, 1, v), v.tabRetention === "preview" ? N(h, v, "start") : h;
|
|
1261
|
+
});
|
|
1262
|
+
return n(I, a, v);
|
|
1263
|
+
}, f = (m, a = {}) => {
|
|
1264
|
+
const d = s(m), l = t(), b = a.region ?? d.region ?? d.fallbackRegion ?? "main", v = l.regions[b], I = Et(l, b, d, a), S = I >= 0 ? v.widgets[I] : void 0, h = !a.replaceWidgetId && a.tabRetention === "preview" && a.resource ? be(l, d.id, a.resource.uri) : void 0, R = a.replaceWidgetId && S ? void 0 : Lt(d, l, a);
|
|
1265
|
+
let C;
|
|
1266
|
+
return h ? C = n(l, h.regionId, h.placement) : R ? C = c(d, R, b, I, a) : S?.contributionId === d.id ? C = o(d, b, I, S, a) : C = u(d, b, I, a), kt({
|
|
1267
|
+
openWidget: f,
|
|
1268
|
+
placement: C,
|
|
1269
|
+
requireWidget: s,
|
|
1270
|
+
widget: d
|
|
1271
|
+
}), n(t(), h?.regionId ?? b, C);
|
|
1272
|
+
};
|
|
1273
|
+
return {
|
|
1274
|
+
openWidget: f
|
|
1275
|
+
};
|
|
1276
|
+
}, xt = (e) => ({
|
|
1277
|
+
getPanel(t) {
|
|
1278
|
+
const s = e.getWidgets()[t];
|
|
1279
|
+
return s ? re(s) : void 0;
|
|
1280
|
+
},
|
|
1281
|
+
listPanels: () => e.listWidgets().map(re),
|
|
1282
|
+
listPanelInstances(t) {
|
|
1283
|
+
return (t ? e.getLayout().regions[t].widgets : Object.values(e.getLayout().regions).flatMap((n) => n.widgets)).map(F);
|
|
1284
|
+
},
|
|
1285
|
+
getActivePanel(t) {
|
|
1286
|
+
if (t) {
|
|
1287
|
+
const i = e.getLayout().regions[t], r = i.widgets.find((o) => o.widgetId === i.activeWidgetId) ?? i.widgets[0];
|
|
1288
|
+
return r ? F(r) : void 0;
|
|
1289
|
+
}
|
|
1290
|
+
const s = e.getLayout().activeWidgetId;
|
|
1291
|
+
if (!s) return;
|
|
1292
|
+
const n = $(e.getLayout(), s);
|
|
1293
|
+
return n ? F(n.placement) : void 0;
|
|
1294
|
+
},
|
|
1295
|
+
openPanel(t, s = {}) {
|
|
1296
|
+
if (!e.getWidgets()[t]) throw new Error(`Panel not registered: ${t}`);
|
|
1297
|
+
return F(e.widgetOpeners.openWidget(t, te(s)));
|
|
1298
|
+
},
|
|
1299
|
+
updatePanel(t, s) {
|
|
1300
|
+
if (!$(e.getLayout(), t))
|
|
1301
|
+
throw new Error(`Panel instance not found: ${t}`);
|
|
1302
|
+
return F(e.placementMethods.updateWidgetPlacement(t, te(s)));
|
|
1303
|
+
},
|
|
1304
|
+
reorderPanel(t, s) {
|
|
1305
|
+
if (!$(e.getLayout(), t))
|
|
1306
|
+
throw new Error(`Panel instance not found: ${t}`);
|
|
1307
|
+
e.placementMethods.reorderWidget(t, s);
|
|
1308
|
+
},
|
|
1309
|
+
activatePanel(t) {
|
|
1310
|
+
if (!$(e.getLayout(), t))
|
|
1311
|
+
throw new Error(`Panel instance not found: ${t}`);
|
|
1312
|
+
return F(e.placementMethods.activateWidget(t));
|
|
1313
|
+
},
|
|
1314
|
+
closePanel(t) {
|
|
1315
|
+
const s = $(e.getLayout(), t);
|
|
1316
|
+
if (!s) throw new Error(`Panel instance not found: ${t}`);
|
|
1317
|
+
if (s.placement.closable !== !0) throw new Error(`Panel cannot be closed: ${t}`);
|
|
1318
|
+
const n = Q(e.getLayout(), t);
|
|
1319
|
+
if (!n) throw new Error(`Panel instance not found: ${t}`);
|
|
1320
|
+
return e.setLayout(n.layout), e.persistLayout(), n.activePlacement ? F(n.activePlacement) : void 0;
|
|
1321
|
+
}
|
|
1322
|
+
}), Mt = (e, t, s) => {
|
|
1323
|
+
const {
|
|
1324
|
+
side: n,
|
|
1325
|
+
...i
|
|
1326
|
+
} = t, r = e.region, o = K.find((c) => c === e.fallbackRegion);
|
|
1327
|
+
return {
|
|
1328
|
+
...i,
|
|
1329
|
+
region: se[r][n],
|
|
1330
|
+
fallbackRegion: o ? se[o][n] : void 0,
|
|
1331
|
+
panelMenuOwner: {
|
|
1332
|
+
level: s === "sub-panel" ? "sub-panel" : "panel",
|
|
1333
|
+
contributionId: e.id
|
|
1334
|
+
},
|
|
1335
|
+
role: "panel-menu"
|
|
1336
|
+
};
|
|
1337
|
+
}, z = (e) => {
|
|
1338
|
+
const {
|
|
1339
|
+
closable: t,
|
|
1340
|
+
metadata: s,
|
|
1341
|
+
panel: n,
|
|
1342
|
+
registerWidget: i,
|
|
1343
|
+
role: r
|
|
1344
|
+
} = e, {
|
|
1345
|
+
panelMenus: o = [],
|
|
1346
|
+
...c
|
|
1347
|
+
} = n, u = [];
|
|
1348
|
+
if (o.length > 0 && !K.includes(n.region))
|
|
1349
|
+
throw new Error(`Panel Menus require a Panel region: ${n.id}`);
|
|
1350
|
+
try {
|
|
1351
|
+
const f = {
|
|
1352
|
+
...c,
|
|
1353
|
+
closable: t ?? r === "sub-panel",
|
|
1354
|
+
ownedPanelMenuIds: o.map((m) => m.id),
|
|
1355
|
+
role: r
|
|
1356
|
+
};
|
|
1357
|
+
u.push(i(f, s));
|
|
1358
|
+
for (const m of o)
|
|
1359
|
+
u.push(i(Mt(n, m, r), s));
|
|
1360
|
+
} catch (f) {
|
|
1361
|
+
for (const m of u.reverse()) m.dispose();
|
|
1362
|
+
throw f;
|
|
1363
|
+
}
|
|
1364
|
+
return P(() => {
|
|
1365
|
+
for (const f of u.reverse()) f.dispose();
|
|
1366
|
+
});
|
|
1367
|
+
}, Dt = (e) => {
|
|
1368
|
+
const t = (o) => o.eligibleLocations ? "sub-panel" : "content";
|
|
1369
|
+
return {
|
|
1370
|
+
registerPanel: (o, c) => z({
|
|
1371
|
+
panel: o,
|
|
1372
|
+
role: t(o),
|
|
1373
|
+
closable: o.closable,
|
|
1374
|
+
metadata: c,
|
|
1375
|
+
registerWidget: e.registerWidget
|
|
1376
|
+
}),
|
|
1377
|
+
registerLocation: (o, c) => z({
|
|
1378
|
+
panel: o,
|
|
1379
|
+
role: "location",
|
|
1380
|
+
metadata: c,
|
|
1381
|
+
registerWidget: e.registerWidget
|
|
1382
|
+
}),
|
|
1383
|
+
registerSubPanel: (o, c) => z({
|
|
1384
|
+
panel: o,
|
|
1385
|
+
role: "sub-panel",
|
|
1386
|
+
metadata: c,
|
|
1387
|
+
registerWidget: e.registerWidget
|
|
1388
|
+
}),
|
|
1389
|
+
registerPanelMenu: (o, c) => e.registerWidget({
|
|
1390
|
+
...o,
|
|
1391
|
+
role: "panel-menu"
|
|
1392
|
+
}, c)
|
|
1393
|
+
};
|
|
1394
|
+
}, Bt = (e) => (t) => {
|
|
1395
|
+
const s = e.getLayout(), n = $(s, t);
|
|
1396
|
+
if (!n) throw new Error(`Panel instance not found: ${t}`);
|
|
1397
|
+
if (n.regionId !== "main") return e.panelMethods.activatePanel(t);
|
|
1398
|
+
const i = {
|
|
1399
|
+
...n.placement,
|
|
1400
|
+
role: "location"
|
|
1401
|
+
}, r = new Set(e.getWidget(i.contributionId)?.ownedPanelMenuIds ?? []), o = Object.fromEntries(Object.entries(s.regions).map(([c, u]) => [c, {
|
|
1402
|
+
...u,
|
|
1403
|
+
widgets: u.widgets.map((f) => f.widgetId === t ? i : !r.has(f.contributionId) || f.resourceUri !== i.resourceUri ? f : {
|
|
1404
|
+
...f,
|
|
1405
|
+
ownerResourceUri: i.resourceUri
|
|
1406
|
+
})
|
|
1407
|
+
}]));
|
|
1408
|
+
return e.applyAndActivate({
|
|
1409
|
+
...s,
|
|
1410
|
+
regions: o
|
|
1411
|
+
}, "main", i), e.panelMethods.getActivePanel("main");
|
|
1412
|
+
}, Ot = (e, t) => {
|
|
1413
|
+
const s = e[t];
|
|
1414
|
+
if (!s) throw new Error(`Widget not registered: ${t}`);
|
|
1415
|
+
return s;
|
|
1416
|
+
}, At = (e = {}) => {
|
|
1417
|
+
let t;
|
|
1418
|
+
const s = de(), n = de(), i = e.persistence?.getLayout(t), r = ce(e.defaultRegionVisibility, i), o = L({
|
|
1419
|
+
name: "workbench.layout",
|
|
1420
|
+
initialState: {
|
|
1421
|
+
layout: r,
|
|
1422
|
+
widgets: {},
|
|
1423
|
+
placeholders: {}
|
|
1424
|
+
}
|
|
1425
|
+
}), c = () => o.getState().layout, u = () => o.getState().placeholders, f = () => o.getState().widgets, m = (g) => u()[g], a = vt({
|
|
1426
|
+
getLayout: c,
|
|
1427
|
+
getWidgets: f,
|
|
1428
|
+
getPlaceholder: m
|
|
1429
|
+
}), d = pt({
|
|
1430
|
+
getPlaceholders: u,
|
|
1431
|
+
getWidgets: f
|
|
1432
|
+
}), l = () => e.persistence?.setLayout(J(c()), t), b = (g) => Ot(f(), g), v = (g) => {
|
|
1433
|
+
const y = o.getState();
|
|
1434
|
+
y.layout !== g && o.setState({
|
|
1435
|
+
...y,
|
|
1436
|
+
layout: g
|
|
1437
|
+
}, !1, "setLayout");
|
|
1438
|
+
}, I = (g, y) => {
|
|
1439
|
+
const p = c(), w = p.regions[g], W = y(w);
|
|
1440
|
+
W !== w && (v({
|
|
1441
|
+
...p,
|
|
1442
|
+
regions: {
|
|
1443
|
+
...p.regions,
|
|
1444
|
+
[g]: W
|
|
1445
|
+
}
|
|
1446
|
+
}), l());
|
|
1447
|
+
}, S = (g, y, p) => (v(Le(g, y, p)), l(), p), h = Rt({
|
|
1448
|
+
store: o,
|
|
1449
|
+
getPlaceholders: u,
|
|
1450
|
+
getWidgets: f,
|
|
1451
|
+
persistLayout: l
|
|
1452
|
+
}), R = Dt({
|
|
1453
|
+
registerWidget: h.registerWidget
|
|
1454
|
+
}), C = Tt({
|
|
1455
|
+
getLayout: c,
|
|
1456
|
+
requireWidget: b,
|
|
1457
|
+
applyAndActivate: S
|
|
1458
|
+
}), T = It({
|
|
1459
|
+
getLayout: c,
|
|
1460
|
+
requireWidget: b,
|
|
1461
|
+
setLayout: v,
|
|
1462
|
+
persistLayout: l,
|
|
1463
|
+
applyAndActivate: S
|
|
1464
|
+
}), M = xt({
|
|
1465
|
+
getLayout: c,
|
|
1466
|
+
getWidgets: f,
|
|
1467
|
+
listWidgets: d.listWidgets,
|
|
1468
|
+
persistLayout: l,
|
|
1469
|
+
placementMethods: T,
|
|
1470
|
+
setLayout: v,
|
|
1471
|
+
widgetOpeners: C
|
|
1472
|
+
}), H = Bt({
|
|
1473
|
+
applyAndActivate: S,
|
|
1474
|
+
getLayout: c,
|
|
1475
|
+
getWidget: b,
|
|
1476
|
+
panelMethods: M
|
|
1477
|
+
});
|
|
1478
|
+
return {
|
|
1479
|
+
store: o,
|
|
1480
|
+
registerPlaceholder: h.registerPlaceholder,
|
|
1481
|
+
registerWidget: h.registerWidget,
|
|
1482
|
+
...R,
|
|
1483
|
+
unregisterWidget(g, y = {}) {
|
|
1484
|
+
const p = o.getState();
|
|
1485
|
+
if (!p.widgets[g]) return;
|
|
1486
|
+
const {
|
|
1487
|
+
[g]: w,
|
|
1488
|
+
...W
|
|
1489
|
+
} = p.widgets, k = y.removePlacements === !1 ? p.layout : ye(p.layout, g);
|
|
1490
|
+
o.setState({
|
|
1491
|
+
...p,
|
|
1492
|
+
widgets: W,
|
|
1493
|
+
layout: k
|
|
1494
|
+
}, !1, "unregisterWidget"), y.persist !== !1 && l();
|
|
1495
|
+
},
|
|
1496
|
+
getWidget(g) {
|
|
1497
|
+
return f()[g];
|
|
1498
|
+
},
|
|
1499
|
+
getPlaceholder: m,
|
|
1500
|
+
getRegionSize: a.getRegionSize,
|
|
1501
|
+
getRegionCollapsible: a.getRegionCollapsible,
|
|
1502
|
+
getRegionHeaderBorderBottom: a.getRegionHeaderBorderBottom,
|
|
1503
|
+
setRegionVisible(g, y) {
|
|
1504
|
+
I(g, (p) => p.visible === y ? p : {
|
|
1505
|
+
...p,
|
|
1506
|
+
visible: y
|
|
1507
|
+
});
|
|
1508
|
+
},
|
|
1509
|
+
setRegionSize(g, y) {
|
|
1510
|
+
I(g, (p) => p.size === y ? p : {
|
|
1511
|
+
...p,
|
|
1512
|
+
size: y
|
|
1513
|
+
});
|
|
1514
|
+
},
|
|
1515
|
+
listPlaceholders: d.listPlaceholders,
|
|
1516
|
+
listWidgets: d.listWidgets,
|
|
1517
|
+
...M,
|
|
1518
|
+
openWidget: C.openWidget,
|
|
1519
|
+
...T,
|
|
1520
|
+
establishLocation: H,
|
|
1521
|
+
setRegionActiveWidget(g, y) {
|
|
1522
|
+
const p = c(), w = p.regions[g], W = y ? w.widgets.find((V) => V.widgetId === y) : void 0;
|
|
1523
|
+
if (y && !W) throw new Error(`Widget placement not found in ${g}: ${y}`);
|
|
1524
|
+
if (w.activeWidgetId === y) return;
|
|
1525
|
+
const k = {
|
|
1526
|
+
...p,
|
|
1527
|
+
activeWidgetId: p.activeWidgetId === w.activeWidgetId ? W?.widgetId : p.activeWidgetId,
|
|
1528
|
+
activeResourceUri: p.activeWidgetId === w.activeWidgetId ? W?.resourceUri : p.activeResourceUri,
|
|
1529
|
+
regions: {
|
|
1530
|
+
...p.regions,
|
|
1531
|
+
[g]: {
|
|
1532
|
+
...w,
|
|
1533
|
+
activeWidgetId: W?.widgetId
|
|
1534
|
+
}
|
|
1535
|
+
}
|
|
1536
|
+
}, x = g !== "side" && K.includes(g) ? ne(k, B(k), g, W?.role === "sub-panel" ? W.widgetId : void 0) : k;
|
|
1537
|
+
v(x), l();
|
|
1538
|
+
},
|
|
1539
|
+
closeWidget(g) {
|
|
1540
|
+
const y = Q(c(), g);
|
|
1541
|
+
if (!y) throw new Error(`Widget placement not found: ${g}`);
|
|
1542
|
+
if (y.closedPlacement.closable !== !0) throw new Error(`Widget cannot be closed: ${g}`);
|
|
1543
|
+
return v(y.layout), l(), y.activePlacement;
|
|
1544
|
+
},
|
|
1545
|
+
removeWidgetPlacement(g) {
|
|
1546
|
+
const y = Q(c(), g);
|
|
1547
|
+
if (y)
|
|
1548
|
+
return v(y.layout), l(), y.activePlacement;
|
|
1549
|
+
},
|
|
1550
|
+
clearRegion(g) {
|
|
1551
|
+
const y = c(), p = y.regions[g], w = p.activeWidgetId, W = {
|
|
1552
|
+
...y,
|
|
1553
|
+
regions: {
|
|
1554
|
+
...y.regions,
|
|
1555
|
+
[g]: {
|
|
1556
|
+
...p,
|
|
1557
|
+
widgets: [],
|
|
1558
|
+
activeWidgetId: void 0
|
|
1559
|
+
}
|
|
1560
|
+
}
|
|
1561
|
+
};
|
|
1562
|
+
let k = w && y.activeWidgetId === w ? {
|
|
1563
|
+
...W,
|
|
1564
|
+
activeWidgetId: void 0,
|
|
1565
|
+
activeResourceUri: void 0
|
|
1566
|
+
} : W;
|
|
1567
|
+
g !== "side" && K.includes(g) && (k = ne(k, B(k), g, void 0)), v(k), l();
|
|
1568
|
+
},
|
|
1569
|
+
resetRegions() {
|
|
1570
|
+
const g = c(), y = {};
|
|
1571
|
+
for (const [p, w] of Object.entries(g.regions))
|
|
1572
|
+
y[p] = {
|
|
1573
|
+
...w,
|
|
1574
|
+
widgets: [],
|
|
1575
|
+
activeWidgetId: void 0
|
|
1576
|
+
};
|
|
1577
|
+
v({
|
|
1578
|
+
regions: y,
|
|
1579
|
+
locationSubPanelSelections: {},
|
|
1580
|
+
activeWidgetId: void 0,
|
|
1581
|
+
activeLocationWidgetId: void 0,
|
|
1582
|
+
activeResourceUri: void 0
|
|
1583
|
+
}), l();
|
|
1584
|
+
},
|
|
1585
|
+
getLayout: c,
|
|
1586
|
+
restoreLayout(g) {
|
|
1587
|
+
v(Se(g, e.defaultRegionVisibility)), l();
|
|
1588
|
+
},
|
|
1589
|
+
setPersistenceScope(g, y = {}) {
|
|
1590
|
+
if (t === g) return;
|
|
1591
|
+
e.persistence?.setLayout(J(c()), t), s.notify(g), t = g;
|
|
1592
|
+
const p = e.persistence?.getLayout(t), w = ce(e.defaultRegionVisibility, p), W = Ct(c(), w), k = Wt(c(), W, y.carryRegionState ?? []), x = o.getState();
|
|
1593
|
+
o.setState({
|
|
1594
|
+
...x,
|
|
1595
|
+
layout: k
|
|
1596
|
+
}, !1, "setPersistenceScope"), n.notify(t);
|
|
1597
|
+
},
|
|
1598
|
+
getPersistenceScope: () => t,
|
|
1599
|
+
onWillChangePersistenceScope: s.subscribe,
|
|
1600
|
+
onDidChangePersistenceScope: n.subscribe
|
|
1601
|
+
};
|
|
1602
|
+
}, le = (e) => e.join("/"), $t = (e) => {
|
|
1603
|
+
const t = L({
|
|
1604
|
+
name: "workbench.menus",
|
|
1605
|
+
initialState: {
|
|
1606
|
+
itemsByPath: {}
|
|
1607
|
+
}
|
|
1608
|
+
});
|
|
1609
|
+
return {
|
|
1610
|
+
menuStore: t,
|
|
1611
|
+
registerMenuItem(s, n, i) {
|
|
1612
|
+
if (!e.commands.getCommand(n.commandId)) throw new Error(`Menu command not registered: ${n.commandId}`);
|
|
1613
|
+
const r = le(s), o = {
|
|
1614
|
+
...D(i),
|
|
1615
|
+
...n,
|
|
1616
|
+
path: s
|
|
1617
|
+
}, c = t.getState(), u = c.itemsByPath[r] ?? [];
|
|
1618
|
+
return t.setState({
|
|
1619
|
+
itemsByPath: {
|
|
1620
|
+
...c.itemsByPath,
|
|
1621
|
+
[r]: [...u, o]
|
|
1622
|
+
}
|
|
1623
|
+
}, !1, "registerMenuItem"), P(() => {
|
|
1624
|
+
const f = t.getState(), m = f.itemsByPath[r] ?? [], a = m.filter((d) => d !== o);
|
|
1625
|
+
a.length !== m.length && t.setState({
|
|
1626
|
+
itemsByPath: {
|
|
1627
|
+
...f.itemsByPath,
|
|
1628
|
+
[r]: a
|
|
1629
|
+
}
|
|
1630
|
+
}, !1, "unregisterMenuItem");
|
|
1631
|
+
});
|
|
1632
|
+
},
|
|
1633
|
+
listMenuItems(s) {
|
|
1634
|
+
return [...t.getState().itemsByPath[le(s)] ?? []].sort((n, i) => {
|
|
1635
|
+
const r = n.order ?? 0, o = i.order ?? 0;
|
|
1636
|
+
return r - o || O(n, i);
|
|
1637
|
+
});
|
|
1638
|
+
}
|
|
1639
|
+
};
|
|
1640
|
+
}, ue = (e, t) => t.priority - e.priority || e.id.localeCompare(t.id), Ft = () => {
|
|
1641
|
+
throw new Error("navigation.openTarget: no dispatcher available (configure resolveDispatcher)");
|
|
1642
|
+
}, Nt = async (e, t) => e.kind === "resource" ? t.openResource(e.resource, e.input) : e.kind === "panel" ? t.openPanel(e.panelId, e.input) : t.executeCommand(e.commandId, e.args), Kt = (e, t) => {
|
|
1643
|
+
if (e.kind === "resource" && t.canOpenResource?.(e.resource) === !1)
|
|
1644
|
+
throw new Error(`Cannot open navigation resource target: ${e.resource.uri}`);
|
|
1645
|
+
if (e.kind === "panel" && t.canOpenPanel?.(e.panelId) === !1)
|
|
1646
|
+
throw new Error(`Cannot open navigation Panel target: ${e.panelId}`);
|
|
1647
|
+
if (e.kind === "command" && t.canExecuteCommand?.(e.commandId) === !1)
|
|
1648
|
+
throw new Error(`Cannot open navigation command target: ${e.commandId}`);
|
|
1649
|
+
}, Ut = (e) => e.kind === "compound" ? e.targets : [e], jt = (e = {}) => {
|
|
1650
|
+
const t = e.resolveDispatcher ?? Ft, s = L({
|
|
1651
|
+
name: "workbench.navigation",
|
|
1652
|
+
initialState: {
|
|
1653
|
+
parsers: {},
|
|
1654
|
+
navigators: {}
|
|
1655
|
+
}
|
|
1656
|
+
}), n = (r, o) => {
|
|
1657
|
+
const {
|
|
1658
|
+
[o]: c,
|
|
1659
|
+
...u
|
|
1660
|
+
} = r;
|
|
1661
|
+
return u;
|
|
1662
|
+
}, i = {
|
|
1663
|
+
store: s,
|
|
1664
|
+
registerParser(r, o) {
|
|
1665
|
+
const c = s.getState();
|
|
1666
|
+
if (c.parsers[r.id]) throw new Error(`Navigation parser already registered: ${r.id}`);
|
|
1667
|
+
const {
|
|
1668
|
+
priority: u,
|
|
1669
|
+
...f
|
|
1670
|
+
} = r, m = {
|
|
1671
|
+
...f,
|
|
1672
|
+
...D({
|
|
1673
|
+
...o,
|
|
1674
|
+
priority: o?.priority ?? u
|
|
1675
|
+
})
|
|
1676
|
+
};
|
|
1677
|
+
return s.setState({
|
|
1678
|
+
...c,
|
|
1679
|
+
parsers: {
|
|
1680
|
+
...c.parsers,
|
|
1681
|
+
[r.id]: m
|
|
1682
|
+
}
|
|
1683
|
+
}, !1, "registerParser"), P(() => {
|
|
1684
|
+
const a = s.getState();
|
|
1685
|
+
a.parsers[r.id] === m && s.setState({
|
|
1686
|
+
...a,
|
|
1687
|
+
parsers: n(a.parsers, r.id)
|
|
1688
|
+
}, !1, "unregisterParser");
|
|
1689
|
+
});
|
|
1690
|
+
},
|
|
1691
|
+
listParsers() {
|
|
1692
|
+
return Object.values(s.getState().parsers).sort(ue);
|
|
1693
|
+
},
|
|
1694
|
+
resolveLocation(r) {
|
|
1695
|
+
const o = this.listParsers().find((c) => c.canParse(r));
|
|
1696
|
+
if (!o) throw new Error(`No navigation parser registered for location: ${r}`);
|
|
1697
|
+
return o.parse(r);
|
|
1698
|
+
},
|
|
1699
|
+
async openTarget(r) {
|
|
1700
|
+
const o = t(), c = Ut(r), u = [];
|
|
1701
|
+
for (const m of c) Kt(m, o);
|
|
1702
|
+
const f = r.kind === "compound" ? o.createCheckpoint?.() : void 0;
|
|
1703
|
+
try {
|
|
1704
|
+
for (const m of c) {
|
|
1705
|
+
const a = await Nt(m, o);
|
|
1706
|
+
u.push(a);
|
|
1707
|
+
}
|
|
1708
|
+
} catch (m) {
|
|
1709
|
+
throw f?.(), m;
|
|
1710
|
+
}
|
|
1711
|
+
return u;
|
|
1712
|
+
},
|
|
1713
|
+
async navigate(r) {
|
|
1714
|
+
return i.openTarget(i.resolveLocation(r));
|
|
1715
|
+
},
|
|
1716
|
+
registerNavigator(r, o) {
|
|
1717
|
+
const c = s.getState();
|
|
1718
|
+
if (c.navigators[r.id]) throw new Error(`Resource navigator already registered: ${r.id}`);
|
|
1719
|
+
const {
|
|
1720
|
+
priority: u,
|
|
1721
|
+
...f
|
|
1722
|
+
} = r, m = {
|
|
1723
|
+
...f,
|
|
1724
|
+
...D({
|
|
1725
|
+
...o,
|
|
1726
|
+
priority: o?.priority ?? u
|
|
1727
|
+
})
|
|
1728
|
+
};
|
|
1729
|
+
return s.setState({
|
|
1730
|
+
...c,
|
|
1731
|
+
navigators: {
|
|
1732
|
+
...c.navigators,
|
|
1733
|
+
[r.id]: m
|
|
1734
|
+
}
|
|
1735
|
+
}, !1, "registerNavigator"), P(() => {
|
|
1736
|
+
const a = s.getState();
|
|
1737
|
+
a.navigators[r.id] === m && s.setState({
|
|
1738
|
+
...a,
|
|
1739
|
+
navigators: n(a.navigators, r.id)
|
|
1740
|
+
}, !1, "unregisterNavigator");
|
|
1741
|
+
});
|
|
1742
|
+
},
|
|
1743
|
+
listNavigators() {
|
|
1744
|
+
return Object.values(s.getState().navigators).sort(ue);
|
|
1745
|
+
},
|
|
1746
|
+
createHref(r) {
|
|
1747
|
+
const o = this.listNavigators().find((c) => c.createHref && c.canNavigate(r));
|
|
1748
|
+
if (!o?.createHref) throw new Error(`No navigator href registered for resource kind: ${r.kind}`);
|
|
1749
|
+
return o.createHref(r);
|
|
1750
|
+
},
|
|
1751
|
+
async navigateResource(r) {
|
|
1752
|
+
const o = this.listNavigators().find((c) => c.canNavigate(r));
|
|
1753
|
+
if (!o) throw new Error(`No navigator registered for resource kind: ${r.kind}`);
|
|
1754
|
+
return await o.navigate(r);
|
|
1755
|
+
}
|
|
1756
|
+
};
|
|
1757
|
+
return i;
|
|
1758
|
+
}, _t = () => {
|
|
1759
|
+
const e = L({
|
|
1760
|
+
name: "workbench.notifications",
|
|
1761
|
+
initialState: {
|
|
1762
|
+
notifications: {}
|
|
1763
|
+
}
|
|
1764
|
+
}), t = /* @__PURE__ */ new Set();
|
|
1765
|
+
let s = 0;
|
|
1766
|
+
const n = (i) => {
|
|
1767
|
+
for (const r of t) r(i);
|
|
1768
|
+
};
|
|
1769
|
+
return {
|
|
1770
|
+
store: e,
|
|
1771
|
+
show(i, r) {
|
|
1772
|
+
let o = i.id;
|
|
1773
|
+
o || (s += 1, o = `workbench.notification.${s.toString()}`);
|
|
1774
|
+
const c = {
|
|
1775
|
+
...D(r),
|
|
1776
|
+
...i,
|
|
1777
|
+
id: o,
|
|
1778
|
+
createdAt: i.createdAt ?? (/* @__PURE__ */ new Date()).toISOString()
|
|
1779
|
+
}, u = e.getState();
|
|
1780
|
+
return e.setState({
|
|
1781
|
+
notifications: {
|
|
1782
|
+
...u.notifications,
|
|
1783
|
+
[o]: c
|
|
1784
|
+
}
|
|
1785
|
+
}, !1, "showNotification"), n({
|
|
1786
|
+
type: "show",
|
|
1787
|
+
id: o,
|
|
1788
|
+
notification: c
|
|
1789
|
+
}), c;
|
|
1790
|
+
},
|
|
1791
|
+
dismiss(i) {
|
|
1792
|
+
const r = e.getState();
|
|
1793
|
+
if (!r.notifications[i]) return !1;
|
|
1794
|
+
const {
|
|
1795
|
+
[i]: o,
|
|
1796
|
+
...c
|
|
1797
|
+
} = r.notifications;
|
|
1798
|
+
return e.setState({
|
|
1799
|
+
notifications: c
|
|
1800
|
+
}, !1, "dismissNotification"), n({
|
|
1801
|
+
type: "dismiss",
|
|
1802
|
+
id: i
|
|
1803
|
+
}), !0;
|
|
1804
|
+
},
|
|
1805
|
+
clear() {
|
|
1806
|
+
const i = Object.keys(e.getState().notifications);
|
|
1807
|
+
e.setState({
|
|
1808
|
+
notifications: {}
|
|
1809
|
+
}, !1, "clearNotifications");
|
|
1810
|
+
for (const r of i) n({
|
|
1811
|
+
type: "dismiss",
|
|
1812
|
+
id: r
|
|
1813
|
+
});
|
|
1814
|
+
},
|
|
1815
|
+
listNotifications() {
|
|
1816
|
+
return Object.values(e.getState().notifications).sort((i, r) => r.createdAt.localeCompare(i.createdAt));
|
|
1817
|
+
},
|
|
1818
|
+
subscribe(i) {
|
|
1819
|
+
return t.add(i), P(() => {
|
|
1820
|
+
t.delete(i);
|
|
1821
|
+
});
|
|
1822
|
+
}
|
|
1823
|
+
};
|
|
1824
|
+
}, ge = (e, t) => `${e}:${t.scope}:${t.scopeId ?? ""}`, Ht = () => {
|
|
1825
|
+
const e = /* @__PURE__ */ new Map();
|
|
1826
|
+
return {
|
|
1827
|
+
getValue(t, s) {
|
|
1828
|
+
return e.get(ge(t, s));
|
|
1829
|
+
},
|
|
1830
|
+
setValue(t, s, n) {
|
|
1831
|
+
e.set(ge(t, n), s);
|
|
1832
|
+
}
|
|
1833
|
+
};
|
|
1834
|
+
}, qt = (e = {}) => {
|
|
1835
|
+
const t = L({
|
|
1836
|
+
name: "workbench.preferences",
|
|
1837
|
+
initialState: {
|
|
1838
|
+
schemas: {}
|
|
1839
|
+
}
|
|
1840
|
+
}), s = e.persistence ?? Ht();
|
|
1841
|
+
return {
|
|
1842
|
+
store: t,
|
|
1843
|
+
registerSchema(n, i) {
|
|
1844
|
+
const r = Object.keys(n.properties), o = t.getState();
|
|
1845
|
+
for (const u of r)
|
|
1846
|
+
if (o.schemas[u]) throw new Error(`Preference schema already registered: ${u}`);
|
|
1847
|
+
const c = {};
|
|
1848
|
+
for (const u of r) {
|
|
1849
|
+
const f = n.properties[u];
|
|
1850
|
+
f && (c[u] = {
|
|
1851
|
+
...f,
|
|
1852
|
+
ownerId: i?.ownerId ?? "workbench.core",
|
|
1853
|
+
source: i?.source ?? "module"
|
|
1854
|
+
});
|
|
1855
|
+
}
|
|
1856
|
+
return t.setState({
|
|
1857
|
+
schemas: {
|
|
1858
|
+
...o.schemas,
|
|
1859
|
+
...c
|
|
1860
|
+
}
|
|
1861
|
+
}, !1, "registerSchema"), P(() => {
|
|
1862
|
+
const f = {
|
|
1863
|
+
...t.getState().schemas
|
|
1864
|
+
};
|
|
1865
|
+
for (const m of r) delete f[m];
|
|
1866
|
+
t.setState({
|
|
1867
|
+
schemas: f
|
|
1868
|
+
}, !1, "unregisterSchema");
|
|
1869
|
+
});
|
|
1870
|
+
},
|
|
1871
|
+
getSchema(n) {
|
|
1872
|
+
return t.getState().schemas[n];
|
|
1873
|
+
},
|
|
1874
|
+
setValue(n, i, r) {
|
|
1875
|
+
if (!t.getState().schemas[n]) throw new Error(`Preference schema not registered: ${n}`);
|
|
1876
|
+
s.setValue(n, i, r);
|
|
1877
|
+
},
|
|
1878
|
+
getValue(n, i) {
|
|
1879
|
+
if (i) {
|
|
1880
|
+
const o = s.getValue(n, i);
|
|
1881
|
+
if (o !== void 0) return o;
|
|
1882
|
+
}
|
|
1883
|
+
const r = s.getValue(n, {
|
|
1884
|
+
scope: "user"
|
|
1885
|
+
});
|
|
1886
|
+
return r !== void 0 ? r : t.getState().schemas[n]?.default;
|
|
1887
|
+
}
|
|
1888
|
+
};
|
|
1889
|
+
}, Vt = (e) => {
|
|
1890
|
+
const {
|
|
1891
|
+
rendererRegistry: t
|
|
1892
|
+
} = e, s = L({
|
|
1893
|
+
name: "workbench.controlsRenderers",
|
|
1894
|
+
initialState: {
|
|
1895
|
+
renderers: {}
|
|
1896
|
+
}
|
|
1897
|
+
}), n = /* @__PURE__ */ new Set();
|
|
1898
|
+
let i = () => null;
|
|
1899
|
+
const r = (o) => {
|
|
1900
|
+
const c = s.getState().renderers[o];
|
|
1901
|
+
if (!c) throw new Error(`Controls renderer not registered: ${o}`);
|
|
1902
|
+
return c;
|
|
1903
|
+
};
|
|
1904
|
+
return {
|
|
1905
|
+
controlsStore: s,
|
|
1906
|
+
setControlsRendererImplementation(o) {
|
|
1907
|
+
i = o;
|
|
1908
|
+
},
|
|
1909
|
+
registerControlsRenderer(o, c) {
|
|
1910
|
+
const u = s.getState();
|
|
1911
|
+
if (u.renderers[o.id])
|
|
1912
|
+
throw new Error(`Controls renderer already registered: ${o.id}`);
|
|
1913
|
+
const f = {
|
|
1914
|
+
...D(c),
|
|
1915
|
+
...o
|
|
1916
|
+
};
|
|
1917
|
+
s.setState({
|
|
1918
|
+
...u,
|
|
1919
|
+
renderers: {
|
|
1920
|
+
...u.renderers,
|
|
1921
|
+
[o.id]: f
|
|
1922
|
+
}
|
|
1923
|
+
}, !1, "registerControlsRenderer");
|
|
1924
|
+
const m = t.registerRenderer({
|
|
1925
|
+
id: o.id,
|
|
1926
|
+
render: (a) => i({
|
|
1927
|
+
...a,
|
|
1928
|
+
controlsRendererId: o.id
|
|
1929
|
+
})
|
|
1930
|
+
});
|
|
1931
|
+
return P(() => {
|
|
1932
|
+
m.dispose();
|
|
1933
|
+
const a = s.getState();
|
|
1934
|
+
if (a.renderers[o.id] !== f) return;
|
|
1935
|
+
const {
|
|
1936
|
+
[o.id]: d,
|
|
1937
|
+
...l
|
|
1938
|
+
} = a.renderers;
|
|
1939
|
+
s.setState({
|
|
1940
|
+
renderers: l
|
|
1941
|
+
}, !1, "unregisterControlsRenderer");
|
|
1942
|
+
});
|
|
1943
|
+
},
|
|
1944
|
+
getControlsRenderer(o) {
|
|
1945
|
+
return s.getState().renderers[o];
|
|
1946
|
+
},
|
|
1947
|
+
listControlsRenderers() {
|
|
1948
|
+
return Object.values(s.getState().renderers).sort(O);
|
|
1949
|
+
},
|
|
1950
|
+
refreshControlsRenderer(o) {
|
|
1951
|
+
r(o);
|
|
1952
|
+
const c = {
|
|
1953
|
+
controlsRendererId: o
|
|
1954
|
+
};
|
|
1955
|
+
for (const u of n) u(c);
|
|
1956
|
+
},
|
|
1957
|
+
onDidRefreshControlsRenderer(o) {
|
|
1958
|
+
return n.add(o), P(() => {
|
|
1959
|
+
n.delete(o);
|
|
1960
|
+
});
|
|
1961
|
+
}
|
|
1962
|
+
};
|
|
1963
|
+
}, zt = (e) => {
|
|
1964
|
+
const t = L({
|
|
1965
|
+
name: "workbench.dataTableRenderers",
|
|
1966
|
+
initialState: {
|
|
1967
|
+
renderers: {}
|
|
1968
|
+
}
|
|
1969
|
+
}), s = /* @__PURE__ */ new Set();
|
|
1970
|
+
let n = () => null;
|
|
1971
|
+
return {
|
|
1972
|
+
dataTableStore: t,
|
|
1973
|
+
setDataTableRendererImplementation(i) {
|
|
1974
|
+
n = i;
|
|
1975
|
+
},
|
|
1976
|
+
registerDataTableRenderer(i, r) {
|
|
1977
|
+
const o = t.getState();
|
|
1978
|
+
if (o.renderers[i.id])
|
|
1979
|
+
throw new Error(`Data table renderer already registered: ${i.id}`);
|
|
1980
|
+
const c = {
|
|
1981
|
+
...D(r),
|
|
1982
|
+
...i
|
|
1983
|
+
};
|
|
1984
|
+
t.setState({
|
|
1985
|
+
renderers: {
|
|
1986
|
+
...o.renderers,
|
|
1987
|
+
[i.id]: c
|
|
1988
|
+
}
|
|
1989
|
+
}, !1, "registerDataTableRenderer");
|
|
1990
|
+
const u = e.rendererRegistry.registerRenderer({
|
|
1991
|
+
id: i.id,
|
|
1992
|
+
render: (f) => n({
|
|
1993
|
+
...f,
|
|
1994
|
+
dataTableRendererId: i.id
|
|
1995
|
+
})
|
|
1996
|
+
});
|
|
1997
|
+
return P(() => {
|
|
1998
|
+
u.dispose();
|
|
1999
|
+
const f = t.getState();
|
|
2000
|
+
if (f.renderers[i.id] !== c) return;
|
|
2001
|
+
const {
|
|
2002
|
+
[i.id]: m,
|
|
2003
|
+
...a
|
|
2004
|
+
} = f.renderers;
|
|
2005
|
+
t.setState({
|
|
2006
|
+
renderers: a
|
|
2007
|
+
}, !1, "unregisterDataTableRenderer");
|
|
2008
|
+
});
|
|
2009
|
+
},
|
|
2010
|
+
getDataTableRenderer(i) {
|
|
2011
|
+
return t.getState().renderers[i];
|
|
2012
|
+
},
|
|
2013
|
+
listDataTableRenderers() {
|
|
2014
|
+
return Object.values(t.getState().renderers).sort(O);
|
|
2015
|
+
},
|
|
2016
|
+
refreshDataTableRenderer(i) {
|
|
2017
|
+
if (!t.getState().renderers[i]) throw new Error(`Data table renderer not registered: ${i}`);
|
|
2018
|
+
const r = {
|
|
2019
|
+
dataTableRendererId: i
|
|
2020
|
+
};
|
|
2021
|
+
for (const o of s) o(r);
|
|
2022
|
+
},
|
|
2023
|
+
onDidRefreshDataTableRenderer(i) {
|
|
2024
|
+
return s.add(i), P(() => s.delete(i));
|
|
2025
|
+
}
|
|
2026
|
+
};
|
|
2027
|
+
}, Qt = (e) => {
|
|
2028
|
+
const {
|
|
2029
|
+
rendererRegistry: t
|
|
2030
|
+
} = e, s = L({
|
|
2031
|
+
name: "workbench.fileRenderers",
|
|
2032
|
+
initialState: {
|
|
2033
|
+
renderers: {}
|
|
2034
|
+
}
|
|
2035
|
+
}), n = /* @__PURE__ */ new Set();
|
|
2036
|
+
let i = () => null;
|
|
2037
|
+
const r = (o) => {
|
|
2038
|
+
const c = s.getState().renderers[o];
|
|
2039
|
+
if (!c) throw new Error(`File renderer not registered: ${o}`);
|
|
2040
|
+
return c;
|
|
2041
|
+
};
|
|
2042
|
+
return {
|
|
2043
|
+
fileRendererStore: s,
|
|
2044
|
+
setFileRendererImplementation(o) {
|
|
2045
|
+
i = o;
|
|
2046
|
+
},
|
|
2047
|
+
registerFileRenderer(o, c) {
|
|
2048
|
+
const u = s.getState();
|
|
2049
|
+
if (u.renderers[o.id]) throw new Error(`File renderer already registered: ${o.id}`);
|
|
2050
|
+
const f = {
|
|
2051
|
+
...D(c),
|
|
2052
|
+
...o
|
|
2053
|
+
};
|
|
2054
|
+
s.setState({
|
|
2055
|
+
...u,
|
|
2056
|
+
renderers: {
|
|
2057
|
+
...u.renderers,
|
|
2058
|
+
[o.id]: f
|
|
2059
|
+
}
|
|
2060
|
+
}, !1, "registerFileRenderer");
|
|
2061
|
+
const m = t.registerRenderer({
|
|
2062
|
+
id: o.id,
|
|
2063
|
+
render: (a) => i({
|
|
2064
|
+
...a,
|
|
2065
|
+
fileRendererId: o.id
|
|
2066
|
+
})
|
|
2067
|
+
});
|
|
2068
|
+
return P(() => {
|
|
2069
|
+
m.dispose();
|
|
2070
|
+
const a = s.getState();
|
|
2071
|
+
if (a.renderers[o.id] !== f) return;
|
|
2072
|
+
const {
|
|
2073
|
+
[o.id]: d,
|
|
2074
|
+
...l
|
|
2075
|
+
} = a.renderers;
|
|
2076
|
+
s.setState({
|
|
2077
|
+
renderers: l
|
|
2078
|
+
}, !1, "unregisterFileRenderer");
|
|
2079
|
+
});
|
|
2080
|
+
},
|
|
2081
|
+
getFileRenderer(o) {
|
|
2082
|
+
return s.getState().renderers[o];
|
|
2083
|
+
},
|
|
2084
|
+
listFileRenderers() {
|
|
2085
|
+
return Object.values(s.getState().renderers).sort(O);
|
|
2086
|
+
},
|
|
2087
|
+
refreshFileRenderer(o) {
|
|
2088
|
+
r(o);
|
|
2089
|
+
const c = {
|
|
2090
|
+
fileRendererId: o
|
|
2091
|
+
};
|
|
2092
|
+
for (const u of n) u(c);
|
|
2093
|
+
},
|
|
2094
|
+
onDidRefreshFileRenderer(o) {
|
|
2095
|
+
return n.add(o), P(() => {
|
|
2096
|
+
n.delete(o);
|
|
2097
|
+
});
|
|
2098
|
+
}
|
|
2099
|
+
};
|
|
2100
|
+
}, Yt = (e) => {
|
|
2101
|
+
const {
|
|
2102
|
+
rendererRegistry: t
|
|
2103
|
+
} = e, s = L({
|
|
2104
|
+
name: "workbench.kanbanRenderers",
|
|
2105
|
+
initialState: {
|
|
2106
|
+
renderers: {}
|
|
2107
|
+
}
|
|
2108
|
+
}), n = /* @__PURE__ */ new Set();
|
|
2109
|
+
let i = () => null;
|
|
2110
|
+
const r = (o) => {
|
|
2111
|
+
const c = s.getState().renderers[o];
|
|
2112
|
+
if (!c) throw new Error(`Kanban renderer not registered: ${o}`);
|
|
2113
|
+
return c;
|
|
2114
|
+
};
|
|
2115
|
+
return {
|
|
2116
|
+
dataStore: s,
|
|
2117
|
+
setKanbanRendererImplementation(o) {
|
|
2118
|
+
i = o;
|
|
2119
|
+
},
|
|
2120
|
+
registerKanbanRenderer(o, c) {
|
|
2121
|
+
const u = s.getState();
|
|
2122
|
+
if (u.renderers[o.id]) throw new Error(`Kanban renderer already registered: ${o.id}`);
|
|
2123
|
+
const f = {
|
|
2124
|
+
...D(c),
|
|
2125
|
+
...o
|
|
2126
|
+
};
|
|
2127
|
+
s.setState({
|
|
2128
|
+
...u,
|
|
2129
|
+
renderers: {
|
|
2130
|
+
...u.renderers,
|
|
2131
|
+
[o.id]: f
|
|
2132
|
+
}
|
|
2133
|
+
}, !1, "registerKanbanRenderer");
|
|
2134
|
+
const m = t.registerRenderer({
|
|
2135
|
+
id: o.id,
|
|
2136
|
+
render: (a) => i({
|
|
2137
|
+
...a,
|
|
2138
|
+
kanbanRendererId: o.id
|
|
2139
|
+
})
|
|
2140
|
+
});
|
|
2141
|
+
return P(() => {
|
|
2142
|
+
m.dispose();
|
|
2143
|
+
const a = s.getState();
|
|
2144
|
+
if (a.renderers[o.id] !== f) return;
|
|
2145
|
+
const {
|
|
2146
|
+
[o.id]: d,
|
|
2147
|
+
...l
|
|
2148
|
+
} = a.renderers;
|
|
2149
|
+
s.setState({
|
|
2150
|
+
renderers: l
|
|
2151
|
+
}, !1, "unregisterKanbanRenderer");
|
|
2152
|
+
});
|
|
2153
|
+
},
|
|
2154
|
+
getKanbanRenderer(o) {
|
|
2155
|
+
return s.getState().renderers[o];
|
|
2156
|
+
},
|
|
2157
|
+
listKanbanRenderers() {
|
|
2158
|
+
return Object.values(s.getState().renderers).sort(O);
|
|
2159
|
+
},
|
|
2160
|
+
refreshKanbanRenderer(o) {
|
|
2161
|
+
r(o);
|
|
2162
|
+
const c = {
|
|
2163
|
+
kanbanRendererId: o
|
|
2164
|
+
};
|
|
2165
|
+
for (const u of n) u(c);
|
|
2166
|
+
},
|
|
2167
|
+
onDidRefreshKanbanRenderer(o) {
|
|
2168
|
+
return n.add(o), P(() => {
|
|
2169
|
+
n.delete(o);
|
|
2170
|
+
});
|
|
2171
|
+
}
|
|
2172
|
+
};
|
|
2173
|
+
}, fe = (e) => ({
|
|
2174
|
+
expandedNodeIds: [...e.defaultExpandedNodeIds ?? []],
|
|
2175
|
+
expandedSectionIds: [...e.defaultExpandedSectionIds ?? []]
|
|
2176
|
+
}), Gt = (e, t) => {
|
|
2177
|
+
const s = (t.defaultExpandedSectionIds ?? []).filter((n) => !e.expandedSectionIds.includes(n));
|
|
2178
|
+
return s.length === 0 ? e : {
|
|
2179
|
+
...e,
|
|
2180
|
+
expandedSectionIds: [...e.expandedSectionIds, ...s]
|
|
2181
|
+
};
|
|
2182
|
+
}, me = (e, t, s) => s ? e.includes(t) ? e : [...e, t] : e.includes(t) ? e.filter((n) => n !== t) : e, Jt = (e) => {
|
|
2183
|
+
const {
|
|
2184
|
+
rendererRegistry: t,
|
|
2185
|
+
persistence: s
|
|
2186
|
+
} = e, n = s?.getTreeStates(), i = L({
|
|
2187
|
+
name: "workbench.treeRenderers",
|
|
2188
|
+
initialState: {
|
|
2189
|
+
trees: {},
|
|
2190
|
+
statesByTreeId: n?.statesByTreeId ?? {},
|
|
2191
|
+
refreshKeysByTreeId: {}
|
|
2192
|
+
}
|
|
2193
|
+
}), r = /* @__PURE__ */ new Set();
|
|
2194
|
+
let o = () => null;
|
|
2195
|
+
const c = (a) => {
|
|
2196
|
+
const d = i.getState().trees[a];
|
|
2197
|
+
if (!d) throw new Error(`Tree renderer not registered: ${a}`);
|
|
2198
|
+
return d;
|
|
2199
|
+
}, u = (a) => {
|
|
2200
|
+
const d = i.getState(), l = d.statesByTreeId[a];
|
|
2201
|
+
if (l) return l;
|
|
2202
|
+
const b = d.trees[a];
|
|
2203
|
+
if (!b) throw new Error(`Tree renderer not registered: ${a}`);
|
|
2204
|
+
const v = fe(b);
|
|
2205
|
+
return i.setState({
|
|
2206
|
+
...d,
|
|
2207
|
+
statesByTreeId: {
|
|
2208
|
+
...d.statesByTreeId,
|
|
2209
|
+
[a]: v
|
|
2210
|
+
}
|
|
2211
|
+
}, !1, "ensureTreeState"), v;
|
|
2212
|
+
}, f = () => {
|
|
2213
|
+
if (!s) return;
|
|
2214
|
+
const a = {};
|
|
2215
|
+
for (const [d, l] of Object.entries(i.getState().statesByTreeId)) {
|
|
2216
|
+
const {
|
|
2217
|
+
loading: b,
|
|
2218
|
+
...v
|
|
2219
|
+
} = l;
|
|
2220
|
+
a[d] = v;
|
|
2221
|
+
}
|
|
2222
|
+
s.setTreeStates({
|
|
2223
|
+
statesByTreeId: a
|
|
2224
|
+
});
|
|
2225
|
+
}, m = (a, d, l) => {
|
|
2226
|
+
const b = u(a), v = d(b);
|
|
2227
|
+
if (v === b) return;
|
|
2228
|
+
const I = i.getState();
|
|
2229
|
+
i.setState({
|
|
2230
|
+
...I,
|
|
2231
|
+
statesByTreeId: {
|
|
2232
|
+
...I.statesByTreeId,
|
|
2233
|
+
[a]: v
|
|
2234
|
+
}
|
|
2235
|
+
}, !1, l), f();
|
|
2236
|
+
};
|
|
2237
|
+
return {
|
|
2238
|
+
treeStore: i,
|
|
2239
|
+
setTreeRendererImplementation(a) {
|
|
2240
|
+
o = a;
|
|
2241
|
+
},
|
|
2242
|
+
registerTreeRenderer(a, d) {
|
|
2243
|
+
const l = i.getState();
|
|
2244
|
+
if (l.trees[a.id]) throw new Error(`Tree renderer already registered: ${a.id}`);
|
|
2245
|
+
const b = {
|
|
2246
|
+
...D(d),
|
|
2247
|
+
...a
|
|
2248
|
+
}, v = l.statesByTreeId[a.id], I = v ? Gt(v, a) : fe(a);
|
|
2249
|
+
i.setState({
|
|
2250
|
+
...l,
|
|
2251
|
+
trees: {
|
|
2252
|
+
...l.trees,
|
|
2253
|
+
[a.id]: b
|
|
2254
|
+
},
|
|
2255
|
+
statesByTreeId: {
|
|
2256
|
+
...l.statesByTreeId,
|
|
2257
|
+
[a.id]: I
|
|
2258
|
+
}
|
|
2259
|
+
}, !1, "registerTreeRenderer");
|
|
2260
|
+
const S = t.registerRenderer({
|
|
2261
|
+
id: a.id,
|
|
2262
|
+
render: (h) => o({
|
|
2263
|
+
...h,
|
|
2264
|
+
treeId: a.id
|
|
2265
|
+
})
|
|
2266
|
+
});
|
|
2267
|
+
return P(() => {
|
|
2268
|
+
S.dispose();
|
|
2269
|
+
const h = i.getState();
|
|
2270
|
+
if (h.trees[a.id] !== b) return;
|
|
2271
|
+
const {
|
|
2272
|
+
[a.id]: R,
|
|
2273
|
+
...C
|
|
2274
|
+
} = h.trees, {
|
|
2275
|
+
[a.id]: T,
|
|
2276
|
+
...M
|
|
2277
|
+
} = h.statesByTreeId, {
|
|
2278
|
+
[a.id]: H,
|
|
2279
|
+
...g
|
|
2280
|
+
} = h.refreshKeysByTreeId;
|
|
2281
|
+
i.setState({
|
|
2282
|
+
trees: C,
|
|
2283
|
+
statesByTreeId: M,
|
|
2284
|
+
refreshKeysByTreeId: g
|
|
2285
|
+
}, !1, "unregisterTreeRenderer"), f();
|
|
2286
|
+
});
|
|
2287
|
+
},
|
|
2288
|
+
getTreeRenderer(a) {
|
|
2289
|
+
return i.getState().trees[a];
|
|
2290
|
+
},
|
|
2291
|
+
listTreeRenderers() {
|
|
2292
|
+
return Object.values(i.getState().trees).sort(O);
|
|
2293
|
+
},
|
|
2294
|
+
async getBody(a, d = {}) {
|
|
2295
|
+
return await c(a).getBody(d);
|
|
2296
|
+
},
|
|
2297
|
+
async getHeader(a, d = {}) {
|
|
2298
|
+
const l = c(a);
|
|
2299
|
+
return l.getHeader ? await l.getHeader(d) : [];
|
|
2300
|
+
},
|
|
2301
|
+
async getFooter(a, d = {}) {
|
|
2302
|
+
const l = c(a);
|
|
2303
|
+
return l.getFooter ? await l.getFooter(d) : [];
|
|
2304
|
+
},
|
|
2305
|
+
async getChildren(a, d, l = {}) {
|
|
2306
|
+
return await c(a).getChildren(d, l);
|
|
2307
|
+
},
|
|
2308
|
+
getTreeState(a) {
|
|
2309
|
+
const d = u(a);
|
|
2310
|
+
return {
|
|
2311
|
+
expandedNodeIds: [...d.expandedNodeIds],
|
|
2312
|
+
expandedSectionIds: [...d.expandedSectionIds],
|
|
2313
|
+
selectedNodeId: d.selectedNodeId,
|
|
2314
|
+
loading: d.loading
|
|
2315
|
+
};
|
|
2316
|
+
},
|
|
2317
|
+
setNodeExpanded(a, d, l) {
|
|
2318
|
+
c(a), m(a, (b) => {
|
|
2319
|
+
const v = me(b.expandedNodeIds, d, l);
|
|
2320
|
+
return v === b.expandedNodeIds ? b : {
|
|
2321
|
+
...b,
|
|
2322
|
+
expandedNodeIds: v
|
|
2323
|
+
};
|
|
2324
|
+
}, "setNodeExpanded");
|
|
2325
|
+
},
|
|
2326
|
+
setSectionExpanded(a, d, l) {
|
|
2327
|
+
c(a), m(a, (b) => {
|
|
2328
|
+
const v = me(b.expandedSectionIds, d, l);
|
|
2329
|
+
return v === b.expandedSectionIds ? b : {
|
|
2330
|
+
...b,
|
|
2331
|
+
expandedSectionIds: v
|
|
2332
|
+
};
|
|
2333
|
+
}, "setSectionExpanded");
|
|
2334
|
+
},
|
|
2335
|
+
setSelectedNode(a, d) {
|
|
2336
|
+
c(a), m(a, (l) => l.selectedNodeId === d ? l : {
|
|
2337
|
+
...l,
|
|
2338
|
+
selectedNodeId: d
|
|
2339
|
+
}, "setSelectedNode");
|
|
2340
|
+
},
|
|
2341
|
+
setLoading(a, d) {
|
|
2342
|
+
c(a);
|
|
2343
|
+
const l = u(a);
|
|
2344
|
+
if (l.loading === d) return;
|
|
2345
|
+
const b = i.getState();
|
|
2346
|
+
i.setState({
|
|
2347
|
+
...b,
|
|
2348
|
+
statesByTreeId: {
|
|
2349
|
+
...b.statesByTreeId,
|
|
2350
|
+
[a]: {
|
|
2351
|
+
...l,
|
|
2352
|
+
loading: d
|
|
2353
|
+
}
|
|
2354
|
+
}
|
|
2355
|
+
}, !1, "setLoading");
|
|
2356
|
+
},
|
|
2357
|
+
refresh(a) {
|
|
2358
|
+
c(a);
|
|
2359
|
+
const d = i.getState(), l = d.refreshKeysByTreeId[a] ?? 0;
|
|
2360
|
+
i.setState({
|
|
2361
|
+
...d,
|
|
2362
|
+
refreshKeysByTreeId: {
|
|
2363
|
+
...d.refreshKeysByTreeId,
|
|
2364
|
+
[a]: l + 1
|
|
2365
|
+
}
|
|
2366
|
+
}, !1, "refreshTreeRenderer");
|
|
2367
|
+
const b = {
|
|
2368
|
+
treeId: a
|
|
2369
|
+
};
|
|
2370
|
+
for (const v of r) v(b);
|
|
2371
|
+
},
|
|
2372
|
+
onDidRefresh(a) {
|
|
2373
|
+
return r.add(a), P(() => {
|
|
2374
|
+
r.delete(a);
|
|
2375
|
+
});
|
|
2376
|
+
}
|
|
2377
|
+
};
|
|
2378
|
+
}, he = (e, t) => (e.order ?? 0) - (t.order ?? 0) || O(e, t), Xt = () => {
|
|
2379
|
+
const e = L({
|
|
2380
|
+
name: "workbench.settings",
|
|
2381
|
+
initialState: {
|
|
2382
|
+
sections: {},
|
|
2383
|
+
panels: {},
|
|
2384
|
+
revision: 0
|
|
2385
|
+
}
|
|
2386
|
+
});
|
|
2387
|
+
return {
|
|
2388
|
+
store: e,
|
|
2389
|
+
refresh() {
|
|
2390
|
+
const t = e.getState();
|
|
2391
|
+
e.setState({
|
|
2392
|
+
...t,
|
|
2393
|
+
revision: t.revision + 1
|
|
2394
|
+
}, !1, "refreshSettings");
|
|
2395
|
+
},
|
|
2396
|
+
registerSection(t, s) {
|
|
2397
|
+
const n = e.getState();
|
|
2398
|
+
if (n.sections[t.id]) throw new Error(`Settings section already registered: ${t.id}`);
|
|
2399
|
+
const i = {
|
|
2400
|
+
...D(s),
|
|
2401
|
+
...t
|
|
2402
|
+
};
|
|
2403
|
+
return e.setState({
|
|
2404
|
+
...n,
|
|
2405
|
+
sections: {
|
|
2406
|
+
...n.sections,
|
|
2407
|
+
[t.id]: i
|
|
2408
|
+
}
|
|
2409
|
+
}, !1, "registerSection"), P(() => {
|
|
2410
|
+
const r = e.getState();
|
|
2411
|
+
if (r.sections[t.id] !== i) return;
|
|
2412
|
+
const {
|
|
2413
|
+
[t.id]: o,
|
|
2414
|
+
...c
|
|
2415
|
+
} = r.sections;
|
|
2416
|
+
e.setState({
|
|
2417
|
+
...r,
|
|
2418
|
+
sections: c
|
|
2419
|
+
}, !1, "unregisterSection");
|
|
2420
|
+
});
|
|
2421
|
+
},
|
|
2422
|
+
registerPanel(t, s) {
|
|
2423
|
+
const n = e.getState();
|
|
2424
|
+
if (n.panels[t.id]) throw new Error(`Settings panel already registered: ${t.id}`);
|
|
2425
|
+
const i = {
|
|
2426
|
+
...D(s),
|
|
2427
|
+
...t
|
|
2428
|
+
};
|
|
2429
|
+
return e.setState({
|
|
2430
|
+
...n,
|
|
2431
|
+
panels: {
|
|
2432
|
+
...n.panels,
|
|
2433
|
+
[t.id]: i
|
|
2434
|
+
}
|
|
2435
|
+
}, !1, "registerPanel"), P(() => {
|
|
2436
|
+
const r = e.getState();
|
|
2437
|
+
if (r.panels[t.id] !== i) return;
|
|
2438
|
+
const {
|
|
2439
|
+
[t.id]: o,
|
|
2440
|
+
...c
|
|
2441
|
+
} = r.panels;
|
|
2442
|
+
e.setState({
|
|
2443
|
+
...r,
|
|
2444
|
+
panels: c
|
|
2445
|
+
}, !1, "unregisterPanel");
|
|
2446
|
+
});
|
|
2447
|
+
},
|
|
2448
|
+
getSection(t) {
|
|
2449
|
+
return e.getState().sections[t];
|
|
2450
|
+
},
|
|
2451
|
+
getPanel(t) {
|
|
2452
|
+
return e.getState().panels[t];
|
|
2453
|
+
},
|
|
2454
|
+
listSections() {
|
|
2455
|
+
return Object.values(e.getState().sections).sort(he);
|
|
2456
|
+
},
|
|
2457
|
+
listPanels() {
|
|
2458
|
+
return Object.values(e.getState().panels).sort(he);
|
|
2459
|
+
}
|
|
2460
|
+
};
|
|
2461
|
+
}, Zt = () => {
|
|
2462
|
+
const e = L({
|
|
2463
|
+
name: "workbench.fileIconThemes",
|
|
2464
|
+
initialState: {
|
|
2465
|
+
themes: []
|
|
2466
|
+
}
|
|
2467
|
+
}), t = /* @__PURE__ */ new Set(), s = () => {
|
|
2468
|
+
e.setState({
|
|
2469
|
+
themes: [...t].flat()
|
|
2470
|
+
}, !1, "syncFileIconThemes");
|
|
2471
|
+
};
|
|
2472
|
+
return {
|
|
2473
|
+
store: e,
|
|
2474
|
+
register(n) {
|
|
2475
|
+
return t.add(n), s(), P(() => {
|
|
2476
|
+
t.delete(n) && s();
|
|
2477
|
+
});
|
|
2478
|
+
},
|
|
2479
|
+
listThemes() {
|
|
2480
|
+
return e.getState().themes;
|
|
2481
|
+
}
|
|
2482
|
+
};
|
|
2483
|
+
}, er = () => {
|
|
2484
|
+
const e = L({
|
|
2485
|
+
name: "workbench.themes",
|
|
2486
|
+
initialState: {
|
|
2487
|
+
themes: []
|
|
2488
|
+
}
|
|
2489
|
+
}), t = /* @__PURE__ */ new Set(), s = () => {
|
|
2490
|
+
e.setState({
|
|
2491
|
+
themes: [...t].flat()
|
|
2492
|
+
}, !1, "syncThemes");
|
|
2493
|
+
};
|
|
2494
|
+
return {
|
|
2495
|
+
store: e,
|
|
2496
|
+
register(n) {
|
|
2497
|
+
return t.add(n), s(), P(() => {
|
|
2498
|
+
t.delete(n) && s();
|
|
2499
|
+
});
|
|
2500
|
+
},
|
|
2501
|
+
listThemes() {
|
|
2502
|
+
return e.getState().themes;
|
|
2503
|
+
}
|
|
2504
|
+
};
|
|
2505
|
+
}, tr = (e) => (t) => e.listProviders().some((n) => n.kind === t.kind) ? e.listResources("").some((n) => n.resource.uri === t.uri) : !0, rr = ({
|
|
2506
|
+
layout: e,
|
|
2507
|
+
isInScope: t
|
|
2508
|
+
}) => {
|
|
2509
|
+
const s = e.store.subscribeSelector((n) => j(n.layout.regions[$e("primary")])?.resourceUri, () => {
|
|
2510
|
+
const n = e.getLayout(), i = Ee(n, "primary");
|
|
2511
|
+
for (const r of Te({
|
|
2512
|
+
layout: n,
|
|
2513
|
+
primary: i,
|
|
2514
|
+
isInScope: t
|
|
2515
|
+
}))
|
|
2516
|
+
r.action === "clear" && e.clearRegion(r.region);
|
|
2517
|
+
});
|
|
2518
|
+
return P(s);
|
|
2519
|
+
}, nr = /* @__PURE__ */ new Set(["sidenav", "secondary", "main-left-menu", "main-right-menu", "secondary-left-menu", "secondary-right-menu", "side-left-menu", "side-right-menu"]), sr = (e) => nr.has(e), or = (e) => ({
|
|
2520
|
+
getRegionState(t) {
|
|
2521
|
+
const s = e.layout.getLayout().regions[t];
|
|
2522
|
+
return {
|
|
2523
|
+
open: s.visible,
|
|
2524
|
+
size: s.size
|
|
2525
|
+
};
|
|
2526
|
+
},
|
|
2527
|
+
setRegionOpen(t, s) {
|
|
2528
|
+
e.layout.setRegionVisible(t, s);
|
|
2529
|
+
},
|
|
2530
|
+
setRegionSize(t, s) {
|
|
2531
|
+
e.layout.setRegionSize(t, s);
|
|
2532
|
+
},
|
|
2533
|
+
getSidePanelPresentation: e.sidePanel.getMode,
|
|
2534
|
+
setSidePanelPresentation: e.sidePanel.setMode,
|
|
2535
|
+
onDidChange(t) {
|
|
2536
|
+
const s = e.layout.store.subscribeSelector((i) => i.layout, t), n = e.sidePanel.onDidChange(t);
|
|
2537
|
+
return P(() => {
|
|
2538
|
+
s(), n.dispose();
|
|
2539
|
+
});
|
|
2540
|
+
}
|
|
2541
|
+
}), ir = "sidenav", ar = (e, t, s) => {
|
|
2542
|
+
e.panels.setOpen(t, s), e.layout.setRegionVisible(t, s);
|
|
2543
|
+
}, cr = (e, t) => {
|
|
2544
|
+
ar(e, t, !e.panels.isOpen(t));
|
|
2545
|
+
}, dr = [{
|
|
2546
|
+
id: "workbench.toggleCommandPalette",
|
|
2547
|
+
label: "Toggle Command Palette",
|
|
2548
|
+
icon: "Command",
|
|
2549
|
+
keybinding: "Mod+K",
|
|
2550
|
+
execute: (e) => e.commandPalette.toggle()
|
|
2551
|
+
}, {
|
|
2552
|
+
id: "workbench.action.showCommands",
|
|
2553
|
+
label: "Run Command",
|
|
2554
|
+
icon: "Terminal",
|
|
2555
|
+
keybinding: "Alt+Shift+K",
|
|
2556
|
+
execute: (e) => e.commandPalette.open({
|
|
2557
|
+
initialQuery: "> "
|
|
2558
|
+
})
|
|
2559
|
+
}, {
|
|
2560
|
+
id: "workbench.action.changeTheme",
|
|
2561
|
+
label: "Change Theme",
|
|
2562
|
+
icon: "Palette",
|
|
2563
|
+
keybinding: "Alt+Shift+T",
|
|
2564
|
+
execute: (e) => e.commandPalette.open({
|
|
2565
|
+
view: "theme"
|
|
2566
|
+
})
|
|
2567
|
+
}, {
|
|
2568
|
+
id: "workbench.action.navigateBack",
|
|
2569
|
+
label: "Navigate Back",
|
|
2570
|
+
icon: "ArrowLeft",
|
|
2571
|
+
keybinding: "Alt+Shift+ArrowLeft",
|
|
2572
|
+
execute: (e) => {
|
|
2573
|
+
e.history.goBack();
|
|
2574
|
+
}
|
|
2575
|
+
}, {
|
|
2576
|
+
id: "workbench.action.navigateForward",
|
|
2577
|
+
label: "Navigate Forward",
|
|
2578
|
+
icon: "ArrowRight",
|
|
2579
|
+
keybinding: "Alt+Shift+ArrowRight",
|
|
2580
|
+
execute: (e) => {
|
|
2581
|
+
e.history.goForward();
|
|
2582
|
+
}
|
|
2583
|
+
}, {
|
|
2584
|
+
id: "workbench.toggleSideBar",
|
|
2585
|
+
label: "Toggle Sidenav",
|
|
2586
|
+
icon: "PanelLeft",
|
|
2587
|
+
keybinding: "Mod+B",
|
|
2588
|
+
execute: (e) => cr(e, ir)
|
|
2589
|
+
}], lr = (e) => {
|
|
2590
|
+
for (const t of dr)
|
|
2591
|
+
e.commands.registerCommand({
|
|
2592
|
+
id: t.id,
|
|
2593
|
+
label: t.label,
|
|
2594
|
+
category: "Workbench",
|
|
2595
|
+
icon: t.icon,
|
|
2596
|
+
when: "!inputFocus"
|
|
2597
|
+
}, {
|
|
2598
|
+
execute: () => t.execute(e)
|
|
2599
|
+
}), e.keybindings.registerKeybinding({
|
|
2600
|
+
commandId: t.id,
|
|
2601
|
+
keybinding: t.keybinding,
|
|
2602
|
+
when: "!inputFocus"
|
|
2603
|
+
}), e.layout.registerMenuItem(oe, {
|
|
2604
|
+
commandId: t.id,
|
|
2605
|
+
group: "Workbench"
|
|
2606
|
+
});
|
|
2607
|
+
e.commands.registerCommand({
|
|
2608
|
+
id: "workbench.action.switchMode",
|
|
2609
|
+
label: "Switch Mode",
|
|
2610
|
+
category: "Workbench",
|
|
2611
|
+
icon: "PanelTop",
|
|
2612
|
+
when: "!inputFocus"
|
|
2613
|
+
}, {
|
|
2614
|
+
execute: (t) => {
|
|
2615
|
+
if (!t?.modeId) {
|
|
2616
|
+
e.commandPalette.open({
|
|
2617
|
+
view: "mode"
|
|
2618
|
+
});
|
|
2619
|
+
return;
|
|
2620
|
+
}
|
|
2621
|
+
if (!e.modes.getMode(t.modeId)) throw new Error(`Workbench mode not registered: ${t.modeId}`);
|
|
2622
|
+
e.modes.setActiveMode(t.modeId);
|
|
2623
|
+
}
|
|
2624
|
+
}), e.layout.registerMenuItem(oe, {
|
|
2625
|
+
commandId: "workbench.action.switchMode",
|
|
2626
|
+
group: "Workbench"
|
|
2627
|
+
});
|
|
2628
|
+
}, E = (e, t) => ({
|
|
2629
|
+
...t,
|
|
2630
|
+
source: e.source,
|
|
2631
|
+
ownerId: e.ownerId
|
|
2632
|
+
}), Re = (e) => e ? Array.isArray(e) ? [...e] : [e] : [], we = (e) => {
|
|
2633
|
+
for (let t = e.length - 1; t >= 0; t -= 1)
|
|
2634
|
+
e[t]?.dispose();
|
|
2635
|
+
}, Pe = (e, t) => {
|
|
2636
|
+
const s = e.context.createScope(t.ownerId);
|
|
2637
|
+
t.track(s);
|
|
2638
|
+
const n = (r) => (t.track(r), r);
|
|
2639
|
+
return {
|
|
2640
|
+
...e,
|
|
2641
|
+
onDidChangePrimaryResource: (r) => n(e.onDidChangePrimaryResource(r)),
|
|
2642
|
+
onDidChangeActiveResource: (r) => n(e.onDidChangeActiveResource(r)),
|
|
2643
|
+
breadcrumbs: {
|
|
2644
|
+
...e.breadcrumbs,
|
|
2645
|
+
setItems: (r) => n(e.breadcrumbs.setItems(r)),
|
|
2646
|
+
onDidChange: (r) => n(e.breadcrumbs.onDidChange(r))
|
|
2647
|
+
},
|
|
2648
|
+
commandPalette: {
|
|
2649
|
+
...e.commandPalette,
|
|
2650
|
+
onDidChange: (r) => n(e.commandPalette.onDidChange(r))
|
|
2651
|
+
},
|
|
2652
|
+
context: {
|
|
2653
|
+
...e.context,
|
|
2654
|
+
set: (r, o) => s.set(r, o),
|
|
2655
|
+
delete: (r) => s.delete(r),
|
|
2656
|
+
createScope: (r) => n(e.context.createScope(r))
|
|
2657
|
+
},
|
|
2658
|
+
focus: {
|
|
2659
|
+
...e.focus,
|
|
2660
|
+
onDidChange: (r) => n(e.focus.onDidChange(r))
|
|
2661
|
+
},
|
|
2662
|
+
commands: {
|
|
2663
|
+
...e.commands,
|
|
2664
|
+
registerCommand: (r, o, c) => n(e.commands.registerCommand(r, o, E(t, c))),
|
|
2665
|
+
onDidExecuteError: (r) => n(e.commands.onDidExecuteError(r))
|
|
2666
|
+
},
|
|
2667
|
+
keybindings: {
|
|
2668
|
+
...e.keybindings,
|
|
2669
|
+
registerKeybinding: (r, o) => n(e.keybindings.registerKeybinding(r, E(t, o)))
|
|
2670
|
+
},
|
|
2671
|
+
lastResource: {
|
|
2672
|
+
...e.lastResource
|
|
2673
|
+
},
|
|
2674
|
+
layout: {
|
|
2675
|
+
...e.layout,
|
|
2676
|
+
openPanel: (r, o) => {
|
|
2677
|
+
const c = e.layout.openPanel(r, o);
|
|
2678
|
+
return n(P(() => e.layout.removeWidgetPlacement(c.instanceId))), c;
|
|
2679
|
+
},
|
|
2680
|
+
openWidget: (r, o) => {
|
|
2681
|
+
const c = e.layout.openWidget(r, {
|
|
2682
|
+
...o,
|
|
2683
|
+
ownerId: t.ownerId,
|
|
2684
|
+
source: t.source
|
|
2685
|
+
});
|
|
2686
|
+
return n(P(() => e.layout.removeWidgetPlacement(c.widgetId))), c;
|
|
2687
|
+
},
|
|
2688
|
+
registerPlaceholder: (r, o) => n(e.layout.registerPlaceholder(r, E(t, o))),
|
|
2689
|
+
registerPanel: (r, o) => n(e.layout.registerPanel(r, E(t, o))),
|
|
2690
|
+
registerWidget: (r, o) => n(e.layout.registerWidget(r, E(t, o))),
|
|
2691
|
+
registerLocation: (r, o) => n(e.layout.registerLocation(r, E(t, o))),
|
|
2692
|
+
registerSubPanel: (r, o) => n(e.layout.registerSubPanel(r, E(t, o))),
|
|
2693
|
+
registerPanelMenu: (r, o) => n(e.layout.registerPanelMenu(r, E(t, o))),
|
|
2694
|
+
registerMenuItem: (r, o, c) => n(e.layout.registerMenuItem(r, o, E(t, c))),
|
|
2695
|
+
onWillChangePersistenceScope: (r) => n(e.layout.onWillChangePersistenceScope(r)),
|
|
2696
|
+
onDidChangePersistenceScope: (r) => n(e.layout.onDidChangePersistenceScope(r))
|
|
2697
|
+
},
|
|
2698
|
+
modes: {
|
|
2699
|
+
...e.modes,
|
|
2700
|
+
registerMode: (r) => n(e.modes.registerMode({
|
|
2701
|
+
...r,
|
|
2702
|
+
activate: () => {
|
|
2703
|
+
const o = [], c = Pe(e, {
|
|
2704
|
+
...t,
|
|
2705
|
+
track: (f) => {
|
|
2706
|
+
o.push(f);
|
|
2707
|
+
}
|
|
2708
|
+
}), u = Re(r.activate(c));
|
|
2709
|
+
return P(() => we([...o, ...u]));
|
|
2710
|
+
}
|
|
2711
|
+
})),
|
|
2712
|
+
onDidChangeActive: (r) => n(e.modes.onDidChangeActive(r))
|
|
2713
|
+
},
|
|
2714
|
+
navigation: {
|
|
2715
|
+
...e.navigation,
|
|
2716
|
+
registerNavigator: (r, o) => n(e.navigation.registerNavigator(r, E(t, o))),
|
|
2717
|
+
registerParser: (r, o) => n(e.navigation.registerParser(r, E(t, o)))
|
|
2718
|
+
},
|
|
2719
|
+
notifications: {
|
|
2720
|
+
...e.notifications,
|
|
2721
|
+
show: (r, o) => e.notifications.show(r, E(t, o))
|
|
2722
|
+
},
|
|
2723
|
+
panels: {
|
|
2724
|
+
...e.panels,
|
|
2725
|
+
onDidChange: (r) => n(e.panels.onDidChange(r))
|
|
2726
|
+
},
|
|
2727
|
+
preferences: {
|
|
2728
|
+
...e.preferences,
|
|
2729
|
+
registerSchema: (r, o) => n(e.preferences.registerSchema(r, E(t, o)))
|
|
2730
|
+
},
|
|
2731
|
+
renderers: {
|
|
2732
|
+
...e.renderers,
|
|
2733
|
+
registerRenderer: (r) => n(e.renderers.registerRenderer(r)),
|
|
2734
|
+
registerTreeRenderer: (r, o) => n(e.renderers.registerTreeRenderer(r, E(t, o))),
|
|
2735
|
+
registerKanbanRenderer: (r, o) => n(e.renderers.registerKanbanRenderer(r, E(t, o))),
|
|
2736
|
+
registerDataTableRenderer: (r, o) => n(e.renderers.registerDataTableRenderer(r, E(t, o))),
|
|
2737
|
+
registerFileRenderer: (r, o) => n(e.renderers.registerFileRenderer(r, E(t, o))),
|
|
2738
|
+
registerControlsRenderer: (r, o) => n(e.renderers.registerControlsRenderer(r, E(t, o))),
|
|
2739
|
+
onDidChange: (r) => n(e.renderers.onDidChange(r)),
|
|
2740
|
+
onDidRefresh: (r) => n(e.renderers.onDidRefresh(r))
|
|
2741
|
+
},
|
|
2742
|
+
resources: {
|
|
2743
|
+
...e.resources,
|
|
2744
|
+
registerKind: (r, o) => n(e.resources.registerKind(r, E(t, o))),
|
|
2745
|
+
registerHierarchyProvider: (r) => n(e.resources.registerHierarchyProvider(r)),
|
|
2746
|
+
registerPresenter: (r) => n(e.resources.registerPresenter(r)),
|
|
2747
|
+
registerProvider: (r) => n(e.resources.registerProvider(r)),
|
|
2748
|
+
onDidOpenResource: (r) => n(e.resources.onDidOpenResource(r))
|
|
2749
|
+
},
|
|
2750
|
+
settings: {
|
|
2751
|
+
...e.settings,
|
|
2752
|
+
registerSection: (r, o) => n(e.settings.registerSection(r, E(t, o))),
|
|
2753
|
+
registerPanel: (r, o) => n(e.settings.registerPanel(r, E(t, o)))
|
|
2754
|
+
},
|
|
2755
|
+
shell: {
|
|
2756
|
+
...e.shell,
|
|
2757
|
+
onDidChange: (r) => n(e.shell.onDidChange(r))
|
|
2758
|
+
},
|
|
2759
|
+
sidePanel: {
|
|
2760
|
+
...e.sidePanel,
|
|
2761
|
+
onDidChange: (r) => n(e.sidePanel.onDidChange(r))
|
|
2762
|
+
},
|
|
2763
|
+
themes: {
|
|
2764
|
+
...e.themes,
|
|
2765
|
+
register: (r) => n(e.themes.register(r))
|
|
2766
|
+
},
|
|
2767
|
+
fileIconThemes: {
|
|
2768
|
+
...e.fileIconThemes,
|
|
2769
|
+
register: (r) => n(e.fileIconThemes.register(r))
|
|
2770
|
+
}
|
|
2771
|
+
};
|
|
2772
|
+
}, yr = (e = {}) => {
|
|
2773
|
+
const t = xe(), s = St({
|
|
2774
|
+
context: t
|
|
2775
|
+
}), n = /* @__PURE__ */ new Map(), i = Me(e.renderers), r = Jt({
|
|
2776
|
+
rendererRegistry: i,
|
|
2777
|
+
persistence: e.treePersistence
|
|
2778
|
+
}), o = Yt({
|
|
2779
|
+
rendererRegistry: i
|
|
2780
|
+
}), c = zt({
|
|
2781
|
+
rendererRegistry: i
|
|
2782
|
+
}), u = Qt({
|
|
2783
|
+
rendererRegistry: i
|
|
2784
|
+
}), f = Vt({
|
|
2785
|
+
rendererRegistry: i
|
|
2786
|
+
}), m = At({
|
|
2787
|
+
defaultRegionVisibility: e.defaultPanelOpenByRegionId,
|
|
2788
|
+
persistence: e.persistence ? {
|
|
2789
|
+
getLayout: (h) => e.persistence?.getSnapshot(h)?.layout,
|
|
2790
|
+
setLayout: (h, R) => e.persistence?.setSnapshot({
|
|
2791
|
+
layout: h
|
|
2792
|
+
}, R),
|
|
2793
|
+
flush: e.persistence.flush,
|
|
2794
|
+
dispose: e.persistence.dispose
|
|
2795
|
+
} : e.layoutPersistence
|
|
2796
|
+
}), {
|
|
2797
|
+
establishLocation: a,
|
|
2798
|
+
...d
|
|
2799
|
+
} = m, l = {
|
|
2800
|
+
...d,
|
|
2801
|
+
...$t({
|
|
2802
|
+
commands: s
|
|
2803
|
+
})
|
|
2804
|
+
}, b = je({
|
|
2805
|
+
context: t,
|
|
2806
|
+
isRegionFocusable: (h) => l.getLayout().regions[h].visible
|
|
2807
|
+
}), v = ft({
|
|
2808
|
+
initialMode: e.initialSidePanelMode
|
|
2809
|
+
}), I = or({
|
|
2810
|
+
layout: l,
|
|
2811
|
+
sidePanel: v
|
|
2812
|
+
}), S = {
|
|
2813
|
+
breadcrumbs: Fe(),
|
|
2814
|
+
commandPalette: Ne(),
|
|
2815
|
+
commands: s,
|
|
2816
|
+
context: t,
|
|
2817
|
+
focus: b,
|
|
2818
|
+
host: {
|
|
2819
|
+
getSnapshot: () => ({
|
|
2820
|
+
layout: l.getLayout()
|
|
2821
|
+
}),
|
|
2822
|
+
restoreSnapshot: (h) => l.restoreLayout(h.layout),
|
|
2823
|
+
setPersistenceScope: (h, R = {}) => l.setPersistenceScope(h, {
|
|
2824
|
+
carryRegionState: R.carryRegions
|
|
2825
|
+
}),
|
|
2826
|
+
getPersistenceScope: l.getPersistenceScope
|
|
2827
|
+
},
|
|
2828
|
+
history: void 0,
|
|
2829
|
+
keybindings: Be({
|
|
2830
|
+
commands: s,
|
|
2831
|
+
context: t
|
|
2832
|
+
}),
|
|
2833
|
+
lastResource: ut({
|
|
2834
|
+
persistence: e.lastResourcePersistence,
|
|
2835
|
+
openResource: (h) => S.resources.openResource(h, {
|
|
2836
|
+
replaceActive: !0
|
|
2837
|
+
})
|
|
2838
|
+
}),
|
|
2839
|
+
layout: l,
|
|
2840
|
+
modes: void 0,
|
|
2841
|
+
notifications: _t(),
|
|
2842
|
+
navigation: jt({
|
|
2843
|
+
resolveDispatcher: () => ({
|
|
2844
|
+
createCheckpoint: () => {
|
|
2845
|
+
const h = S.layout.getLayout();
|
|
2846
|
+
return () => S.layout.restoreLayout(h);
|
|
2847
|
+
},
|
|
2848
|
+
canOpenResource: (h) => {
|
|
2849
|
+
const R = S.resources.store.getState();
|
|
2850
|
+
return !!(R.kinds[h.kind] && Object.values(R.presenters).some((C) => C.canOpen(h)));
|
|
2851
|
+
},
|
|
2852
|
+
canOpenPanel: (h) => !!S.layout.getPanel(h),
|
|
2853
|
+
canExecuteCommand: (h) => !!S.commands.getCommand(h),
|
|
2854
|
+
openResource: (h, R) => S.resources.openResource(h, R),
|
|
2855
|
+
openPanel: (h, R) => {
|
|
2856
|
+
const C = S.layout.openPanel(h, R), T = S.layout.getPanel(h), M = R?.region ?? T?.region;
|
|
2857
|
+
return M && (M === "side" ? S.shell.setSidePanelPresentation("attached") : sr(M) && S.shell.setRegionOpen(M, !0)), C;
|
|
2858
|
+
},
|
|
2859
|
+
executeCommand: (h, R) => S.commands.executeCommand(h, R)
|
|
2860
|
+
})
|
|
2861
|
+
}),
|
|
2862
|
+
panels: gt({
|
|
2863
|
+
defaultOpenByRegionId: e.defaultPanelOpenByRegionId,
|
|
2864
|
+
persistence: e.panelsPersistence
|
|
2865
|
+
}),
|
|
2866
|
+
preferences: qt({
|
|
2867
|
+
persistence: e.preferencePersistence
|
|
2868
|
+
}),
|
|
2869
|
+
renderers: {
|
|
2870
|
+
...i,
|
|
2871
|
+
...r,
|
|
2872
|
+
...o,
|
|
2873
|
+
...c,
|
|
2874
|
+
...u,
|
|
2875
|
+
...f
|
|
2876
|
+
},
|
|
2877
|
+
commandPaletteResources: bt(),
|
|
2878
|
+
resources: De({
|
|
2879
|
+
getPrimary: () => B(S.layout.getLayout())?.resource,
|
|
2880
|
+
establishLocation: (h) => a(h.instanceId)
|
|
2881
|
+
}),
|
|
2882
|
+
settings: Xt(),
|
|
2883
|
+
shell: I,
|
|
2884
|
+
sidePanel: v,
|
|
2885
|
+
terminal: yt(),
|
|
2886
|
+
themes: er(),
|
|
2887
|
+
fileIconThemes: Zt(),
|
|
2888
|
+
getActiveResource() {
|
|
2889
|
+
const h = S.layout.getLayout().activeWidgetId;
|
|
2890
|
+
if (h)
|
|
2891
|
+
for (const R of Object.values(S.layout.getLayout().regions)) {
|
|
2892
|
+
const C = R.widgets.find((T) => T.widgetId === h);
|
|
2893
|
+
if (C) return C.resource;
|
|
2894
|
+
}
|
|
2895
|
+
},
|
|
2896
|
+
onDidChangeActiveResource(h) {
|
|
2897
|
+
return P(S.layout.store.subscribeSelector((R) => R.layout.activeResourceUri, () => h(S.getActiveResource())));
|
|
2898
|
+
},
|
|
2899
|
+
getPrimaryResource() {
|
|
2900
|
+
return B(S.layout.getLayout())?.resource;
|
|
2901
|
+
},
|
|
2902
|
+
onDidChangePrimaryResource(h) {
|
|
2903
|
+
return P(S.layout.store.subscribeSelector((R) => B(R.layout)?.resourceUri, () => h(S.getPrimaryResource())));
|
|
2904
|
+
},
|
|
2905
|
+
registerModule(h) {
|
|
2906
|
+
if (n.has(h.id)) throw new Error(`Workbench module already registered: ${h.id}`);
|
|
2907
|
+
const R = [], C = {
|
|
2908
|
+
disposable: void 0
|
|
2909
|
+
};
|
|
2910
|
+
C.disposable = P(() => {
|
|
2911
|
+
n.get(h.id) === C && (n.delete(h.id), we(R));
|
|
2912
|
+
}), n.set(h.id, C);
|
|
2913
|
+
try {
|
|
2914
|
+
const T = Pe(S, {
|
|
2915
|
+
ownerId: h.ownerId ?? h.id,
|
|
2916
|
+
source: h.source ?? "module",
|
|
2917
|
+
track: (M) => {
|
|
2918
|
+
R.push(M);
|
|
2919
|
+
}
|
|
2920
|
+
});
|
|
2921
|
+
R.push(...Re(h.activate(T)));
|
|
2922
|
+
} catch (T) {
|
|
2923
|
+
throw C.disposable.dispose(), T;
|
|
2924
|
+
}
|
|
2925
|
+
return C.disposable;
|
|
2926
|
+
},
|
|
2927
|
+
unregisterModule(h) {
|
|
2928
|
+
n.get(h)?.disposable.dispose();
|
|
2929
|
+
}
|
|
2930
|
+
};
|
|
2931
|
+
return S.modes = Oe({
|
|
2932
|
+
establishLocation: (h) => a(h),
|
|
2933
|
+
resolveContext: () => S
|
|
2934
|
+
}), S.history = lt({
|
|
2935
|
+
layout: S.layout,
|
|
2936
|
+
modes: S.modes,
|
|
2937
|
+
resources: S.resources,
|
|
2938
|
+
persistence: e.historyPersistence
|
|
2939
|
+
}), S.layout.store.subscribe((h) => {
|
|
2940
|
+
const R = S.focus.getActiveRegion();
|
|
2941
|
+
R && !h.layout.regions[R].visible && S.focus.clearFocus();
|
|
2942
|
+
}), S.layout.onDidChangePersistenceScope(() => {
|
|
2943
|
+
const h = S.layout.getLayout();
|
|
2944
|
+
for (const R of Object.values(h.regions))
|
|
2945
|
+
S.panels.setOpen(R.id, R.visible);
|
|
2946
|
+
}), S.onDidChangePrimaryResource((h) => {
|
|
2947
|
+
h && S.lastResource.set(h);
|
|
2948
|
+
}), rr({
|
|
2949
|
+
layout: S.layout,
|
|
2950
|
+
isInScope: e.isInScope ?? tr(S.resources)
|
|
2951
|
+
}), lr(S), S;
|
|
2952
|
+
};
|
|
5
2953
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
b as createPreferenceRegistry,
|
|
21
|
-
K as createResourceRegistry,
|
|
22
|
-
d as createSettingsRegistry,
|
|
23
|
-
u as createThemeRegistry,
|
|
24
|
-
y as createTreeRendererRegistry,
|
|
25
|
-
k as createWorkbenchBreadcrumbController,
|
|
26
|
-
C as createWorkbenchCommandPaletteController,
|
|
27
|
-
m as createWorkbenchCore,
|
|
28
|
-
P as createWorkbenchFocusController,
|
|
29
|
-
W as createWorkbenchLastResourceController,
|
|
30
|
-
w as createWorkbenchModeRegistry,
|
|
31
|
-
M as createWorkbenchPanelsController,
|
|
32
|
-
L as createWorkbenchRendererRegistry,
|
|
33
|
-
j as createWorkbenchResourceContextValues,
|
|
34
|
-
v as createWorkbenchSelectionResourceMetadata,
|
|
35
|
-
x as createWorkbenchSessionPanelController,
|
|
36
|
-
F as createWorkbenchStore,
|
|
37
|
-
f as createWorkbenchTerminalController,
|
|
38
|
-
G as getAnchorResource,
|
|
39
|
-
H as getKeybindingSteps,
|
|
40
|
-
J as getSurface,
|
|
41
|
-
I as getWorkbenchSelectionResourceUris,
|
|
42
|
-
re as headerLeadingMenuPath,
|
|
43
|
-
ae as headerTrailingMenuPath,
|
|
44
|
-
O as listAnchorAreas,
|
|
45
|
-
Q as listProjectionAreas,
|
|
46
|
-
X as listProjectionsReading,
|
|
47
|
-
D as matchesContextExpression,
|
|
48
|
-
Y as reconcileAnchors,
|
|
49
|
-
Z as resolveAnchorArea,
|
|
50
|
-
te as resourceContextMenuPath,
|
|
51
|
-
N as standardResourceIcons,
|
|
52
|
-
_ as surfaceMap,
|
|
53
|
-
se as workbenchAreaTabLeadingMenuPath,
|
|
54
|
-
$ as workbenchAreas,
|
|
2954
|
+
hr as createResourceBreadcrumbItems,
|
|
2955
|
+
yr as createWorkbenchCore,
|
|
2956
|
+
vr as createWorkbenchResourceContextValues,
|
|
2957
|
+
pr as createWorkbenchSelectionResourceMetadata,
|
|
2958
|
+
Rr as getKeybindingSteps,
|
|
2959
|
+
wr as getWorkbenchModePanelForRegion,
|
|
2960
|
+
Pr as getWorkbenchSelectionResourceUris,
|
|
2961
|
+
Mr as headerLeadingMenuPath,
|
|
2962
|
+
Dr as headerTrailingMenuPath,
|
|
2963
|
+
Ir as isWorkbenchModePanelAvailable,
|
|
2964
|
+
Cr as matchesContextExpression,
|
|
2965
|
+
$e as resolveAnchorRegion,
|
|
2966
|
+
Br as resourceContextMenuPath,
|
|
2967
|
+
Wr as standardResourceIcons,
|
|
55
2968
|
oe as workbenchCommandPaletteMenuPath,
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
2969
|
+
Or as workbenchRegionTabAddMenuPath,
|
|
2970
|
+
Ar as workbenchRegionTabLeadingMenuPath,
|
|
2971
|
+
kr as workbenchResourceIdContextKey,
|
|
2972
|
+
Lr as workbenchResourceKindContextKey,
|
|
2973
|
+
Er as workbenchResourceMetadataContextKey,
|
|
2974
|
+
Tr as workbenchSelectionResourceUriMetadataKey,
|
|
2975
|
+
$r as workbenchTopHeaderLeadingMenuPath,
|
|
2976
|
+
Fr as workbenchTopHeaderTrailingMenuPath
|
|
63
2977
|
};
|
|
64
2978
|
//# sourceMappingURL=index.js.map
|