@lvce-editor/editor-worker 19.73.2 → 19.73.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editorWorkerMain.js +1014 -892
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -4218,15 +4218,177 @@ const notifyTabModifiedStatusChange = async (uri, modified, applicationId) => {
|
|
|
4218
4218
|
}
|
|
4219
4219
|
};
|
|
4220
4220
|
|
|
4221
|
-
const
|
|
4222
|
-
|
|
4223
|
-
|
|
4224
|
-
|
|
4225
|
-
|
|
4226
|
-
|
|
4227
|
-
|
|
4221
|
+
const comparePositions = (left, right) => left.rowIndex - right.rowIndex || left.columnIndex - right.columnIndex;
|
|
4222
|
+
const getInsertedEnd = (start, inserted) => {
|
|
4223
|
+
if (inserted.length === 1) {
|
|
4224
|
+
return {
|
|
4225
|
+
columnIndex: start.columnIndex + inserted[0].length,
|
|
4226
|
+
rowIndex: start.rowIndex
|
|
4227
|
+
};
|
|
4228
4228
|
}
|
|
4229
|
-
return
|
|
4229
|
+
return {
|
|
4230
|
+
columnIndex: inserted.at(-1).length,
|
|
4231
|
+
rowIndex: start.rowIndex + inserted.length - 1
|
|
4232
|
+
};
|
|
4233
|
+
};
|
|
4234
|
+
const transformPosition = (position, start, end, inserted, affinity) => {
|
|
4235
|
+
const startComparison = comparePositions(position, start);
|
|
4236
|
+
const endComparison = comparePositions(position, end);
|
|
4237
|
+
if (startComparison < 0 || startComparison === 0 && affinity === 'left') {
|
|
4238
|
+
return position;
|
|
4239
|
+
}
|
|
4240
|
+
if (endComparison <= 0) {
|
|
4241
|
+
return getInsertedEnd(start, inserted);
|
|
4242
|
+
}
|
|
4243
|
+
const insertedEnd = getInsertedEnd(start, inserted);
|
|
4244
|
+
if (position.rowIndex === end.rowIndex) {
|
|
4245
|
+
return {
|
|
4246
|
+
columnIndex: insertedEnd.columnIndex + position.columnIndex - end.columnIndex,
|
|
4247
|
+
rowIndex: insertedEnd.rowIndex
|
|
4248
|
+
};
|
|
4249
|
+
}
|
|
4250
|
+
return {
|
|
4251
|
+
columnIndex: position.columnIndex,
|
|
4252
|
+
rowIndex: insertedEnd.rowIndex + position.rowIndex - end.rowIndex
|
|
4253
|
+
};
|
|
4254
|
+
};
|
|
4255
|
+
const overlapsDeletedText = (diagnostic, start, end) => {
|
|
4256
|
+
if (comparePositions(start, end) === 0) {
|
|
4257
|
+
return false;
|
|
4258
|
+
}
|
|
4259
|
+
const diagnosticStart = {
|
|
4260
|
+
columnIndex: diagnostic.columnIndex,
|
|
4261
|
+
rowIndex: diagnostic.rowIndex
|
|
4262
|
+
};
|
|
4263
|
+
const diagnosticEnd = {
|
|
4264
|
+
columnIndex: diagnostic.endColumnIndex,
|
|
4265
|
+
rowIndex: diagnostic.endRowIndex
|
|
4266
|
+
};
|
|
4267
|
+
return comparePositions(start, diagnosticEnd) < 0 && comparePositions(end, diagnosticStart) > 0;
|
|
4268
|
+
};
|
|
4269
|
+
const transformDiagnostic = (diagnostic, changes) => {
|
|
4270
|
+
let transformed = diagnostic;
|
|
4271
|
+
let linesDelta = 0;
|
|
4272
|
+
for (const change of changes) {
|
|
4273
|
+
const start = {
|
|
4274
|
+
columnIndex: change.start.columnIndex,
|
|
4275
|
+
rowIndex: change.start.rowIndex + linesDelta
|
|
4276
|
+
};
|
|
4277
|
+
const end = {
|
|
4278
|
+
columnIndex: change.end.columnIndex,
|
|
4279
|
+
rowIndex: change.end.rowIndex + linesDelta
|
|
4280
|
+
};
|
|
4281
|
+
if (overlapsDeletedText(transformed, start, end)) {
|
|
4282
|
+
return undefined;
|
|
4283
|
+
}
|
|
4284
|
+
const inserted = change.inserted.length > 0 ? change.inserted : [''];
|
|
4285
|
+
const diagnosticStart = transformPosition({
|
|
4286
|
+
columnIndex: transformed.columnIndex,
|
|
4287
|
+
rowIndex: transformed.rowIndex
|
|
4288
|
+
}, start, end, inserted, 'right');
|
|
4289
|
+
const diagnosticEnd = transformPosition({
|
|
4290
|
+
columnIndex: transformed.endColumnIndex,
|
|
4291
|
+
rowIndex: transformed.endRowIndex
|
|
4292
|
+
}, start, end, inserted, 'left');
|
|
4293
|
+
if (comparePositions(diagnosticStart, diagnosticEnd) > 0) {
|
|
4294
|
+
return undefined;
|
|
4295
|
+
}
|
|
4296
|
+
transformed = {
|
|
4297
|
+
...transformed,
|
|
4298
|
+
columnIndex: diagnosticStart.columnIndex,
|
|
4299
|
+
endColumnIndex: diagnosticEnd.columnIndex,
|
|
4300
|
+
endRowIndex: diagnosticEnd.rowIndex,
|
|
4301
|
+
rowIndex: diagnosticStart.rowIndex
|
|
4302
|
+
};
|
|
4303
|
+
linesDelta += inserted.length - change.deleted.length;
|
|
4304
|
+
}
|
|
4305
|
+
return transformed;
|
|
4306
|
+
};
|
|
4307
|
+
const transformDiagnostics = (diagnostics, changes) => {
|
|
4308
|
+
if (changes.length === 0 || diagnostics.length === 0) {
|
|
4309
|
+
return diagnostics;
|
|
4310
|
+
}
|
|
4311
|
+
return diagnostics.flatMap(diagnostic => {
|
|
4312
|
+
const transformed = transformDiagnostic(diagnostic, changes);
|
|
4313
|
+
return transformed ? [transformed] : [];
|
|
4314
|
+
});
|
|
4315
|
+
};
|
|
4316
|
+
|
|
4317
|
+
const queues = {};
|
|
4318
|
+
const enqueue = async (uid, callback) => {
|
|
4319
|
+
const instance = get$8(uid);
|
|
4320
|
+
if (!instance) {
|
|
4321
|
+
return undefined;
|
|
4322
|
+
}
|
|
4323
|
+
const {
|
|
4324
|
+
applicationId,
|
|
4325
|
+
uri
|
|
4326
|
+
} = instance.newState;
|
|
4327
|
+
const key = JSON.stringify([applicationId ?? null, uri || uid]);
|
|
4328
|
+
const previous = queues[key];
|
|
4329
|
+
const {
|
|
4330
|
+
promise,
|
|
4331
|
+
resolve
|
|
4332
|
+
} = Promise.withResolvers();
|
|
4333
|
+
queues[key] = promise;
|
|
4334
|
+
if (previous) {
|
|
4335
|
+
await previous;
|
|
4336
|
+
}
|
|
4337
|
+
try {
|
|
4338
|
+
return await callback();
|
|
4339
|
+
} finally {
|
|
4340
|
+
resolve();
|
|
4341
|
+
if (queues[key] === promise) {
|
|
4342
|
+
delete queues[key];
|
|
4343
|
+
}
|
|
4344
|
+
}
|
|
4345
|
+
};
|
|
4346
|
+
|
|
4347
|
+
const logError = async (error, prefix) => {
|
|
4348
|
+
const prettyError = await invoke$h('Errors.prepare', error);
|
|
4349
|
+
await invoke$h('Errors.print', prettyError, prefix);
|
|
4350
|
+
};
|
|
4351
|
+
const logFallback = (error, prefix) => {
|
|
4352
|
+
if (prefix) {
|
|
4353
|
+
console.error(prefix, error);
|
|
4354
|
+
return;
|
|
4355
|
+
}
|
|
4356
|
+
console.error(error);
|
|
4357
|
+
};
|
|
4358
|
+
const handleError$1 = async (error, prefix = '') => {
|
|
4359
|
+
try {
|
|
4360
|
+
await logError(error, prefix);
|
|
4361
|
+
} catch (otherError) {
|
|
4362
|
+
console.warn('ErrorHandling error', otherError);
|
|
4363
|
+
logFallback(error, prefix);
|
|
4364
|
+
}
|
|
4365
|
+
};
|
|
4366
|
+
|
|
4367
|
+
const invoke$8 = async (applicationId, method, ...args) => {
|
|
4368
|
+
return applicationId === undefined ? invoke$g(method, ...args) : invoke$g('Extensions.invokeForApplication', applicationId, method, ...args);
|
|
4369
|
+
};
|
|
4370
|
+
const invokeAndTransfer = async (applicationId, method, ...args) => {
|
|
4371
|
+
return applicationId === undefined ? invokeAndTransfer$2(method, ...args) : invokeAndTransfer$2('Extensions.invokeForApplication', applicationId, method, ...args);
|
|
4372
|
+
};
|
|
4373
|
+
|
|
4374
|
+
const getTextDocument$3 = editor => {
|
|
4375
|
+
return {
|
|
4376
|
+
documentId: editor.id || editor.uid,
|
|
4377
|
+
languageId: editor.languageId,
|
|
4378
|
+
text: getText$1(editor),
|
|
4379
|
+
uri: editor.uri
|
|
4380
|
+
};
|
|
4381
|
+
};
|
|
4382
|
+
const streamIsolatedDiagnosticProvider = async (editor, resultPort) => {
|
|
4383
|
+
const textDocument = getTextDocument$3(editor);
|
|
4384
|
+
return invokeAndTransfer(editor.applicationId, 'Extensions.streamDiagnosticProvider', textDocument, resultPort);
|
|
4385
|
+
};
|
|
4386
|
+
const streamDiagnosticProvider = async (editor, resultPort) => {
|
|
4387
|
+
return streamIsolatedDiagnosticProvider(editor, resultPort);
|
|
4388
|
+
};
|
|
4389
|
+
|
|
4390
|
+
const getDiagnosticType = diagnostic => {
|
|
4391
|
+
return diagnostic.type;
|
|
4230
4392
|
};
|
|
4231
4393
|
|
|
4232
4394
|
const getTabCount = string => {
|
|
@@ -4262,117 +4424,12 @@ const getX = async (line, column, fontWeight, fontSize, fontFamily, isMonospaceF
|
|
|
4262
4424
|
return Math.min(width, textWidth - halfCursorWidth + difference);
|
|
4263
4425
|
};
|
|
4264
4426
|
|
|
4265
|
-
const
|
|
4266
|
-
|
|
4267
|
-
};
|
|
4268
|
-
|
|
4269
|
-
const fromRange = (startRowIndex, startColumnIndex, endRowIndex, endColumnIndex) => {
|
|
4270
|
-
return new Uint32Array([startRowIndex, startColumnIndex, endRowIndex, endColumnIndex]);
|
|
4271
|
-
};
|
|
4272
|
-
const alloc = length => {
|
|
4273
|
-
return new Uint32Array(length);
|
|
4274
|
-
};
|
|
4275
|
-
const clone = selections => {
|
|
4276
|
-
return alloc(selections.length);
|
|
4277
|
-
};
|
|
4278
|
-
const map = (selections, fn) => {
|
|
4279
|
-
const newSelections = clone(selections);
|
|
4280
|
-
for (let i = 0; i < newSelections.length; i += 4) {
|
|
4281
|
-
const [selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn] = getSelectionPairs(selections, i);
|
|
4282
|
-
fn(newSelections, i, selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn);
|
|
4283
|
-
}
|
|
4284
|
-
return newSelections;
|
|
4285
|
-
};
|
|
4286
|
-
const forEach = (selections, fn) => {
|
|
4287
|
-
for (let i = 0; i < selections.length; i += 4) {
|
|
4288
|
-
const selectionStartRow = selections[i];
|
|
4289
|
-
const selectionStartColumn = selections[i + 1];
|
|
4290
|
-
const selectionEndRow = selections[i + 2];
|
|
4291
|
-
const selectionEndColumn = selections[i + 3];
|
|
4292
|
-
fn(selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn);
|
|
4293
|
-
}
|
|
4294
|
-
};
|
|
4295
|
-
const moveRangeToPosition$1 = (selections, i, rowIndex, columnIndex) => {
|
|
4296
|
-
selections[i] = selections[i + 2] = rowIndex;
|
|
4297
|
-
selections[i + 1] = selections[i + 3] = columnIndex;
|
|
4298
|
-
};
|
|
4299
|
-
const isEmpty$1 = (selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn) => {
|
|
4300
|
-
return selectionStartRow === selectionEndRow && selectionStartColumn === selectionEndColumn;
|
|
4301
|
-
};
|
|
4302
|
-
const isSelectionSingleLine = (selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn) => {
|
|
4303
|
-
return selectionStartRow === selectionEndRow;
|
|
4304
|
-
};
|
|
4305
|
-
const isEverySelection = (selections, fn) => {
|
|
4306
|
-
for (let i = 0; i < selections.length; i += 4) {
|
|
4307
|
-
const selectionStartRow = selections[i];
|
|
4308
|
-
const selectionStartColumn = selections[i + 1];
|
|
4309
|
-
const selectionEndRow = selections[i + 2];
|
|
4310
|
-
const selectionEndColumn = selections[i + 3];
|
|
4311
|
-
if (!fn(selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn)) {
|
|
4312
|
-
return false;
|
|
4313
|
-
}
|
|
4314
|
-
}
|
|
4315
|
-
return true;
|
|
4316
|
-
};
|
|
4317
|
-
const isEverySelectionEmpty = selections => {
|
|
4318
|
-
return isEverySelection(selections, isEmpty$1);
|
|
4319
|
-
};
|
|
4320
|
-
const isEverySelectionSingleLine = selections => {
|
|
4321
|
-
return isEverySelection(selections, isSelectionSingleLine);
|
|
4322
|
-
};
|
|
4323
|
-
const from = (array, getSelection) => {
|
|
4324
|
-
const newSelections = alloc(array.length * 4);
|
|
4325
|
-
let i = 0;
|
|
4326
|
-
for (const item of array) {
|
|
4327
|
-
const {
|
|
4328
|
-
end,
|
|
4329
|
-
start
|
|
4330
|
-
} = getSelection(item);
|
|
4331
|
-
newSelections[i++] = start.rowIndex;
|
|
4332
|
-
newSelections[i++] = start.columnIndex;
|
|
4333
|
-
newSelections[i++] = end.rowIndex;
|
|
4334
|
-
newSelections[i++] = end.columnIndex;
|
|
4335
|
-
}
|
|
4336
|
-
return newSelections;
|
|
4337
|
-
};
|
|
4338
|
-
|
|
4339
|
-
// TODO maybe only accept sorted selection edits in the first place
|
|
4340
|
-
|
|
4341
|
-
const emptyCursors = [];
|
|
4342
|
-
const getCursorArray = (visibleCursors, isFocused) => {
|
|
4343
|
-
if (!isFocused) {
|
|
4344
|
-
return emptyCursors;
|
|
4345
|
-
}
|
|
4346
|
-
const cursorArray = [];
|
|
4347
|
-
for (let i = 0; i < visibleCursors.length; i += 2) {
|
|
4348
|
-
const x = visibleCursors[i];
|
|
4349
|
-
const y = visibleCursors[i + 1];
|
|
4350
|
-
cursorArray.push(`${px(x)} ${px(y)}`);
|
|
4351
|
-
}
|
|
4352
|
-
return cursorArray;
|
|
4353
|
-
};
|
|
4354
|
-
const getSelectionArray = visibleSelections => {
|
|
4355
|
-
const selectionsArray = [];
|
|
4356
|
-
for (let i = 0; i < visibleSelections.length; i += 4) {
|
|
4357
|
-
const x = visibleSelections[i];
|
|
4358
|
-
const y = visibleSelections[i + 1];
|
|
4359
|
-
const width = visibleSelections[i + 2];
|
|
4360
|
-
const height = visibleSelections[i + 3];
|
|
4361
|
-
selectionsArray.push(px(x), px(y), px(width), px(height));
|
|
4362
|
-
}
|
|
4363
|
-
return selectionsArray;
|
|
4364
|
-
};
|
|
4365
|
-
const getVisible = async editor => {
|
|
4366
|
-
const visibleCursors = [];
|
|
4367
|
-
const visibleSelections = [];
|
|
4368
|
-
// // TODO binary search
|
|
4369
|
-
|
|
4427
|
+
const getVisibleDiagnostics = async (editor, diagnostics) => {
|
|
4428
|
+
const visibleDiagnostics = [];
|
|
4370
4429
|
const {
|
|
4371
4430
|
charWidth,
|
|
4372
|
-
|
|
4431
|
+
deltaX = 0,
|
|
4373
4432
|
deltaY,
|
|
4374
|
-
focused,
|
|
4375
|
-
foldingRanges = [],
|
|
4376
4433
|
fontFamily,
|
|
4377
4434
|
fontSize,
|
|
4378
4435
|
fontWeight,
|
|
@@ -4380,36 +4437,516 @@ const getVisible = async editor => {
|
|
|
4380
4437
|
itemHeight,
|
|
4381
4438
|
letterSpacing,
|
|
4382
4439
|
lines,
|
|
4383
|
-
maxLineY,
|
|
4384
|
-
minLineY,
|
|
4385
4440
|
rowHeight,
|
|
4386
|
-
selections,
|
|
4387
4441
|
tabSize,
|
|
4388
|
-
viewLineIndices
|
|
4389
|
-
visibleLineIndices,
|
|
4390
|
-
visibleViewLineIndices,
|
|
4391
|
-
width
|
|
4442
|
+
viewLineIndices
|
|
4392
4443
|
} = editor;
|
|
4393
|
-
const
|
|
4394
|
-
const
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
|
|
4401
|
-
|
|
4402
|
-
|
|
4403
|
-
|
|
4404
|
-
const
|
|
4405
|
-
const
|
|
4406
|
-
const
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4444
|
+
const startVisualRow = itemHeight ? Math.floor(deltaY / itemHeight) : editor.minLineY || 0;
|
|
4445
|
+
for (const diagnostic of diagnostics) {
|
|
4446
|
+
const {
|
|
4447
|
+
columnIndex,
|
|
4448
|
+
endColumnIndex,
|
|
4449
|
+
rowIndex
|
|
4450
|
+
} = diagnostic;
|
|
4451
|
+
const endLineDifference = -deltaX;
|
|
4452
|
+
const halfCursorWidth = 0;
|
|
4453
|
+
const x = await getX(lines[rowIndex], columnIndex, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, Infinity, charWidth, endLineDifference);
|
|
4454
|
+
const endX = await getX(lines[rowIndex], endColumnIndex, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, Infinity, charWidth, endLineDifference);
|
|
4455
|
+
const diagnosticWidth = Math.max(charWidth, endX - x);
|
|
4456
|
+
const visualRow = viewLineIndices ? getVisualRowForDocumentRow$1(rowIndex, viewLineIndices) : rowIndex;
|
|
4457
|
+
const y = (visualRow - startVisualRow) * rowHeight;
|
|
4458
|
+
visibleDiagnostics.push({
|
|
4459
|
+
height: rowHeight,
|
|
4460
|
+
type: getDiagnosticType(diagnostic),
|
|
4461
|
+
width: diagnosticWidth,
|
|
4462
|
+
x,
|
|
4463
|
+
y
|
|
4464
|
+
});
|
|
4465
|
+
}
|
|
4466
|
+
return visibleDiagnostics;
|
|
4467
|
+
};
|
|
4468
|
+
|
|
4469
|
+
const invoke$7 = (...args) => invoke$d(...args);
|
|
4470
|
+
|
|
4471
|
+
/**
|
|
4472
|
+
* Merges link decorations with diagnostic decorations
|
|
4473
|
+
* Links should always be present, but we also need to include any diagnostic decorations
|
|
4474
|
+
*/
|
|
4475
|
+
const mergeLinksWithDiagnosticDecorations = (editor, diagnosticDecorations) => {
|
|
4476
|
+
// Get link decorations
|
|
4477
|
+
const linkDecorations = detectAllLinksAsDecorations(editor);
|
|
4478
|
+
|
|
4479
|
+
// Merge with diagnostic decorations
|
|
4480
|
+
const allDecorations = [...linkDecorations, ...diagnosticDecorations];
|
|
4481
|
+
|
|
4482
|
+
// Sort by offset to maintain proper order
|
|
4483
|
+
const sortedDecorations = [];
|
|
4484
|
+
for (let i = 0; i < allDecorations.length; i += 4) {
|
|
4485
|
+
sortedDecorations.push({
|
|
4486
|
+
length: allDecorations[i + 1],
|
|
4487
|
+
modifiers: allDecorations[i + 3],
|
|
4488
|
+
offset: allDecorations[i],
|
|
4489
|
+
type: allDecorations[i + 2]
|
|
4490
|
+
});
|
|
4491
|
+
}
|
|
4492
|
+
sortedDecorations.sort((a, b) => a.offset - b.offset);
|
|
4493
|
+
|
|
4494
|
+
// Flatten back to array format
|
|
4495
|
+
const result = [];
|
|
4496
|
+
for (const dec of sortedDecorations) {
|
|
4497
|
+
result.push(dec.offset, dec.length, dec.type, dec.modifiers);
|
|
4498
|
+
}
|
|
4499
|
+
return result;
|
|
4500
|
+
};
|
|
4501
|
+
|
|
4502
|
+
const requestGenerations = new Map();
|
|
4503
|
+
const requestDiagnosticSnapshots = new Map();
|
|
4504
|
+
const previousProviderResults = new Map();
|
|
4505
|
+
const getDiagnostics$1 = async (editor, resultPort) => {
|
|
4506
|
+
return streamDiagnosticProvider(editor, resultPort);
|
|
4507
|
+
};
|
|
4508
|
+
const addDiagnostics = async (editor, diagnostics) => {
|
|
4509
|
+
const visualDecorations = await getVisibleDiagnostics(editor, diagnostics);
|
|
4510
|
+
const diagnosticDecorations = visualDecorations.flatMap(decoration => [decoration.offset, decoration.length, decoration.type, decoration.modifiers || 0]);
|
|
4511
|
+
const decorations = mergeLinksWithDiagnosticDecorations(editor, diagnosticDecorations);
|
|
4512
|
+
return {
|
|
4513
|
+
...editor,
|
|
4514
|
+
decorations,
|
|
4515
|
+
diagnostics,
|
|
4516
|
+
lightBulbRowIndex: -1,
|
|
4517
|
+
visualDecorations
|
|
4518
|
+
};
|
|
4519
|
+
};
|
|
4520
|
+
const handleError = async (error, editor) => {
|
|
4521
|
+
if (error instanceof Error && error.message.includes('No diagnostic provider found')) {
|
|
4522
|
+
return editor;
|
|
4523
|
+
}
|
|
4524
|
+
await handleError$1(error, 'Failed to update diagnostics: ');
|
|
4525
|
+
return editor;
|
|
4526
|
+
};
|
|
4527
|
+
const notifyDiagnosticsChange = async (uri, applicationId) => {
|
|
4528
|
+
try {
|
|
4529
|
+
await invoke$9(applicationId, 'Layout.handleDiagnosticsChange', uri);
|
|
4530
|
+
} catch {
|
|
4531
|
+
// Older renderer workers do not support diagnostics change listeners.
|
|
4532
|
+
}
|
|
4533
|
+
};
|
|
4534
|
+
const diagnosticsEqual = (left, right) => {
|
|
4535
|
+
if (left === right) {
|
|
4536
|
+
return true;
|
|
4537
|
+
}
|
|
4538
|
+
if ((left?.length ?? 0) !== right.length) {
|
|
4539
|
+
return false;
|
|
4540
|
+
}
|
|
4541
|
+
return right.every((diagnostic, index) => {
|
|
4542
|
+
const other = left[index];
|
|
4543
|
+
return other.code === diagnostic.code && other.columnIndex === diagnostic.columnIndex && other.endColumnIndex === diagnostic.endColumnIndex && other.endRowIndex === diagnostic.endRowIndex && other.message === diagnostic.message && other.rowIndex === diagnostic.rowIndex && other.source === diagnostic.source && (other.tags === diagnostic.tags || (other.tags?.length ?? 0) === (diagnostic.tags?.length ?? 0) && (other.tags ?? []).every((tag, index) => tag === diagnostic.tags?.[index])) && other.type === diagnostic.type && other.uri === diagnostic.uri;
|
|
4544
|
+
});
|
|
4545
|
+
};
|
|
4546
|
+
const diagnosticLayoutEqual = (left, right) => left.charWidth === right.charWidth && left.deltaY === right.deltaY && left.fontFamily === right.fontFamily && left.fontSize === right.fontSize && left.fontWeight === right.fontWeight && left.isMonospaceFont === right.isMonospaceFont && left.itemHeight === right.itemHeight && left.letterSpacing === right.letterSpacing && left.lines === right.lines && left.minLineY === right.minLineY && left.rowHeight === right.rowHeight && left.tabSize === right.tabSize && left.viewLineIndices === right.viewLineIndices && left.width === right.width;
|
|
4547
|
+
const isApplicable = (latest, editor, generation) => latest && requestGenerations.get(editor.id) === generation && latest.newState.diagnostics === requestDiagnosticSnapshots.get(editor.id) && latest.newState.diagnosticsEnabled && !latest.newState.loadError && latest.newState.languageId === editor.languageId && latest.newState.lines === editor.lines && latest.newState.uri === editor.uri;
|
|
4548
|
+
const mergeDiagnostics = (editor, editorWithDiagnostics) => ({
|
|
4549
|
+
...editor,
|
|
4550
|
+
decorations: editorWithDiagnostics.decorations,
|
|
4551
|
+
diagnostics: editorWithDiagnostics.diagnostics,
|
|
4552
|
+
lightBulbRowIndex: editorWithDiagnostics.lightBulbRowIndex,
|
|
4553
|
+
visualDecorations: editorWithDiagnostics.visualDecorations
|
|
4554
|
+
});
|
|
4555
|
+
const commitDiagnostics = async (editor, generation, diagnostics, onAccepted) => {
|
|
4556
|
+
return (await enqueue(editor.id, async () => {
|
|
4557
|
+
let latest = get$8(editor.id);
|
|
4558
|
+
if (!isApplicable(latest, editor, generation)) {
|
|
4559
|
+
return editor;
|
|
4560
|
+
}
|
|
4561
|
+
if (diagnosticsEqual(latest.newState.diagnostics, diagnostics)) {
|
|
4562
|
+
onAccepted?.();
|
|
4563
|
+
return latest.newState;
|
|
4564
|
+
}
|
|
4565
|
+
let calculationState = latest.newState;
|
|
4566
|
+
let editorWithDiagnostics = await addDiagnostics(calculationState, diagnostics);
|
|
4567
|
+
latest = get$8(editor.id);
|
|
4568
|
+
while (isApplicable(latest, editor, generation) && !diagnosticLayoutEqual(calculationState, latest.newState)) {
|
|
4569
|
+
calculationState = latest.newState;
|
|
4570
|
+
editorWithDiagnostics = await addDiagnostics(calculationState, diagnostics);
|
|
4571
|
+
latest = get$8(editor.id);
|
|
4572
|
+
}
|
|
4573
|
+
if (!isApplicable(latest, editor, generation)) {
|
|
4574
|
+
return editor;
|
|
4575
|
+
}
|
|
4576
|
+
if (diagnosticsEqual(latest.newState.diagnostics, diagnostics)) {
|
|
4577
|
+
return latest.newState;
|
|
4578
|
+
}
|
|
4579
|
+
const newEditor = mergeDiagnostics(latest.newState, editorWithDiagnostics);
|
|
4580
|
+
set$a(editor.id, latest.oldState, newEditor);
|
|
4581
|
+
requestDiagnosticSnapshots.set(editor.id, diagnostics);
|
|
4582
|
+
onAccepted?.();
|
|
4583
|
+
await invoke$7('Editor.renderPending', newEditor.id);
|
|
4584
|
+
await notifyDiagnosticsChange(newEditor.uri, newEditor.applicationId);
|
|
4585
|
+
return newEditor;
|
|
4586
|
+
})) ?? editor;
|
|
4587
|
+
};
|
|
4588
|
+
const flattenProviderDiagnostics = providers => {
|
|
4589
|
+
return providers.values().toArray().toSorted((left, right) => left.providerIndex - right.providerIndex).flatMap(({
|
|
4590
|
+
diagnostics
|
|
4591
|
+
}) => diagnostics);
|
|
4592
|
+
};
|
|
4593
|
+
const saveProviderResults = (editor, providers) => {
|
|
4594
|
+
previousProviderResults.set(editor.id, {
|
|
4595
|
+
languageId: editor.languageId,
|
|
4596
|
+
providers: new Map(providers),
|
|
4597
|
+
uri: editor.uri
|
|
4598
|
+
});
|
|
4599
|
+
};
|
|
4600
|
+
const updateDiagnostics = async (editor, timeoutMs = 0) => {
|
|
4601
|
+
const strict = timeoutMs > 0;
|
|
4602
|
+
if (strict && editor.loadError) {
|
|
4603
|
+
throw new Error(`Cannot await diagnostics: ${editor.loadError}`);
|
|
4604
|
+
}
|
|
4605
|
+
if (!editor.diagnosticsEnabled || editor.loadError) {
|
|
4606
|
+
return editor;
|
|
4607
|
+
}
|
|
4608
|
+
const generation = (requestGenerations.get(editor.id) ?? 0) + 1;
|
|
4609
|
+
requestGenerations.set(editor.id, generation);
|
|
4610
|
+
requestDiagnosticSnapshots.set(editor.id, get$8(editor.id)?.newState.diagnostics ?? editor.diagnostics);
|
|
4611
|
+
const providers = new Map();
|
|
4612
|
+
const previous = previousProviderResults.get(editor.id);
|
|
4613
|
+
if (previous && previous.languageId === editor.languageId && previous.uri === editor.uri) {
|
|
4614
|
+
for (const [providerId, result] of previous.providers) {
|
|
4615
|
+
providers.set(providerId, result);
|
|
4616
|
+
}
|
|
4617
|
+
}
|
|
4618
|
+
const {
|
|
4619
|
+
port1,
|
|
4620
|
+
port2
|
|
4621
|
+
} = new MessageChannel();
|
|
4622
|
+
const completed = Promise.withResolvers();
|
|
4623
|
+
let commitQueue = Promise.resolve();
|
|
4624
|
+
let providerCount = -1;
|
|
4625
|
+
let finished = false;
|
|
4626
|
+
const receivedProviders = new Set();
|
|
4627
|
+
const timeout = strict ? setTimeout(() => completed.reject(new Error(`Diagnostics timed out after ${timeoutMs}ms for ${editor.uri}`)), timeoutMs) : undefined;
|
|
4628
|
+
port1.onmessage = event => {
|
|
4629
|
+
const previousCommit = commitQueue;
|
|
4630
|
+
commitQueue = (async () => {
|
|
4631
|
+
await previousCommit;
|
|
4632
|
+
try {
|
|
4633
|
+
if (finished) {
|
|
4634
|
+
return;
|
|
4635
|
+
}
|
|
4636
|
+
const message = event.data;
|
|
4637
|
+
if (requestGenerations.get(editor.id) !== generation) {
|
|
4638
|
+
if (strict) {
|
|
4639
|
+
throw new Error('Diagnostics request was superseded');
|
|
4640
|
+
}
|
|
4641
|
+
if (message.type === 'done') {
|
|
4642
|
+
port1.close();
|
|
4643
|
+
completed.resolve();
|
|
4644
|
+
}
|
|
4645
|
+
return;
|
|
4646
|
+
}
|
|
4647
|
+
if (message.type === 'providers') {
|
|
4648
|
+
providerCount = message.providerCount ?? 0;
|
|
4649
|
+
const providerIds = message.providerIds ?? [];
|
|
4650
|
+
for (const providerId of providers.keys()) {
|
|
4651
|
+
if (providerIds.includes(providerId)) {
|
|
4652
|
+
const previousResult = providers.get(providerId);
|
|
4653
|
+
providers.set(providerId, {
|
|
4654
|
+
...previousResult,
|
|
4655
|
+
providerIndex: providerIds.indexOf(providerId)
|
|
4656
|
+
});
|
|
4657
|
+
} else {
|
|
4658
|
+
providers.delete(providerId);
|
|
4659
|
+
}
|
|
4660
|
+
}
|
|
4661
|
+
if (requestGenerations.get(editor.id) === generation) {
|
|
4662
|
+
saveProviderResults(editor, providers);
|
|
4663
|
+
}
|
|
4664
|
+
return;
|
|
4665
|
+
}
|
|
4666
|
+
if (message.type === 'result' && message.providerId !== undefined) {
|
|
4667
|
+
if (strict && message.error !== undefined) {
|
|
4668
|
+
throw new Error(`Diagnostic provider ${message.providerId} failed: ${message.error}`);
|
|
4669
|
+
}
|
|
4670
|
+
receivedProviders.add(message.providerId);
|
|
4671
|
+
providers.set(message.providerId, {
|
|
4672
|
+
diagnostics: message.diagnostics ?? [],
|
|
4673
|
+
providerIndex: message.providerIndex ?? providers.size
|
|
4674
|
+
});
|
|
4675
|
+
await commitDiagnostics(editor, generation, flattenProviderDiagnostics(providers), () => saveProviderResults(editor, providers));
|
|
4676
|
+
return;
|
|
4677
|
+
}
|
|
4678
|
+
if (message.type === 'done') {
|
|
4679
|
+
if (strict && (providerCount < 0 || receivedProviders.size !== providerCount)) {
|
|
4680
|
+
throw new Error('Diagnostics stream ended without all provider results');
|
|
4681
|
+
}
|
|
4682
|
+
if (providerCount === 0) {
|
|
4683
|
+
providers.clear();
|
|
4684
|
+
await commitDiagnostics(editor, generation, [], () => saveProviderResults(editor, providers));
|
|
4685
|
+
}
|
|
4686
|
+
if (requestGenerations.get(editor.id) === generation) {
|
|
4687
|
+
saveProviderResults(editor, providers);
|
|
4688
|
+
}
|
|
4689
|
+
port1.close();
|
|
4690
|
+
completed.resolve();
|
|
4691
|
+
}
|
|
4692
|
+
} catch (error) {
|
|
4693
|
+
port1.close();
|
|
4694
|
+
if (strict) {
|
|
4695
|
+
completed.reject(error);
|
|
4696
|
+
} else {
|
|
4697
|
+
completed.resolve();
|
|
4698
|
+
await handleError(error, editor);
|
|
4699
|
+
}
|
|
4700
|
+
}
|
|
4701
|
+
})();
|
|
4702
|
+
};
|
|
4703
|
+
port1.start();
|
|
4704
|
+
const request = async () => {
|
|
4705
|
+
const response = await getDiagnostics$1(editor, port2);
|
|
4706
|
+
if (finished) {
|
|
4707
|
+
return;
|
|
4708
|
+
}
|
|
4709
|
+
if (Array.isArray(response) && providerCount === -1) {
|
|
4710
|
+
if (strict) {
|
|
4711
|
+
throw new Error('Diagnostic provider does not support completion and error reporting');
|
|
4712
|
+
}
|
|
4713
|
+
providers.set('legacy', {
|
|
4714
|
+
diagnostics: response,
|
|
4715
|
+
providerIndex: 0
|
|
4716
|
+
});
|
|
4717
|
+
await commitDiagnostics(editor, generation, response, () => saveProviderResults(editor, providers));
|
|
4718
|
+
port1.close();
|
|
4719
|
+
completed.resolve();
|
|
4720
|
+
}
|
|
4721
|
+
};
|
|
4722
|
+
try {
|
|
4723
|
+
await Promise.all([request(), completed.promise]);
|
|
4724
|
+
const latest = get$8(editor.id);
|
|
4725
|
+
if (strict && !isApplicable(latest, editor, generation)) {
|
|
4726
|
+
throw new Error('Editor changed or closed while waiting for diagnostics');
|
|
4727
|
+
}
|
|
4728
|
+
return isApplicable(latest, editor, generation) ? latest.newState : editor;
|
|
4729
|
+
} catch (error) {
|
|
4730
|
+
if (strict) {
|
|
4731
|
+
if (requestGenerations.get(editor.id) === generation) {
|
|
4732
|
+
requestGenerations.set(editor.id, generation + 1);
|
|
4733
|
+
}
|
|
4734
|
+
throw error;
|
|
4735
|
+
}
|
|
4736
|
+
return handleError(error, editor);
|
|
4737
|
+
} finally {
|
|
4738
|
+
finished = true;
|
|
4739
|
+
clearTimeout(timeout);
|
|
4740
|
+
port1.close();
|
|
4741
|
+
port2.close();
|
|
4742
|
+
}
|
|
4743
|
+
};
|
|
4744
|
+
const requestDiagnostics = editor => {
|
|
4745
|
+
void updateDiagnostics(editor);
|
|
4746
|
+
return editor;
|
|
4747
|
+
};
|
|
4748
|
+
const clearDiagnosticRequestState = editorId => {
|
|
4749
|
+
requestGenerations.delete(editorId);
|
|
4750
|
+
requestDiagnosticSnapshots.delete(editorId);
|
|
4751
|
+
previousProviderResults.delete(editorId);
|
|
4752
|
+
};
|
|
4753
|
+
const transformCachedDiagnostics = (editorId, changes) => {
|
|
4754
|
+
const previous = previousProviderResults.get(editorId);
|
|
4755
|
+
if (!previous) {
|
|
4756
|
+
return;
|
|
4757
|
+
}
|
|
4758
|
+
const providers = new Map();
|
|
4759
|
+
for (const [providerId, result] of previous.providers) {
|
|
4760
|
+
providers.set(providerId, {
|
|
4761
|
+
...result,
|
|
4762
|
+
diagnostics: transformDiagnostics(result.diagnostics, changes)
|
|
4763
|
+
});
|
|
4764
|
+
}
|
|
4765
|
+
previousProviderResults.set(editorId, {
|
|
4766
|
+
...previous,
|
|
4767
|
+
providers
|
|
4768
|
+
});
|
|
4769
|
+
};
|
|
4770
|
+
const updateDiagnosticsAll = async () => {
|
|
4771
|
+
for (const key of getKeys$2()) {
|
|
4772
|
+
const editor = get$8(Number(key))?.newState;
|
|
4773
|
+
if (editor) {
|
|
4774
|
+
await updateDiagnostics(editor);
|
|
4775
|
+
}
|
|
4776
|
+
}
|
|
4777
|
+
};
|
|
4778
|
+
|
|
4779
|
+
// Do not wrap this command in EditorCommandQueue: streamed results need that queue to commit.
|
|
4780
|
+
const waitForDiagnostics = async (editorId, timeoutMs = 30_000) => {
|
|
4781
|
+
if (!Number.isFinite(timeoutMs) || timeoutMs <= 0 || timeoutMs > 300_000) {
|
|
4782
|
+
throw new Error('Diagnostics timeout must be between 1 and 300000ms');
|
|
4783
|
+
}
|
|
4784
|
+
const editor = get$8(editorId)?.newState;
|
|
4785
|
+
if (!editor || editor.initial) {
|
|
4786
|
+
throw new Error(`Editor is not ready: ${editorId}`);
|
|
4787
|
+
}
|
|
4788
|
+
await updateDiagnostics(editor, timeoutMs);
|
|
4789
|
+
};
|
|
4790
|
+
|
|
4791
|
+
const getSelectionPairs = (selections, i) => {
|
|
4792
|
+
const first = selections[i];
|
|
4793
|
+
const second = selections[i + 1];
|
|
4794
|
+
const third = selections[i + 2];
|
|
4795
|
+
const fourth = selections[i + 3];
|
|
4796
|
+
if (first > third || first === third && second >= fourth) {
|
|
4797
|
+
return [third, fourth, first, second, 1];
|
|
4798
|
+
}
|
|
4799
|
+
return [first, second, third, fourth, 0];
|
|
4800
|
+
};
|
|
4801
|
+
|
|
4802
|
+
const px = value => {
|
|
4803
|
+
return `${value}px`;
|
|
4804
|
+
};
|
|
4805
|
+
|
|
4806
|
+
const fromRange = (startRowIndex, startColumnIndex, endRowIndex, endColumnIndex) => {
|
|
4807
|
+
return new Uint32Array([startRowIndex, startColumnIndex, endRowIndex, endColumnIndex]);
|
|
4808
|
+
};
|
|
4809
|
+
const alloc = length => {
|
|
4810
|
+
return new Uint32Array(length);
|
|
4811
|
+
};
|
|
4812
|
+
const clone = selections => {
|
|
4813
|
+
return alloc(selections.length);
|
|
4814
|
+
};
|
|
4815
|
+
const map = (selections, fn) => {
|
|
4816
|
+
const newSelections = clone(selections);
|
|
4817
|
+
for (let i = 0; i < newSelections.length; i += 4) {
|
|
4818
|
+
const [selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn] = getSelectionPairs(selections, i);
|
|
4819
|
+
fn(newSelections, i, selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn);
|
|
4820
|
+
}
|
|
4821
|
+
return newSelections;
|
|
4822
|
+
};
|
|
4823
|
+
const forEach = (selections, fn) => {
|
|
4824
|
+
for (let i = 0; i < selections.length; i += 4) {
|
|
4825
|
+
const selectionStartRow = selections[i];
|
|
4826
|
+
const selectionStartColumn = selections[i + 1];
|
|
4827
|
+
const selectionEndRow = selections[i + 2];
|
|
4828
|
+
const selectionEndColumn = selections[i + 3];
|
|
4829
|
+
fn(selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn);
|
|
4830
|
+
}
|
|
4831
|
+
};
|
|
4832
|
+
const moveRangeToPosition$1 = (selections, i, rowIndex, columnIndex) => {
|
|
4833
|
+
selections[i] = selections[i + 2] = rowIndex;
|
|
4834
|
+
selections[i + 1] = selections[i + 3] = columnIndex;
|
|
4835
|
+
};
|
|
4836
|
+
const isEmpty$1 = (selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn) => {
|
|
4837
|
+
return selectionStartRow === selectionEndRow && selectionStartColumn === selectionEndColumn;
|
|
4838
|
+
};
|
|
4839
|
+
const isSelectionSingleLine = (selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn) => {
|
|
4840
|
+
return selectionStartRow === selectionEndRow;
|
|
4841
|
+
};
|
|
4842
|
+
const isEverySelection = (selections, fn) => {
|
|
4843
|
+
for (let i = 0; i < selections.length; i += 4) {
|
|
4844
|
+
const selectionStartRow = selections[i];
|
|
4845
|
+
const selectionStartColumn = selections[i + 1];
|
|
4846
|
+
const selectionEndRow = selections[i + 2];
|
|
4847
|
+
const selectionEndColumn = selections[i + 3];
|
|
4848
|
+
if (!fn(selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn)) {
|
|
4849
|
+
return false;
|
|
4850
|
+
}
|
|
4851
|
+
}
|
|
4852
|
+
return true;
|
|
4853
|
+
};
|
|
4854
|
+
const isEverySelectionEmpty = selections => {
|
|
4855
|
+
return isEverySelection(selections, isEmpty$1);
|
|
4856
|
+
};
|
|
4857
|
+
const isEverySelectionSingleLine = selections => {
|
|
4858
|
+
return isEverySelection(selections, isSelectionSingleLine);
|
|
4859
|
+
};
|
|
4860
|
+
const from = (array, getSelection) => {
|
|
4861
|
+
const newSelections = alloc(array.length * 4);
|
|
4862
|
+
let i = 0;
|
|
4863
|
+
for (const item of array) {
|
|
4864
|
+
const {
|
|
4865
|
+
end,
|
|
4866
|
+
start
|
|
4867
|
+
} = getSelection(item);
|
|
4868
|
+
newSelections[i++] = start.rowIndex;
|
|
4869
|
+
newSelections[i++] = start.columnIndex;
|
|
4870
|
+
newSelections[i++] = end.rowIndex;
|
|
4871
|
+
newSelections[i++] = end.columnIndex;
|
|
4872
|
+
}
|
|
4873
|
+
return newSelections;
|
|
4874
|
+
};
|
|
4875
|
+
|
|
4876
|
+
// TODO maybe only accept sorted selection edits in the first place
|
|
4877
|
+
|
|
4878
|
+
const emptyCursors = [];
|
|
4879
|
+
const getCursorArray = (visibleCursors, isFocused) => {
|
|
4880
|
+
if (!isFocused) {
|
|
4881
|
+
return emptyCursors;
|
|
4882
|
+
}
|
|
4883
|
+
const cursorArray = [];
|
|
4884
|
+
for (let i = 0; i < visibleCursors.length; i += 2) {
|
|
4885
|
+
const x = visibleCursors[i];
|
|
4886
|
+
const y = visibleCursors[i + 1];
|
|
4887
|
+
cursorArray.push(`${px(x)} ${px(y)}`);
|
|
4888
|
+
}
|
|
4889
|
+
return cursorArray;
|
|
4890
|
+
};
|
|
4891
|
+
const getSelectionArray = visibleSelections => {
|
|
4892
|
+
const selectionsArray = [];
|
|
4893
|
+
for (let i = 0; i < visibleSelections.length; i += 4) {
|
|
4894
|
+
const x = visibleSelections[i];
|
|
4895
|
+
const y = visibleSelections[i + 1];
|
|
4896
|
+
const width = visibleSelections[i + 2];
|
|
4897
|
+
const height = visibleSelections[i + 3];
|
|
4898
|
+
selectionsArray.push(px(x), px(y), px(width), px(height));
|
|
4899
|
+
}
|
|
4900
|
+
return selectionsArray;
|
|
4901
|
+
};
|
|
4902
|
+
const getVisible = async editor => {
|
|
4903
|
+
const visibleCursors = [];
|
|
4904
|
+
const visibleSelections = [];
|
|
4905
|
+
// // TODO binary search
|
|
4906
|
+
|
|
4907
|
+
const {
|
|
4908
|
+
charWidth,
|
|
4909
|
+
cursorWidth,
|
|
4910
|
+
deltaY,
|
|
4911
|
+
focused,
|
|
4912
|
+
foldingRanges = [],
|
|
4913
|
+
fontFamily,
|
|
4914
|
+
fontSize,
|
|
4915
|
+
fontWeight,
|
|
4916
|
+
isMonospaceFont,
|
|
4917
|
+
itemHeight,
|
|
4918
|
+
letterSpacing,
|
|
4919
|
+
lines,
|
|
4920
|
+
maxLineY,
|
|
4921
|
+
minLineY,
|
|
4922
|
+
rowHeight,
|
|
4923
|
+
selections,
|
|
4924
|
+
tabSize,
|
|
4925
|
+
viewLineIndices,
|
|
4926
|
+
visibleLineIndices,
|
|
4927
|
+
visibleViewLineIndices,
|
|
4928
|
+
width
|
|
4929
|
+
} = editor;
|
|
4930
|
+
const averageCharWidth = charWidth;
|
|
4931
|
+
const halfCursorWidth = cursorWidth / 2;
|
|
4932
|
+
const actualVisibleLineIndices = visibleLineIndices || Array.from({
|
|
4933
|
+
length: maxLineY - minLineY
|
|
4934
|
+
}, (_, index) => minLineY + index);
|
|
4935
|
+
const getVisualRow = rowIndex => viewLineIndices ? getVisualRowForDocumentRow$1(rowIndex, viewLineIndices) : getVisualRowForDocumentRow(rowIndex, foldingRanges);
|
|
4936
|
+
const startVisualRow = itemHeight ? Math.floor(deltaY / itemHeight) : getVisualRow(minLineY);
|
|
4937
|
+
const endVisualRow = startVisualRow + (visibleViewLineIndices?.length || actualVisibleLineIndices.length);
|
|
4938
|
+
const getRelativeRow = rowIndex => getVisualRow(rowIndex) - startVisualRow;
|
|
4939
|
+
const horizontalOffset = -(editor.deltaX ?? 0);
|
|
4940
|
+
for (let i = 0; i < selections.length; i += 4) {
|
|
4941
|
+
const [selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn, reversed] = getSelectionPairs(selections, i);
|
|
4942
|
+
const selectionStartVisualRow = getVisualRow(selectionStartRow);
|
|
4943
|
+
const selectionEndVisualRow = getVisualRow(selectionEndRow);
|
|
4944
|
+
if (selectionEndVisualRow < startVisualRow || selectionStartVisualRow >= endVisualRow) {
|
|
4945
|
+
continue;
|
|
4946
|
+
}
|
|
4947
|
+
const relativeEndLineRow = getRelativeRow(selectionEndRow);
|
|
4948
|
+
const endLineDifference = horizontalOffset;
|
|
4949
|
+
const endLine = lines[selectionEndRow];
|
|
4413
4950
|
const endLineEndX = await getX(endLine, selectionEndColumn, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, endLineDifference);
|
|
4414
4951
|
const endLineY = relativeEndLineRow * rowHeight;
|
|
4415
4952
|
if (isEmpty$1(selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn) && endLineEndX > 0) {
|
|
@@ -4612,6 +5149,11 @@ const applyAutoClosingRangesEdit = (editor, changes) => {
|
|
|
4612
5149
|
}
|
|
4613
5150
|
return newAutoClosingRanges;
|
|
4614
5151
|
};
|
|
5152
|
+
const updateTransformedDiagnostics = async (editor, changes) => {
|
|
5153
|
+
transformCachedDiagnostics(editor.id ?? editor.uid, changes);
|
|
5154
|
+
const diagnostics = transformDiagnostics(editor.diagnostics ?? [], changes);
|
|
5155
|
+
return addDiagnostics(editor, diagnostics);
|
|
5156
|
+
};
|
|
4615
5157
|
const scheduleSelections = (editor, selectionEdits) => {
|
|
4616
5158
|
return setSelections$2(editor, selectionEdits);
|
|
4617
5159
|
};
|
|
@@ -4638,6 +5180,7 @@ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionCh
|
|
|
4638
5180
|
}
|
|
4639
5181
|
const newLines = applyEdits(editor, changes);
|
|
4640
5182
|
const partialNewEditor = updateLines(editor, newLines);
|
|
5183
|
+
const partialNewEditorWithDiagnostics = await updateTransformedDiagnostics(partialNewEditor, changes);
|
|
4641
5184
|
const newSelections = selectionChanges || applyEdit$1(partialNewEditor, changes);
|
|
4642
5185
|
const selectionHistory = {
|
|
4643
5186
|
after: newSelections,
|
|
@@ -4665,7 +5208,7 @@ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionCh
|
|
|
4665
5208
|
inserted: [previous.inserted[0] + change.inserted[0]]
|
|
4666
5209
|
}]] : [...editor.undoStack, changes];
|
|
4667
5210
|
const newEditor = {
|
|
4668
|
-
...
|
|
5211
|
+
...partialNewEditorWithDiagnostics,
|
|
4669
5212
|
autoClosingRanges,
|
|
4670
5213
|
canCoalesceTyping,
|
|
4671
5214
|
invalidStartIndex,
|
|
@@ -4727,10 +5270,11 @@ const scheduleDocumentAndCursorsSelectionIsUndo = async (editor, changes, select
|
|
|
4727
5270
|
}
|
|
4728
5271
|
const newLines = applyEdits(editor, changes);
|
|
4729
5272
|
const partialNewEditor = updateLines(editor, newLines);
|
|
5273
|
+
const partialNewEditorWithDiagnostics = await updateTransformedDiagnostics(partialNewEditor, changes);
|
|
4730
5274
|
const newSelections = selectionChanges || applyEdit$1(partialNewEditor, changes);
|
|
4731
5275
|
const invalidStartIndex = Math.min(editor.invalidStartIndex, changes[0].start.rowIndex);
|
|
4732
5276
|
const newEditor = {
|
|
4733
|
-
...
|
|
5277
|
+
...partialNewEditorWithDiagnostics,
|
|
4734
5278
|
// undoStack: [...editor.undoStack.slice(0, -2)],
|
|
4735
5279
|
invalidStartIndex,
|
|
4736
5280
|
lines: newLines,
|
|
@@ -4763,6 +5307,8 @@ const scheduleDocumentAndCursorsSelectionIsUndo = async (editor, changes, select
|
|
|
4763
5307
|
// @ts-ignore
|
|
4764
5308
|
const scheduleDocument = async (editor, changes) => {
|
|
4765
5309
|
const newLines = applyEdits(editor, changes);
|
|
5310
|
+
const partialNewEditor = updateLines(editor, newLines);
|
|
5311
|
+
const partialNewEditorWithDiagnostics = await updateTransformedDiagnostics(partialNewEditor, changes);
|
|
4766
5312
|
const invalidStartIndex = changes[0].start.rowIndex;
|
|
4767
5313
|
// if (editor.undoStack) {
|
|
4768
5314
|
// editor.undoStack.push(changes)
|
|
@@ -4777,7 +5323,7 @@ const scheduleDocument = async (editor, changes) => {
|
|
|
4777
5323
|
// const scrollBarHeight = editor.scrollBarHeight
|
|
4778
5324
|
|
|
4779
5325
|
const newEditor = {
|
|
4780
|
-
...
|
|
5326
|
+
...partialNewEditorWithDiagnostics,
|
|
4781
5327
|
invalidStartIndex,
|
|
4782
5328
|
redoStack: [],
|
|
4783
5329
|
undoStack: [...editor.undoStack, changes]
|
|
@@ -4931,14 +5477,7 @@ const updateColorPickerValue$1 = async (editor, value) => {
|
|
|
4931
5477
|
};
|
|
4932
5478
|
};
|
|
4933
5479
|
|
|
4934
|
-
const
|
|
4935
|
-
return applicationId === undefined ? invoke$g(method, ...args) : invoke$g('Extensions.invokeForApplication', applicationId, method, ...args);
|
|
4936
|
-
};
|
|
4937
|
-
const invokeAndTransfer = async (applicationId, method, ...args) => {
|
|
4938
|
-
return applicationId === undefined ? invokeAndTransfer$2(method, ...args) : invokeAndTransfer$2('Extensions.invokeForApplication', applicationId, method, ...args);
|
|
4939
|
-
};
|
|
4940
|
-
|
|
4941
|
-
const getTextDocument$3 = editor => ({
|
|
5480
|
+
const getTextDocument$2 = editor => ({
|
|
4942
5481
|
documentId: editor.id || editor.uid,
|
|
4943
5482
|
languageId: editor.languageId,
|
|
4944
5483
|
text: getText$1(editor),
|
|
@@ -4954,7 +5493,7 @@ const execute = async ({
|
|
|
4954
5493
|
if (editor.largeFile) {
|
|
4955
5494
|
return noProviderFoundResult;
|
|
4956
5495
|
}
|
|
4957
|
-
const textDocument = getTextDocument$
|
|
5496
|
+
const textDocument = getTextDocument$2(editor);
|
|
4958
5497
|
const result = await invoke$8(editor.applicationId, 'Extensions.executeLanguageProvider', kind, method, textDocument, ...args);
|
|
4959
5498
|
if (!result.found) {
|
|
4960
5499
|
return noProviderFoundResult;
|
|
@@ -5399,52 +5938,6 @@ const getVisibleBracketMatches = async editor => {
|
|
|
5399
5938
|
return infos.filter(info => info !== undefined);
|
|
5400
5939
|
};
|
|
5401
5940
|
|
|
5402
|
-
const getDiagnosticType = diagnostic => {
|
|
5403
|
-
return diagnostic.type;
|
|
5404
|
-
};
|
|
5405
|
-
|
|
5406
|
-
const getVisibleDiagnostics = async (editor, diagnostics) => {
|
|
5407
|
-
const visibleDiagnostics = [];
|
|
5408
|
-
const {
|
|
5409
|
-
charWidth,
|
|
5410
|
-
deltaX = 0,
|
|
5411
|
-
deltaY,
|
|
5412
|
-
fontFamily,
|
|
5413
|
-
fontSize,
|
|
5414
|
-
fontWeight,
|
|
5415
|
-
isMonospaceFont,
|
|
5416
|
-
itemHeight,
|
|
5417
|
-
letterSpacing,
|
|
5418
|
-
lines,
|
|
5419
|
-
rowHeight,
|
|
5420
|
-
tabSize,
|
|
5421
|
-
viewLineIndices
|
|
5422
|
-
} = editor;
|
|
5423
|
-
const startVisualRow = itemHeight ? Math.floor(deltaY / itemHeight) : editor.minLineY || 0;
|
|
5424
|
-
for (const diagnostic of diagnostics) {
|
|
5425
|
-
const {
|
|
5426
|
-
columnIndex,
|
|
5427
|
-
endColumnIndex,
|
|
5428
|
-
rowIndex
|
|
5429
|
-
} = diagnostic;
|
|
5430
|
-
const endLineDifference = -deltaX;
|
|
5431
|
-
const halfCursorWidth = 0;
|
|
5432
|
-
const x = await getX(lines[rowIndex], columnIndex, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, Infinity, charWidth, endLineDifference);
|
|
5433
|
-
const endX = await getX(lines[rowIndex], endColumnIndex, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, Infinity, charWidth, endLineDifference);
|
|
5434
|
-
const diagnosticWidth = Math.max(charWidth, endX - x);
|
|
5435
|
-
const visualRow = viewLineIndices ? getVisualRowForDocumentRow$1(rowIndex, viewLineIndices) : rowIndex;
|
|
5436
|
-
const y = (visualRow - startVisualRow) * rowHeight;
|
|
5437
|
-
visibleDiagnostics.push({
|
|
5438
|
-
height: rowHeight,
|
|
5439
|
-
type: getDiagnosticType(diagnostic),
|
|
5440
|
-
width: diagnosticWidth,
|
|
5441
|
-
x,
|
|
5442
|
-
y
|
|
5443
|
-
});
|
|
5444
|
-
}
|
|
5445
|
-
return visibleDiagnostics;
|
|
5446
|
-
};
|
|
5447
|
-
|
|
5448
5941
|
// Owned by the editor lifecycle, with only the current document's distinct lines retained.
|
|
5449
5942
|
const caches = new WeakMap();
|
|
5450
5943
|
const updateHorizontalLayout = async state => {
|
|
@@ -5678,7 +6171,7 @@ const getOrCreate$2 = () => {
|
|
|
5678
6171
|
}
|
|
5679
6172
|
return state$8.workerPromise;
|
|
5680
6173
|
};
|
|
5681
|
-
const invoke$
|
|
6174
|
+
const invoke$6 = async (method, ...params) => {
|
|
5682
6175
|
const worker = await getOrCreate$2();
|
|
5683
6176
|
return await worker.invoke(method, ...params);
|
|
5684
6177
|
};
|
|
@@ -5692,10 +6185,10 @@ const loadContent$3 = async (state, parentUid) => {
|
|
|
5692
6185
|
x,
|
|
5693
6186
|
y
|
|
5694
6187
|
} = state;
|
|
5695
|
-
await invoke$
|
|
5696
|
-
await invoke$
|
|
5697
|
-
const diff = await invoke$
|
|
5698
|
-
const commands = await invoke$
|
|
6188
|
+
await invoke$6('ColorPicker.create', uid, x, y, width, height, parentUid);
|
|
6189
|
+
await invoke$6('ColorPicker.loadContent', uid, toColorPickerValue(value));
|
|
6190
|
+
const diff = await invoke$6('ColorPicker.diff2', uid);
|
|
6191
|
+
const commands = await invoke$6('ColorPicker.render2', uid, diff);
|
|
5699
6192
|
return {
|
|
5700
6193
|
...state,
|
|
5701
6194
|
commands
|
|
@@ -6267,745 +6760,374 @@ const createStandaloneEditor = async ({
|
|
|
6267
6760
|
const finalEditor = {
|
|
6268
6761
|
...editorWithVisibleText,
|
|
6269
6762
|
cursorInfos,
|
|
6270
|
-
selectionInfos
|
|
6271
|
-
};
|
|
6272
|
-
if (!createdEditor.lifecycle?.disposed) {
|
|
6273
|
-
set$a(id, createdEditor, finalEditor);
|
|
6274
|
-
}
|
|
6275
|
-
};
|
|
6276
|
-
|
|
6277
|
-
const isEqual$5 = (oldState, newState) => {
|
|
6278
|
-
return oldState.additionalFocus === newState.additionalFocus;
|
|
6279
|
-
};
|
|
6280
|
-
|
|
6281
|
-
const isEqual$4 = (oldState, newState) => {
|
|
6282
|
-
return oldState.rowHeight === newState.rowHeight && oldState.deltaY === newState.deltaY && oldState.finalDeltaY === newState.finalDeltaY && oldState.height === newState.height && oldState.deltaX === newState.deltaX && oldState.gutterWidth === newState.gutterWidth && oldState.longestLineWidth === newState.longestLineWidth && oldState.minimumSliderSize === newState.minimumSliderSize && oldState.width === newState.width && oldState.scrollBarHeight === newState.scrollBarHeight;
|
|
6283
|
-
};
|
|
6284
|
-
|
|
6285
|
-
const isEqual$3 = (oldState, newState) => {
|
|
6286
|
-
if (oldState.focus !== newState.focus) {
|
|
6287
|
-
return false;
|
|
6288
|
-
}
|
|
6289
|
-
if (!newState.focused) {
|
|
6290
|
-
return true;
|
|
6291
|
-
}
|
|
6292
|
-
if (!oldState.isSelecting && newState.isSelecting) {
|
|
6293
|
-
return false;
|
|
6294
|
-
}
|
|
6295
|
-
return oldState.focused === newState.focused;
|
|
6296
|
-
};
|
|
6297
|
-
|
|
6298
|
-
const isEqual$2 = (oldState, newState) => {
|
|
6299
|
-
return oldState.breadcrumbFileIcon === newState.breadcrumbFileIcon && oldState.breadcrumbsEnabled === newState.breadcrumbsEnabled && oldState.breakPoints === newState.breakPoints && oldState.bracketMatchInfos === newState.bracketMatchInfos && oldState.cursorInfos === newState.cursorInfos && oldState.diagnostics === newState.diagnostics && oldState.documentSymbols === newState.documentSymbols && oldState.endOfLineDecorations === newState.endOfLineDecorations && oldState.focused === newState.focused && oldState.gutterDecorations === newState.gutterDecorations && oldState.highlightActiveLineNumber === newState.highlightActiveLineNumber && oldState.highlightedLine === newState.highlightedLine && oldState.problemsHighlightedRow === newState.problemsHighlightedRow && oldState.lineNumbers === newState.lineNumbers && oldState.loadError === newState.loadError && oldState.textInfos === newState.textInfos && oldState.visibleViewLineIndices === newState.visibleViewLineIndices && oldState.differences === newState.differences && oldState.initial === newState.initial && oldState.scrollBarHeight === newState.scrollBarHeight && oldState.width === newState.width && oldState.gutterWidth === newState.gutterWidth && oldState.longestLineWidth === newState.longestLineWidth && oldState.minimumSliderSize === newState.minimumSliderSize && oldState.selectionInfos === newState.selectionInfos && oldState.selections === newState.selections && oldState.workspaceUri === newState.workspaceUri;
|
|
6300
|
-
};
|
|
6301
|
-
|
|
6302
|
-
const isEqual$1 = (oldState, newState) => {
|
|
6303
|
-
if (!oldState.minimapEnabled && !newState.minimapEnabled) {
|
|
6304
|
-
return true;
|
|
6305
|
-
}
|
|
6306
|
-
return oldState.minimapEnabled === newState.minimapEnabled && oldState.minimapLines === newState.minimapLines && oldState.minimapRevision === newState.minimapRevision && oldState.deltaY === newState.deltaY && oldState.finalDeltaY === newState.finalDeltaY && oldState.height === newState.height && oldState.numberOfVisibleLines === newState.numberOfVisibleLines;
|
|
6307
|
-
};
|
|
6308
|
-
|
|
6309
|
-
const RenderFocus = 6;
|
|
6310
|
-
const RenderFocusContext = 7;
|
|
6311
|
-
const RenderCss = 11;
|
|
6312
|
-
const RenderIncremental = 12;
|
|
6313
|
-
const RenderWidgets = 13;
|
|
6314
|
-
const RenderAdditionalFocusContext = 14;
|
|
6315
|
-
const RenderMinimap = 15;
|
|
6316
|
-
|
|
6317
|
-
const isEqual = (oldState, newState) => {
|
|
6318
|
-
return oldState.widgets === newState.widgets && oldState.widgetRevision === newState.widgetRevision;
|
|
6319
|
-
};
|
|
6320
|
-
|
|
6321
|
-
const modules = [isEqual$2, isEqual$1, isEqual$3, isEqual$3, isEqual$5, isEqual$4, isEqual];
|
|
6322
|
-
const numbers = [RenderIncremental, RenderMinimap, RenderFocus, RenderFocusContext, RenderAdditionalFocusContext, RenderCss, RenderWidgets];
|
|
6323
|
-
|
|
6324
|
-
const diff = (oldState, newState) => {
|
|
6325
|
-
const diffResult = [];
|
|
6326
|
-
for (let i = 0; i < modules.length; i++) {
|
|
6327
|
-
const fn = modules[i];
|
|
6328
|
-
if (!fn(oldState, newState)) {
|
|
6329
|
-
diffResult.push(numbers[i]);
|
|
6330
|
-
}
|
|
6331
|
-
}
|
|
6332
|
-
return diffResult;
|
|
6333
|
-
};
|
|
6334
|
-
|
|
6335
|
-
const diff2 = uid => {
|
|
6336
|
-
const editor = get$8(uid);
|
|
6337
|
-
if (!editor) {
|
|
6338
|
-
return [];
|
|
6339
|
-
}
|
|
6340
|
-
const {
|
|
6341
|
-
newState,
|
|
6342
|
-
oldState
|
|
6343
|
-
} = editor;
|
|
6344
|
-
const result = diff(oldState, newState);
|
|
6345
|
-
return result;
|
|
6346
|
-
};
|
|
6347
|
-
|
|
6348
|
-
const autoSaveDelay = 1000;
|
|
6349
|
-
const pendingSaves = new Map();
|
|
6350
|
-
const state$7 = {
|
|
6351
|
-
nextToken: 0
|
|
6352
|
-
};
|
|
6353
|
-
const run = async (uid, token, save) => {
|
|
6354
|
-
if (!isLatest(uid, token)) {
|
|
6355
|
-
return;
|
|
6356
|
-
}
|
|
6357
|
-
await save(token);
|
|
6358
|
-
};
|
|
6359
|
-
const schedule$1 = (uid, save) => {
|
|
6360
|
-
dispose$4(uid);
|
|
6361
|
-
const token = ++state$7.nextToken;
|
|
6362
|
-
const timeout = setTimeout(run, autoSaveDelay, uid, token, save);
|
|
6363
|
-
pendingSaves.set(uid, {
|
|
6364
|
-
timeout,
|
|
6365
|
-
token
|
|
6366
|
-
});
|
|
6367
|
-
};
|
|
6368
|
-
const isLatest = (uid, token) => {
|
|
6369
|
-
return pendingSaves.get(uid)?.token === token;
|
|
6370
|
-
};
|
|
6371
|
-
const consume = (uid, token) => {
|
|
6372
|
-
if (!isLatest(uid, token)) {
|
|
6373
|
-
return;
|
|
6374
|
-
}
|
|
6375
|
-
dispose$4(uid);
|
|
6376
|
-
};
|
|
6377
|
-
const dispose$4 = uid => {
|
|
6378
|
-
const pendingSave = pendingSaves.get(uid);
|
|
6379
|
-
if (!pendingSave) {
|
|
6380
|
-
return;
|
|
6381
|
-
}
|
|
6382
|
-
clearTimeout(pendingSave.timeout);
|
|
6383
|
-
pendingSaves.delete(uid);
|
|
6384
|
-
};
|
|
6385
|
-
|
|
6386
|
-
const dismissals$1 = new Map();
|
|
6387
|
-
const clear$3 = editorUid => {
|
|
6388
|
-
const dismissal = dismissals$1.get(editorUid);
|
|
6389
|
-
if (dismissal) {
|
|
6390
|
-
clearTimeout(dismissal.timeout);
|
|
6391
|
-
dismissals$1.delete(editorUid);
|
|
6392
|
-
}
|
|
6393
|
-
};
|
|
6394
|
-
const set$4 = (editorUid, dismissal) => {
|
|
6395
|
-
clear$3(editorUid);
|
|
6396
|
-
dismissals$1.set(editorUid, dismissal);
|
|
6397
|
-
};
|
|
6398
|
-
|
|
6399
|
-
const state$6 = {
|
|
6400
|
-
editor: undefined,
|
|
6401
|
-
timeout: -1,
|
|
6402
|
-
token: 0,
|
|
6403
|
-
x: 0,
|
|
6404
|
-
y: 0
|
|
6405
|
-
};
|
|
6406
|
-
const get$2 = () => {
|
|
6407
|
-
return state$6;
|
|
6408
|
-
};
|
|
6409
|
-
const set$3 = (editor, timeout, x, y, token) => {
|
|
6410
|
-
state$6.editor = editor;
|
|
6411
|
-
state$6.timeout = timeout;
|
|
6412
|
-
state$6.token = token;
|
|
6413
|
-
state$6.x = x;
|
|
6414
|
-
state$6.y = y;
|
|
6415
|
-
};
|
|
6416
|
-
const clear$2 = editorUid => {
|
|
6417
|
-
const {
|
|
6418
|
-
editor,
|
|
6419
|
-
timeout
|
|
6420
|
-
} = state$6;
|
|
6421
|
-
if (editorUid !== undefined && editor?.uid !== editorUid) {
|
|
6422
|
-
return;
|
|
6423
|
-
}
|
|
6424
|
-
if (timeout !== -1) {
|
|
6425
|
-
clearTimeout(timeout);
|
|
6426
|
-
}
|
|
6427
|
-
state$6.editor = undefined;
|
|
6428
|
-
state$6.timeout = -1;
|
|
6429
|
-
state$6.token++;
|
|
6430
|
-
};
|
|
6431
|
-
|
|
6432
|
-
const dismissals = new Map();
|
|
6433
|
-
const clear$1 = editorUid => {
|
|
6434
|
-
const dismissal = dismissals.get(editorUid);
|
|
6435
|
-
if (!dismissal) {
|
|
6436
|
-
return;
|
|
6437
|
-
}
|
|
6438
|
-
clearTimeout(dismissal.timeout);
|
|
6439
|
-
dismissals.delete(editorUid);
|
|
6440
|
-
};
|
|
6441
|
-
const set$2 = (editorUid, dismissal) => {
|
|
6442
|
-
clear$1(editorUid);
|
|
6443
|
-
dismissals.set(editorUid, dismissal);
|
|
6444
|
-
};
|
|
6445
|
-
|
|
6446
|
-
const getOffset = (lines, rowIndex, columnIndex) => {
|
|
6447
|
-
let offset = columnIndex;
|
|
6448
|
-
for (let i = 0; i < rowIndex; i++) {
|
|
6449
|
-
offset += lines[i].length + 1;
|
|
6450
|
-
}
|
|
6451
|
-
return offset;
|
|
6452
|
-
};
|
|
6453
|
-
const getSelectedChars = editor => {
|
|
6454
|
-
const {
|
|
6455
|
-
lines,
|
|
6456
|
-
selections
|
|
6457
|
-
} = editor;
|
|
6458
|
-
let selectedChars = 0;
|
|
6459
|
-
for (let i = 0; i < selections.length; i += 4) {
|
|
6460
|
-
const startOffset = getOffset(lines, selections[i], selections[i + 1]);
|
|
6461
|
-
const endOffset = getOffset(lines, selections[i + 2], selections[i + 3]);
|
|
6462
|
-
selectedChars += Math.abs(endOffset - startOffset);
|
|
6463
|
-
}
|
|
6464
|
-
return selectedChars;
|
|
6465
|
-
};
|
|
6466
|
-
const getEditorStatus = editor => {
|
|
6467
|
-
const primarySelectionIndex = editor.primarySelectionIndex || 0;
|
|
6468
|
-
const rowIndex = editor.selections[primarySelectionIndex + 2] || 0;
|
|
6469
|
-
const columnIndex = editor.selections[primarySelectionIndex + 3] || 0;
|
|
6470
|
-
return {
|
|
6471
|
-
column: columnIndex + 1,
|
|
6472
|
-
encoding: 'utf8',
|
|
6473
|
-
endOfLine: editor.endOfLine,
|
|
6474
|
-
insertSpaces: editor.insertSpaces,
|
|
6475
|
-
languageId: editor.languageId,
|
|
6476
|
-
line: rowIndex + 1,
|
|
6477
|
-
selectedChars: getSelectedChars(editor),
|
|
6478
|
-
tabSize: editor.tabSize
|
|
6763
|
+
selectionInfos
|
|
6479
6764
|
};
|
|
6480
|
-
|
|
6481
|
-
|
|
6482
|
-
const sendToListener = async (rpcId, status) => {
|
|
6483
|
-
const rpc = get$9(rpcId);
|
|
6484
|
-
if (rpc) {
|
|
6485
|
-
await send$2(rpcId, rpc, status);
|
|
6486
|
-
}
|
|
6487
|
-
};
|
|
6488
|
-
const initializeListener = async rpcId => {
|
|
6489
|
-
if (!getListeners(EditorSelection$1).includes(rpcId)) {
|
|
6490
|
-
return;
|
|
6491
|
-
}
|
|
6492
|
-
const editor = getKeys$2().map(uid => get$8(Number(uid))?.newState).find(state => {
|
|
6493
|
-
const {
|
|
6494
|
-
focused,
|
|
6495
|
-
initial
|
|
6496
|
-
} = state || {};
|
|
6497
|
-
return focused && !initial;
|
|
6498
|
-
});
|
|
6499
|
-
await sendToListener(rpcId, editor ? getEditorStatus(editor) : undefined);
|
|
6500
|
-
};
|
|
6501
|
-
const notifyEditorStatusChange = async (_oldEditor, newEditor) => {
|
|
6502
|
-
if (newEditor.initial || !newEditor.focused) {
|
|
6503
|
-
return;
|
|
6765
|
+
if (!createdEditor.lifecycle?.disposed) {
|
|
6766
|
+
set$a(id, createdEditor, finalEditor);
|
|
6504
6767
|
}
|
|
6505
|
-
const status = getEditorStatus(newEditor);
|
|
6506
|
-
await Promise.all(getListeners(EditorSelection$1).map(rpcId => sendToListener(rpcId, status)));
|
|
6507
|
-
};
|
|
6508
|
-
const notifyEditorStatusCleared = async () => {
|
|
6509
|
-
await Promise.all(getListeners(EditorSelection$1).map(rpcId => sendToListener(rpcId, undefined)));
|
|
6510
6768
|
};
|
|
6511
6769
|
|
|
6512
|
-
const
|
|
6513
|
-
|
|
6514
|
-
const url = 'renameWorkerMain.js';
|
|
6515
|
-
const rpc = await launchWorker(name, url);
|
|
6516
|
-
await rpc.invoke('Rename.initialize');
|
|
6517
|
-
return rpc;
|
|
6770
|
+
const isEqual$5 = (oldState, newState) => {
|
|
6771
|
+
return oldState.additionalFocus === newState.additionalFocus;
|
|
6518
6772
|
};
|
|
6519
6773
|
|
|
6520
|
-
|
|
6521
|
-
|
|
6522
|
-
// eslint-disable-next-line unicorn/no-top-level-assignment-in-function
|
|
6523
|
-
workerPromise ||= launchRenameWorker();
|
|
6524
|
-
const worker = await workerPromise;
|
|
6525
|
-
return await worker.invoke(method, ...params);
|
|
6526
|
-
};
|
|
6527
|
-
const dispose$3 = async () => {
|
|
6528
|
-
if (getKeys$2().some(uid => get$8(Number(uid))?.newState.widgets?.some(widget => widget.id === Rename$1))) {
|
|
6529
|
-
return;
|
|
6530
|
-
}
|
|
6531
|
-
const promise = workerPromise;
|
|
6532
|
-
// eslint-disable-next-line unicorn/no-top-level-assignment-in-function
|
|
6533
|
-
workerPromise = undefined;
|
|
6534
|
-
try {
|
|
6535
|
-
// eslint-disable-next-line unicorn/prefer-await
|
|
6536
|
-
await promise?.then(worker => worker.dispose(), () => {});
|
|
6537
|
-
} catch {}
|
|
6774
|
+
const isEqual$4 = (oldState, newState) => {
|
|
6775
|
+
return oldState.rowHeight === newState.rowHeight && oldState.deltaY === newState.deltaY && oldState.finalDeltaY === newState.finalDeltaY && oldState.height === newState.height && oldState.deltaX === newState.deltaX && oldState.gutterWidth === newState.gutterWidth && oldState.longestLineWidth === newState.longestLineWidth && oldState.minimumSliderSize === newState.minimumSliderSize && oldState.width === newState.width && oldState.scrollBarHeight === newState.scrollBarHeight;
|
|
6538
6776
|
};
|
|
6539
6777
|
|
|
6540
|
-
const
|
|
6541
|
-
|
|
6542
|
-
|
|
6543
|
-
return renderedDoms.get(uid);
|
|
6544
|
-
};
|
|
6545
|
-
const set$1 = (uid, dom, paths) => {
|
|
6546
|
-
renderedDoms.set(uid, dom);
|
|
6547
|
-
setTextAppendPaths(uid, paths);
|
|
6548
|
-
};
|
|
6549
|
-
const getTextAppendPaths$1 = uid => {
|
|
6550
|
-
return textAppendPaths.get(uid);
|
|
6551
|
-
};
|
|
6552
|
-
const setTextAppendPaths = (uid, paths) => {
|
|
6553
|
-
if (paths) {
|
|
6554
|
-
textAppendPaths.set(uid, paths);
|
|
6555
|
-
} else {
|
|
6556
|
-
textAppendPaths.delete(uid);
|
|
6778
|
+
const isEqual$3 = (oldState, newState) => {
|
|
6779
|
+
if (oldState.focus !== newState.focus) {
|
|
6780
|
+
return false;
|
|
6557
6781
|
}
|
|
6558
|
-
|
|
6559
|
-
|
|
6560
|
-
renderedDoms.delete(uid);
|
|
6561
|
-
textAppendPaths.delete(uid);
|
|
6562
|
-
};
|
|
6563
|
-
|
|
6564
|
-
const addWidget$1 = widget => {
|
|
6565
|
-
const module = get$7(widget.id);
|
|
6566
|
-
if (!module) {
|
|
6567
|
-
throw new Error('unsupported widget');
|
|
6782
|
+
if (!newState.focused) {
|
|
6783
|
+
return true;
|
|
6568
6784
|
}
|
|
6569
|
-
|
|
6570
|
-
|
|
6571
|
-
const renderWidget = widget => {
|
|
6572
|
-
const module = get$7(widget.id);
|
|
6573
|
-
if (!module) {
|
|
6574
|
-
throw new Error('unsupported widget');
|
|
6785
|
+
if (!oldState.isSelecting && newState.isSelecting) {
|
|
6786
|
+
return false;
|
|
6575
6787
|
}
|
|
6576
|
-
return
|
|
6788
|
+
return oldState.focused === newState.focused;
|
|
6577
6789
|
};
|
|
6578
6790
|
|
|
6579
|
-
const
|
|
6580
|
-
|
|
6581
|
-
const revision = (revisions.get(editorUid) || 0) + 1;
|
|
6582
|
-
revisions.set(editorUid, revision);
|
|
6583
|
-
return revision;
|
|
6584
|
-
};
|
|
6585
|
-
const get = editorUid => {
|
|
6586
|
-
return revisions.get(editorUid) || 0;
|
|
6791
|
+
const isEqual$2 = (oldState, newState) => {
|
|
6792
|
+
return oldState.breadcrumbFileIcon === newState.breadcrumbFileIcon && oldState.breadcrumbsEnabled === newState.breadcrumbsEnabled && oldState.breakPoints === newState.breakPoints && oldState.bracketMatchInfos === newState.bracketMatchInfos && oldState.cursorInfos === newState.cursorInfos && oldState.diagnostics === newState.diagnostics && oldState.documentSymbols === newState.documentSymbols && oldState.endOfLineDecorations === newState.endOfLineDecorations && oldState.focused === newState.focused && oldState.gutterDecorations === newState.gutterDecorations && oldState.highlightActiveLineNumber === newState.highlightActiveLineNumber && oldState.highlightedLine === newState.highlightedLine && oldState.problemsHighlightedRow === newState.problemsHighlightedRow && oldState.lineNumbers === newState.lineNumbers && oldState.loadError === newState.loadError && oldState.textInfos === newState.textInfos && oldState.visibleViewLineIndices === newState.visibleViewLineIndices && oldState.differences === newState.differences && oldState.initial === newState.initial && oldState.scrollBarHeight === newState.scrollBarHeight && oldState.width === newState.width && oldState.gutterWidth === newState.gutterWidth && oldState.longestLineWidth === newState.longestLineWidth && oldState.minimumSliderSize === newState.minimumSliderSize && oldState.selectionInfos === newState.selectionInfos && oldState.selections === newState.selections && oldState.workspaceUri === newState.workspaceUri;
|
|
6587
6793
|
};
|
|
6588
|
-
|
|
6589
|
-
|
|
6794
|
+
|
|
6795
|
+
const isEqual$1 = (oldState, newState) => {
|
|
6796
|
+
if (!oldState.minimapEnabled && !newState.minimapEnabled) {
|
|
6797
|
+
return true;
|
|
6798
|
+
}
|
|
6799
|
+
return oldState.minimapEnabled === newState.minimapEnabled && oldState.minimapLines === newState.minimapLines && oldState.minimapRevision === newState.minimapRevision && oldState.deltaY === newState.deltaY && oldState.finalDeltaY === newState.finalDeltaY && oldState.height === newState.height && oldState.numberOfVisibleLines === newState.numberOfVisibleLines;
|
|
6590
6800
|
};
|
|
6591
|
-
|
|
6592
|
-
|
|
6801
|
+
|
|
6802
|
+
const RenderFocus = 6;
|
|
6803
|
+
const RenderFocusContext = 7;
|
|
6804
|
+
const RenderCss = 11;
|
|
6805
|
+
const RenderIncremental = 12;
|
|
6806
|
+
const RenderWidgets = 13;
|
|
6807
|
+
const RenderAdditionalFocusContext = 14;
|
|
6808
|
+
const RenderMinimap = 15;
|
|
6809
|
+
|
|
6810
|
+
const isEqual = (oldState, newState) => {
|
|
6811
|
+
return oldState.widgets === newState.widgets && oldState.widgetRevision === newState.widgetRevision;
|
|
6593
6812
|
};
|
|
6594
6813
|
|
|
6595
|
-
const
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
const
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6603
|
-
|
|
6604
|
-
}
|
|
6605
|
-
for (const newWidget of newWidgets) {
|
|
6606
|
-
newWidgetMap[newWidget.id] = newWidget;
|
|
6607
|
-
}
|
|
6608
|
-
for (const oldWidget of oldWidgets) {
|
|
6609
|
-
if (Object.hasOwn(newWidgetMap, oldWidget.id)) {
|
|
6610
|
-
changedWidgets.push(newWidgetMap[oldWidget.id]);
|
|
6611
|
-
}
|
|
6612
|
-
}
|
|
6613
|
-
for (const newWidget of newWidgets) {
|
|
6614
|
-
if (Object.hasOwn(oldWidgetMap, newWidget.id)) ; else {
|
|
6615
|
-
addedWidgets.push(newWidget);
|
|
6616
|
-
}
|
|
6617
|
-
}
|
|
6618
|
-
const addCommands = [];
|
|
6619
|
-
for (const addedWidget of addedWidgets) {
|
|
6620
|
-
const childCommands = addWidget$1(addedWidget);
|
|
6621
|
-
if (childCommands.length > 0) {
|
|
6622
|
-
addCommands.push(...childCommands);
|
|
6623
|
-
}
|
|
6624
|
-
}
|
|
6625
|
-
const changeCommands = [];
|
|
6626
|
-
for (const changedWidget of changedWidgets) {
|
|
6627
|
-
const childCommands = renderWidget(changedWidget);
|
|
6628
|
-
if (childCommands.length > 0) {
|
|
6629
|
-
changeCommands.push(...childCommands);
|
|
6814
|
+
const modules = [isEqual$2, isEqual$1, isEqual$3, isEqual$3, isEqual$5, isEqual$4, isEqual];
|
|
6815
|
+
const numbers = [RenderIncremental, RenderMinimap, RenderFocus, RenderFocusContext, RenderAdditionalFocusContext, RenderCss, RenderWidgets];
|
|
6816
|
+
|
|
6817
|
+
const diff = (oldState, newState) => {
|
|
6818
|
+
const diffResult = [];
|
|
6819
|
+
for (let i = 0; i < modules.length; i++) {
|
|
6820
|
+
const fn = modules[i];
|
|
6821
|
+
if (!fn(oldState, newState)) {
|
|
6822
|
+
diffResult.push(numbers[i]);
|
|
6630
6823
|
}
|
|
6631
6824
|
}
|
|
6632
|
-
|
|
6633
|
-
const declaredRevision = hasDeclaredRevision ? newState.widgetRevision : next(newState.uid);
|
|
6634
|
-
record(newState.uid, declaredRevision);
|
|
6635
|
-
const widgetUids = newWidgets.map(widget => widget.newState.uid);
|
|
6636
|
-
const allCommands = [...addCommands, ...changeCommands, ['Viewlet.setWidgets', newState.uid, declaredRevision, widgetUids]];
|
|
6637
|
-
return allCommands.filter(item => item[0] !== 'Viewlet.appendToBody' && (item[0] !== 'Viewlet.setFocusContext' || item.length >= 3));
|
|
6825
|
+
return diffResult;
|
|
6638
6826
|
};
|
|
6639
6827
|
|
|
6640
|
-
const
|
|
6641
|
-
const
|
|
6642
|
-
|
|
6643
|
-
|
|
6644
|
-
return undefined;
|
|
6828
|
+
const diff2 = uid => {
|
|
6829
|
+
const editor = get$8(uid);
|
|
6830
|
+
if (!editor) {
|
|
6831
|
+
return [];
|
|
6645
6832
|
}
|
|
6646
6833
|
const {
|
|
6647
|
-
|
|
6648
|
-
|
|
6649
|
-
} =
|
|
6650
|
-
const
|
|
6651
|
-
|
|
6652
|
-
const {
|
|
6653
|
-
promise,
|
|
6654
|
-
resolve
|
|
6655
|
-
} = Promise.withResolvers();
|
|
6656
|
-
queues[key] = promise;
|
|
6657
|
-
if (previous) {
|
|
6658
|
-
await previous;
|
|
6659
|
-
}
|
|
6660
|
-
try {
|
|
6661
|
-
return await callback();
|
|
6662
|
-
} finally {
|
|
6663
|
-
resolve();
|
|
6664
|
-
if (queues[key] === promise) {
|
|
6665
|
-
delete queues[key];
|
|
6666
|
-
}
|
|
6667
|
-
}
|
|
6834
|
+
newState,
|
|
6835
|
+
oldState
|
|
6836
|
+
} = editor;
|
|
6837
|
+
const result = diff(oldState, newState);
|
|
6838
|
+
return result;
|
|
6668
6839
|
};
|
|
6669
6840
|
|
|
6670
|
-
const
|
|
6671
|
-
|
|
6672
|
-
|
|
6841
|
+
const autoSaveDelay = 1000;
|
|
6842
|
+
const pendingSaves = new Map();
|
|
6843
|
+
const state$7 = {
|
|
6844
|
+
nextToken: 0
|
|
6673
6845
|
};
|
|
6674
|
-
const
|
|
6675
|
-
if (
|
|
6676
|
-
|
|
6846
|
+
const run = async (uid, token, save) => {
|
|
6847
|
+
if (!isLatest(uid, token)) {
|
|
6848
|
+
return;
|
|
6849
|
+
}
|
|
6850
|
+
await save(token);
|
|
6851
|
+
};
|
|
6852
|
+
const schedule$1 = (uid, save) => {
|
|
6853
|
+
dispose$4(uid);
|
|
6854
|
+
const token = ++state$7.nextToken;
|
|
6855
|
+
const timeout = setTimeout(run, autoSaveDelay, uid, token, save);
|
|
6856
|
+
pendingSaves.set(uid, {
|
|
6857
|
+
timeout,
|
|
6858
|
+
token
|
|
6859
|
+
});
|
|
6860
|
+
};
|
|
6861
|
+
const isLatest = (uid, token) => {
|
|
6862
|
+
return pendingSaves.get(uid)?.token === token;
|
|
6863
|
+
};
|
|
6864
|
+
const consume = (uid, token) => {
|
|
6865
|
+
if (!isLatest(uid, token)) {
|
|
6866
|
+
return;
|
|
6867
|
+
}
|
|
6868
|
+
dispose$4(uid);
|
|
6869
|
+
};
|
|
6870
|
+
const dispose$4 = uid => {
|
|
6871
|
+
const pendingSave = pendingSaves.get(uid);
|
|
6872
|
+
if (!pendingSave) {
|
|
6677
6873
|
return;
|
|
6678
6874
|
}
|
|
6679
|
-
|
|
6875
|
+
clearTimeout(pendingSave.timeout);
|
|
6876
|
+
pendingSaves.delete(uid);
|
|
6680
6877
|
};
|
|
6681
|
-
|
|
6682
|
-
|
|
6683
|
-
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6878
|
+
|
|
6879
|
+
const dismissals$1 = new Map();
|
|
6880
|
+
const clear$3 = editorUid => {
|
|
6881
|
+
const dismissal = dismissals$1.get(editorUid);
|
|
6882
|
+
if (dismissal) {
|
|
6883
|
+
clearTimeout(dismissal.timeout);
|
|
6884
|
+
dismissals$1.delete(editorUid);
|
|
6687
6885
|
}
|
|
6688
6886
|
};
|
|
6887
|
+
const set$4 = (editorUid, dismissal) => {
|
|
6888
|
+
clear$3(editorUid);
|
|
6889
|
+
dismissals$1.set(editorUid, dismissal);
|
|
6890
|
+
};
|
|
6689
6891
|
|
|
6690
|
-
const
|
|
6691
|
-
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
};
|
|
6892
|
+
const state$6 = {
|
|
6893
|
+
editor: undefined,
|
|
6894
|
+
timeout: -1,
|
|
6895
|
+
token: 0,
|
|
6896
|
+
x: 0,
|
|
6897
|
+
y: 0
|
|
6697
6898
|
};
|
|
6698
|
-
const
|
|
6699
|
-
|
|
6700
|
-
return invokeAndTransfer(editor.applicationId, 'Extensions.streamDiagnosticProvider', textDocument, resultPort);
|
|
6899
|
+
const get$2 = () => {
|
|
6900
|
+
return state$6;
|
|
6701
6901
|
};
|
|
6702
|
-
const
|
|
6703
|
-
|
|
6902
|
+
const set$3 = (editor, timeout, x, y, token) => {
|
|
6903
|
+
state$6.editor = editor;
|
|
6904
|
+
state$6.timeout = timeout;
|
|
6905
|
+
state$6.token = token;
|
|
6906
|
+
state$6.x = x;
|
|
6907
|
+
state$6.y = y;
|
|
6704
6908
|
};
|
|
6705
|
-
|
|
6706
|
-
const
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6711
|
-
|
|
6712
|
-
const mergeLinksWithDiagnosticDecorations = (editor, diagnosticDecorations) => {
|
|
6713
|
-
// Get link decorations
|
|
6714
|
-
const linkDecorations = detectAllLinksAsDecorations(editor);
|
|
6715
|
-
|
|
6716
|
-
// Merge with diagnostic decorations
|
|
6717
|
-
const allDecorations = [...linkDecorations, ...diagnosticDecorations];
|
|
6718
|
-
|
|
6719
|
-
// Sort by offset to maintain proper order
|
|
6720
|
-
const sortedDecorations = [];
|
|
6721
|
-
for (let i = 0; i < allDecorations.length; i += 4) {
|
|
6722
|
-
sortedDecorations.push({
|
|
6723
|
-
length: allDecorations[i + 1],
|
|
6724
|
-
modifiers: allDecorations[i + 3],
|
|
6725
|
-
offset: allDecorations[i],
|
|
6726
|
-
type: allDecorations[i + 2]
|
|
6727
|
-
});
|
|
6909
|
+
const clear$2 = editorUid => {
|
|
6910
|
+
const {
|
|
6911
|
+
editor,
|
|
6912
|
+
timeout
|
|
6913
|
+
} = state$6;
|
|
6914
|
+
if (editorUid !== undefined && editor?.uid !== editorUid) {
|
|
6915
|
+
return;
|
|
6728
6916
|
}
|
|
6729
|
-
|
|
6917
|
+
if (timeout !== -1) {
|
|
6918
|
+
clearTimeout(timeout);
|
|
6919
|
+
}
|
|
6920
|
+
state$6.editor = undefined;
|
|
6921
|
+
state$6.timeout = -1;
|
|
6922
|
+
state$6.token++;
|
|
6923
|
+
};
|
|
6730
6924
|
|
|
6731
|
-
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
|
|
6925
|
+
const dismissals = new Map();
|
|
6926
|
+
const clear$1 = editorUid => {
|
|
6927
|
+
const dismissal = dismissals.get(editorUid);
|
|
6928
|
+
if (!dismissal) {
|
|
6929
|
+
return;
|
|
6735
6930
|
}
|
|
6736
|
-
|
|
6931
|
+
clearTimeout(dismissal.timeout);
|
|
6932
|
+
dismissals.delete(editorUid);
|
|
6933
|
+
};
|
|
6934
|
+
const set$2 = (editorUid, dismissal) => {
|
|
6935
|
+
clear$1(editorUid);
|
|
6936
|
+
dismissals.set(editorUid, dismissal);
|
|
6737
6937
|
};
|
|
6738
6938
|
|
|
6739
|
-
const
|
|
6740
|
-
|
|
6741
|
-
|
|
6742
|
-
|
|
6743
|
-
|
|
6939
|
+
const getOffset = (lines, rowIndex, columnIndex) => {
|
|
6940
|
+
let offset = columnIndex;
|
|
6941
|
+
for (let i = 0; i < rowIndex; i++) {
|
|
6942
|
+
offset += lines[i].length + 1;
|
|
6943
|
+
}
|
|
6944
|
+
return offset;
|
|
6744
6945
|
};
|
|
6745
|
-
const
|
|
6746
|
-
const
|
|
6747
|
-
|
|
6748
|
-
|
|
6946
|
+
const getSelectedChars = editor => {
|
|
6947
|
+
const {
|
|
6948
|
+
lines,
|
|
6949
|
+
selections
|
|
6950
|
+
} = editor;
|
|
6951
|
+
let selectedChars = 0;
|
|
6952
|
+
for (let i = 0; i < selections.length; i += 4) {
|
|
6953
|
+
const startOffset = getOffset(lines, selections[i], selections[i + 1]);
|
|
6954
|
+
const endOffset = getOffset(lines, selections[i + 2], selections[i + 3]);
|
|
6955
|
+
selectedChars += Math.abs(endOffset - startOffset);
|
|
6956
|
+
}
|
|
6957
|
+
return selectedChars;
|
|
6958
|
+
};
|
|
6959
|
+
const getEditorStatus = editor => {
|
|
6960
|
+
const primarySelectionIndex = editor.primarySelectionIndex || 0;
|
|
6961
|
+
const rowIndex = editor.selections[primarySelectionIndex + 2] || 0;
|
|
6962
|
+
const columnIndex = editor.selections[primarySelectionIndex + 3] || 0;
|
|
6749
6963
|
return {
|
|
6750
|
-
|
|
6751
|
-
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6964
|
+
column: columnIndex + 1,
|
|
6965
|
+
encoding: 'utf8',
|
|
6966
|
+
endOfLine: editor.endOfLine,
|
|
6967
|
+
insertSpaces: editor.insertSpaces,
|
|
6968
|
+
languageId: editor.languageId,
|
|
6969
|
+
line: rowIndex + 1,
|
|
6970
|
+
selectedChars: getSelectedChars(editor),
|
|
6971
|
+
tabSize: editor.tabSize
|
|
6755
6972
|
};
|
|
6756
6973
|
};
|
|
6757
|
-
|
|
6758
|
-
|
|
6759
|
-
|
|
6974
|
+
|
|
6975
|
+
const sendToListener = async (rpcId, status) => {
|
|
6976
|
+
const rpc = get$9(rpcId);
|
|
6977
|
+
if (rpc) {
|
|
6978
|
+
await send$2(rpcId, rpc, status);
|
|
6760
6979
|
}
|
|
6761
|
-
await handleError$1(error, 'Failed to update diagnostics: ');
|
|
6762
|
-
return editor;
|
|
6763
6980
|
};
|
|
6764
|
-
const
|
|
6765
|
-
|
|
6766
|
-
|
|
6767
|
-
} catch {
|
|
6768
|
-
// Older renderer workers do not support diagnostics change listeners.
|
|
6981
|
+
const initializeListener = async rpcId => {
|
|
6982
|
+
if (!getListeners(EditorSelection$1).includes(rpcId)) {
|
|
6983
|
+
return;
|
|
6769
6984
|
}
|
|
6985
|
+
const editor = getKeys$2().map(uid => get$8(Number(uid))?.newState).find(state => {
|
|
6986
|
+
const {
|
|
6987
|
+
focused,
|
|
6988
|
+
initial
|
|
6989
|
+
} = state || {};
|
|
6990
|
+
return focused && !initial;
|
|
6991
|
+
});
|
|
6992
|
+
await sendToListener(rpcId, editor ? getEditorStatus(editor) : undefined);
|
|
6770
6993
|
};
|
|
6771
|
-
const
|
|
6772
|
-
if (
|
|
6773
|
-
return
|
|
6994
|
+
const notifyEditorStatusChange = async (_oldEditor, newEditor) => {
|
|
6995
|
+
if (newEditor.initial || !newEditor.focused) {
|
|
6996
|
+
return;
|
|
6774
6997
|
}
|
|
6775
|
-
|
|
6776
|
-
|
|
6998
|
+
const status = getEditorStatus(newEditor);
|
|
6999
|
+
await Promise.all(getListeners(EditorSelection$1).map(rpcId => sendToListener(rpcId, status)));
|
|
7000
|
+
};
|
|
7001
|
+
const notifyEditorStatusCleared = async () => {
|
|
7002
|
+
await Promise.all(getListeners(EditorSelection$1).map(rpcId => sendToListener(rpcId, undefined)));
|
|
7003
|
+
};
|
|
7004
|
+
|
|
7005
|
+
const launchRenameWorker = async () => {
|
|
7006
|
+
const name = 'Rename Worker';
|
|
7007
|
+
const url = 'renameWorkerMain.js';
|
|
7008
|
+
const rpc = await launchWorker(name, url);
|
|
7009
|
+
await rpc.invoke('Rename.initialize');
|
|
7010
|
+
return rpc;
|
|
7011
|
+
};
|
|
7012
|
+
|
|
7013
|
+
let workerPromise;
|
|
7014
|
+
const invoke$5 = async (method, ...params) => {
|
|
7015
|
+
// eslint-disable-next-line unicorn/no-top-level-assignment-in-function
|
|
7016
|
+
workerPromise ||= launchRenameWorker();
|
|
7017
|
+
const worker = await workerPromise;
|
|
7018
|
+
return await worker.invoke(method, ...params);
|
|
7019
|
+
};
|
|
7020
|
+
const dispose$3 = async () => {
|
|
7021
|
+
if (getKeys$2().some(uid => get$8(Number(uid))?.newState.widgets?.some(widget => widget.id === Rename$1))) {
|
|
7022
|
+
return;
|
|
6777
7023
|
}
|
|
6778
|
-
|
|
6779
|
-
|
|
6780
|
-
|
|
6781
|
-
|
|
7024
|
+
const promise = workerPromise;
|
|
7025
|
+
// eslint-disable-next-line unicorn/no-top-level-assignment-in-function
|
|
7026
|
+
workerPromise = undefined;
|
|
7027
|
+
try {
|
|
7028
|
+
// eslint-disable-next-line unicorn/prefer-await
|
|
7029
|
+
await promise?.then(worker => worker.dispose(), () => {});
|
|
7030
|
+
} catch {}
|
|
6782
7031
|
};
|
|
6783
|
-
|
|
6784
|
-
const
|
|
6785
|
-
const
|
|
6786
|
-
|
|
6787
|
-
|
|
6788
|
-
diagnostics: editorWithDiagnostics.diagnostics,
|
|
6789
|
-
lightBulbRowIndex: editorWithDiagnostics.lightBulbRowIndex,
|
|
6790
|
-
visualDecorations: editorWithDiagnostics.visualDecorations
|
|
6791
|
-
});
|
|
6792
|
-
const commitDiagnostics = async (editor, generation, diagnostics, onAccepted) => {
|
|
6793
|
-
return (await enqueue(editor.id, async () => {
|
|
6794
|
-
let latest = get$8(editor.id);
|
|
6795
|
-
if (!isApplicable(latest, editor, generation)) {
|
|
6796
|
-
return editor;
|
|
6797
|
-
}
|
|
6798
|
-
if (diagnosticsEqual(latest.newState.diagnostics, diagnostics)) {
|
|
6799
|
-
onAccepted?.();
|
|
6800
|
-
return latest.newState;
|
|
6801
|
-
}
|
|
6802
|
-
let calculationState = latest.newState;
|
|
6803
|
-
let editorWithDiagnostics = await addDiagnostics(calculationState, diagnostics);
|
|
6804
|
-
latest = get$8(editor.id);
|
|
6805
|
-
while (isApplicable(latest, editor, generation) && !diagnosticLayoutEqual(calculationState, latest.newState)) {
|
|
6806
|
-
calculationState = latest.newState;
|
|
6807
|
-
editorWithDiagnostics = await addDiagnostics(calculationState, diagnostics);
|
|
6808
|
-
latest = get$8(editor.id);
|
|
6809
|
-
}
|
|
6810
|
-
if (!isApplicable(latest, editor, generation)) {
|
|
6811
|
-
return editor;
|
|
6812
|
-
}
|
|
6813
|
-
if (diagnosticsEqual(latest.newState.diagnostics, diagnostics)) {
|
|
6814
|
-
return latest.newState;
|
|
6815
|
-
}
|
|
6816
|
-
const newEditor = mergeDiagnostics(latest.newState, editorWithDiagnostics);
|
|
6817
|
-
set$a(editor.id, latest.oldState, newEditor);
|
|
6818
|
-
requestDiagnosticSnapshots.set(editor.id, diagnostics);
|
|
6819
|
-
onAccepted?.();
|
|
6820
|
-
await invoke$5('Editor.renderPending', newEditor.id);
|
|
6821
|
-
await notifyDiagnosticsChange(newEditor.uri, newEditor.applicationId);
|
|
6822
|
-
return newEditor;
|
|
6823
|
-
})) ?? editor;
|
|
7032
|
+
|
|
7033
|
+
const renderedDoms = new Map();
|
|
7034
|
+
const textAppendPaths = new Map();
|
|
7035
|
+
const get$1 = uid => {
|
|
7036
|
+
return renderedDoms.get(uid);
|
|
6824
7037
|
};
|
|
6825
|
-
const
|
|
6826
|
-
|
|
6827
|
-
|
|
6828
|
-
}) => diagnostics);
|
|
7038
|
+
const set$1 = (uid, dom, paths) => {
|
|
7039
|
+
renderedDoms.set(uid, dom);
|
|
7040
|
+
setTextAppendPaths(uid, paths);
|
|
6829
7041
|
};
|
|
6830
|
-
const
|
|
6831
|
-
|
|
6832
|
-
languageId: editor.languageId,
|
|
6833
|
-
providers: new Map(providers),
|
|
6834
|
-
uri: editor.uri
|
|
6835
|
-
});
|
|
7042
|
+
const getTextAppendPaths$1 = uid => {
|
|
7043
|
+
return textAppendPaths.get(uid);
|
|
6836
7044
|
};
|
|
6837
|
-
const
|
|
6838
|
-
|
|
6839
|
-
|
|
6840
|
-
|
|
6841
|
-
|
|
6842
|
-
if (!editor.diagnosticsEnabled || editor.loadError) {
|
|
6843
|
-
return editor;
|
|
7045
|
+
const setTextAppendPaths = (uid, paths) => {
|
|
7046
|
+
if (paths) {
|
|
7047
|
+
textAppendPaths.set(uid, paths);
|
|
7048
|
+
} else {
|
|
7049
|
+
textAppendPaths.delete(uid);
|
|
6844
7050
|
}
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
|
|
6848
|
-
|
|
6849
|
-
|
|
6850
|
-
|
|
6851
|
-
|
|
6852
|
-
|
|
6853
|
-
|
|
7051
|
+
};
|
|
7052
|
+
const dispose$2 = uid => {
|
|
7053
|
+
renderedDoms.delete(uid);
|
|
7054
|
+
textAppendPaths.delete(uid);
|
|
7055
|
+
};
|
|
7056
|
+
|
|
7057
|
+
const addWidget$1 = widget => {
|
|
7058
|
+
const module = get$7(widget.id);
|
|
7059
|
+
if (!module) {
|
|
7060
|
+
throw new Error('unsupported widget');
|
|
6854
7061
|
}
|
|
6855
|
-
|
|
6856
|
-
|
|
6857
|
-
|
|
6858
|
-
|
|
6859
|
-
|
|
6860
|
-
|
|
6861
|
-
let providerCount = -1;
|
|
6862
|
-
let finished = false;
|
|
6863
|
-
const receivedProviders = new Set();
|
|
6864
|
-
const timeout = strict ? setTimeout(() => completed.reject(new Error(`Diagnostics timed out after ${timeoutMs}ms for ${editor.uri}`)), timeoutMs) : undefined;
|
|
6865
|
-
port1.onmessage = event => {
|
|
6866
|
-
const previousCommit = commitQueue;
|
|
6867
|
-
commitQueue = (async () => {
|
|
6868
|
-
await previousCommit;
|
|
6869
|
-
try {
|
|
6870
|
-
if (finished) {
|
|
6871
|
-
return;
|
|
6872
|
-
}
|
|
6873
|
-
const message = event.data;
|
|
6874
|
-
if (requestGenerations.get(editor.id) !== generation) {
|
|
6875
|
-
if (strict) {
|
|
6876
|
-
throw new Error('Diagnostics request was superseded');
|
|
6877
|
-
}
|
|
6878
|
-
if (message.type === 'done') {
|
|
6879
|
-
port1.close();
|
|
6880
|
-
completed.resolve();
|
|
6881
|
-
}
|
|
6882
|
-
return;
|
|
6883
|
-
}
|
|
6884
|
-
if (message.type === 'providers') {
|
|
6885
|
-
providerCount = message.providerCount ?? 0;
|
|
6886
|
-
const providerIds = message.providerIds ?? [];
|
|
6887
|
-
for (const providerId of providers.keys()) {
|
|
6888
|
-
if (providerIds.includes(providerId)) {
|
|
6889
|
-
const previousResult = providers.get(providerId);
|
|
6890
|
-
providers.set(providerId, {
|
|
6891
|
-
...previousResult,
|
|
6892
|
-
providerIndex: providerIds.indexOf(providerId)
|
|
6893
|
-
});
|
|
6894
|
-
} else {
|
|
6895
|
-
providers.delete(providerId);
|
|
6896
|
-
}
|
|
6897
|
-
}
|
|
6898
|
-
if (requestGenerations.get(editor.id) === generation) {
|
|
6899
|
-
saveProviderResults(editor, providers);
|
|
6900
|
-
}
|
|
6901
|
-
return;
|
|
6902
|
-
}
|
|
6903
|
-
if (message.type === 'result' && message.providerId !== undefined) {
|
|
6904
|
-
if (strict && message.error !== undefined) {
|
|
6905
|
-
throw new Error(`Diagnostic provider ${message.providerId} failed: ${message.error}`);
|
|
6906
|
-
}
|
|
6907
|
-
receivedProviders.add(message.providerId);
|
|
6908
|
-
providers.set(message.providerId, {
|
|
6909
|
-
diagnostics: message.diagnostics ?? [],
|
|
6910
|
-
providerIndex: message.providerIndex ?? providers.size
|
|
6911
|
-
});
|
|
6912
|
-
await commitDiagnostics(editor, generation, flattenProviderDiagnostics(providers), () => saveProviderResults(editor, providers));
|
|
6913
|
-
return;
|
|
6914
|
-
}
|
|
6915
|
-
if (message.type === 'done') {
|
|
6916
|
-
if (strict && (providerCount < 0 || receivedProviders.size !== providerCount)) {
|
|
6917
|
-
throw new Error('Diagnostics stream ended without all provider results');
|
|
6918
|
-
}
|
|
6919
|
-
if (providerCount === 0) {
|
|
6920
|
-
providers.clear();
|
|
6921
|
-
await commitDiagnostics(editor, generation, [], () => saveProviderResults(editor, providers));
|
|
6922
|
-
}
|
|
6923
|
-
if (requestGenerations.get(editor.id) === generation) {
|
|
6924
|
-
saveProviderResults(editor, providers);
|
|
6925
|
-
}
|
|
6926
|
-
port1.close();
|
|
6927
|
-
completed.resolve();
|
|
6928
|
-
}
|
|
6929
|
-
} catch (error) {
|
|
6930
|
-
port1.close();
|
|
6931
|
-
if (strict) {
|
|
6932
|
-
completed.reject(error);
|
|
6933
|
-
} else {
|
|
6934
|
-
completed.resolve();
|
|
6935
|
-
await handleError(error, editor);
|
|
6936
|
-
}
|
|
6937
|
-
}
|
|
6938
|
-
})();
|
|
6939
|
-
};
|
|
6940
|
-
port1.start();
|
|
6941
|
-
const request = async () => {
|
|
6942
|
-
const response = await getDiagnostics$1(editor, port2);
|
|
6943
|
-
if (finished) {
|
|
6944
|
-
return;
|
|
6945
|
-
}
|
|
6946
|
-
if (Array.isArray(response) && providerCount === -1) {
|
|
6947
|
-
if (strict) {
|
|
6948
|
-
throw new Error('Diagnostic provider does not support completion and error reporting');
|
|
6949
|
-
}
|
|
6950
|
-
providers.set('legacy', {
|
|
6951
|
-
diagnostics: response,
|
|
6952
|
-
providerIndex: 0
|
|
6953
|
-
});
|
|
6954
|
-
await commitDiagnostics(editor, generation, response, () => saveProviderResults(editor, providers));
|
|
6955
|
-
port1.close();
|
|
6956
|
-
completed.resolve();
|
|
6957
|
-
}
|
|
6958
|
-
};
|
|
6959
|
-
try {
|
|
6960
|
-
await Promise.all([request(), completed.promise]);
|
|
6961
|
-
const latest = get$8(editor.id);
|
|
6962
|
-
if (strict && !isApplicable(latest, editor, generation)) {
|
|
6963
|
-
throw new Error('Editor changed or closed while waiting for diagnostics');
|
|
6964
|
-
}
|
|
6965
|
-
return isApplicable(latest, editor, generation) ? latest.newState : editor;
|
|
6966
|
-
} catch (error) {
|
|
6967
|
-
if (strict) {
|
|
6968
|
-
if (requestGenerations.get(editor.id) === generation) {
|
|
6969
|
-
requestGenerations.set(editor.id, generation + 1);
|
|
6970
|
-
}
|
|
6971
|
-
throw error;
|
|
6972
|
-
}
|
|
6973
|
-
return handleError(error, editor);
|
|
6974
|
-
} finally {
|
|
6975
|
-
finished = true;
|
|
6976
|
-
clearTimeout(timeout);
|
|
6977
|
-
port1.close();
|
|
6978
|
-
port2.close();
|
|
7062
|
+
return module.add(widget);
|
|
7063
|
+
};
|
|
7064
|
+
const renderWidget = widget => {
|
|
7065
|
+
const module = get$7(widget.id);
|
|
7066
|
+
if (!module) {
|
|
7067
|
+
throw new Error('unsupported widget');
|
|
6979
7068
|
}
|
|
7069
|
+
return module.render(widget);
|
|
6980
7070
|
};
|
|
6981
|
-
|
|
6982
|
-
|
|
6983
|
-
|
|
7071
|
+
|
|
7072
|
+
const revisions = new Map();
|
|
7073
|
+
const next = editorUid => {
|
|
7074
|
+
const revision = (revisions.get(editorUid) || 0) + 1;
|
|
7075
|
+
revisions.set(editorUid, revision);
|
|
7076
|
+
return revision;
|
|
6984
7077
|
};
|
|
6985
|
-
const
|
|
6986
|
-
|
|
6987
|
-
requestDiagnosticSnapshots.delete(editorId);
|
|
6988
|
-
previousProviderResults.delete(editorId);
|
|
7078
|
+
const get = editorUid => {
|
|
7079
|
+
return revisions.get(editorUid) || 0;
|
|
6989
7080
|
};
|
|
6990
|
-
const
|
|
6991
|
-
|
|
6992
|
-
|
|
6993
|
-
|
|
6994
|
-
|
|
6995
|
-
}
|
|
6996
|
-
}
|
|
7081
|
+
const record = (editorUid, revision) => {
|
|
7082
|
+
revisions.set(editorUid, Math.max(get(editorUid), revision));
|
|
7083
|
+
};
|
|
7084
|
+
const dispose$1 = editorUid => {
|
|
7085
|
+
revisions.delete(editorUid);
|
|
6997
7086
|
};
|
|
6998
7087
|
|
|
6999
|
-
|
|
7000
|
-
const
|
|
7001
|
-
|
|
7002
|
-
|
|
7088
|
+
const renderWidgets$1 = (oldState, newState) => {
|
|
7089
|
+
const addedWidgets = [];
|
|
7090
|
+
const changedWidgets = [];
|
|
7091
|
+
const oldWidgets = oldState.widgets || [];
|
|
7092
|
+
const newWidgets = newState.widgets || [];
|
|
7093
|
+
const oldWidgetMap = Object.create(null);
|
|
7094
|
+
const newWidgetMap = Object.create(null);
|
|
7095
|
+
for (const oldWidget of oldWidgets) {
|
|
7096
|
+
oldWidgetMap[oldWidget.id] = oldWidget;
|
|
7003
7097
|
}
|
|
7004
|
-
const
|
|
7005
|
-
|
|
7006
|
-
throw new Error(`Editor is not ready: ${editorId}`);
|
|
7098
|
+
for (const newWidget of newWidgets) {
|
|
7099
|
+
newWidgetMap[newWidget.id] = newWidget;
|
|
7007
7100
|
}
|
|
7008
|
-
|
|
7101
|
+
for (const oldWidget of oldWidgets) {
|
|
7102
|
+
if (Object.hasOwn(newWidgetMap, oldWidget.id)) {
|
|
7103
|
+
changedWidgets.push(newWidgetMap[oldWidget.id]);
|
|
7104
|
+
}
|
|
7105
|
+
}
|
|
7106
|
+
for (const newWidget of newWidgets) {
|
|
7107
|
+
if (Object.hasOwn(oldWidgetMap, newWidget.id)) ; else {
|
|
7108
|
+
addedWidgets.push(newWidget);
|
|
7109
|
+
}
|
|
7110
|
+
}
|
|
7111
|
+
const addCommands = [];
|
|
7112
|
+
for (const addedWidget of addedWidgets) {
|
|
7113
|
+
const childCommands = addWidget$1(addedWidget);
|
|
7114
|
+
if (childCommands.length > 0) {
|
|
7115
|
+
addCommands.push(...childCommands);
|
|
7116
|
+
}
|
|
7117
|
+
}
|
|
7118
|
+
const changeCommands = [];
|
|
7119
|
+
for (const changedWidget of changedWidgets) {
|
|
7120
|
+
const childCommands = renderWidget(changedWidget);
|
|
7121
|
+
if (childCommands.length > 0) {
|
|
7122
|
+
changeCommands.push(...childCommands);
|
|
7123
|
+
}
|
|
7124
|
+
}
|
|
7125
|
+
const hasDeclaredRevision = typeof newState.widgetRevision === 'number' && newState.widgetRevision > (oldState.widgetRevision || 0);
|
|
7126
|
+
const declaredRevision = hasDeclaredRevision ? newState.widgetRevision : next(newState.uid);
|
|
7127
|
+
record(newState.uid, declaredRevision);
|
|
7128
|
+
const widgetUids = newWidgets.map(widget => widget.newState.uid);
|
|
7129
|
+
const allCommands = [...addCommands, ...changeCommands, ['Viewlet.setWidgets', newState.uid, declaredRevision, widgetUids]];
|
|
7130
|
+
return allCommands.filter(item => item[0] !== 'Viewlet.appendToBody' && (item[0] !== 'Viewlet.setFocusContext' || item.length >= 3));
|
|
7009
7131
|
};
|
|
7010
7132
|
|
|
7011
7133
|
const disposeEditor = async editorUid => {
|
|
@@ -7037,7 +7159,7 @@ const disposeEditor = async editorUid => {
|
|
|
7037
7159
|
}
|
|
7038
7160
|
for (const widget of editor.widgets) {
|
|
7039
7161
|
if (widget.id === ColorPicker$2) {
|
|
7040
|
-
pending.push(invoke$
|
|
7162
|
+
pending.push(invoke$6('ColorPicker.dispose', widget.newState.uid));
|
|
7041
7163
|
}
|
|
7042
7164
|
}
|
|
7043
7165
|
const commands = renderWidgets$1(editor, {
|
|
@@ -8685,7 +8807,7 @@ const applyWorkspaceEdit = async (editor, changes) => {
|
|
|
8685
8807
|
currentEditor = await scheduleDocumentAndCursorsSelections(openEditor, textChanges);
|
|
8686
8808
|
} else {
|
|
8687
8809
|
await updateOpenEditor(openEditor.uid, textChanges);
|
|
8688
|
-
await invoke$
|
|
8810
|
+
await invoke$7('Editor.renderPending', openEditor.uid);
|
|
8689
8811
|
}
|
|
8690
8812
|
continue;
|
|
8691
8813
|
}
|
|
@@ -9168,7 +9290,7 @@ const closeRename = async editor => {
|
|
|
9168
9290
|
return editor;
|
|
9169
9291
|
}
|
|
9170
9292
|
const renameWidget = widgets[renameWidgetIndex];
|
|
9171
|
-
await invoke$
|
|
9293
|
+
await invoke$5('Rename.close', renameWidget.newState.uid);
|
|
9172
9294
|
const latest = get$8(uid);
|
|
9173
9295
|
const {
|
|
9174
9296
|
newState
|
|
@@ -11400,10 +11522,10 @@ const getHover = async (editor, offset) => {
|
|
|
11400
11522
|
};
|
|
11401
11523
|
|
|
11402
11524
|
const getVirtualDomFromMarkdown = async markdown => {
|
|
11403
|
-
const html = await invoke$
|
|
11525
|
+
const html = await invoke$7('Markdown.renderMarkdown', markdown, {
|
|
11404
11526
|
linksExternal: true
|
|
11405
11527
|
});
|
|
11406
|
-
return invoke$
|
|
11528
|
+
return invoke$7('Markdown.getVirtualDom', html);
|
|
11407
11529
|
};
|
|
11408
11530
|
|
|
11409
11531
|
const getLineInfo = (line, tokens, TokenMap) => {
|
|
@@ -12704,7 +12826,7 @@ const invoke$1 = async (method, ...params) => {
|
|
|
12704
12826
|
const getWidgetInvoke = widgetId => {
|
|
12705
12827
|
switch (widgetId) {
|
|
12706
12828
|
case ColorPicker$2:
|
|
12707
|
-
return invoke$
|
|
12829
|
+
return invoke$6;
|
|
12708
12830
|
case Completion:
|
|
12709
12831
|
return invoke$4;
|
|
12710
12832
|
case Find:
|
|
@@ -12712,7 +12834,7 @@ const getWidgetInvoke = widgetId => {
|
|
|
12712
12834
|
case Hover:
|
|
12713
12835
|
return invoke$2;
|
|
12714
12836
|
case Rename$1:
|
|
12715
|
-
return invoke$
|
|
12837
|
+
return invoke$5;
|
|
12716
12838
|
case SourceAction$1:
|
|
12717
12839
|
return invoke$1;
|
|
12718
12840
|
default:
|
|
@@ -13056,10 +13178,10 @@ const newStateGenerator$1 = async (state, parentUid) => {
|
|
|
13056
13178
|
const {
|
|
13057
13179
|
languageId
|
|
13058
13180
|
} = newState;
|
|
13059
|
-
await invoke$
|
|
13060
|
-
await invoke$
|
|
13061
|
-
const diff = await invoke$
|
|
13062
|
-
const commands = await invoke$
|
|
13181
|
+
await invoke$5('Rename.create', uid, x, y, width, height, parentUid, languageId);
|
|
13182
|
+
await invoke$5('Rename.loadContent', uid);
|
|
13183
|
+
const diff = await invoke$5('Rename.diff2', uid);
|
|
13184
|
+
const commands = await invoke$5('Rename.render2', uid, diff);
|
|
13063
13185
|
return {
|
|
13064
13186
|
...state,
|
|
13065
13187
|
commands
|