@lvce-editor/editor-worker 19.73.1 → 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 +1016 -890
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -3779,6 +3779,10 @@ const getIncrementalEdits = async (oldState, newState) => {
|
|
|
3779
3779
|
lines
|
|
3780
3780
|
} = newState;
|
|
3781
3781
|
const oldLine = oldState.lines[rowIndex];
|
|
3782
|
+
// Empty lines have no nonempty token to update; render the new token normally.
|
|
3783
|
+
if (oldLine.length === 0) {
|
|
3784
|
+
return emptyIncrementalEdits;
|
|
3785
|
+
}
|
|
3782
3786
|
const newLine = lines[rowIndex];
|
|
3783
3787
|
// Renderer edit offsets address full lines, so clipped rows need a fresh visible window.
|
|
3784
3788
|
const threshold = newState.horizontalVirtualizationThreshold ?? 500;
|
|
@@ -4214,15 +4218,177 @@ const notifyTabModifiedStatusChange = async (uri, modified, applicationId) => {
|
|
|
4214
4218
|
}
|
|
4215
4219
|
};
|
|
4216
4220
|
|
|
4217
|
-
const
|
|
4218
|
-
|
|
4219
|
-
|
|
4220
|
-
|
|
4221
|
-
|
|
4222
|
-
|
|
4223
|
-
|
|
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
|
+
};
|
|
4224
4228
|
}
|
|
4225
|
-
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;
|
|
4226
4392
|
};
|
|
4227
4393
|
|
|
4228
4394
|
const getTabCount = string => {
|
|
@@ -4258,117 +4424,12 @@ const getX = async (line, column, fontWeight, fontSize, fontFamily, isMonospaceF
|
|
|
4258
4424
|
return Math.min(width, textWidth - halfCursorWidth + difference);
|
|
4259
4425
|
};
|
|
4260
4426
|
|
|
4261
|
-
const
|
|
4262
|
-
|
|
4263
|
-
};
|
|
4264
|
-
|
|
4265
|
-
const fromRange = (startRowIndex, startColumnIndex, endRowIndex, endColumnIndex) => {
|
|
4266
|
-
return new Uint32Array([startRowIndex, startColumnIndex, endRowIndex, endColumnIndex]);
|
|
4267
|
-
};
|
|
4268
|
-
const alloc = length => {
|
|
4269
|
-
return new Uint32Array(length);
|
|
4270
|
-
};
|
|
4271
|
-
const clone = selections => {
|
|
4272
|
-
return alloc(selections.length);
|
|
4273
|
-
};
|
|
4274
|
-
const map = (selections, fn) => {
|
|
4275
|
-
const newSelections = clone(selections);
|
|
4276
|
-
for (let i = 0; i < newSelections.length; i += 4) {
|
|
4277
|
-
const [selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn] = getSelectionPairs(selections, i);
|
|
4278
|
-
fn(newSelections, i, selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn);
|
|
4279
|
-
}
|
|
4280
|
-
return newSelections;
|
|
4281
|
-
};
|
|
4282
|
-
const forEach = (selections, fn) => {
|
|
4283
|
-
for (let i = 0; i < selections.length; i += 4) {
|
|
4284
|
-
const selectionStartRow = selections[i];
|
|
4285
|
-
const selectionStartColumn = selections[i + 1];
|
|
4286
|
-
const selectionEndRow = selections[i + 2];
|
|
4287
|
-
const selectionEndColumn = selections[i + 3];
|
|
4288
|
-
fn(selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn);
|
|
4289
|
-
}
|
|
4290
|
-
};
|
|
4291
|
-
const moveRangeToPosition$1 = (selections, i, rowIndex, columnIndex) => {
|
|
4292
|
-
selections[i] = selections[i + 2] = rowIndex;
|
|
4293
|
-
selections[i + 1] = selections[i + 3] = columnIndex;
|
|
4294
|
-
};
|
|
4295
|
-
const isEmpty$1 = (selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn) => {
|
|
4296
|
-
return selectionStartRow === selectionEndRow && selectionStartColumn === selectionEndColumn;
|
|
4297
|
-
};
|
|
4298
|
-
const isSelectionSingleLine = (selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn) => {
|
|
4299
|
-
return selectionStartRow === selectionEndRow;
|
|
4300
|
-
};
|
|
4301
|
-
const isEverySelection = (selections, fn) => {
|
|
4302
|
-
for (let i = 0; i < selections.length; i += 4) {
|
|
4303
|
-
const selectionStartRow = selections[i];
|
|
4304
|
-
const selectionStartColumn = selections[i + 1];
|
|
4305
|
-
const selectionEndRow = selections[i + 2];
|
|
4306
|
-
const selectionEndColumn = selections[i + 3];
|
|
4307
|
-
if (!fn(selectionStartRow, selectionStartColumn, selectionEndRow, selectionEndColumn)) {
|
|
4308
|
-
return false;
|
|
4309
|
-
}
|
|
4310
|
-
}
|
|
4311
|
-
return true;
|
|
4312
|
-
};
|
|
4313
|
-
const isEverySelectionEmpty = selections => {
|
|
4314
|
-
return isEverySelection(selections, isEmpty$1);
|
|
4315
|
-
};
|
|
4316
|
-
const isEverySelectionSingleLine = selections => {
|
|
4317
|
-
return isEverySelection(selections, isSelectionSingleLine);
|
|
4318
|
-
};
|
|
4319
|
-
const from = (array, getSelection) => {
|
|
4320
|
-
const newSelections = alloc(array.length * 4);
|
|
4321
|
-
let i = 0;
|
|
4322
|
-
for (const item of array) {
|
|
4323
|
-
const {
|
|
4324
|
-
end,
|
|
4325
|
-
start
|
|
4326
|
-
} = getSelection(item);
|
|
4327
|
-
newSelections[i++] = start.rowIndex;
|
|
4328
|
-
newSelections[i++] = start.columnIndex;
|
|
4329
|
-
newSelections[i++] = end.rowIndex;
|
|
4330
|
-
newSelections[i++] = end.columnIndex;
|
|
4331
|
-
}
|
|
4332
|
-
return newSelections;
|
|
4333
|
-
};
|
|
4334
|
-
|
|
4335
|
-
// TODO maybe only accept sorted selection edits in the first place
|
|
4336
|
-
|
|
4337
|
-
const emptyCursors = [];
|
|
4338
|
-
const getCursorArray = (visibleCursors, isFocused) => {
|
|
4339
|
-
if (!isFocused) {
|
|
4340
|
-
return emptyCursors;
|
|
4341
|
-
}
|
|
4342
|
-
const cursorArray = [];
|
|
4343
|
-
for (let i = 0; i < visibleCursors.length; i += 2) {
|
|
4344
|
-
const x = visibleCursors[i];
|
|
4345
|
-
const y = visibleCursors[i + 1];
|
|
4346
|
-
cursorArray.push(`${px(x)} ${px(y)}`);
|
|
4347
|
-
}
|
|
4348
|
-
return cursorArray;
|
|
4349
|
-
};
|
|
4350
|
-
const getSelectionArray = visibleSelections => {
|
|
4351
|
-
const selectionsArray = [];
|
|
4352
|
-
for (let i = 0; i < visibleSelections.length; i += 4) {
|
|
4353
|
-
const x = visibleSelections[i];
|
|
4354
|
-
const y = visibleSelections[i + 1];
|
|
4355
|
-
const width = visibleSelections[i + 2];
|
|
4356
|
-
const height = visibleSelections[i + 3];
|
|
4357
|
-
selectionsArray.push(px(x), px(y), px(width), px(height));
|
|
4358
|
-
}
|
|
4359
|
-
return selectionsArray;
|
|
4360
|
-
};
|
|
4361
|
-
const getVisible = async editor => {
|
|
4362
|
-
const visibleCursors = [];
|
|
4363
|
-
const visibleSelections = [];
|
|
4364
|
-
// // TODO binary search
|
|
4365
|
-
|
|
4427
|
+
const getVisibleDiagnostics = async (editor, diagnostics) => {
|
|
4428
|
+
const visibleDiagnostics = [];
|
|
4366
4429
|
const {
|
|
4367
4430
|
charWidth,
|
|
4368
|
-
|
|
4431
|
+
deltaX = 0,
|
|
4369
4432
|
deltaY,
|
|
4370
|
-
focused,
|
|
4371
|
-
foldingRanges = [],
|
|
4372
4433
|
fontFamily,
|
|
4373
4434
|
fontSize,
|
|
4374
4435
|
fontWeight,
|
|
@@ -4376,34 +4437,514 @@ const getVisible = async editor => {
|
|
|
4376
4437
|
itemHeight,
|
|
4377
4438
|
letterSpacing,
|
|
4378
4439
|
lines,
|
|
4379
|
-
maxLineY,
|
|
4380
|
-
minLineY,
|
|
4381
4440
|
rowHeight,
|
|
4382
|
-
selections,
|
|
4383
4441
|
tabSize,
|
|
4384
|
-
viewLineIndices
|
|
4385
|
-
visibleLineIndices,
|
|
4386
|
-
visibleViewLineIndices,
|
|
4387
|
-
width
|
|
4442
|
+
viewLineIndices
|
|
4388
4443
|
} = editor;
|
|
4389
|
-
const
|
|
4390
|
-
const
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4394
|
-
|
|
4395
|
-
|
|
4396
|
-
|
|
4397
|
-
|
|
4398
|
-
|
|
4399
|
-
|
|
4400
|
-
const
|
|
4401
|
-
const
|
|
4402
|
-
const
|
|
4403
|
-
|
|
4404
|
-
|
|
4405
|
-
|
|
4406
|
-
|
|
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);
|
|
4407
4948
|
const endLineDifference = horizontalOffset;
|
|
4408
4949
|
const endLine = lines[selectionEndRow];
|
|
4409
4950
|
const endLineEndX = await getX(endLine, selectionEndColumn, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, width, averageCharWidth, endLineDifference);
|
|
@@ -4608,6 +5149,11 @@ const applyAutoClosingRangesEdit = (editor, changes) => {
|
|
|
4608
5149
|
}
|
|
4609
5150
|
return newAutoClosingRanges;
|
|
4610
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
|
+
};
|
|
4611
5157
|
const scheduleSelections = (editor, selectionEdits) => {
|
|
4612
5158
|
return setSelections$2(editor, selectionEdits);
|
|
4613
5159
|
};
|
|
@@ -4634,6 +5180,7 @@ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionCh
|
|
|
4634
5180
|
}
|
|
4635
5181
|
const newLines = applyEdits(editor, changes);
|
|
4636
5182
|
const partialNewEditor = updateLines(editor, newLines);
|
|
5183
|
+
const partialNewEditorWithDiagnostics = await updateTransformedDiagnostics(partialNewEditor, changes);
|
|
4637
5184
|
const newSelections = selectionChanges || applyEdit$1(partialNewEditor, changes);
|
|
4638
5185
|
const selectionHistory = {
|
|
4639
5186
|
after: newSelections,
|
|
@@ -4661,7 +5208,7 @@ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionCh
|
|
|
4661
5208
|
inserted: [previous.inserted[0] + change.inserted[0]]
|
|
4662
5209
|
}]] : [...editor.undoStack, changes];
|
|
4663
5210
|
const newEditor = {
|
|
4664
|
-
...
|
|
5211
|
+
...partialNewEditorWithDiagnostics,
|
|
4665
5212
|
autoClosingRanges,
|
|
4666
5213
|
canCoalesceTyping,
|
|
4667
5214
|
invalidStartIndex,
|
|
@@ -4723,10 +5270,11 @@ const scheduleDocumentAndCursorsSelectionIsUndo = async (editor, changes, select
|
|
|
4723
5270
|
}
|
|
4724
5271
|
const newLines = applyEdits(editor, changes);
|
|
4725
5272
|
const partialNewEditor = updateLines(editor, newLines);
|
|
5273
|
+
const partialNewEditorWithDiagnostics = await updateTransformedDiagnostics(partialNewEditor, changes);
|
|
4726
5274
|
const newSelections = selectionChanges || applyEdit$1(partialNewEditor, changes);
|
|
4727
5275
|
const invalidStartIndex = Math.min(editor.invalidStartIndex, changes[0].start.rowIndex);
|
|
4728
5276
|
const newEditor = {
|
|
4729
|
-
...
|
|
5277
|
+
...partialNewEditorWithDiagnostics,
|
|
4730
5278
|
// undoStack: [...editor.undoStack.slice(0, -2)],
|
|
4731
5279
|
invalidStartIndex,
|
|
4732
5280
|
lines: newLines,
|
|
@@ -4759,6 +5307,8 @@ const scheduleDocumentAndCursorsSelectionIsUndo = async (editor, changes, select
|
|
|
4759
5307
|
// @ts-ignore
|
|
4760
5308
|
const scheduleDocument = async (editor, changes) => {
|
|
4761
5309
|
const newLines = applyEdits(editor, changes);
|
|
5310
|
+
const partialNewEditor = updateLines(editor, newLines);
|
|
5311
|
+
const partialNewEditorWithDiagnostics = await updateTransformedDiagnostics(partialNewEditor, changes);
|
|
4762
5312
|
const invalidStartIndex = changes[0].start.rowIndex;
|
|
4763
5313
|
// if (editor.undoStack) {
|
|
4764
5314
|
// editor.undoStack.push(changes)
|
|
@@ -4773,7 +5323,7 @@ const scheduleDocument = async (editor, changes) => {
|
|
|
4773
5323
|
// const scrollBarHeight = editor.scrollBarHeight
|
|
4774
5324
|
|
|
4775
5325
|
const newEditor = {
|
|
4776
|
-
...
|
|
5326
|
+
...partialNewEditorWithDiagnostics,
|
|
4777
5327
|
invalidStartIndex,
|
|
4778
5328
|
redoStack: [],
|
|
4779
5329
|
undoStack: [...editor.undoStack, changes]
|
|
@@ -4927,14 +5477,7 @@ const updateColorPickerValue$1 = async (editor, value) => {
|
|
|
4927
5477
|
};
|
|
4928
5478
|
};
|
|
4929
5479
|
|
|
4930
|
-
const
|
|
4931
|
-
return applicationId === undefined ? invoke$g(method, ...args) : invoke$g('Extensions.invokeForApplication', applicationId, method, ...args);
|
|
4932
|
-
};
|
|
4933
|
-
const invokeAndTransfer = async (applicationId, method, ...args) => {
|
|
4934
|
-
return applicationId === undefined ? invokeAndTransfer$2(method, ...args) : invokeAndTransfer$2('Extensions.invokeForApplication', applicationId, method, ...args);
|
|
4935
|
-
};
|
|
4936
|
-
|
|
4937
|
-
const getTextDocument$3 = editor => ({
|
|
5480
|
+
const getTextDocument$2 = editor => ({
|
|
4938
5481
|
documentId: editor.id || editor.uid,
|
|
4939
5482
|
languageId: editor.languageId,
|
|
4940
5483
|
text: getText$1(editor),
|
|
@@ -4950,7 +5493,7 @@ const execute = async ({
|
|
|
4950
5493
|
if (editor.largeFile) {
|
|
4951
5494
|
return noProviderFoundResult;
|
|
4952
5495
|
}
|
|
4953
|
-
const textDocument = getTextDocument$
|
|
5496
|
+
const textDocument = getTextDocument$2(editor);
|
|
4954
5497
|
const result = await invoke$8(editor.applicationId, 'Extensions.executeLanguageProvider', kind, method, textDocument, ...args);
|
|
4955
5498
|
if (!result.found) {
|
|
4956
5499
|
return noProviderFoundResult;
|
|
@@ -5395,52 +5938,6 @@ const getVisibleBracketMatches = async editor => {
|
|
|
5395
5938
|
return infos.filter(info => info !== undefined);
|
|
5396
5939
|
};
|
|
5397
5940
|
|
|
5398
|
-
const getDiagnosticType = diagnostic => {
|
|
5399
|
-
return diagnostic.type;
|
|
5400
|
-
};
|
|
5401
|
-
|
|
5402
|
-
const getVisibleDiagnostics = async (editor, diagnostics) => {
|
|
5403
|
-
const visibleDiagnostics = [];
|
|
5404
|
-
const {
|
|
5405
|
-
charWidth,
|
|
5406
|
-
deltaX = 0,
|
|
5407
|
-
deltaY,
|
|
5408
|
-
fontFamily,
|
|
5409
|
-
fontSize,
|
|
5410
|
-
fontWeight,
|
|
5411
|
-
isMonospaceFont,
|
|
5412
|
-
itemHeight,
|
|
5413
|
-
letterSpacing,
|
|
5414
|
-
lines,
|
|
5415
|
-
rowHeight,
|
|
5416
|
-
tabSize,
|
|
5417
|
-
viewLineIndices
|
|
5418
|
-
} = editor;
|
|
5419
|
-
const startVisualRow = itemHeight ? Math.floor(deltaY / itemHeight) : editor.minLineY || 0;
|
|
5420
|
-
for (const diagnostic of diagnostics) {
|
|
5421
|
-
const {
|
|
5422
|
-
columnIndex,
|
|
5423
|
-
endColumnIndex,
|
|
5424
|
-
rowIndex
|
|
5425
|
-
} = diagnostic;
|
|
5426
|
-
const endLineDifference = -deltaX;
|
|
5427
|
-
const halfCursorWidth = 0;
|
|
5428
|
-
const x = await getX(lines[rowIndex], columnIndex, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, Infinity, charWidth, endLineDifference);
|
|
5429
|
-
const endX = await getX(lines[rowIndex], endColumnIndex, fontWeight, fontSize, fontFamily, isMonospaceFont, letterSpacing, tabSize, halfCursorWidth, Infinity, charWidth, endLineDifference);
|
|
5430
|
-
const diagnosticWidth = Math.max(charWidth, endX - x);
|
|
5431
|
-
const visualRow = viewLineIndices ? getVisualRowForDocumentRow$1(rowIndex, viewLineIndices) : rowIndex;
|
|
5432
|
-
const y = (visualRow - startVisualRow) * rowHeight;
|
|
5433
|
-
visibleDiagnostics.push({
|
|
5434
|
-
height: rowHeight,
|
|
5435
|
-
type: getDiagnosticType(diagnostic),
|
|
5436
|
-
width: diagnosticWidth,
|
|
5437
|
-
x,
|
|
5438
|
-
y
|
|
5439
|
-
});
|
|
5440
|
-
}
|
|
5441
|
-
return visibleDiagnostics;
|
|
5442
|
-
};
|
|
5443
|
-
|
|
5444
5941
|
// Owned by the editor lifecycle, with only the current document's distinct lines retained.
|
|
5445
5942
|
const caches = new WeakMap();
|
|
5446
5943
|
const updateHorizontalLayout = async state => {
|
|
@@ -5674,7 +6171,7 @@ const getOrCreate$2 = () => {
|
|
|
5674
6171
|
}
|
|
5675
6172
|
return state$8.workerPromise;
|
|
5676
6173
|
};
|
|
5677
|
-
const invoke$
|
|
6174
|
+
const invoke$6 = async (method, ...params) => {
|
|
5678
6175
|
const worker = await getOrCreate$2();
|
|
5679
6176
|
return await worker.invoke(method, ...params);
|
|
5680
6177
|
};
|
|
@@ -5688,10 +6185,10 @@ const loadContent$3 = async (state, parentUid) => {
|
|
|
5688
6185
|
x,
|
|
5689
6186
|
y
|
|
5690
6187
|
} = state;
|
|
5691
|
-
await invoke$
|
|
5692
|
-
await invoke$
|
|
5693
|
-
const diff = await invoke$
|
|
5694
|
-
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);
|
|
5695
6192
|
return {
|
|
5696
6193
|
...state,
|
|
5697
6194
|
commands
|
|
@@ -6263,745 +6760,374 @@ const createStandaloneEditor = async ({
|
|
|
6263
6760
|
const finalEditor = {
|
|
6264
6761
|
...editorWithVisibleText,
|
|
6265
6762
|
cursorInfos,
|
|
6266
|
-
selectionInfos
|
|
6267
|
-
};
|
|
6268
|
-
if (!createdEditor.lifecycle?.disposed) {
|
|
6269
|
-
set$a(id, createdEditor, finalEditor);
|
|
6270
|
-
}
|
|
6271
|
-
};
|
|
6272
|
-
|
|
6273
|
-
const isEqual$5 = (oldState, newState) => {
|
|
6274
|
-
return oldState.additionalFocus === newState.additionalFocus;
|
|
6275
|
-
};
|
|
6276
|
-
|
|
6277
|
-
const isEqual$4 = (oldState, newState) => {
|
|
6278
|
-
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;
|
|
6279
|
-
};
|
|
6280
|
-
|
|
6281
|
-
const isEqual$3 = (oldState, newState) => {
|
|
6282
|
-
if (oldState.focus !== newState.focus) {
|
|
6283
|
-
return false;
|
|
6284
|
-
}
|
|
6285
|
-
if (!newState.focused) {
|
|
6286
|
-
return true;
|
|
6287
|
-
}
|
|
6288
|
-
if (!oldState.isSelecting && newState.isSelecting) {
|
|
6289
|
-
return false;
|
|
6290
|
-
}
|
|
6291
|
-
return oldState.focused === newState.focused;
|
|
6292
|
-
};
|
|
6293
|
-
|
|
6294
|
-
const isEqual$2 = (oldState, newState) => {
|
|
6295
|
-
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;
|
|
6296
|
-
};
|
|
6297
|
-
|
|
6298
|
-
const isEqual$1 = (oldState, newState) => {
|
|
6299
|
-
if (!oldState.minimapEnabled && !newState.minimapEnabled) {
|
|
6300
|
-
return true;
|
|
6301
|
-
}
|
|
6302
|
-
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;
|
|
6303
|
-
};
|
|
6304
|
-
|
|
6305
|
-
const RenderFocus = 6;
|
|
6306
|
-
const RenderFocusContext = 7;
|
|
6307
|
-
const RenderCss = 11;
|
|
6308
|
-
const RenderIncremental = 12;
|
|
6309
|
-
const RenderWidgets = 13;
|
|
6310
|
-
const RenderAdditionalFocusContext = 14;
|
|
6311
|
-
const RenderMinimap = 15;
|
|
6312
|
-
|
|
6313
|
-
const isEqual = (oldState, newState) => {
|
|
6314
|
-
return oldState.widgets === newState.widgets && oldState.widgetRevision === newState.widgetRevision;
|
|
6315
|
-
};
|
|
6316
|
-
|
|
6317
|
-
const modules = [isEqual$2, isEqual$1, isEqual$3, isEqual$3, isEqual$5, isEqual$4, isEqual];
|
|
6318
|
-
const numbers = [RenderIncremental, RenderMinimap, RenderFocus, RenderFocusContext, RenderAdditionalFocusContext, RenderCss, RenderWidgets];
|
|
6319
|
-
|
|
6320
|
-
const diff = (oldState, newState) => {
|
|
6321
|
-
const diffResult = [];
|
|
6322
|
-
for (let i = 0; i < modules.length; i++) {
|
|
6323
|
-
const fn = modules[i];
|
|
6324
|
-
if (!fn(oldState, newState)) {
|
|
6325
|
-
diffResult.push(numbers[i]);
|
|
6326
|
-
}
|
|
6327
|
-
}
|
|
6328
|
-
return diffResult;
|
|
6329
|
-
};
|
|
6330
|
-
|
|
6331
|
-
const diff2 = uid => {
|
|
6332
|
-
const editor = get$8(uid);
|
|
6333
|
-
if (!editor) {
|
|
6334
|
-
return [];
|
|
6335
|
-
}
|
|
6336
|
-
const {
|
|
6337
|
-
newState,
|
|
6338
|
-
oldState
|
|
6339
|
-
} = editor;
|
|
6340
|
-
const result = diff(oldState, newState);
|
|
6341
|
-
return result;
|
|
6342
|
-
};
|
|
6343
|
-
|
|
6344
|
-
const autoSaveDelay = 1000;
|
|
6345
|
-
const pendingSaves = new Map();
|
|
6346
|
-
const state$7 = {
|
|
6347
|
-
nextToken: 0
|
|
6348
|
-
};
|
|
6349
|
-
const run = async (uid, token, save) => {
|
|
6350
|
-
if (!isLatest(uid, token)) {
|
|
6351
|
-
return;
|
|
6352
|
-
}
|
|
6353
|
-
await save(token);
|
|
6354
|
-
};
|
|
6355
|
-
const schedule$1 = (uid, save) => {
|
|
6356
|
-
dispose$4(uid);
|
|
6357
|
-
const token = ++state$7.nextToken;
|
|
6358
|
-
const timeout = setTimeout(run, autoSaveDelay, uid, token, save);
|
|
6359
|
-
pendingSaves.set(uid, {
|
|
6360
|
-
timeout,
|
|
6361
|
-
token
|
|
6362
|
-
});
|
|
6363
|
-
};
|
|
6364
|
-
const isLatest = (uid, token) => {
|
|
6365
|
-
return pendingSaves.get(uid)?.token === token;
|
|
6366
|
-
};
|
|
6367
|
-
const consume = (uid, token) => {
|
|
6368
|
-
if (!isLatest(uid, token)) {
|
|
6369
|
-
return;
|
|
6370
|
-
}
|
|
6371
|
-
dispose$4(uid);
|
|
6372
|
-
};
|
|
6373
|
-
const dispose$4 = uid => {
|
|
6374
|
-
const pendingSave = pendingSaves.get(uid);
|
|
6375
|
-
if (!pendingSave) {
|
|
6376
|
-
return;
|
|
6377
|
-
}
|
|
6378
|
-
clearTimeout(pendingSave.timeout);
|
|
6379
|
-
pendingSaves.delete(uid);
|
|
6380
|
-
};
|
|
6381
|
-
|
|
6382
|
-
const dismissals$1 = new Map();
|
|
6383
|
-
const clear$3 = editorUid => {
|
|
6384
|
-
const dismissal = dismissals$1.get(editorUid);
|
|
6385
|
-
if (dismissal) {
|
|
6386
|
-
clearTimeout(dismissal.timeout);
|
|
6387
|
-
dismissals$1.delete(editorUid);
|
|
6388
|
-
}
|
|
6389
|
-
};
|
|
6390
|
-
const set$4 = (editorUid, dismissal) => {
|
|
6391
|
-
clear$3(editorUid);
|
|
6392
|
-
dismissals$1.set(editorUid, dismissal);
|
|
6393
|
-
};
|
|
6394
|
-
|
|
6395
|
-
const state$6 = {
|
|
6396
|
-
editor: undefined,
|
|
6397
|
-
timeout: -1,
|
|
6398
|
-
token: 0,
|
|
6399
|
-
x: 0,
|
|
6400
|
-
y: 0
|
|
6401
|
-
};
|
|
6402
|
-
const get$2 = () => {
|
|
6403
|
-
return state$6;
|
|
6404
|
-
};
|
|
6405
|
-
const set$3 = (editor, timeout, x, y, token) => {
|
|
6406
|
-
state$6.editor = editor;
|
|
6407
|
-
state$6.timeout = timeout;
|
|
6408
|
-
state$6.token = token;
|
|
6409
|
-
state$6.x = x;
|
|
6410
|
-
state$6.y = y;
|
|
6411
|
-
};
|
|
6412
|
-
const clear$2 = editorUid => {
|
|
6413
|
-
const {
|
|
6414
|
-
editor,
|
|
6415
|
-
timeout
|
|
6416
|
-
} = state$6;
|
|
6417
|
-
if (editorUid !== undefined && editor?.uid !== editorUid) {
|
|
6418
|
-
return;
|
|
6419
|
-
}
|
|
6420
|
-
if (timeout !== -1) {
|
|
6421
|
-
clearTimeout(timeout);
|
|
6422
|
-
}
|
|
6423
|
-
state$6.editor = undefined;
|
|
6424
|
-
state$6.timeout = -1;
|
|
6425
|
-
state$6.token++;
|
|
6426
|
-
};
|
|
6427
|
-
|
|
6428
|
-
const dismissals = new Map();
|
|
6429
|
-
const clear$1 = editorUid => {
|
|
6430
|
-
const dismissal = dismissals.get(editorUid);
|
|
6431
|
-
if (!dismissal) {
|
|
6432
|
-
return;
|
|
6433
|
-
}
|
|
6434
|
-
clearTimeout(dismissal.timeout);
|
|
6435
|
-
dismissals.delete(editorUid);
|
|
6436
|
-
};
|
|
6437
|
-
const set$2 = (editorUid, dismissal) => {
|
|
6438
|
-
clear$1(editorUid);
|
|
6439
|
-
dismissals.set(editorUid, dismissal);
|
|
6440
|
-
};
|
|
6441
|
-
|
|
6442
|
-
const getOffset = (lines, rowIndex, columnIndex) => {
|
|
6443
|
-
let offset = columnIndex;
|
|
6444
|
-
for (let i = 0; i < rowIndex; i++) {
|
|
6445
|
-
offset += lines[i].length + 1;
|
|
6446
|
-
}
|
|
6447
|
-
return offset;
|
|
6448
|
-
};
|
|
6449
|
-
const getSelectedChars = editor => {
|
|
6450
|
-
const {
|
|
6451
|
-
lines,
|
|
6452
|
-
selections
|
|
6453
|
-
} = editor;
|
|
6454
|
-
let selectedChars = 0;
|
|
6455
|
-
for (let i = 0; i < selections.length; i += 4) {
|
|
6456
|
-
const startOffset = getOffset(lines, selections[i], selections[i + 1]);
|
|
6457
|
-
const endOffset = getOffset(lines, selections[i + 2], selections[i + 3]);
|
|
6458
|
-
selectedChars += Math.abs(endOffset - startOffset);
|
|
6459
|
-
}
|
|
6460
|
-
return selectedChars;
|
|
6461
|
-
};
|
|
6462
|
-
const getEditorStatus = editor => {
|
|
6463
|
-
const primarySelectionIndex = editor.primarySelectionIndex || 0;
|
|
6464
|
-
const rowIndex = editor.selections[primarySelectionIndex + 2] || 0;
|
|
6465
|
-
const columnIndex = editor.selections[primarySelectionIndex + 3] || 0;
|
|
6466
|
-
return {
|
|
6467
|
-
column: columnIndex + 1,
|
|
6468
|
-
encoding: 'utf8',
|
|
6469
|
-
endOfLine: editor.endOfLine,
|
|
6470
|
-
insertSpaces: editor.insertSpaces,
|
|
6471
|
-
languageId: editor.languageId,
|
|
6472
|
-
line: rowIndex + 1,
|
|
6473
|
-
selectedChars: getSelectedChars(editor),
|
|
6474
|
-
tabSize: editor.tabSize
|
|
6763
|
+
selectionInfos
|
|
6475
6764
|
};
|
|
6476
|
-
|
|
6477
|
-
|
|
6478
|
-
const sendToListener = async (rpcId, status) => {
|
|
6479
|
-
const rpc = get$9(rpcId);
|
|
6480
|
-
if (rpc) {
|
|
6481
|
-
await send$2(rpcId, rpc, status);
|
|
6482
|
-
}
|
|
6483
|
-
};
|
|
6484
|
-
const initializeListener = async rpcId => {
|
|
6485
|
-
if (!getListeners(EditorSelection$1).includes(rpcId)) {
|
|
6486
|
-
return;
|
|
6487
|
-
}
|
|
6488
|
-
const editor = getKeys$2().map(uid => get$8(Number(uid))?.newState).find(state => {
|
|
6489
|
-
const {
|
|
6490
|
-
focused,
|
|
6491
|
-
initial
|
|
6492
|
-
} = state || {};
|
|
6493
|
-
return focused && !initial;
|
|
6494
|
-
});
|
|
6495
|
-
await sendToListener(rpcId, editor ? getEditorStatus(editor) : undefined);
|
|
6496
|
-
};
|
|
6497
|
-
const notifyEditorStatusChange = async (_oldEditor, newEditor) => {
|
|
6498
|
-
if (newEditor.initial || !newEditor.focused) {
|
|
6499
|
-
return;
|
|
6765
|
+
if (!createdEditor.lifecycle?.disposed) {
|
|
6766
|
+
set$a(id, createdEditor, finalEditor);
|
|
6500
6767
|
}
|
|
6501
|
-
const status = getEditorStatus(newEditor);
|
|
6502
|
-
await Promise.all(getListeners(EditorSelection$1).map(rpcId => sendToListener(rpcId, status)));
|
|
6503
|
-
};
|
|
6504
|
-
const notifyEditorStatusCleared = async () => {
|
|
6505
|
-
await Promise.all(getListeners(EditorSelection$1).map(rpcId => sendToListener(rpcId, undefined)));
|
|
6506
6768
|
};
|
|
6507
6769
|
|
|
6508
|
-
const
|
|
6509
|
-
|
|
6510
|
-
const url = 'renameWorkerMain.js';
|
|
6511
|
-
const rpc = await launchWorker(name, url);
|
|
6512
|
-
await rpc.invoke('Rename.initialize');
|
|
6513
|
-
return rpc;
|
|
6770
|
+
const isEqual$5 = (oldState, newState) => {
|
|
6771
|
+
return oldState.additionalFocus === newState.additionalFocus;
|
|
6514
6772
|
};
|
|
6515
6773
|
|
|
6516
|
-
|
|
6517
|
-
|
|
6518
|
-
// eslint-disable-next-line unicorn/no-top-level-assignment-in-function
|
|
6519
|
-
workerPromise ||= launchRenameWorker();
|
|
6520
|
-
const worker = await workerPromise;
|
|
6521
|
-
return await worker.invoke(method, ...params);
|
|
6522
|
-
};
|
|
6523
|
-
const dispose$3 = async () => {
|
|
6524
|
-
if (getKeys$2().some(uid => get$8(Number(uid))?.newState.widgets?.some(widget => widget.id === Rename$1))) {
|
|
6525
|
-
return;
|
|
6526
|
-
}
|
|
6527
|
-
const promise = workerPromise;
|
|
6528
|
-
// eslint-disable-next-line unicorn/no-top-level-assignment-in-function
|
|
6529
|
-
workerPromise = undefined;
|
|
6530
|
-
try {
|
|
6531
|
-
// eslint-disable-next-line unicorn/prefer-await
|
|
6532
|
-
await promise?.then(worker => worker.dispose(), () => {});
|
|
6533
|
-
} 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;
|
|
6534
6776
|
};
|
|
6535
6777
|
|
|
6536
|
-
const
|
|
6537
|
-
|
|
6538
|
-
|
|
6539
|
-
return renderedDoms.get(uid);
|
|
6540
|
-
};
|
|
6541
|
-
const set$1 = (uid, dom, paths) => {
|
|
6542
|
-
renderedDoms.set(uid, dom);
|
|
6543
|
-
setTextAppendPaths(uid, paths);
|
|
6544
|
-
};
|
|
6545
|
-
const getTextAppendPaths$1 = uid => {
|
|
6546
|
-
return textAppendPaths.get(uid);
|
|
6547
|
-
};
|
|
6548
|
-
const setTextAppendPaths = (uid, paths) => {
|
|
6549
|
-
if (paths) {
|
|
6550
|
-
textAppendPaths.set(uid, paths);
|
|
6551
|
-
} else {
|
|
6552
|
-
textAppendPaths.delete(uid);
|
|
6778
|
+
const isEqual$3 = (oldState, newState) => {
|
|
6779
|
+
if (oldState.focus !== newState.focus) {
|
|
6780
|
+
return false;
|
|
6553
6781
|
}
|
|
6554
|
-
|
|
6555
|
-
|
|
6556
|
-
renderedDoms.delete(uid);
|
|
6557
|
-
textAppendPaths.delete(uid);
|
|
6558
|
-
};
|
|
6559
|
-
|
|
6560
|
-
const addWidget$1 = widget => {
|
|
6561
|
-
const module = get$7(widget.id);
|
|
6562
|
-
if (!module) {
|
|
6563
|
-
throw new Error('unsupported widget');
|
|
6782
|
+
if (!newState.focused) {
|
|
6783
|
+
return true;
|
|
6564
6784
|
}
|
|
6565
|
-
|
|
6566
|
-
|
|
6567
|
-
const renderWidget = widget => {
|
|
6568
|
-
const module = get$7(widget.id);
|
|
6569
|
-
if (!module) {
|
|
6570
|
-
throw new Error('unsupported widget');
|
|
6785
|
+
if (!oldState.isSelecting && newState.isSelecting) {
|
|
6786
|
+
return false;
|
|
6571
6787
|
}
|
|
6572
|
-
return
|
|
6788
|
+
return oldState.focused === newState.focused;
|
|
6573
6789
|
};
|
|
6574
6790
|
|
|
6575
|
-
const
|
|
6576
|
-
|
|
6577
|
-
const revision = (revisions.get(editorUid) || 0) + 1;
|
|
6578
|
-
revisions.set(editorUid, revision);
|
|
6579
|
-
return revision;
|
|
6580
|
-
};
|
|
6581
|
-
const get = editorUid => {
|
|
6582
|
-
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;
|
|
6583
6793
|
};
|
|
6584
|
-
|
|
6585
|
-
|
|
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;
|
|
6586
6800
|
};
|
|
6587
|
-
|
|
6588
|
-
|
|
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;
|
|
6589
6812
|
};
|
|
6590
6813
|
|
|
6591
|
-
const
|
|
6592
|
-
|
|
6593
|
-
|
|
6594
|
-
|
|
6595
|
-
const
|
|
6596
|
-
|
|
6597
|
-
|
|
6598
|
-
|
|
6599
|
-
|
|
6600
|
-
}
|
|
6601
|
-
for (const newWidget of newWidgets) {
|
|
6602
|
-
newWidgetMap[newWidget.id] = newWidget;
|
|
6603
|
-
}
|
|
6604
|
-
for (const oldWidget of oldWidgets) {
|
|
6605
|
-
if (Object.hasOwn(newWidgetMap, oldWidget.id)) {
|
|
6606
|
-
changedWidgets.push(newWidgetMap[oldWidget.id]);
|
|
6607
|
-
}
|
|
6608
|
-
}
|
|
6609
|
-
for (const newWidget of newWidgets) {
|
|
6610
|
-
if (Object.hasOwn(oldWidgetMap, newWidget.id)) ; else {
|
|
6611
|
-
addedWidgets.push(newWidget);
|
|
6612
|
-
}
|
|
6613
|
-
}
|
|
6614
|
-
const addCommands = [];
|
|
6615
|
-
for (const addedWidget of addedWidgets) {
|
|
6616
|
-
const childCommands = addWidget$1(addedWidget);
|
|
6617
|
-
if (childCommands.length > 0) {
|
|
6618
|
-
addCommands.push(...childCommands);
|
|
6619
|
-
}
|
|
6620
|
-
}
|
|
6621
|
-
const changeCommands = [];
|
|
6622
|
-
for (const changedWidget of changedWidgets) {
|
|
6623
|
-
const childCommands = renderWidget(changedWidget);
|
|
6624
|
-
if (childCommands.length > 0) {
|
|
6625
|
-
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]);
|
|
6626
6823
|
}
|
|
6627
6824
|
}
|
|
6628
|
-
|
|
6629
|
-
const declaredRevision = hasDeclaredRevision ? newState.widgetRevision : next(newState.uid);
|
|
6630
|
-
record(newState.uid, declaredRevision);
|
|
6631
|
-
const widgetUids = newWidgets.map(widget => widget.newState.uid);
|
|
6632
|
-
const allCommands = [...addCommands, ...changeCommands, ['Viewlet.setWidgets', newState.uid, declaredRevision, widgetUids]];
|
|
6633
|
-
return allCommands.filter(item => item[0] !== 'Viewlet.appendToBody' && (item[0] !== 'Viewlet.setFocusContext' || item.length >= 3));
|
|
6825
|
+
return diffResult;
|
|
6634
6826
|
};
|
|
6635
6827
|
|
|
6636
|
-
const
|
|
6637
|
-
const
|
|
6638
|
-
|
|
6639
|
-
|
|
6640
|
-
return undefined;
|
|
6828
|
+
const diff2 = uid => {
|
|
6829
|
+
const editor = get$8(uid);
|
|
6830
|
+
if (!editor) {
|
|
6831
|
+
return [];
|
|
6641
6832
|
}
|
|
6642
6833
|
const {
|
|
6643
|
-
|
|
6644
|
-
|
|
6645
|
-
} =
|
|
6646
|
-
const
|
|
6647
|
-
|
|
6648
|
-
const {
|
|
6649
|
-
promise,
|
|
6650
|
-
resolve
|
|
6651
|
-
} = Promise.withResolvers();
|
|
6652
|
-
queues[key] = promise;
|
|
6653
|
-
if (previous) {
|
|
6654
|
-
await previous;
|
|
6655
|
-
}
|
|
6656
|
-
try {
|
|
6657
|
-
return await callback();
|
|
6658
|
-
} finally {
|
|
6659
|
-
resolve();
|
|
6660
|
-
if (queues[key] === promise) {
|
|
6661
|
-
delete queues[key];
|
|
6662
|
-
}
|
|
6663
|
-
}
|
|
6834
|
+
newState,
|
|
6835
|
+
oldState
|
|
6836
|
+
} = editor;
|
|
6837
|
+
const result = diff(oldState, newState);
|
|
6838
|
+
return result;
|
|
6664
6839
|
};
|
|
6665
6840
|
|
|
6666
|
-
const
|
|
6667
|
-
|
|
6668
|
-
|
|
6841
|
+
const autoSaveDelay = 1000;
|
|
6842
|
+
const pendingSaves = new Map();
|
|
6843
|
+
const state$7 = {
|
|
6844
|
+
nextToken: 0
|
|
6669
6845
|
};
|
|
6670
|
-
const
|
|
6671
|
-
if (
|
|
6672
|
-
|
|
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) {
|
|
6673
6873
|
return;
|
|
6674
6874
|
}
|
|
6675
|
-
|
|
6875
|
+
clearTimeout(pendingSave.timeout);
|
|
6876
|
+
pendingSaves.delete(uid);
|
|
6676
6877
|
};
|
|
6677
|
-
|
|
6678
|
-
|
|
6679
|
-
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
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);
|
|
6683
6885
|
}
|
|
6684
6886
|
};
|
|
6887
|
+
const set$4 = (editorUid, dismissal) => {
|
|
6888
|
+
clear$3(editorUid);
|
|
6889
|
+
dismissals$1.set(editorUid, dismissal);
|
|
6890
|
+
};
|
|
6685
6891
|
|
|
6686
|
-
const
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6691
|
-
|
|
6692
|
-
};
|
|
6892
|
+
const state$6 = {
|
|
6893
|
+
editor: undefined,
|
|
6894
|
+
timeout: -1,
|
|
6895
|
+
token: 0,
|
|
6896
|
+
x: 0,
|
|
6897
|
+
y: 0
|
|
6693
6898
|
};
|
|
6694
|
-
const
|
|
6695
|
-
|
|
6696
|
-
return invokeAndTransfer(editor.applicationId, 'Extensions.streamDiagnosticProvider', textDocument, resultPort);
|
|
6899
|
+
const get$2 = () => {
|
|
6900
|
+
return state$6;
|
|
6697
6901
|
};
|
|
6698
|
-
const
|
|
6699
|
-
|
|
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;
|
|
6700
6908
|
};
|
|
6701
|
-
|
|
6702
|
-
const
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
const mergeLinksWithDiagnosticDecorations = (editor, diagnosticDecorations) => {
|
|
6709
|
-
// Get link decorations
|
|
6710
|
-
const linkDecorations = detectAllLinksAsDecorations(editor);
|
|
6711
|
-
|
|
6712
|
-
// Merge with diagnostic decorations
|
|
6713
|
-
const allDecorations = [...linkDecorations, ...diagnosticDecorations];
|
|
6714
|
-
|
|
6715
|
-
// Sort by offset to maintain proper order
|
|
6716
|
-
const sortedDecorations = [];
|
|
6717
|
-
for (let i = 0; i < allDecorations.length; i += 4) {
|
|
6718
|
-
sortedDecorations.push({
|
|
6719
|
-
length: allDecorations[i + 1],
|
|
6720
|
-
modifiers: allDecorations[i + 3],
|
|
6721
|
-
offset: allDecorations[i],
|
|
6722
|
-
type: allDecorations[i + 2]
|
|
6723
|
-
});
|
|
6909
|
+
const clear$2 = editorUid => {
|
|
6910
|
+
const {
|
|
6911
|
+
editor,
|
|
6912
|
+
timeout
|
|
6913
|
+
} = state$6;
|
|
6914
|
+
if (editorUid !== undefined && editor?.uid !== editorUid) {
|
|
6915
|
+
return;
|
|
6724
6916
|
}
|
|
6725
|
-
|
|
6917
|
+
if (timeout !== -1) {
|
|
6918
|
+
clearTimeout(timeout);
|
|
6919
|
+
}
|
|
6920
|
+
state$6.editor = undefined;
|
|
6921
|
+
state$6.timeout = -1;
|
|
6922
|
+
state$6.token++;
|
|
6923
|
+
};
|
|
6726
6924
|
|
|
6727
|
-
|
|
6728
|
-
|
|
6729
|
-
|
|
6730
|
-
|
|
6925
|
+
const dismissals = new Map();
|
|
6926
|
+
const clear$1 = editorUid => {
|
|
6927
|
+
const dismissal = dismissals.get(editorUid);
|
|
6928
|
+
if (!dismissal) {
|
|
6929
|
+
return;
|
|
6731
6930
|
}
|
|
6732
|
-
|
|
6931
|
+
clearTimeout(dismissal.timeout);
|
|
6932
|
+
dismissals.delete(editorUid);
|
|
6933
|
+
};
|
|
6934
|
+
const set$2 = (editorUid, dismissal) => {
|
|
6935
|
+
clear$1(editorUid);
|
|
6936
|
+
dismissals.set(editorUid, dismissal);
|
|
6733
6937
|
};
|
|
6734
6938
|
|
|
6735
|
-
const
|
|
6736
|
-
|
|
6737
|
-
|
|
6738
|
-
|
|
6739
|
-
|
|
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;
|
|
6740
6945
|
};
|
|
6741
|
-
const
|
|
6742
|
-
const
|
|
6743
|
-
|
|
6744
|
-
|
|
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;
|
|
6745
6963
|
return {
|
|
6746
|
-
|
|
6747
|
-
|
|
6748
|
-
|
|
6749
|
-
|
|
6750
|
-
|
|
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
|
|
6751
6972
|
};
|
|
6752
6973
|
};
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
|
|
6974
|
+
|
|
6975
|
+
const sendToListener = async (rpcId, status) => {
|
|
6976
|
+
const rpc = get$9(rpcId);
|
|
6977
|
+
if (rpc) {
|
|
6978
|
+
await send$2(rpcId, rpc, status);
|
|
6756
6979
|
}
|
|
6757
|
-
await handleError$1(error, 'Failed to update diagnostics: ');
|
|
6758
|
-
return editor;
|
|
6759
6980
|
};
|
|
6760
|
-
const
|
|
6761
|
-
|
|
6762
|
-
|
|
6763
|
-
} catch {
|
|
6764
|
-
// Older renderer workers do not support diagnostics change listeners.
|
|
6981
|
+
const initializeListener = async rpcId => {
|
|
6982
|
+
if (!getListeners(EditorSelection$1).includes(rpcId)) {
|
|
6983
|
+
return;
|
|
6765
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);
|
|
6766
6993
|
};
|
|
6767
|
-
const
|
|
6768
|
-
if (
|
|
6769
|
-
return
|
|
6994
|
+
const notifyEditorStatusChange = async (_oldEditor, newEditor) => {
|
|
6995
|
+
if (newEditor.initial || !newEditor.focused) {
|
|
6996
|
+
return;
|
|
6770
6997
|
}
|
|
6771
|
-
|
|
6772
|
-
|
|
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;
|
|
6773
7023
|
}
|
|
6774
|
-
|
|
6775
|
-
|
|
6776
|
-
|
|
6777
|
-
|
|
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 {}
|
|
6778
7031
|
};
|
|
6779
|
-
|
|
6780
|
-
const
|
|
6781
|
-
const
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
diagnostics: editorWithDiagnostics.diagnostics,
|
|
6785
|
-
lightBulbRowIndex: editorWithDiagnostics.lightBulbRowIndex,
|
|
6786
|
-
visualDecorations: editorWithDiagnostics.visualDecorations
|
|
6787
|
-
});
|
|
6788
|
-
const commitDiagnostics = async (editor, generation, diagnostics, onAccepted) => {
|
|
6789
|
-
return (await enqueue(editor.id, async () => {
|
|
6790
|
-
let latest = get$8(editor.id);
|
|
6791
|
-
if (!isApplicable(latest, editor, generation)) {
|
|
6792
|
-
return editor;
|
|
6793
|
-
}
|
|
6794
|
-
if (diagnosticsEqual(latest.newState.diagnostics, diagnostics)) {
|
|
6795
|
-
onAccepted?.();
|
|
6796
|
-
return latest.newState;
|
|
6797
|
-
}
|
|
6798
|
-
let calculationState = latest.newState;
|
|
6799
|
-
let editorWithDiagnostics = await addDiagnostics(calculationState, diagnostics);
|
|
6800
|
-
latest = get$8(editor.id);
|
|
6801
|
-
while (isApplicable(latest, editor, generation) && !diagnosticLayoutEqual(calculationState, latest.newState)) {
|
|
6802
|
-
calculationState = latest.newState;
|
|
6803
|
-
editorWithDiagnostics = await addDiagnostics(calculationState, diagnostics);
|
|
6804
|
-
latest = get$8(editor.id);
|
|
6805
|
-
}
|
|
6806
|
-
if (!isApplicable(latest, editor, generation)) {
|
|
6807
|
-
return editor;
|
|
6808
|
-
}
|
|
6809
|
-
if (diagnosticsEqual(latest.newState.diagnostics, diagnostics)) {
|
|
6810
|
-
return latest.newState;
|
|
6811
|
-
}
|
|
6812
|
-
const newEditor = mergeDiagnostics(latest.newState, editorWithDiagnostics);
|
|
6813
|
-
set$a(editor.id, latest.oldState, newEditor);
|
|
6814
|
-
requestDiagnosticSnapshots.set(editor.id, diagnostics);
|
|
6815
|
-
onAccepted?.();
|
|
6816
|
-
await invoke$5('Editor.renderPending', newEditor.id);
|
|
6817
|
-
await notifyDiagnosticsChange(newEditor.uri, newEditor.applicationId);
|
|
6818
|
-
return newEditor;
|
|
6819
|
-
})) ?? editor;
|
|
7032
|
+
|
|
7033
|
+
const renderedDoms = new Map();
|
|
7034
|
+
const textAppendPaths = new Map();
|
|
7035
|
+
const get$1 = uid => {
|
|
7036
|
+
return renderedDoms.get(uid);
|
|
6820
7037
|
};
|
|
6821
|
-
const
|
|
6822
|
-
|
|
6823
|
-
|
|
6824
|
-
}) => diagnostics);
|
|
7038
|
+
const set$1 = (uid, dom, paths) => {
|
|
7039
|
+
renderedDoms.set(uid, dom);
|
|
7040
|
+
setTextAppendPaths(uid, paths);
|
|
6825
7041
|
};
|
|
6826
|
-
const
|
|
6827
|
-
|
|
6828
|
-
languageId: editor.languageId,
|
|
6829
|
-
providers: new Map(providers),
|
|
6830
|
-
uri: editor.uri
|
|
6831
|
-
});
|
|
7042
|
+
const getTextAppendPaths$1 = uid => {
|
|
7043
|
+
return textAppendPaths.get(uid);
|
|
6832
7044
|
};
|
|
6833
|
-
const
|
|
6834
|
-
|
|
6835
|
-
|
|
6836
|
-
|
|
6837
|
-
|
|
6838
|
-
if (!editor.diagnosticsEnabled || editor.loadError) {
|
|
6839
|
-
return editor;
|
|
7045
|
+
const setTextAppendPaths = (uid, paths) => {
|
|
7046
|
+
if (paths) {
|
|
7047
|
+
textAppendPaths.set(uid, paths);
|
|
7048
|
+
} else {
|
|
7049
|
+
textAppendPaths.delete(uid);
|
|
6840
7050
|
}
|
|
6841
|
-
|
|
6842
|
-
|
|
6843
|
-
|
|
6844
|
-
|
|
6845
|
-
|
|
6846
|
-
|
|
6847
|
-
|
|
6848
|
-
|
|
6849
|
-
|
|
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');
|
|
6850
7061
|
}
|
|
6851
|
-
|
|
6852
|
-
|
|
6853
|
-
|
|
6854
|
-
|
|
6855
|
-
|
|
6856
|
-
|
|
6857
|
-
let providerCount = -1;
|
|
6858
|
-
let finished = false;
|
|
6859
|
-
const receivedProviders = new Set();
|
|
6860
|
-
const timeout = strict ? setTimeout(() => completed.reject(new Error(`Diagnostics timed out after ${timeoutMs}ms for ${editor.uri}`)), timeoutMs) : undefined;
|
|
6861
|
-
port1.onmessage = event => {
|
|
6862
|
-
const previousCommit = commitQueue;
|
|
6863
|
-
commitQueue = (async () => {
|
|
6864
|
-
await previousCommit;
|
|
6865
|
-
try {
|
|
6866
|
-
if (finished) {
|
|
6867
|
-
return;
|
|
6868
|
-
}
|
|
6869
|
-
const message = event.data;
|
|
6870
|
-
if (requestGenerations.get(editor.id) !== generation) {
|
|
6871
|
-
if (strict) {
|
|
6872
|
-
throw new Error('Diagnostics request was superseded');
|
|
6873
|
-
}
|
|
6874
|
-
if (message.type === 'done') {
|
|
6875
|
-
port1.close();
|
|
6876
|
-
completed.resolve();
|
|
6877
|
-
}
|
|
6878
|
-
return;
|
|
6879
|
-
}
|
|
6880
|
-
if (message.type === 'providers') {
|
|
6881
|
-
providerCount = message.providerCount ?? 0;
|
|
6882
|
-
const providerIds = message.providerIds ?? [];
|
|
6883
|
-
for (const providerId of providers.keys()) {
|
|
6884
|
-
if (providerIds.includes(providerId)) {
|
|
6885
|
-
const previousResult = providers.get(providerId);
|
|
6886
|
-
providers.set(providerId, {
|
|
6887
|
-
...previousResult,
|
|
6888
|
-
providerIndex: providerIds.indexOf(providerId)
|
|
6889
|
-
});
|
|
6890
|
-
} else {
|
|
6891
|
-
providers.delete(providerId);
|
|
6892
|
-
}
|
|
6893
|
-
}
|
|
6894
|
-
if (requestGenerations.get(editor.id) === generation) {
|
|
6895
|
-
saveProviderResults(editor, providers);
|
|
6896
|
-
}
|
|
6897
|
-
return;
|
|
6898
|
-
}
|
|
6899
|
-
if (message.type === 'result' && message.providerId !== undefined) {
|
|
6900
|
-
if (strict && message.error !== undefined) {
|
|
6901
|
-
throw new Error(`Diagnostic provider ${message.providerId} failed: ${message.error}`);
|
|
6902
|
-
}
|
|
6903
|
-
receivedProviders.add(message.providerId);
|
|
6904
|
-
providers.set(message.providerId, {
|
|
6905
|
-
diagnostics: message.diagnostics ?? [],
|
|
6906
|
-
providerIndex: message.providerIndex ?? providers.size
|
|
6907
|
-
});
|
|
6908
|
-
await commitDiagnostics(editor, generation, flattenProviderDiagnostics(providers), () => saveProviderResults(editor, providers));
|
|
6909
|
-
return;
|
|
6910
|
-
}
|
|
6911
|
-
if (message.type === 'done') {
|
|
6912
|
-
if (strict && (providerCount < 0 || receivedProviders.size !== providerCount)) {
|
|
6913
|
-
throw new Error('Diagnostics stream ended without all provider results');
|
|
6914
|
-
}
|
|
6915
|
-
if (providerCount === 0) {
|
|
6916
|
-
providers.clear();
|
|
6917
|
-
await commitDiagnostics(editor, generation, [], () => saveProviderResults(editor, providers));
|
|
6918
|
-
}
|
|
6919
|
-
if (requestGenerations.get(editor.id) === generation) {
|
|
6920
|
-
saveProviderResults(editor, providers);
|
|
6921
|
-
}
|
|
6922
|
-
port1.close();
|
|
6923
|
-
completed.resolve();
|
|
6924
|
-
}
|
|
6925
|
-
} catch (error) {
|
|
6926
|
-
port1.close();
|
|
6927
|
-
if (strict) {
|
|
6928
|
-
completed.reject(error);
|
|
6929
|
-
} else {
|
|
6930
|
-
completed.resolve();
|
|
6931
|
-
await handleError(error, editor);
|
|
6932
|
-
}
|
|
6933
|
-
}
|
|
6934
|
-
})();
|
|
6935
|
-
};
|
|
6936
|
-
port1.start();
|
|
6937
|
-
const request = async () => {
|
|
6938
|
-
const response = await getDiagnostics$1(editor, port2);
|
|
6939
|
-
if (finished) {
|
|
6940
|
-
return;
|
|
6941
|
-
}
|
|
6942
|
-
if (Array.isArray(response) && providerCount === -1) {
|
|
6943
|
-
if (strict) {
|
|
6944
|
-
throw new Error('Diagnostic provider does not support completion and error reporting');
|
|
6945
|
-
}
|
|
6946
|
-
providers.set('legacy', {
|
|
6947
|
-
diagnostics: response,
|
|
6948
|
-
providerIndex: 0
|
|
6949
|
-
});
|
|
6950
|
-
await commitDiagnostics(editor, generation, response, () => saveProviderResults(editor, providers));
|
|
6951
|
-
port1.close();
|
|
6952
|
-
completed.resolve();
|
|
6953
|
-
}
|
|
6954
|
-
};
|
|
6955
|
-
try {
|
|
6956
|
-
await Promise.all([request(), completed.promise]);
|
|
6957
|
-
const latest = get$8(editor.id);
|
|
6958
|
-
if (strict && !isApplicable(latest, editor, generation)) {
|
|
6959
|
-
throw new Error('Editor changed or closed while waiting for diagnostics');
|
|
6960
|
-
}
|
|
6961
|
-
return isApplicable(latest, editor, generation) ? latest.newState : editor;
|
|
6962
|
-
} catch (error) {
|
|
6963
|
-
if (strict) {
|
|
6964
|
-
if (requestGenerations.get(editor.id) === generation) {
|
|
6965
|
-
requestGenerations.set(editor.id, generation + 1);
|
|
6966
|
-
}
|
|
6967
|
-
throw error;
|
|
6968
|
-
}
|
|
6969
|
-
return handleError(error, editor);
|
|
6970
|
-
} finally {
|
|
6971
|
-
finished = true;
|
|
6972
|
-
clearTimeout(timeout);
|
|
6973
|
-
port1.close();
|
|
6974
|
-
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');
|
|
6975
7068
|
}
|
|
7069
|
+
return module.render(widget);
|
|
6976
7070
|
};
|
|
6977
|
-
|
|
6978
|
-
|
|
6979
|
-
|
|
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;
|
|
6980
7077
|
};
|
|
6981
|
-
const
|
|
6982
|
-
|
|
6983
|
-
requestDiagnosticSnapshots.delete(editorId);
|
|
6984
|
-
previousProviderResults.delete(editorId);
|
|
7078
|
+
const get = editorUid => {
|
|
7079
|
+
return revisions.get(editorUid) || 0;
|
|
6985
7080
|
};
|
|
6986
|
-
const
|
|
6987
|
-
|
|
6988
|
-
|
|
6989
|
-
|
|
6990
|
-
|
|
6991
|
-
}
|
|
6992
|
-
}
|
|
7081
|
+
const record = (editorUid, revision) => {
|
|
7082
|
+
revisions.set(editorUid, Math.max(get(editorUid), revision));
|
|
7083
|
+
};
|
|
7084
|
+
const dispose$1 = editorUid => {
|
|
7085
|
+
revisions.delete(editorUid);
|
|
6993
7086
|
};
|
|
6994
7087
|
|
|
6995
|
-
|
|
6996
|
-
const
|
|
6997
|
-
|
|
6998
|
-
|
|
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;
|
|
6999
7097
|
}
|
|
7000
|
-
const
|
|
7001
|
-
|
|
7002
|
-
throw new Error(`Editor is not ready: ${editorId}`);
|
|
7098
|
+
for (const newWidget of newWidgets) {
|
|
7099
|
+
newWidgetMap[newWidget.id] = newWidget;
|
|
7003
7100
|
}
|
|
7004
|
-
|
|
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));
|
|
7005
7131
|
};
|
|
7006
7132
|
|
|
7007
7133
|
const disposeEditor = async editorUid => {
|
|
@@ -7033,7 +7159,7 @@ const disposeEditor = async editorUid => {
|
|
|
7033
7159
|
}
|
|
7034
7160
|
for (const widget of editor.widgets) {
|
|
7035
7161
|
if (widget.id === ColorPicker$2) {
|
|
7036
|
-
pending.push(invoke$
|
|
7162
|
+
pending.push(invoke$6('ColorPicker.dispose', widget.newState.uid));
|
|
7037
7163
|
}
|
|
7038
7164
|
}
|
|
7039
7165
|
const commands = renderWidgets$1(editor, {
|
|
@@ -8681,7 +8807,7 @@ const applyWorkspaceEdit = async (editor, changes) => {
|
|
|
8681
8807
|
currentEditor = await scheduleDocumentAndCursorsSelections(openEditor, textChanges);
|
|
8682
8808
|
} else {
|
|
8683
8809
|
await updateOpenEditor(openEditor.uid, textChanges);
|
|
8684
|
-
await invoke$
|
|
8810
|
+
await invoke$7('Editor.renderPending', openEditor.uid);
|
|
8685
8811
|
}
|
|
8686
8812
|
continue;
|
|
8687
8813
|
}
|
|
@@ -9164,7 +9290,7 @@ const closeRename = async editor => {
|
|
|
9164
9290
|
return editor;
|
|
9165
9291
|
}
|
|
9166
9292
|
const renameWidget = widgets[renameWidgetIndex];
|
|
9167
|
-
await invoke$
|
|
9293
|
+
await invoke$5('Rename.close', renameWidget.newState.uid);
|
|
9168
9294
|
const latest = get$8(uid);
|
|
9169
9295
|
const {
|
|
9170
9296
|
newState
|
|
@@ -11396,10 +11522,10 @@ const getHover = async (editor, offset) => {
|
|
|
11396
11522
|
};
|
|
11397
11523
|
|
|
11398
11524
|
const getVirtualDomFromMarkdown = async markdown => {
|
|
11399
|
-
const html = await invoke$
|
|
11525
|
+
const html = await invoke$7('Markdown.renderMarkdown', markdown, {
|
|
11400
11526
|
linksExternal: true
|
|
11401
11527
|
});
|
|
11402
|
-
return invoke$
|
|
11528
|
+
return invoke$7('Markdown.getVirtualDom', html);
|
|
11403
11529
|
};
|
|
11404
11530
|
|
|
11405
11531
|
const getLineInfo = (line, tokens, TokenMap) => {
|
|
@@ -12700,7 +12826,7 @@ const invoke$1 = async (method, ...params) => {
|
|
|
12700
12826
|
const getWidgetInvoke = widgetId => {
|
|
12701
12827
|
switch (widgetId) {
|
|
12702
12828
|
case ColorPicker$2:
|
|
12703
|
-
return invoke$
|
|
12829
|
+
return invoke$6;
|
|
12704
12830
|
case Completion:
|
|
12705
12831
|
return invoke$4;
|
|
12706
12832
|
case Find:
|
|
@@ -12708,7 +12834,7 @@ const getWidgetInvoke = widgetId => {
|
|
|
12708
12834
|
case Hover:
|
|
12709
12835
|
return invoke$2;
|
|
12710
12836
|
case Rename$1:
|
|
12711
|
-
return invoke$
|
|
12837
|
+
return invoke$5;
|
|
12712
12838
|
case SourceAction$1:
|
|
12713
12839
|
return invoke$1;
|
|
12714
12840
|
default:
|
|
@@ -13052,10 +13178,10 @@ const newStateGenerator$1 = async (state, parentUid) => {
|
|
|
13052
13178
|
const {
|
|
13053
13179
|
languageId
|
|
13054
13180
|
} = newState;
|
|
13055
|
-
await invoke$
|
|
13056
|
-
await invoke$
|
|
13057
|
-
const diff = await invoke$
|
|
13058
|
-
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);
|
|
13059
13185
|
return {
|
|
13060
13186
|
...state,
|
|
13061
13187
|
commands
|