@hediet/linkrpc-cli 0.0.3-next.20260922.2 → 0.0.3-next.20260924.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +164 -6
- package/dist/chunks/{cli-FDKN1ydZ.js → cli-CY5WVWEQ.js} +3552 -2015
- package/dist/chunks/cli-CY5WVWEQ.js.map +1 -0
- package/dist/chunks/dist-BOcSU4-O.js +1500 -0
- package/dist/chunks/dist-BOcSU4-O.js.map +1 -0
- package/dist/chunks/{runApprovalUi-CTyhiDpa.js → runApprovalUi-C4yIUu8Y.js} +5 -4
- package/dist/chunks/{runApprovalUi-CTyhiDpa.js.map → runApprovalUi-C4yIUu8Y.js.map} +1 -1
- package/dist/chunks/{runComplete-Du5wmOdB.js → runComplete-F95L0neY.js} +19 -17
- package/dist/chunks/runComplete-F95L0neY.js.map +1 -0
- package/dist/chunks/{runUi-CuJr8_tY.js → runUi-Dp2P3aNN.js} +639 -92
- package/dist/chunks/runUi-Dp2P3aNN.js.map +1 -0
- package/dist/chunks/{scroll--AVfTs5W.js → scroll-CY9Rcshb.js} +2 -2
- package/dist/chunks/{scroll--AVfTs5W.js.map → scroll-CY9Rcshb.js.map} +1 -1
- package/dist/hub.js +1 -1
- package/dist/index.js +1 -1
- package/dist/linkrpc.js +1 -1
- package/dist/rpc.js +1 -1
- package/package.json +6 -6
- package/dist/chunks/cli-FDKN1ydZ.js.map +0 -1
- package/dist/chunks/runComplete-Du5wmOdB.js.map +0 -1
- package/dist/chunks/runUi-CuJr8_tY.js.map +0 -1
|
@@ -0,0 +1,1500 @@
|
|
|
1
|
+
//#region ../../node_modules/.pnpm/@vscode+observables@0.1.1-0/node_modules/@vscode/observables/dist/observableInternal/logging/logging.js
|
|
2
|
+
let globalObservableLogger;
|
|
3
|
+
function addLogger(logger) {
|
|
4
|
+
if (!globalObservableLogger) globalObservableLogger = logger;
|
|
5
|
+
else if (globalObservableLogger instanceof ComposedLogger) globalObservableLogger.loggers.push(logger);
|
|
6
|
+
else globalObservableLogger = new ComposedLogger([globalObservableLogger, logger]);
|
|
7
|
+
}
|
|
8
|
+
function getLogger() {
|
|
9
|
+
return globalObservableLogger;
|
|
10
|
+
}
|
|
11
|
+
let globalObservableLoggerFn = void 0;
|
|
12
|
+
function setLogObservableFn(fn) {
|
|
13
|
+
globalObservableLoggerFn = fn;
|
|
14
|
+
}
|
|
15
|
+
function logObservable(obs) {
|
|
16
|
+
if (globalObservableLoggerFn) globalObservableLoggerFn(obs);
|
|
17
|
+
}
|
|
18
|
+
var ComposedLogger = class {
|
|
19
|
+
constructor(loggers) {
|
|
20
|
+
this.loggers = loggers;
|
|
21
|
+
}
|
|
22
|
+
handleObservableCreated(observable, location) {
|
|
23
|
+
for (const logger of this.loggers) logger.handleObservableCreated(observable, location);
|
|
24
|
+
}
|
|
25
|
+
handleOnListenerCountChanged(observable, newCount) {
|
|
26
|
+
for (const logger of this.loggers) logger.handleOnListenerCountChanged(observable, newCount);
|
|
27
|
+
}
|
|
28
|
+
handleObservableUpdated(observable, info) {
|
|
29
|
+
for (const logger of this.loggers) logger.handleObservableUpdated(observable, info);
|
|
30
|
+
}
|
|
31
|
+
handleAutorunCreated(autorun, location) {
|
|
32
|
+
for (const logger of this.loggers) logger.handleAutorunCreated(autorun, location);
|
|
33
|
+
}
|
|
34
|
+
handleAutorunDisposed(autorun) {
|
|
35
|
+
for (const logger of this.loggers) logger.handleAutorunDisposed(autorun);
|
|
36
|
+
}
|
|
37
|
+
handleAutorunDependencyChanged(autorun, observable, change) {
|
|
38
|
+
for (const logger of this.loggers) logger.handleAutorunDependencyChanged(autorun, observable, change);
|
|
39
|
+
}
|
|
40
|
+
handleAutorunStarted(autorun) {
|
|
41
|
+
for (const logger of this.loggers) logger.handleAutorunStarted(autorun);
|
|
42
|
+
}
|
|
43
|
+
handleAutorunFinished(autorun) {
|
|
44
|
+
for (const logger of this.loggers) logger.handleAutorunFinished(autorun);
|
|
45
|
+
}
|
|
46
|
+
handleDerivedDependencyChanged(derived, observable, change) {
|
|
47
|
+
for (const logger of this.loggers) logger.handleDerivedDependencyChanged(derived, observable, change);
|
|
48
|
+
}
|
|
49
|
+
handleDerivedCleared(observable) {
|
|
50
|
+
for (const logger of this.loggers) logger.handleDerivedCleared(observable);
|
|
51
|
+
}
|
|
52
|
+
handleBeginTransaction(transaction) {
|
|
53
|
+
for (const logger of this.loggers) logger.handleBeginTransaction(transaction);
|
|
54
|
+
}
|
|
55
|
+
handleEndTransaction(transaction) {
|
|
56
|
+
for (const logger of this.loggers) logger.handleEndTransaction(transaction);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
59
|
+
//#endregion
|
|
60
|
+
//#region ../../node_modules/.pnpm/@vscode+observables@0.1.1-0/node_modules/@vscode/observables/dist/observableInternal/debugLocation.js
|
|
61
|
+
var DebugLocation;
|
|
62
|
+
(function(DebugLocation) {
|
|
63
|
+
let enabled = false;
|
|
64
|
+
function enable() {
|
|
65
|
+
enabled = true;
|
|
66
|
+
}
|
|
67
|
+
DebugLocation.enable = enable;
|
|
68
|
+
function ofCaller() {
|
|
69
|
+
return ofNthCaller(1);
|
|
70
|
+
}
|
|
71
|
+
DebugLocation.ofCaller = ofCaller;
|
|
72
|
+
function ofNthCaller(n) {
|
|
73
|
+
if (!enabled) return;
|
|
74
|
+
const Err = Error;
|
|
75
|
+
const l = Err.stackTraceLimit;
|
|
76
|
+
Err.stackTraceLimit = 3;
|
|
77
|
+
const stack = (/* @__PURE__ */ new Error()).stack;
|
|
78
|
+
Err.stackTraceLimit = l;
|
|
79
|
+
return DebugLocationImpl.fromStack(stack, n + 1);
|
|
80
|
+
}
|
|
81
|
+
DebugLocation.ofNthCaller = ofNthCaller;
|
|
82
|
+
})(DebugLocation || (DebugLocation = {}));
|
|
83
|
+
var DebugLocationImpl = class DebugLocationImpl {
|
|
84
|
+
static fromStack(stack, parentIdx) {
|
|
85
|
+
const location = parseLine(stack.split("\n")[parentIdx + 1]);
|
|
86
|
+
if (location) return new DebugLocationImpl(location.fileName, location.line, location.column, location.id);
|
|
87
|
+
else return;
|
|
88
|
+
}
|
|
89
|
+
constructor(fileName, line, column, id) {
|
|
90
|
+
this.fileName = fileName;
|
|
91
|
+
this.line = line;
|
|
92
|
+
this.column = column;
|
|
93
|
+
this.id = id;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
function parseLine(stackLine) {
|
|
97
|
+
if (!stackLine) return;
|
|
98
|
+
const match = stackLine.match(/\((.*):(\d+):(\d+)\)/);
|
|
99
|
+
if (match) return {
|
|
100
|
+
fileName: match[1],
|
|
101
|
+
line: parseInt(match[2]),
|
|
102
|
+
column: parseInt(match[3]),
|
|
103
|
+
id: stackLine
|
|
104
|
+
};
|
|
105
|
+
const match2 = stackLine.match(/at ([^\(\)]*):(\d+):(\d+)/);
|
|
106
|
+
if (match2) return {
|
|
107
|
+
fileName: match2[1],
|
|
108
|
+
line: parseInt(match2[2]),
|
|
109
|
+
column: parseInt(match2[3]),
|
|
110
|
+
id: stackLine
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region ../../node_modules/.pnpm/@vscode+observables@0.1.1-0/node_modules/@vscode/observables/dist/observableInternal/debugName.js
|
|
115
|
+
var DebugNameData = class {
|
|
116
|
+
constructor(owner, debugNameSource, referenceFn) {
|
|
117
|
+
this.owner = owner;
|
|
118
|
+
this.debugNameSource = debugNameSource;
|
|
119
|
+
this.referenceFn = referenceFn;
|
|
120
|
+
}
|
|
121
|
+
getDebugName(target) {
|
|
122
|
+
return getDebugName(target, this);
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
const countPerName = /* @__PURE__ */ new Map();
|
|
126
|
+
const cachedDebugName = /* @__PURE__ */ new WeakMap();
|
|
127
|
+
function getDebugName(target, data) {
|
|
128
|
+
const cached = cachedDebugName.get(target);
|
|
129
|
+
if (cached) return cached;
|
|
130
|
+
const dbgName = computeDebugName(target, data);
|
|
131
|
+
if (dbgName) {
|
|
132
|
+
let count = countPerName.get(dbgName) ?? 0;
|
|
133
|
+
count++;
|
|
134
|
+
countPerName.set(dbgName, count);
|
|
135
|
+
const result = count === 1 ? dbgName : `${dbgName}#${count}`;
|
|
136
|
+
cachedDebugName.set(target, result);
|
|
137
|
+
return result;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function computeDebugName(self, data) {
|
|
141
|
+
const cached = cachedDebugName.get(self);
|
|
142
|
+
if (cached) return cached;
|
|
143
|
+
const ownerStr = data.owner ? formatOwner(data.owner) + `.` : "";
|
|
144
|
+
let result;
|
|
145
|
+
const debugNameSource = data.debugNameSource;
|
|
146
|
+
if (debugNameSource !== void 0) {
|
|
147
|
+
if (typeof debugNameSource === "function") {
|
|
148
|
+
result = debugNameSource();
|
|
149
|
+
if (result !== void 0) return ownerStr + result;
|
|
150
|
+
} else return ownerStr + debugNameSource;
|
|
151
|
+
}
|
|
152
|
+
const referenceFn = data.referenceFn;
|
|
153
|
+
if (referenceFn !== void 0) {
|
|
154
|
+
result = getFunctionName(referenceFn);
|
|
155
|
+
if (result !== void 0) return ownerStr + result;
|
|
156
|
+
}
|
|
157
|
+
if (data.owner !== void 0) {
|
|
158
|
+
const key = findKey(data.owner, self);
|
|
159
|
+
if (key !== void 0) return ownerStr + key;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function findKey(obj, value) {
|
|
163
|
+
for (const key in obj) if (obj[key] === value) return key;
|
|
164
|
+
}
|
|
165
|
+
const countPerClassName = /* @__PURE__ */ new Map();
|
|
166
|
+
const ownerId = /* @__PURE__ */ new WeakMap();
|
|
167
|
+
function formatOwner(owner) {
|
|
168
|
+
const id = ownerId.get(owner);
|
|
169
|
+
if (id) return id;
|
|
170
|
+
const className = getClassName(owner) ?? "Object";
|
|
171
|
+
let count = countPerClassName.get(className) ?? 0;
|
|
172
|
+
count++;
|
|
173
|
+
countPerClassName.set(className, count);
|
|
174
|
+
const result = count === 1 ? className : `${className}#${count}`;
|
|
175
|
+
ownerId.set(owner, result);
|
|
176
|
+
return result;
|
|
177
|
+
}
|
|
178
|
+
function getClassName(obj) {
|
|
179
|
+
const ctor = obj.constructor;
|
|
180
|
+
if (ctor) {
|
|
181
|
+
if (ctor.name === "Object") return;
|
|
182
|
+
return ctor.name;
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
function getFunctionName(fn) {
|
|
186
|
+
const fnSrc = fn.toString();
|
|
187
|
+
const match = /\/\*\*\s*@description\s*([^*]*)\*\//.exec(fnSrc);
|
|
188
|
+
return (match ? match[1] : void 0)?.trim();
|
|
189
|
+
}
|
|
190
|
+
//#endregion
|
|
191
|
+
//#region ../../node_modules/.pnpm/@vscode+observables@0.1.1-0/node_modules/@vscode/observables/dist/observableInternal/observables/baseObservable.js
|
|
192
|
+
let _derived;
|
|
193
|
+
/**
|
|
194
|
+
* @internal
|
|
195
|
+
* This is to allow splitting files.
|
|
196
|
+
*/
|
|
197
|
+
function _setDerivedOpts(derived) {
|
|
198
|
+
_derived = derived;
|
|
199
|
+
}
|
|
200
|
+
let _recomputeInitiallyAndOnChange;
|
|
201
|
+
function _setRecomputeInitiallyAndOnChange(recomputeInitiallyAndOnChange) {
|
|
202
|
+
_recomputeInitiallyAndOnChange = recomputeInitiallyAndOnChange;
|
|
203
|
+
}
|
|
204
|
+
let _keepObserved;
|
|
205
|
+
function _setKeepObserved(keepObserved) {
|
|
206
|
+
_keepObserved = keepObserved;
|
|
207
|
+
}
|
|
208
|
+
let _debugGetDependencyGraph;
|
|
209
|
+
function _setDebugGetDependencyGraph(debugGetDependencyGraph) {
|
|
210
|
+
_debugGetDependencyGraph = debugGetDependencyGraph;
|
|
211
|
+
}
|
|
212
|
+
var ConvenientObservable = class {
|
|
213
|
+
get TChange() {
|
|
214
|
+
return null;
|
|
215
|
+
}
|
|
216
|
+
reportChanges() {
|
|
217
|
+
this.get();
|
|
218
|
+
}
|
|
219
|
+
/** @sealed */
|
|
220
|
+
read(reader) {
|
|
221
|
+
if (reader) return reader.readObservable(this);
|
|
222
|
+
else return this.get();
|
|
223
|
+
}
|
|
224
|
+
map(fnOrOwner, fnOrUndefined, debugLocation = DebugLocation.ofCaller()) {
|
|
225
|
+
const owner = fnOrUndefined === void 0 ? void 0 : fnOrOwner;
|
|
226
|
+
const fn = fnOrUndefined === void 0 ? fnOrOwner : fnOrUndefined;
|
|
227
|
+
return _derived({
|
|
228
|
+
owner,
|
|
229
|
+
debugName: () => {
|
|
230
|
+
const name = getFunctionName(fn);
|
|
231
|
+
if (name !== void 0) return name;
|
|
232
|
+
const match = /^\s*\(?\s*([a-zA-Z_$][a-zA-Z_$0-9]*)\s*\)?\s*=>\s*\1(?:\??)\.([a-zA-Z_$][a-zA-Z_$0-9]*)\s*$/.exec(fn.toString());
|
|
233
|
+
if (match) return `${this.debugName}.${match[2]}`;
|
|
234
|
+
if (!owner) return `${this.debugName} (mapped)`;
|
|
235
|
+
},
|
|
236
|
+
debugReferenceFn: fn
|
|
237
|
+
}, (reader) => fn(this.read(reader), reader), debugLocation);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* @sealed
|
|
241
|
+
* Converts an observable of an observable value into a direct observable of the value.
|
|
242
|
+
*/
|
|
243
|
+
flatten() {
|
|
244
|
+
return _derived({
|
|
245
|
+
owner: void 0,
|
|
246
|
+
debugName: () => `${this.debugName} (flattened)`
|
|
247
|
+
}, (reader) => this.read(reader).read(reader));
|
|
248
|
+
}
|
|
249
|
+
recomputeInitiallyAndOnChange(store, handleValue) {
|
|
250
|
+
store.add(_recomputeInitiallyAndOnChange(this, handleValue));
|
|
251
|
+
return this;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Ensures that this observable is observed. This keeps the cache alive.
|
|
255
|
+
* However, in case of deriveds, it does not force eager evaluation (only when the value is read/get).
|
|
256
|
+
* Use `recomputeInitiallyAndOnChange` for eager evaluation.
|
|
257
|
+
*/
|
|
258
|
+
keepObserved(store) {
|
|
259
|
+
store.add(_keepObserved(this));
|
|
260
|
+
return this;
|
|
261
|
+
}
|
|
262
|
+
get debugValue() {
|
|
263
|
+
return this.get();
|
|
264
|
+
}
|
|
265
|
+
debugGetDependencyGraph() {
|
|
266
|
+
return _debugGetDependencyGraph(this);
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
var BaseObservable = class extends ConvenientObservable {
|
|
270
|
+
constructor(debugLocation) {
|
|
271
|
+
super();
|
|
272
|
+
this._observers = /* @__PURE__ */ new Set();
|
|
273
|
+
getLogger()?.handleObservableCreated(this, debugLocation);
|
|
274
|
+
}
|
|
275
|
+
addObserver(observer) {
|
|
276
|
+
const len = this._observers.size;
|
|
277
|
+
this._observers.add(observer);
|
|
278
|
+
if (len === 0) this.onFirstObserverAdded();
|
|
279
|
+
if (len !== this._observers.size) getLogger()?.handleOnListenerCountChanged(this, this._observers.size);
|
|
280
|
+
}
|
|
281
|
+
removeObserver(observer) {
|
|
282
|
+
const deleted = this._observers.delete(observer);
|
|
283
|
+
if (deleted && this._observers.size === 0) this.onLastObserverRemoved();
|
|
284
|
+
if (deleted) getLogger()?.handleOnListenerCountChanged(this, this._observers.size);
|
|
285
|
+
}
|
|
286
|
+
onFirstObserverAdded() {}
|
|
287
|
+
onLastObserverRemoved() {}
|
|
288
|
+
log() {
|
|
289
|
+
const hadLogger = !!getLogger();
|
|
290
|
+
logObservable(this);
|
|
291
|
+
if (!hadLogger) getLogger()?.handleObservableCreated(this, DebugLocation.ofCaller());
|
|
292
|
+
return this;
|
|
293
|
+
}
|
|
294
|
+
debugGetObservers() {
|
|
295
|
+
return this._observers;
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
//#endregion
|
|
299
|
+
//#region ../../node_modules/.pnpm/@vscode+observables@0.1.1-0/node_modules/@vscode/observables/dist/observableInternal/commonFacade/deps.js
|
|
300
|
+
function toDisposable(fn) {
|
|
301
|
+
return { dispose: fn };
|
|
302
|
+
}
|
|
303
|
+
var BugIndicatingError = class BugIndicatingError extends Error {
|
|
304
|
+
constructor(message) {
|
|
305
|
+
super(message || "An unexpected bug occurred.");
|
|
306
|
+
Object.setPrototypeOf(this, BugIndicatingError.prototype);
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
function onBugIndicatingError(error) {
|
|
310
|
+
throw error;
|
|
311
|
+
}
|
|
312
|
+
function onUnexpectedError(error) {
|
|
313
|
+
console.error("Unexpected error:", error);
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Compares two items for equality using strict equality.
|
|
317
|
+
*/
|
|
318
|
+
const strictEquals = (a, b) => a === b;
|
|
319
|
+
//#endregion
|
|
320
|
+
//#region ../../node_modules/.pnpm/@vscode+observables@0.1.1-0/node_modules/@vscode/observables/dist/disposables.js
|
|
321
|
+
var DisposableStore = class {
|
|
322
|
+
constructor() {
|
|
323
|
+
this.disposables = [];
|
|
324
|
+
this._isDisposed = false;
|
|
325
|
+
}
|
|
326
|
+
get isDisposed() {
|
|
327
|
+
return this._isDisposed;
|
|
328
|
+
}
|
|
329
|
+
dispose() {
|
|
330
|
+
this.clear();
|
|
331
|
+
this._isDisposed = true;
|
|
332
|
+
}
|
|
333
|
+
add(disposable) {
|
|
334
|
+
if (disposable) this.disposables.push(disposable);
|
|
335
|
+
return disposable;
|
|
336
|
+
}
|
|
337
|
+
remove(disposable) {
|
|
338
|
+
if (!disposable) return disposable;
|
|
339
|
+
const index = this.disposables.indexOf(disposable);
|
|
340
|
+
if (index !== -1) this.disposables.splice(index, 1);
|
|
341
|
+
return disposable;
|
|
342
|
+
}
|
|
343
|
+
clear() {
|
|
344
|
+
for (const disposable of this.disposables) disposable.dispose();
|
|
345
|
+
this.disposables = [];
|
|
346
|
+
}
|
|
347
|
+
leakItems() {
|
|
348
|
+
this.disposables = [];
|
|
349
|
+
}
|
|
350
|
+
};
|
|
351
|
+
var Disposable = class {
|
|
352
|
+
constructor() {
|
|
353
|
+
this._store = new DisposableStore();
|
|
354
|
+
}
|
|
355
|
+
dispose() {
|
|
356
|
+
this._store.dispose();
|
|
357
|
+
}
|
|
358
|
+
_register(t) {
|
|
359
|
+
this._store.add(t);
|
|
360
|
+
return t;
|
|
361
|
+
}
|
|
362
|
+
_registerOrDispose(t) {
|
|
363
|
+
if (t) {
|
|
364
|
+
if (this._store.isDisposed) t.dispose();
|
|
365
|
+
else this._store.add(t);
|
|
366
|
+
}
|
|
367
|
+
return t;
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
//#endregion
|
|
371
|
+
//#region ../../node_modules/.pnpm/@vscode+observables@0.1.1-0/node_modules/@vscode/observables/dist/observableInternal/observables/derivedImpl.js
|
|
372
|
+
function derivedStateToString(state) {
|
|
373
|
+
switch (state) {
|
|
374
|
+
case 0: return "initial";
|
|
375
|
+
case 1: return "dependenciesMightHaveChanged";
|
|
376
|
+
case 2: return "stale";
|
|
377
|
+
case 3: return "upToDate";
|
|
378
|
+
default: return "<unknown>";
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
var Derived = class extends BaseObservable {
|
|
382
|
+
get debugName() {
|
|
383
|
+
return this._debugNameData.getDebugName(this) ?? "(anonymous)";
|
|
384
|
+
}
|
|
385
|
+
constructor(_debugNameData, _computeFn, _changeTracker, _handleLastObserverRemoved = void 0, _equalityComparator, debugLocation) {
|
|
386
|
+
super(debugLocation);
|
|
387
|
+
this._debugNameData = _debugNameData;
|
|
388
|
+
this._computeFn = _computeFn;
|
|
389
|
+
this._changeTracker = _changeTracker;
|
|
390
|
+
this._handleLastObserverRemoved = _handleLastObserverRemoved;
|
|
391
|
+
this._equalityComparator = _equalityComparator;
|
|
392
|
+
this._state = 0;
|
|
393
|
+
this._value = void 0;
|
|
394
|
+
this._updateCount = 0;
|
|
395
|
+
this._dependencies = /* @__PURE__ */ new Set();
|
|
396
|
+
this._dependenciesToBeRemoved = /* @__PURE__ */ new Set();
|
|
397
|
+
this._changeSummary = void 0;
|
|
398
|
+
this._isUpdating = false;
|
|
399
|
+
this._isComputing = false;
|
|
400
|
+
this._didReportChange = false;
|
|
401
|
+
this._isInBeforeUpdate = false;
|
|
402
|
+
this._isReaderValid = false;
|
|
403
|
+
this._store = void 0;
|
|
404
|
+
this._delayedStore = void 0;
|
|
405
|
+
this._removedObserverToCallEndUpdateOn = null;
|
|
406
|
+
this._changeSummary = this._changeTracker?.createChangeSummary(void 0);
|
|
407
|
+
}
|
|
408
|
+
onLastObserverRemoved() {
|
|
409
|
+
/**
|
|
410
|
+
* We are not tracking changes anymore, thus we have to assume
|
|
411
|
+
* that our cache is invalid.
|
|
412
|
+
*/
|
|
413
|
+
this._state = 0;
|
|
414
|
+
this._value = void 0;
|
|
415
|
+
getLogger()?.handleDerivedCleared(this);
|
|
416
|
+
for (const d of this._dependencies) d.removeObserver(this);
|
|
417
|
+
this._dependencies.clear();
|
|
418
|
+
if (this._store !== void 0) {
|
|
419
|
+
this._store.dispose();
|
|
420
|
+
this._store = void 0;
|
|
421
|
+
}
|
|
422
|
+
if (this._delayedStore !== void 0) {
|
|
423
|
+
this._delayedStore.dispose();
|
|
424
|
+
this._delayedStore = void 0;
|
|
425
|
+
}
|
|
426
|
+
this._handleLastObserverRemoved?.();
|
|
427
|
+
}
|
|
428
|
+
get() {
|
|
429
|
+
if (this._isComputing && false);
|
|
430
|
+
if (this._observers.size === 0) {
|
|
431
|
+
let result;
|
|
432
|
+
try {
|
|
433
|
+
this._isReaderValid = true;
|
|
434
|
+
let changeSummary = void 0;
|
|
435
|
+
if (this._changeTracker) {
|
|
436
|
+
changeSummary = this._changeTracker.createChangeSummary(void 0);
|
|
437
|
+
this._changeTracker.beforeUpdate?.(this, changeSummary);
|
|
438
|
+
}
|
|
439
|
+
result = this._computeFn(this, changeSummary);
|
|
440
|
+
} finally {
|
|
441
|
+
this._isReaderValid = false;
|
|
442
|
+
}
|
|
443
|
+
this.onLastObserverRemoved();
|
|
444
|
+
return result;
|
|
445
|
+
} else {
|
|
446
|
+
do {
|
|
447
|
+
if (this._state === 1) for (const d of this._dependencies) {
|
|
448
|
+
/** might call {@link handleChange} indirectly, which could make us stale */
|
|
449
|
+
d.reportChanges();
|
|
450
|
+
if (this._state === 2) break;
|
|
451
|
+
}
|
|
452
|
+
if (this._state === 1) this._state = 3;
|
|
453
|
+
if (this._state !== 3) this._recompute();
|
|
454
|
+
} while (this._state !== 3);
|
|
455
|
+
return this._value;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
_recompute() {
|
|
459
|
+
let didChange = false;
|
|
460
|
+
this._isComputing = true;
|
|
461
|
+
this._didReportChange = false;
|
|
462
|
+
const emptySet = this._dependenciesToBeRemoved;
|
|
463
|
+
this._dependenciesToBeRemoved = this._dependencies;
|
|
464
|
+
this._dependencies = emptySet;
|
|
465
|
+
try {
|
|
466
|
+
const changeSummary = this._changeSummary;
|
|
467
|
+
this._isReaderValid = true;
|
|
468
|
+
if (this._changeTracker) {
|
|
469
|
+
this._isInBeforeUpdate = true;
|
|
470
|
+
this._changeTracker.beforeUpdate?.(this, changeSummary);
|
|
471
|
+
this._isInBeforeUpdate = false;
|
|
472
|
+
this._changeSummary = this._changeTracker?.createChangeSummary(changeSummary);
|
|
473
|
+
}
|
|
474
|
+
const hadValue = this._state !== 0;
|
|
475
|
+
const oldValue = this._value;
|
|
476
|
+
this._state = 3;
|
|
477
|
+
const delayedStore = this._delayedStore;
|
|
478
|
+
if (delayedStore !== void 0) this._delayedStore = void 0;
|
|
479
|
+
try {
|
|
480
|
+
if (this._store !== void 0) {
|
|
481
|
+
this._store.dispose();
|
|
482
|
+
this._store = void 0;
|
|
483
|
+
}
|
|
484
|
+
/** might call {@link handleChange} indirectly, which could invalidate us */
|
|
485
|
+
this._value = this._computeFn(this, changeSummary);
|
|
486
|
+
} finally {
|
|
487
|
+
this._isReaderValid = false;
|
|
488
|
+
for (const o of this._dependenciesToBeRemoved) o.removeObserver(this);
|
|
489
|
+
this._dependenciesToBeRemoved.clear();
|
|
490
|
+
if (delayedStore !== void 0) delayedStore.dispose();
|
|
491
|
+
}
|
|
492
|
+
didChange = this._didReportChange || hadValue && !this._equalityComparator(oldValue, this._value);
|
|
493
|
+
getLogger()?.handleObservableUpdated(this, {
|
|
494
|
+
oldValue,
|
|
495
|
+
newValue: this._value,
|
|
496
|
+
change: void 0,
|
|
497
|
+
didChange,
|
|
498
|
+
hadValue
|
|
499
|
+
});
|
|
500
|
+
} catch (e) {
|
|
501
|
+
onBugIndicatingError(e);
|
|
502
|
+
}
|
|
503
|
+
this._isComputing = false;
|
|
504
|
+
if (!this._didReportChange && didChange) for (const r of this._observers) r.handleChange(this, void 0);
|
|
505
|
+
else this._didReportChange = false;
|
|
506
|
+
}
|
|
507
|
+
toString() {
|
|
508
|
+
return `LazyDerived<${this.debugName}>`;
|
|
509
|
+
}
|
|
510
|
+
beginUpdate(_observable) {
|
|
511
|
+
if (this._isUpdating) throw new BugIndicatingError("Cyclic deriveds are not supported yet!");
|
|
512
|
+
this._updateCount++;
|
|
513
|
+
this._isUpdating = true;
|
|
514
|
+
try {
|
|
515
|
+
const propagateBeginUpdate = this._updateCount === 1;
|
|
516
|
+
if (this._state === 3) {
|
|
517
|
+
this._state = 1;
|
|
518
|
+
if (!propagateBeginUpdate) for (const r of this._observers) r.handlePossibleChange(this);
|
|
519
|
+
}
|
|
520
|
+
if (propagateBeginUpdate) for (const r of this._observers) r.beginUpdate(this);
|
|
521
|
+
} finally {
|
|
522
|
+
this._isUpdating = false;
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
endUpdate(_observable) {
|
|
526
|
+
this._updateCount--;
|
|
527
|
+
if (this._updateCount === 0) {
|
|
528
|
+
const observers = [...this._observers];
|
|
529
|
+
for (const r of observers) r.endUpdate(this);
|
|
530
|
+
if (this._removedObserverToCallEndUpdateOn) {
|
|
531
|
+
const observers = [...this._removedObserverToCallEndUpdateOn];
|
|
532
|
+
this._removedObserverToCallEndUpdateOn = null;
|
|
533
|
+
for (const r of observers) r.endUpdate(this);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
handlePossibleChange(observable) {
|
|
538
|
+
if (this._state === 3 && this._dependencies.has(observable) && !this._dependenciesToBeRemoved.has(observable)) {
|
|
539
|
+
this._state = 1;
|
|
540
|
+
for (const r of this._observers) r.handlePossibleChange(this);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
handleChange(observable, change) {
|
|
544
|
+
if (this._dependencies.has(observable) && !this._dependenciesToBeRemoved.has(observable) || this._isInBeforeUpdate) {
|
|
545
|
+
getLogger()?.handleDerivedDependencyChanged(this, observable, change);
|
|
546
|
+
let shouldReact = false;
|
|
547
|
+
try {
|
|
548
|
+
shouldReact = this._changeTracker ? this._changeTracker.handleChange({
|
|
549
|
+
changedObservable: observable,
|
|
550
|
+
change,
|
|
551
|
+
didChange: (o) => o === observable
|
|
552
|
+
}, this._changeSummary) : true;
|
|
553
|
+
} catch (e) {
|
|
554
|
+
onBugIndicatingError(e);
|
|
555
|
+
}
|
|
556
|
+
const wasUpToDate = this._state === 3;
|
|
557
|
+
if (shouldReact && (this._state === 1 || wasUpToDate)) {
|
|
558
|
+
this._state = 2;
|
|
559
|
+
if (wasUpToDate) for (const r of this._observers) r.handlePossibleChange(this);
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
_ensureReaderValid() {
|
|
564
|
+
if (!this._isReaderValid) throw new BugIndicatingError("The reader object cannot be used outside its compute function!");
|
|
565
|
+
}
|
|
566
|
+
readObservable(observable) {
|
|
567
|
+
this._ensureReaderValid();
|
|
568
|
+
observable.addObserver(this);
|
|
569
|
+
/** This might call {@link handleChange} indirectly, which could invalidate us */
|
|
570
|
+
const value = observable.get();
|
|
571
|
+
this._dependencies.add(observable);
|
|
572
|
+
this._dependenciesToBeRemoved.delete(observable);
|
|
573
|
+
return value;
|
|
574
|
+
}
|
|
575
|
+
reportChange(change) {
|
|
576
|
+
this._ensureReaderValid();
|
|
577
|
+
this._didReportChange = true;
|
|
578
|
+
for (const r of this._observers) r.handleChange(this, change);
|
|
579
|
+
}
|
|
580
|
+
get store() {
|
|
581
|
+
this._ensureReaderValid();
|
|
582
|
+
if (this._store === void 0) this._store = new DisposableStore();
|
|
583
|
+
return this._store;
|
|
584
|
+
}
|
|
585
|
+
get delayedStore() {
|
|
586
|
+
this._ensureReaderValid();
|
|
587
|
+
if (this._delayedStore === void 0) this._delayedStore = new DisposableStore();
|
|
588
|
+
return this._delayedStore;
|
|
589
|
+
}
|
|
590
|
+
addObserver(observer) {
|
|
591
|
+
const shouldCallBeginUpdate = !this._observers.has(observer) && this._updateCount > 0;
|
|
592
|
+
super.addObserver(observer);
|
|
593
|
+
if (shouldCallBeginUpdate) {
|
|
594
|
+
if (this._removedObserverToCallEndUpdateOn && this._removedObserverToCallEndUpdateOn.has(observer)) this._removedObserverToCallEndUpdateOn.delete(observer);
|
|
595
|
+
else observer.beginUpdate(this);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
removeObserver(observer) {
|
|
599
|
+
if (this._observers.has(observer) && this._updateCount > 0) {
|
|
600
|
+
if (!this._removedObserverToCallEndUpdateOn) this._removedObserverToCallEndUpdateOn = /* @__PURE__ */ new Set();
|
|
601
|
+
this._removedObserverToCallEndUpdateOn.add(observer);
|
|
602
|
+
}
|
|
603
|
+
super.removeObserver(observer);
|
|
604
|
+
}
|
|
605
|
+
debugGetState() {
|
|
606
|
+
return {
|
|
607
|
+
state: this._state,
|
|
608
|
+
stateStr: derivedStateToString(this._state),
|
|
609
|
+
updateCount: this._updateCount,
|
|
610
|
+
isComputing: this._isComputing,
|
|
611
|
+
dependencies: this._dependencies,
|
|
612
|
+
value: this._value
|
|
613
|
+
};
|
|
614
|
+
}
|
|
615
|
+
debugSetValue(newValue) {
|
|
616
|
+
this._value = newValue;
|
|
617
|
+
}
|
|
618
|
+
debugRecompute() {
|
|
619
|
+
if (!this._isComputing) this._recompute();
|
|
620
|
+
else this._state = 2;
|
|
621
|
+
}
|
|
622
|
+
setValue(newValue, tx, change) {
|
|
623
|
+
this._value = newValue;
|
|
624
|
+
const observers = this._observers;
|
|
625
|
+
tx.updateObserver(this, this);
|
|
626
|
+
for (const d of observers) d.handleChange(this, change);
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
//#endregion
|
|
630
|
+
//#region ../../node_modules/.pnpm/@vscode+observables@0.1.1-0/node_modules/@vscode/observables/dist/observableInternal/observables/derived.js
|
|
631
|
+
function derived(computeFnOrOwner, computeFn, debugLocation = DebugLocation.ofCaller()) {
|
|
632
|
+
if (computeFn !== void 0) return new Derived(new DebugNameData(computeFnOrOwner, void 0, computeFn), computeFn, void 0, void 0, strictEquals, debugLocation);
|
|
633
|
+
return new Derived(new DebugNameData(void 0, void 0, computeFnOrOwner), computeFnOrOwner, void 0, void 0, strictEquals, debugLocation);
|
|
634
|
+
}
|
|
635
|
+
function derivedOpts(options, computeFn, debugLocation = DebugLocation.ofCaller()) {
|
|
636
|
+
return new Derived(new DebugNameData(options.owner, options.debugName, options.debugReferenceFn), computeFn, void 0, options.onLastObserverRemoved, options.equalsFn ?? strictEquals, debugLocation);
|
|
637
|
+
}
|
|
638
|
+
_setDerivedOpts(derivedOpts);
|
|
639
|
+
//#endregion
|
|
640
|
+
//#region ../../node_modules/.pnpm/@vscode+observables@0.1.1-0/node_modules/@vscode/observables/dist/observableInternal/reactions/createEffectImpl.js
|
|
641
|
+
function autorunStateToString(state) {
|
|
642
|
+
switch (state) {
|
|
643
|
+
case 1: return "dependenciesMightHaveChanged";
|
|
644
|
+
case 2: return "stale";
|
|
645
|
+
case 3: return "upToDate";
|
|
646
|
+
default: return "<unknown>";
|
|
647
|
+
}
|
|
648
|
+
}
|
|
649
|
+
var AutorunObserver = class {
|
|
650
|
+
get debugName() {
|
|
651
|
+
return this._debugNameData.getDebugName(this) ?? "(anonymous)";
|
|
652
|
+
}
|
|
653
|
+
constructor(_debugNameData, _runFn, _changeTracker, debugLocation) {
|
|
654
|
+
this._debugNameData = _debugNameData;
|
|
655
|
+
this._runFn = _runFn;
|
|
656
|
+
this._changeTracker = _changeTracker;
|
|
657
|
+
this._state = 2;
|
|
658
|
+
this._updateCount = 0;
|
|
659
|
+
this._disposed = false;
|
|
660
|
+
this._dependencies = /* @__PURE__ */ new Set();
|
|
661
|
+
this._dependenciesToBeRemoved = /* @__PURE__ */ new Set();
|
|
662
|
+
this._isRunning = false;
|
|
663
|
+
this._store = void 0;
|
|
664
|
+
this._delayedStore = void 0;
|
|
665
|
+
this._changeSummary = this._changeTracker?.createChangeSummary(void 0);
|
|
666
|
+
getLogger()?.handleAutorunCreated(this, debugLocation);
|
|
667
|
+
this._run();
|
|
668
|
+
}
|
|
669
|
+
dispose() {
|
|
670
|
+
if (this._disposed) return;
|
|
671
|
+
this._disposed = true;
|
|
672
|
+
for (const o of this._dependencies) o.removeObserver(this);
|
|
673
|
+
this._dependencies.clear();
|
|
674
|
+
if (this._store !== void 0) this._store.dispose();
|
|
675
|
+
if (this._delayedStore !== void 0) this._delayedStore.dispose();
|
|
676
|
+
getLogger()?.handleAutorunDisposed(this);
|
|
677
|
+
}
|
|
678
|
+
_run() {
|
|
679
|
+
const emptySet = this._dependenciesToBeRemoved;
|
|
680
|
+
this._dependenciesToBeRemoved = this._dependencies;
|
|
681
|
+
this._dependencies = emptySet;
|
|
682
|
+
this._state = 3;
|
|
683
|
+
try {
|
|
684
|
+
if (!this._disposed) {
|
|
685
|
+
getLogger()?.handleAutorunStarted(this);
|
|
686
|
+
const changeSummary = this._changeSummary;
|
|
687
|
+
const delayedStore = this._delayedStore;
|
|
688
|
+
if (delayedStore !== void 0) this._delayedStore = void 0;
|
|
689
|
+
try {
|
|
690
|
+
this._isRunning = true;
|
|
691
|
+
if (this._changeTracker) {
|
|
692
|
+
this._changeTracker.beforeUpdate?.(this, changeSummary);
|
|
693
|
+
this._changeSummary = this._changeTracker.createChangeSummary(changeSummary);
|
|
694
|
+
}
|
|
695
|
+
if (this._store !== void 0) {
|
|
696
|
+
this._store.dispose();
|
|
697
|
+
this._store = void 0;
|
|
698
|
+
}
|
|
699
|
+
this._runFn(this, changeSummary);
|
|
700
|
+
} catch (e) {
|
|
701
|
+
onBugIndicatingError(e);
|
|
702
|
+
} finally {
|
|
703
|
+
this._isRunning = false;
|
|
704
|
+
if (delayedStore !== void 0) delayedStore.dispose();
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
} finally {
|
|
708
|
+
if (!this._disposed) getLogger()?.handleAutorunFinished(this);
|
|
709
|
+
for (const o of this._dependenciesToBeRemoved) o.removeObserver(this);
|
|
710
|
+
this._dependenciesToBeRemoved.clear();
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
toString() {
|
|
714
|
+
return `Autorun<${this.debugName}>`;
|
|
715
|
+
}
|
|
716
|
+
beginUpdate(_observable) {
|
|
717
|
+
if (this._state === 3) this._state = 1;
|
|
718
|
+
this._updateCount++;
|
|
719
|
+
}
|
|
720
|
+
endUpdate(_observable) {
|
|
721
|
+
try {
|
|
722
|
+
if (this._updateCount === 1) do {
|
|
723
|
+
if (this._state === 1) {
|
|
724
|
+
this._state = 3;
|
|
725
|
+
for (const d of this._dependencies) {
|
|
726
|
+
d.reportChanges();
|
|
727
|
+
if (this._state === 2) break;
|
|
728
|
+
}
|
|
729
|
+
}
|
|
730
|
+
if (this._state !== 3) this._run();
|
|
731
|
+
} while (this._state !== 3);
|
|
732
|
+
} finally {
|
|
733
|
+
this._updateCount--;
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
handlePossibleChange(observable) {
|
|
737
|
+
if (this._state === 3 && this._isDependency(observable)) this._state = 1;
|
|
738
|
+
}
|
|
739
|
+
handleChange(observable, change) {
|
|
740
|
+
if (this._isDependency(observable)) {
|
|
741
|
+
getLogger()?.handleAutorunDependencyChanged(this, observable, change);
|
|
742
|
+
try {
|
|
743
|
+
if (this._changeTracker ? this._changeTracker.handleChange({
|
|
744
|
+
changedObservable: observable,
|
|
745
|
+
change,
|
|
746
|
+
didChange: (o) => o === observable
|
|
747
|
+
}, this._changeSummary) : true) this._state = 2;
|
|
748
|
+
} catch (e) {
|
|
749
|
+
onBugIndicatingError(e);
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
_isDependency(observable) {
|
|
754
|
+
return this._dependencies.has(observable) && !this._dependenciesToBeRemoved.has(observable);
|
|
755
|
+
}
|
|
756
|
+
_ensureNoRunning() {
|
|
757
|
+
if (!this._isRunning) throw new BugIndicatingError("The reader object cannot be used outside its compute function!");
|
|
758
|
+
}
|
|
759
|
+
readObservable(observable) {
|
|
760
|
+
this._ensureNoRunning();
|
|
761
|
+
if (this._disposed) return observable.get();
|
|
762
|
+
observable.addObserver(this);
|
|
763
|
+
const value = observable.get();
|
|
764
|
+
this._dependencies.add(observable);
|
|
765
|
+
this._dependenciesToBeRemoved.delete(observable);
|
|
766
|
+
return value;
|
|
767
|
+
}
|
|
768
|
+
get store() {
|
|
769
|
+
this._ensureNoRunning();
|
|
770
|
+
if (this._disposed) throw new BugIndicatingError("Cannot access store after dispose");
|
|
771
|
+
if (this._store === void 0) this._store = new DisposableStore();
|
|
772
|
+
return this._store;
|
|
773
|
+
}
|
|
774
|
+
get delayedStore() {
|
|
775
|
+
this._ensureNoRunning();
|
|
776
|
+
if (this._disposed) throw new BugIndicatingError("Cannot access store after dispose");
|
|
777
|
+
if (this._delayedStore === void 0) this._delayedStore = new DisposableStore();
|
|
778
|
+
return this._delayedStore;
|
|
779
|
+
}
|
|
780
|
+
debugGetState() {
|
|
781
|
+
return {
|
|
782
|
+
isRunning: this._isRunning,
|
|
783
|
+
updateCount: this._updateCount,
|
|
784
|
+
dependencies: this._dependencies,
|
|
785
|
+
state: this._state,
|
|
786
|
+
stateStr: autorunStateToString(this._state)
|
|
787
|
+
};
|
|
788
|
+
}
|
|
789
|
+
debugRerun() {
|
|
790
|
+
if (!this._isRunning) this._run();
|
|
791
|
+
else this._state = 2;
|
|
792
|
+
}
|
|
793
|
+
};
|
|
794
|
+
//#endregion
|
|
795
|
+
//#region ../../node_modules/.pnpm/@vscode+observables@0.1.1-0/node_modules/@vscode/observables/dist/observableInternal/reactions/createEffect.js
|
|
796
|
+
/**
|
|
797
|
+
* Runs immediately and whenever a transaction ends and an observed observable changed.
|
|
798
|
+
* {@link fn} should start with a JS Doc using `@description` to name the effect.
|
|
799
|
+
*/
|
|
800
|
+
function createEffect(fn, debugLocation = DebugLocation.ofCaller()) {
|
|
801
|
+
return new AutorunObserver(new DebugNameData(void 0, void 0, fn), fn, void 0, debugLocation);
|
|
802
|
+
}
|
|
803
|
+
/**
|
|
804
|
+
* @deprecated Use {@link createEffect} instead.
|
|
805
|
+
*/
|
|
806
|
+
const autorun = createEffect;
|
|
807
|
+
//#endregion
|
|
808
|
+
//#region ../../node_modules/.pnpm/@vscode+observables@0.1.1-0/node_modules/@vscode/observables/dist/observableInternal/base.js
|
|
809
|
+
/**
|
|
810
|
+
* This function is used to indicate that the caller recovered from an error that indicates a bug.
|
|
811
|
+
*/
|
|
812
|
+
function handleBugIndicatingErrorRecovery(message) {
|
|
813
|
+
const err = /* @__PURE__ */ new Error("BugIndicatingErrorRecovery: " + message);
|
|
814
|
+
onUnexpectedError(err);
|
|
815
|
+
console.error("recovered from an error that indicates a bug", err);
|
|
816
|
+
}
|
|
817
|
+
//#endregion
|
|
818
|
+
//#region ../../node_modules/.pnpm/@vscode+observables@0.1.1-0/node_modules/@vscode/observables/dist/observableInternal/transaction.js
|
|
819
|
+
/**
|
|
820
|
+
* Starts a transaction in which many observables can be changed at once.
|
|
821
|
+
* {@link fn} should start with a JS Doc using `@description` to give the transaction a debug name.
|
|
822
|
+
* Reaction run on demand or when the transaction ends.
|
|
823
|
+
*/
|
|
824
|
+
function transaction(fn, getDebugName) {
|
|
825
|
+
const tx = new TransactionImpl(fn, getDebugName);
|
|
826
|
+
try {
|
|
827
|
+
fn(tx);
|
|
828
|
+
} finally {
|
|
829
|
+
tx.finish();
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
/**
|
|
833
|
+
* Allows to chain transactions.
|
|
834
|
+
*/
|
|
835
|
+
function subtransaction(tx, fn, getDebugName) {
|
|
836
|
+
if (!tx) transaction(fn, getDebugName);
|
|
837
|
+
else fn(tx);
|
|
838
|
+
}
|
|
839
|
+
var TransactionImpl = class {
|
|
840
|
+
constructor(_fn, _getDebugName) {
|
|
841
|
+
this._fn = _fn;
|
|
842
|
+
this._getDebugName = _getDebugName;
|
|
843
|
+
this._updatingObservers = [];
|
|
844
|
+
getLogger()?.handleBeginTransaction(this);
|
|
845
|
+
}
|
|
846
|
+
getDebugName() {
|
|
847
|
+
if (this._getDebugName) return this._getDebugName();
|
|
848
|
+
return getFunctionName(this._fn);
|
|
849
|
+
}
|
|
850
|
+
updateObserver(observer, observable) {
|
|
851
|
+
if (!this._updatingObservers) {
|
|
852
|
+
handleBugIndicatingErrorRecovery("Transaction already finished!");
|
|
853
|
+
transaction((tx) => {
|
|
854
|
+
tx.updateObserver(observer, observable);
|
|
855
|
+
});
|
|
856
|
+
return;
|
|
857
|
+
}
|
|
858
|
+
this._updatingObservers.push({
|
|
859
|
+
observer,
|
|
860
|
+
observable
|
|
861
|
+
});
|
|
862
|
+
observer.beginUpdate(observable);
|
|
863
|
+
}
|
|
864
|
+
finish() {
|
|
865
|
+
const updatingObservers = this._updatingObservers;
|
|
866
|
+
if (!updatingObservers) {
|
|
867
|
+
handleBugIndicatingErrorRecovery("transaction.finish() has already been called!");
|
|
868
|
+
return;
|
|
869
|
+
}
|
|
870
|
+
for (let i = 0; i < updatingObservers.length; i++) {
|
|
871
|
+
const { observer, observable } = updatingObservers[i];
|
|
872
|
+
observer.endUpdate(observable);
|
|
873
|
+
}
|
|
874
|
+
this._updatingObservers = null;
|
|
875
|
+
getLogger()?.handleEndTransaction(this);
|
|
876
|
+
}
|
|
877
|
+
debugGetUpdatingObservers() {
|
|
878
|
+
return this._updatingObservers;
|
|
879
|
+
}
|
|
880
|
+
};
|
|
881
|
+
//#endregion
|
|
882
|
+
//#region ../../node_modules/.pnpm/@vscode+observables@0.1.1-0/node_modules/@vscode/observables/dist/observableInternal/observables/observableValue.js
|
|
883
|
+
function observableValue(nameOrOwner, initialValue, debugLocation = DebugLocation.ofCaller()) {
|
|
884
|
+
let debugNameData;
|
|
885
|
+
if (typeof nameOrOwner === "string") debugNameData = new DebugNameData(void 0, nameOrOwner, void 0);
|
|
886
|
+
else debugNameData = new DebugNameData(nameOrOwner, void 0, void 0);
|
|
887
|
+
return new ObservableValue(debugNameData, initialValue, strictEquals, debugLocation);
|
|
888
|
+
}
|
|
889
|
+
var ObservableValue = class extends BaseObservable {
|
|
890
|
+
get debugName() {
|
|
891
|
+
return this._debugNameData.getDebugName(this) ?? "ObservableValue";
|
|
892
|
+
}
|
|
893
|
+
constructor(_debugNameData, initialValue, _equalityComparator, debugLocation) {
|
|
894
|
+
super(debugLocation);
|
|
895
|
+
this._debugNameData = _debugNameData;
|
|
896
|
+
this._equalityComparator = _equalityComparator;
|
|
897
|
+
this._value = initialValue;
|
|
898
|
+
getLogger()?.handleObservableUpdated(this, {
|
|
899
|
+
hadValue: false,
|
|
900
|
+
newValue: initialValue,
|
|
901
|
+
change: void 0,
|
|
902
|
+
didChange: true,
|
|
903
|
+
oldValue: void 0
|
|
904
|
+
});
|
|
905
|
+
}
|
|
906
|
+
get() {
|
|
907
|
+
return this._value;
|
|
908
|
+
}
|
|
909
|
+
set(value, tx, change) {
|
|
910
|
+
if (change === void 0 && this._equalityComparator(this._value, value)) return;
|
|
911
|
+
let _tx;
|
|
912
|
+
if (!tx) tx = _tx = new TransactionImpl(() => {}, () => `Setting ${this.debugName}`);
|
|
913
|
+
try {
|
|
914
|
+
const oldValue = this._value;
|
|
915
|
+
this._setValue(value);
|
|
916
|
+
getLogger()?.handleObservableUpdated(this, {
|
|
917
|
+
oldValue,
|
|
918
|
+
newValue: value,
|
|
919
|
+
change,
|
|
920
|
+
didChange: true,
|
|
921
|
+
hadValue: true
|
|
922
|
+
});
|
|
923
|
+
for (const observer of this._observers) {
|
|
924
|
+
tx.updateObserver(observer, this);
|
|
925
|
+
observer.handleChange(this, change);
|
|
926
|
+
}
|
|
927
|
+
} finally {
|
|
928
|
+
if (_tx) _tx.finish();
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
toString() {
|
|
932
|
+
return `${this.debugName}: ${this._value}`;
|
|
933
|
+
}
|
|
934
|
+
_setValue(newValue) {
|
|
935
|
+
this._value = newValue;
|
|
936
|
+
}
|
|
937
|
+
debugGetState() {
|
|
938
|
+
return { value: this._value };
|
|
939
|
+
}
|
|
940
|
+
debugSetValue(value) {
|
|
941
|
+
this._value = value;
|
|
942
|
+
}
|
|
943
|
+
};
|
|
944
|
+
//#endregion
|
|
945
|
+
//#region ../../node_modules/.pnpm/@vscode+observables@0.1.1-0/node_modules/@vscode/observables/dist/observableInternal/observables/observableFromEvent.js
|
|
946
|
+
function observableFromEvent(...args) {
|
|
947
|
+
let owner;
|
|
948
|
+
let event;
|
|
949
|
+
let getValue;
|
|
950
|
+
let debugLocation;
|
|
951
|
+
if (args.length === 2) [event, getValue] = args;
|
|
952
|
+
else [owner, event, getValue, debugLocation] = args;
|
|
953
|
+
return new FromEventObservable(new DebugNameData(owner, void 0, getValue), event, getValue, () => FromEventObservable.globalTransaction, strictEquals, debugLocation ?? DebugLocation.ofCaller());
|
|
954
|
+
}
|
|
955
|
+
var FromEventObservable = class extends BaseObservable {
|
|
956
|
+
constructor(_debugNameData, event, _getValue, _getTransaction, _equalityComparator, debugLocation) {
|
|
957
|
+
super(debugLocation);
|
|
958
|
+
this._debugNameData = _debugNameData;
|
|
959
|
+
this.event = event;
|
|
960
|
+
this._getValue = _getValue;
|
|
961
|
+
this._getTransaction = _getTransaction;
|
|
962
|
+
this._equalityComparator = _equalityComparator;
|
|
963
|
+
this._hasValue = false;
|
|
964
|
+
this.handleEvent = (args) => {
|
|
965
|
+
const newValue = this._getValue(args);
|
|
966
|
+
const oldValue = this._value;
|
|
967
|
+
const didChange = !this._hasValue || !this._equalityComparator(oldValue, newValue);
|
|
968
|
+
let didRunTransaction = false;
|
|
969
|
+
if (didChange) {
|
|
970
|
+
this._value = newValue;
|
|
971
|
+
if (this._hasValue) {
|
|
972
|
+
didRunTransaction = true;
|
|
973
|
+
subtransaction(this._getTransaction(), (tx) => {
|
|
974
|
+
getLogger()?.handleObservableUpdated(this, {
|
|
975
|
+
oldValue,
|
|
976
|
+
newValue,
|
|
977
|
+
change: void 0,
|
|
978
|
+
didChange,
|
|
979
|
+
hadValue: this._hasValue
|
|
980
|
+
});
|
|
981
|
+
for (const o of this._observers) {
|
|
982
|
+
tx.updateObserver(o, this);
|
|
983
|
+
o.handleChange(this, void 0);
|
|
984
|
+
}
|
|
985
|
+
}, () => {
|
|
986
|
+
const name = this.getDebugName();
|
|
987
|
+
return "Event fired" + (name ? `: ${name}` : "");
|
|
988
|
+
});
|
|
989
|
+
}
|
|
990
|
+
this._hasValue = true;
|
|
991
|
+
}
|
|
992
|
+
if (!didRunTransaction) getLogger()?.handleObservableUpdated(this, {
|
|
993
|
+
oldValue,
|
|
994
|
+
newValue,
|
|
995
|
+
change: void 0,
|
|
996
|
+
didChange,
|
|
997
|
+
hadValue: this._hasValue
|
|
998
|
+
});
|
|
999
|
+
};
|
|
1000
|
+
}
|
|
1001
|
+
getDebugName() {
|
|
1002
|
+
return this._debugNameData.getDebugName(this);
|
|
1003
|
+
}
|
|
1004
|
+
get debugName() {
|
|
1005
|
+
const name = this.getDebugName();
|
|
1006
|
+
return "From Event" + (name ? `: ${name}` : "");
|
|
1007
|
+
}
|
|
1008
|
+
onFirstObserverAdded() {
|
|
1009
|
+
this._subscription = this.event(this.handleEvent);
|
|
1010
|
+
}
|
|
1011
|
+
onLastObserverRemoved() {
|
|
1012
|
+
this._subscription.dispose();
|
|
1013
|
+
this._subscription = void 0;
|
|
1014
|
+
this._hasValue = false;
|
|
1015
|
+
this._value = void 0;
|
|
1016
|
+
}
|
|
1017
|
+
get() {
|
|
1018
|
+
if (this._subscription) {
|
|
1019
|
+
if (!this._hasValue) this.handleEvent(void 0);
|
|
1020
|
+
return this._value;
|
|
1021
|
+
} else return this._getValue(void 0);
|
|
1022
|
+
}
|
|
1023
|
+
debugSetValue(value) {
|
|
1024
|
+
this._value = value;
|
|
1025
|
+
}
|
|
1026
|
+
debugGetState() {
|
|
1027
|
+
return {
|
|
1028
|
+
value: this._value,
|
|
1029
|
+
hasValue: this._hasValue
|
|
1030
|
+
};
|
|
1031
|
+
}
|
|
1032
|
+
};
|
|
1033
|
+
(function(observableFromEvent) {
|
|
1034
|
+
observableFromEvent.Observer = FromEventObservable;
|
|
1035
|
+
function batchEventsGlobally(tx, fn) {
|
|
1036
|
+
let didSet = false;
|
|
1037
|
+
if (FromEventObservable.globalTransaction === void 0) {
|
|
1038
|
+
FromEventObservable.globalTransaction = tx;
|
|
1039
|
+
didSet = true;
|
|
1040
|
+
}
|
|
1041
|
+
try {
|
|
1042
|
+
fn();
|
|
1043
|
+
} finally {
|
|
1044
|
+
if (didSet) FromEventObservable.globalTransaction = void 0;
|
|
1045
|
+
}
|
|
1046
|
+
}
|
|
1047
|
+
observableFromEvent.batchEventsGlobally = batchEventsGlobally;
|
|
1048
|
+
})(observableFromEvent || (observableFromEvent = {}));
|
|
1049
|
+
//#endregion
|
|
1050
|
+
//#region ../../node_modules/.pnpm/@vscode+observables@0.1.1-0/node_modules/@vscode/observables/dist/observableInternal/utils/utils.js
|
|
1051
|
+
/**
|
|
1052
|
+
* This makes sure the observable is being observed and keeps its cache alive.
|
|
1053
|
+
*/
|
|
1054
|
+
function keepObserved(observable) {
|
|
1055
|
+
const o = new KeepAliveObserver(false, void 0);
|
|
1056
|
+
observable.addObserver(o);
|
|
1057
|
+
return toDisposable(() => {
|
|
1058
|
+
observable.removeObserver(o);
|
|
1059
|
+
});
|
|
1060
|
+
}
|
|
1061
|
+
_setKeepObserved(keepObserved);
|
|
1062
|
+
/**
|
|
1063
|
+
* This converts the given observable into an autorun.
|
|
1064
|
+
*/
|
|
1065
|
+
function recomputeInitiallyAndOnChange(observable, handleValue) {
|
|
1066
|
+
const o = new KeepAliveObserver(true, handleValue);
|
|
1067
|
+
observable.addObserver(o);
|
|
1068
|
+
try {
|
|
1069
|
+
o.beginUpdate(observable);
|
|
1070
|
+
} finally {
|
|
1071
|
+
o.endUpdate(observable);
|
|
1072
|
+
}
|
|
1073
|
+
return toDisposable(() => {
|
|
1074
|
+
observable.removeObserver(o);
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
_setRecomputeInitiallyAndOnChange(recomputeInitiallyAndOnChange);
|
|
1078
|
+
var KeepAliveObserver = class {
|
|
1079
|
+
constructor(_forceRecompute, _handleValue) {
|
|
1080
|
+
this._forceRecompute = _forceRecompute;
|
|
1081
|
+
this._handleValue = _handleValue;
|
|
1082
|
+
this._counter = 0;
|
|
1083
|
+
}
|
|
1084
|
+
beginUpdate(observable) {
|
|
1085
|
+
this._counter++;
|
|
1086
|
+
}
|
|
1087
|
+
endUpdate(observable) {
|
|
1088
|
+
if (this._counter === 1 && this._forceRecompute) {
|
|
1089
|
+
if (this._handleValue) this._handleValue(observable.get());
|
|
1090
|
+
else observable.reportChanges();
|
|
1091
|
+
}
|
|
1092
|
+
this._counter--;
|
|
1093
|
+
}
|
|
1094
|
+
handlePossibleChange(observable) {}
|
|
1095
|
+
handleChange(observable, change) {}
|
|
1096
|
+
};
|
|
1097
|
+
//#endregion
|
|
1098
|
+
//#region ../../node_modules/.pnpm/@vscode+observables@0.1.1-0/node_modules/@vscode/observables/dist/observableInternal/logging/consoleObservableLogger.js
|
|
1099
|
+
let consoleObservableLogger;
|
|
1100
|
+
function logObservableToConsole(obs) {
|
|
1101
|
+
if (!consoleObservableLogger) {
|
|
1102
|
+
consoleObservableLogger = new ConsoleObservableLogger();
|
|
1103
|
+
addLogger(consoleObservableLogger);
|
|
1104
|
+
}
|
|
1105
|
+
consoleObservableLogger.addFilteredObj(obs);
|
|
1106
|
+
}
|
|
1107
|
+
var ConsoleObservableLogger = class {
|
|
1108
|
+
constructor() {
|
|
1109
|
+
this.indentation = 0;
|
|
1110
|
+
this.changedObservablesSets = /* @__PURE__ */ new WeakMap();
|
|
1111
|
+
}
|
|
1112
|
+
addFilteredObj(obj) {
|
|
1113
|
+
if (!this._filteredObjects) this._filteredObjects = /* @__PURE__ */ new Set();
|
|
1114
|
+
this._filteredObjects.add(obj);
|
|
1115
|
+
}
|
|
1116
|
+
_isIncluded(obj) {
|
|
1117
|
+
return this._filteredObjects?.has(obj) ?? true;
|
|
1118
|
+
}
|
|
1119
|
+
textToConsoleArgs(text) {
|
|
1120
|
+
return consoleTextToArgs([normalText(repeat("| ", this.indentation)), text]);
|
|
1121
|
+
}
|
|
1122
|
+
formatInfo(info) {
|
|
1123
|
+
if (!info.hadValue) return [
|
|
1124
|
+
normalText(` `),
|
|
1125
|
+
styled(formatValue(info.newValue, 60), { color: "green" }),
|
|
1126
|
+
normalText(` (initial)`)
|
|
1127
|
+
];
|
|
1128
|
+
return info.didChange ? [
|
|
1129
|
+
normalText(` `),
|
|
1130
|
+
styled(formatValue(info.oldValue, 70), {
|
|
1131
|
+
color: "red",
|
|
1132
|
+
strikeThrough: true
|
|
1133
|
+
}),
|
|
1134
|
+
normalText(` `),
|
|
1135
|
+
styled(formatValue(info.newValue, 60), { color: "green" })
|
|
1136
|
+
] : [normalText(` (unchanged)`)];
|
|
1137
|
+
}
|
|
1138
|
+
handleObservableCreated(observable) {
|
|
1139
|
+
if (observable instanceof Derived) {
|
|
1140
|
+
const derived = observable;
|
|
1141
|
+
this.changedObservablesSets.set(derived, /* @__PURE__ */ new Set());
|
|
1142
|
+
}
|
|
1143
|
+
}
|
|
1144
|
+
handleOnListenerCountChanged(observable, newCount) {}
|
|
1145
|
+
handleObservableUpdated(observable, info) {
|
|
1146
|
+
if (!this._isIncluded(observable)) return;
|
|
1147
|
+
if (observable instanceof Derived) {
|
|
1148
|
+
this._handleDerivedRecomputed(observable, info);
|
|
1149
|
+
return;
|
|
1150
|
+
}
|
|
1151
|
+
console.log(...this.textToConsoleArgs([
|
|
1152
|
+
formatKind("observable value changed"),
|
|
1153
|
+
styled(observable.debugName, { color: "BlueViolet" }),
|
|
1154
|
+
...this.formatInfo(info)
|
|
1155
|
+
]));
|
|
1156
|
+
}
|
|
1157
|
+
formatChanges(changes) {
|
|
1158
|
+
if (changes.size === 0) return;
|
|
1159
|
+
return styled(" (changed deps: " + [...changes].map((o) => o.debugName).join(", ") + ")", { color: "gray" });
|
|
1160
|
+
}
|
|
1161
|
+
handleDerivedDependencyChanged(derived, observable, change) {
|
|
1162
|
+
if (!this._isIncluded(derived)) return;
|
|
1163
|
+
this.changedObservablesSets.get(derived)?.add(observable);
|
|
1164
|
+
}
|
|
1165
|
+
_handleDerivedRecomputed(derived, info) {
|
|
1166
|
+
if (!this._isIncluded(derived)) return;
|
|
1167
|
+
const changedObservables = this.changedObservablesSets.get(derived);
|
|
1168
|
+
if (!changedObservables) return;
|
|
1169
|
+
console.log(...this.textToConsoleArgs([
|
|
1170
|
+
formatKind("derived recomputed"),
|
|
1171
|
+
styled(derived.debugName, { color: "BlueViolet" }),
|
|
1172
|
+
...this.formatInfo(info),
|
|
1173
|
+
this.formatChanges(changedObservables),
|
|
1174
|
+
{ data: [{ fn: derived._debugNameData.referenceFn ?? derived._computeFn }] }
|
|
1175
|
+
]));
|
|
1176
|
+
changedObservables.clear();
|
|
1177
|
+
}
|
|
1178
|
+
handleDerivedCleared(derived) {
|
|
1179
|
+
if (!this._isIncluded(derived)) return;
|
|
1180
|
+
console.log(...this.textToConsoleArgs([formatKind("derived cleared"), styled(derived.debugName, { color: "BlueViolet" })]));
|
|
1181
|
+
}
|
|
1182
|
+
handleFromEventObservableTriggered(observable, info) {
|
|
1183
|
+
if (!this._isIncluded(observable)) return;
|
|
1184
|
+
console.log(...this.textToConsoleArgs([
|
|
1185
|
+
formatKind("observable from event triggered"),
|
|
1186
|
+
styled(observable.debugName, { color: "BlueViolet" }),
|
|
1187
|
+
...this.formatInfo(info),
|
|
1188
|
+
{ data: [{ fn: observable._getValue }] }
|
|
1189
|
+
]));
|
|
1190
|
+
}
|
|
1191
|
+
handleAutorunCreated(autorun) {
|
|
1192
|
+
if (!this._isIncluded(autorun)) return;
|
|
1193
|
+
this.changedObservablesSets.set(autorun, /* @__PURE__ */ new Set());
|
|
1194
|
+
}
|
|
1195
|
+
handleAutorunDisposed(autorun) {}
|
|
1196
|
+
handleAutorunDependencyChanged(autorun, observable, change) {
|
|
1197
|
+
if (!this._isIncluded(autorun)) return;
|
|
1198
|
+
this.changedObservablesSets.get(autorun).add(observable);
|
|
1199
|
+
}
|
|
1200
|
+
handleAutorunStarted(autorun) {
|
|
1201
|
+
const changedObservables = this.changedObservablesSets.get(autorun);
|
|
1202
|
+
if (!changedObservables) return;
|
|
1203
|
+
if (this._isIncluded(autorun)) console.log(...this.textToConsoleArgs([
|
|
1204
|
+
formatKind("autorun"),
|
|
1205
|
+
styled(autorun.debugName, { color: "BlueViolet" }),
|
|
1206
|
+
this.formatChanges(changedObservables),
|
|
1207
|
+
{ data: [{ fn: autorun._debugNameData.referenceFn ?? autorun._runFn }] }
|
|
1208
|
+
]));
|
|
1209
|
+
changedObservables.clear();
|
|
1210
|
+
this.indentation++;
|
|
1211
|
+
}
|
|
1212
|
+
handleAutorunFinished(autorun) {
|
|
1213
|
+
this.indentation--;
|
|
1214
|
+
}
|
|
1215
|
+
handleBeginTransaction(transaction) {
|
|
1216
|
+
let transactionName = transaction.getDebugName();
|
|
1217
|
+
if (transactionName === void 0) transactionName = "";
|
|
1218
|
+
if (this._isIncluded(transaction)) console.log(...this.textToConsoleArgs([
|
|
1219
|
+
formatKind("transaction"),
|
|
1220
|
+
styled(transactionName, { color: "BlueViolet" }),
|
|
1221
|
+
{ data: [{ fn: transaction._fn }] }
|
|
1222
|
+
]));
|
|
1223
|
+
this.indentation++;
|
|
1224
|
+
}
|
|
1225
|
+
handleEndTransaction() {
|
|
1226
|
+
this.indentation--;
|
|
1227
|
+
}
|
|
1228
|
+
};
|
|
1229
|
+
function consoleTextToArgs(text) {
|
|
1230
|
+
const styles = new Array();
|
|
1231
|
+
const data = [];
|
|
1232
|
+
let firstArg = "";
|
|
1233
|
+
function process(t) {
|
|
1234
|
+
if ("length" in t) {
|
|
1235
|
+
for (const item of t) if (item) process(item);
|
|
1236
|
+
} else if ("text" in t) {
|
|
1237
|
+
firstArg += `%c${t.text}`;
|
|
1238
|
+
styles.push(t.style);
|
|
1239
|
+
if (t.data) data.push(...t.data);
|
|
1240
|
+
} else if ("data" in t) data.push(...t.data);
|
|
1241
|
+
}
|
|
1242
|
+
process(text);
|
|
1243
|
+
const result = [firstArg, ...styles];
|
|
1244
|
+
result.push(...data);
|
|
1245
|
+
return result;
|
|
1246
|
+
}
|
|
1247
|
+
function normalText(text) {
|
|
1248
|
+
return styled(text, { color: "black" });
|
|
1249
|
+
}
|
|
1250
|
+
function formatKind(kind) {
|
|
1251
|
+
return styled(padStr(`${kind}: `, 10), {
|
|
1252
|
+
color: "black",
|
|
1253
|
+
bold: true
|
|
1254
|
+
});
|
|
1255
|
+
}
|
|
1256
|
+
function styled(text, options = { color: "black" }) {
|
|
1257
|
+
function objToCss(styleObj) {
|
|
1258
|
+
return Object.entries(styleObj).reduce((styleString, [propName, propValue]) => {
|
|
1259
|
+
return `${styleString}${propName}:${propValue};`;
|
|
1260
|
+
}, "");
|
|
1261
|
+
}
|
|
1262
|
+
const style = { color: options.color };
|
|
1263
|
+
if (options.strikeThrough) style["text-decoration"] = "line-through";
|
|
1264
|
+
if (options.bold) style["font-weight"] = "bold";
|
|
1265
|
+
return {
|
|
1266
|
+
text,
|
|
1267
|
+
style: objToCss(style)
|
|
1268
|
+
};
|
|
1269
|
+
}
|
|
1270
|
+
function formatValue(value, availableLen) {
|
|
1271
|
+
try {
|
|
1272
|
+
return formatValueUnsafe(value, availableLen);
|
|
1273
|
+
} catch {
|
|
1274
|
+
return "[[???]]";
|
|
1275
|
+
}
|
|
1276
|
+
}
|
|
1277
|
+
function formatValueUnsafe(value, availableLen) {
|
|
1278
|
+
switch (typeof value) {
|
|
1279
|
+
case "number": return "" + value;
|
|
1280
|
+
case "string":
|
|
1281
|
+
if (value.length + 2 <= availableLen) return `"${value}"`;
|
|
1282
|
+
return `"${value.substr(0, availableLen - 7)}"+...`;
|
|
1283
|
+
case "boolean": return value ? "true" : "false";
|
|
1284
|
+
case "undefined": return "undefined";
|
|
1285
|
+
case "object":
|
|
1286
|
+
if (value === null) return "null";
|
|
1287
|
+
if (Array.isArray(value)) return formatArray(value, availableLen);
|
|
1288
|
+
return formatObject(value, availableLen);
|
|
1289
|
+
case "symbol": return value.toString();
|
|
1290
|
+
case "function": return `[[Function${value.name ? " " + value.name : ""}]]`;
|
|
1291
|
+
default: return "" + value;
|
|
1292
|
+
}
|
|
1293
|
+
}
|
|
1294
|
+
function formatArray(value, availableLen) {
|
|
1295
|
+
let result = "[ ";
|
|
1296
|
+
let first = true;
|
|
1297
|
+
for (const val of value) {
|
|
1298
|
+
if (!first) result += ", ";
|
|
1299
|
+
if (result.length - 5 > availableLen) {
|
|
1300
|
+
result += "...";
|
|
1301
|
+
break;
|
|
1302
|
+
}
|
|
1303
|
+
first = false;
|
|
1304
|
+
result += `${formatValue(val, availableLen - result.length)}`;
|
|
1305
|
+
}
|
|
1306
|
+
result += " ]";
|
|
1307
|
+
return result;
|
|
1308
|
+
}
|
|
1309
|
+
function formatObject(value, availableLen) {
|
|
1310
|
+
try {
|
|
1311
|
+
if (typeof value.toString === "function" && value.toString !== Object.prototype.toString) {
|
|
1312
|
+
const val = value.toString();
|
|
1313
|
+
if (val.length <= availableLen) return val;
|
|
1314
|
+
return val.substring(0, availableLen - 3) + "...";
|
|
1315
|
+
}
|
|
1316
|
+
} catch {
|
|
1317
|
+
return "[[Object]]";
|
|
1318
|
+
}
|
|
1319
|
+
const className = getClassName(value);
|
|
1320
|
+
let result = className ? className + "(" : "{ ";
|
|
1321
|
+
let first = true;
|
|
1322
|
+
let entries;
|
|
1323
|
+
try {
|
|
1324
|
+
entries = Object.entries(value);
|
|
1325
|
+
} catch {
|
|
1326
|
+
return className ? `${className}(...)` : "[[Object]]";
|
|
1327
|
+
}
|
|
1328
|
+
for (const [key, val] of entries) {
|
|
1329
|
+
if (!first) result += ", ";
|
|
1330
|
+
if (result.length - 5 > availableLen) {
|
|
1331
|
+
result += "...";
|
|
1332
|
+
break;
|
|
1333
|
+
}
|
|
1334
|
+
first = false;
|
|
1335
|
+
result += `${key}: ${formatValue(val, availableLen - result.length)}`;
|
|
1336
|
+
}
|
|
1337
|
+
result += className ? ")" : " }";
|
|
1338
|
+
return result;
|
|
1339
|
+
}
|
|
1340
|
+
function repeat(str, count) {
|
|
1341
|
+
let result = "";
|
|
1342
|
+
for (let i = 1; i <= count; i++) result += str;
|
|
1343
|
+
return result;
|
|
1344
|
+
}
|
|
1345
|
+
function padStr(str, length) {
|
|
1346
|
+
while (str.length < length) str += " ";
|
|
1347
|
+
return str;
|
|
1348
|
+
}
|
|
1349
|
+
//#endregion
|
|
1350
|
+
//#region ../../node_modules/.pnpm/@vscode+observables@0.1.1-0/node_modules/@vscode/observables/dist/observableInternal/logging/debugGetDependencyGraph.js
|
|
1351
|
+
function debugGetDependencyGraph(obs, options) {
|
|
1352
|
+
const debugNamePostProcessor = options?.debugNamePostProcessor ?? ((str) => str);
|
|
1353
|
+
const info = Info.from(obs, debugNamePostProcessor);
|
|
1354
|
+
if (!info) return "";
|
|
1355
|
+
return formatObservableInfo(info, 0, /* @__PURE__ */ new Set()).trim();
|
|
1356
|
+
}
|
|
1357
|
+
function formatObservableInfo(info, indentLevel, alreadyListed) {
|
|
1358
|
+
const indent = " ".repeat(indentLevel);
|
|
1359
|
+
const lines = [];
|
|
1360
|
+
if (alreadyListed.has(info.sourceObj)) {
|
|
1361
|
+
lines.push(`${indent}* ${info.type} ${info.name} (already listed)`);
|
|
1362
|
+
return lines.join("\n");
|
|
1363
|
+
}
|
|
1364
|
+
alreadyListed.add(info.sourceObj);
|
|
1365
|
+
lines.push(`${indent}* ${info.type} ${info.name}:`);
|
|
1366
|
+
lines.push(`${indent} value: ${formatValue(info.value, 50)}`);
|
|
1367
|
+
lines.push(`${indent} state: ${info.state}`);
|
|
1368
|
+
if (info.dependencies.length > 0) {
|
|
1369
|
+
lines.push(`${indent} dependencies:`);
|
|
1370
|
+
for (const dep of info.dependencies) lines.push(formatObservableInfo(dep, indentLevel + 1, alreadyListed));
|
|
1371
|
+
}
|
|
1372
|
+
return lines.join("\n");
|
|
1373
|
+
}
|
|
1374
|
+
var Info = class Info {
|
|
1375
|
+
static from(obs, debugNamePostProcessor) {
|
|
1376
|
+
if (obs instanceof AutorunObserver) {
|
|
1377
|
+
const state = obs.debugGetState();
|
|
1378
|
+
return new Info(obs, debugNamePostProcessor(obs.debugName), "autorun", void 0, state.stateStr, Array.from(state.dependencies).map((dep) => Info.from(dep, debugNamePostProcessor) || Info.unknown(dep)));
|
|
1379
|
+
} else if (obs instanceof Derived) {
|
|
1380
|
+
const state = obs.debugGetState();
|
|
1381
|
+
return new Info(obs, debugNamePostProcessor(obs.debugName), "derived", state.value, state.stateStr, Array.from(state.dependencies).map((dep) => Info.from(dep, debugNamePostProcessor) || Info.unknown(dep)));
|
|
1382
|
+
} else if (obs instanceof ObservableValue) {
|
|
1383
|
+
const state = obs.debugGetState();
|
|
1384
|
+
return new Info(obs, debugNamePostProcessor(obs.debugName), "observableValue", state.value, "upToDate", []);
|
|
1385
|
+
} else if (obs instanceof FromEventObservable) {
|
|
1386
|
+
const state = obs.debugGetState();
|
|
1387
|
+
return new Info(obs, debugNamePostProcessor(obs.debugName), "fromEvent", state.value, state.hasValue ? "upToDate" : "initial", []);
|
|
1388
|
+
}
|
|
1389
|
+
}
|
|
1390
|
+
static unknown(obs) {
|
|
1391
|
+
return new Info(obs, "(unknown)", "unknown", void 0, "unknown", []);
|
|
1392
|
+
}
|
|
1393
|
+
constructor(sourceObj, name, type, value, state, dependencies) {
|
|
1394
|
+
this.sourceObj = sourceObj;
|
|
1395
|
+
this.name = name;
|
|
1396
|
+
this.type = type;
|
|
1397
|
+
this.value = value;
|
|
1398
|
+
this.state = state;
|
|
1399
|
+
this.dependencies = dependencies;
|
|
1400
|
+
}
|
|
1401
|
+
};
|
|
1402
|
+
//#endregion
|
|
1403
|
+
//#region ../../node_modules/.pnpm/@vscode+observables@0.1.1-0/node_modules/@vscode/observables/dist/observableInternal/index.js
|
|
1404
|
+
_setDebugGetDependencyGraph(debugGetDependencyGraph);
|
|
1405
|
+
setLogObservableFn(logObservableToConsole);
|
|
1406
|
+
//#endregion
|
|
1407
|
+
//#region ../../node_modules/.pnpm/@vscode+observables@0.1.1-0/node_modules/@vscode/observables/dist/observableInternal/utils/promise.js
|
|
1408
|
+
var ObservableLazy = class {
|
|
1409
|
+
/**
|
|
1410
|
+
* The cached value.
|
|
1411
|
+
* Does not force a computation of the value.
|
|
1412
|
+
*/
|
|
1413
|
+
get cachedValue() {
|
|
1414
|
+
return this._value;
|
|
1415
|
+
}
|
|
1416
|
+
constructor(_computeValue) {
|
|
1417
|
+
this._computeValue = _computeValue;
|
|
1418
|
+
this._value = observableValue(this, void 0);
|
|
1419
|
+
}
|
|
1420
|
+
/**
|
|
1421
|
+
* Returns the cached value.
|
|
1422
|
+
* Computes the value if the value has not been cached yet.
|
|
1423
|
+
*/
|
|
1424
|
+
getValue() {
|
|
1425
|
+
let v = this._value.get();
|
|
1426
|
+
if (!v) {
|
|
1427
|
+
v = this._computeValue();
|
|
1428
|
+
this._value.set(v, void 0);
|
|
1429
|
+
}
|
|
1430
|
+
return v;
|
|
1431
|
+
}
|
|
1432
|
+
};
|
|
1433
|
+
/**
|
|
1434
|
+
* A promise whose state is observable.
|
|
1435
|
+
*/
|
|
1436
|
+
var ObservablePromise = class ObservablePromise {
|
|
1437
|
+
static fromFn(fn) {
|
|
1438
|
+
return new ObservablePromise(fn());
|
|
1439
|
+
}
|
|
1440
|
+
constructor(promise) {
|
|
1441
|
+
this._value = observableValue(this, void 0);
|
|
1442
|
+
/**
|
|
1443
|
+
* The current state of the promise.
|
|
1444
|
+
* Is `undefined` if the promise didn't resolve yet.
|
|
1445
|
+
*/
|
|
1446
|
+
this.promiseResult = this._value;
|
|
1447
|
+
this.resolvedValue = derived(this, (reader) => {
|
|
1448
|
+
const result = this.promiseResult.read(reader);
|
|
1449
|
+
if (!result) return;
|
|
1450
|
+
return result.getDataOrThrow();
|
|
1451
|
+
});
|
|
1452
|
+
this.promise = promise.then((value) => {
|
|
1453
|
+
transaction((tx) => {
|
|
1454
|
+
/** @description onPromiseResolved */
|
|
1455
|
+
this._value.set(new PromiseResult(value, void 0), tx);
|
|
1456
|
+
});
|
|
1457
|
+
return value;
|
|
1458
|
+
}, (error) => {
|
|
1459
|
+
transaction((tx) => {
|
|
1460
|
+
/** @description onPromiseRejected */
|
|
1461
|
+
this._value.set(new PromiseResult(void 0, error), tx);
|
|
1462
|
+
});
|
|
1463
|
+
throw error;
|
|
1464
|
+
});
|
|
1465
|
+
}
|
|
1466
|
+
};
|
|
1467
|
+
var PromiseResult = class {
|
|
1468
|
+
constructor(data, error) {
|
|
1469
|
+
this.data = data;
|
|
1470
|
+
this.error = error;
|
|
1471
|
+
}
|
|
1472
|
+
/**
|
|
1473
|
+
* Returns the value if the promise resolved, otherwise throws the error.
|
|
1474
|
+
*/
|
|
1475
|
+
getDataOrThrow() {
|
|
1476
|
+
if (this.error) throw this.error;
|
|
1477
|
+
return this.data;
|
|
1478
|
+
}
|
|
1479
|
+
};
|
|
1480
|
+
/**
|
|
1481
|
+
* A lazy promise whose state is observable.
|
|
1482
|
+
*/
|
|
1483
|
+
var ObservableLazyPromise = class {
|
|
1484
|
+
constructor(_computePromise) {
|
|
1485
|
+
this._computePromise = _computePromise;
|
|
1486
|
+
this._lazyValue = new ObservableLazy(() => new ObservablePromise(this._computePromise()));
|
|
1487
|
+
/**
|
|
1488
|
+
* Does not enforce evaluation of the promise compute function.
|
|
1489
|
+
* Is undefined if the promise has not been computed yet.
|
|
1490
|
+
*/
|
|
1491
|
+
this.cachedPromiseResult = derived(this, (reader) => this._lazyValue.cachedValue.read(reader)?.promiseResult.read(reader));
|
|
1492
|
+
}
|
|
1493
|
+
getPromise() {
|
|
1494
|
+
return this._lazyValue.getValue().promise;
|
|
1495
|
+
}
|
|
1496
|
+
};
|
|
1497
|
+
//#endregion
|
|
1498
|
+
export { derived as a, autorun as i, ObservablePromise as n, Disposable as o, observableValue as r, ObservableLazyPromise as t };
|
|
1499
|
+
|
|
1500
|
+
//# sourceMappingURL=dist-BOcSU4-O.js.map
|