@lvce-editor/editor-worker 19.81.0 → 19.81.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/diff-sdk.d.ts +7 -5
- package/dist/diff-sdk.js +558 -373
- package/dist/editorWorkerMain.js +575 -369
- package/dist/settings.json +2 -10
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -1363,6 +1363,9 @@ const {
|
|
|
1363
1363
|
invoke: invoke$i,
|
|
1364
1364
|
set: set$i
|
|
1365
1365
|
} = create$c(ErrorWorker);
|
|
1366
|
+
const prepare = async error => {
|
|
1367
|
+
return invoke$i('Errors.prepare', error);
|
|
1368
|
+
};
|
|
1366
1369
|
|
|
1367
1370
|
const {
|
|
1368
1371
|
invoke: invoke$h,
|
|
@@ -1455,6 +1458,15 @@ const {
|
|
|
1455
1458
|
invoke: invoke$f,
|
|
1456
1459
|
set: set$f
|
|
1457
1460
|
} = create$c(TextMeasurementWorker);
|
|
1461
|
+
const measureTextWidth$1 = async (text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth) => {
|
|
1462
|
+
return invoke$f('TextMeasurement.measureTextWidth', text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth);
|
|
1463
|
+
};
|
|
1464
|
+
const measureTextWidths$1 = async (texts, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth) => {
|
|
1465
|
+
return invoke$f('TextMeasurement.measureTextWidths', texts, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth);
|
|
1466
|
+
};
|
|
1467
|
+
const ensureFont = async (fontName, fontUrl) => {
|
|
1468
|
+
return invoke$f('TextMeasurement.ensureFont', fontName, fontUrl);
|
|
1469
|
+
};
|
|
1458
1470
|
|
|
1459
1471
|
const {
|
|
1460
1472
|
invoke: invoke$e,
|
|
@@ -1490,6 +1502,9 @@ const sendMessagePortToErrorWorker = async (port, rpcId) => {
|
|
|
1490
1502
|
const command = 'Errors.handleMessagePort';
|
|
1491
1503
|
await invokeAndTransfer$1('SendMessagePortToExtensionHostWorker.sendMessagePortToErrorWorker', port, command, rpcId);
|
|
1492
1504
|
};
|
|
1505
|
+
const setFocus$1 = key => {
|
|
1506
|
+
return invoke$e('Focus.setFocus', key);
|
|
1507
|
+
};
|
|
1493
1508
|
const writeClipBoardText = async text => {
|
|
1494
1509
|
await invoke$e('ClipBoard.writeText', /* text */text);
|
|
1495
1510
|
};
|
|
@@ -1511,6 +1526,9 @@ const sendMessagePortToExtensionManagementWorker$1 = async (port, rpcId) => {
|
|
|
1511
1526
|
const getPreference$1 = async key => {
|
|
1512
1527
|
return await invoke$e('Preferences.get', key);
|
|
1513
1528
|
};
|
|
1529
|
+
const rerenderEditor = async key => {
|
|
1530
|
+
return invoke$e('Editor.rerender', key);
|
|
1531
|
+
};
|
|
1514
1532
|
const openUri = async (uri, focus, options) => {
|
|
1515
1533
|
await invoke$e('Main.openUri', {
|
|
1516
1534
|
...options,
|
|
@@ -1521,6 +1539,9 @@ const openUri = async (uri, focus, options) => {
|
|
|
1521
1539
|
const sendMessagePortToSyntaxHighlightingWorker$1 = async port => {
|
|
1522
1540
|
await invokeAndTransfer$1('SendMessagePortToSyntaxHighlightingWorker.sendMessagePortToSyntaxHighlightingWorker', port, 'HandleMessagePort.handleMessagePort2');
|
|
1523
1541
|
};
|
|
1542
|
+
const showSideBar = async (id, focus) => {
|
|
1543
|
+
return invoke$e('SideBar.show', id, focus);
|
|
1544
|
+
};
|
|
1524
1545
|
const send$1 = async (port, sourceId = 0) => {
|
|
1525
1546
|
await sendMessagePortToOpenerWorker(port, sourceId);
|
|
1526
1547
|
};
|
|
@@ -2158,10 +2179,12 @@ const getVisibleLineCount = (lineCount, ranges) => {
|
|
|
2158
2179
|
for (const range of getSortedRanges(ranges)) {
|
|
2159
2180
|
const start = Math.max(range.start + 1, hiddenUntil + 1);
|
|
2160
2181
|
const end = Math.min(range.end, lineCount - 1);
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2182
|
+
const hasVisibleRange = start <= end;
|
|
2183
|
+
if (!hasVisibleRange) {
|
|
2184
|
+
continue;
|
|
2164
2185
|
}
|
|
2186
|
+
hidden += end - start + 1;
|
|
2187
|
+
hiddenUntil = end;
|
|
2165
2188
|
}
|
|
2166
2189
|
return lineCount - hidden;
|
|
2167
2190
|
};
|
|
@@ -2268,10 +2291,11 @@ const removeRangeAt = (ranges, rowIndex) => {
|
|
|
2268
2291
|
break;
|
|
2269
2292
|
}
|
|
2270
2293
|
const range = ranges[i];
|
|
2271
|
-
if (rowIndex >= range.start && rowIndex <= range.end && range.end - range.start < bestSize) {
|
|
2272
|
-
|
|
2273
|
-
bestSize = range.end - range.start;
|
|
2294
|
+
if (!(rowIndex >= range.start && rowIndex <= range.end && range.end - range.start < bestSize)) {
|
|
2295
|
+
continue;
|
|
2274
2296
|
}
|
|
2297
|
+
bestIndex = i;
|
|
2298
|
+
bestSize = range.end - range.start;
|
|
2275
2299
|
}
|
|
2276
2300
|
return bestIndex === -1 ? ranges : ranges.filter((_, index) => index !== bestIndex);
|
|
2277
2301
|
};
|
|
@@ -2312,20 +2336,22 @@ const scanLine = (line, row, stack, ranges, state) => {
|
|
|
2312
2336
|
stack.push(row);
|
|
2313
2337
|
continue;
|
|
2314
2338
|
}
|
|
2315
|
-
if (character
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2339
|
+
if (character !== '}') {
|
|
2340
|
+
continue;
|
|
2341
|
+
}
|
|
2342
|
+
const start = stack.pop();
|
|
2343
|
+
if (start !== undefined && start < row) {
|
|
2344
|
+
ranges.push({
|
|
2345
|
+
end: row,
|
|
2346
|
+
start
|
|
2347
|
+
});
|
|
2323
2348
|
}
|
|
2324
2349
|
}
|
|
2325
|
-
if (state.quote
|
|
2326
|
-
|
|
2327
|
-
state.escaped = false;
|
|
2350
|
+
if (state.quote === '`') {
|
|
2351
|
+
return;
|
|
2328
2352
|
}
|
|
2353
|
+
state.quote = '';
|
|
2354
|
+
state.escaped = false;
|
|
2329
2355
|
};
|
|
2330
2356
|
const findRanges = lines => {
|
|
2331
2357
|
const stack = [];
|
|
@@ -3486,7 +3512,10 @@ const getVisualColumns = line => {
|
|
|
3486
3512
|
}
|
|
3487
3513
|
return columns;
|
|
3488
3514
|
};
|
|
3489
|
-
const getPosition = async (line, column, measure,
|
|
3515
|
+
const getPosition = async (line, column, measure, {
|
|
3516
|
+
runs = getRuns(line),
|
|
3517
|
+
selectedRun = getCaretRun(runs, column)
|
|
3518
|
+
} = {}) => {
|
|
3490
3519
|
let x = 0;
|
|
3491
3520
|
for (const run of runs) {
|
|
3492
3521
|
const text = line.slice(run.start, run.end);
|
|
@@ -3512,8 +3541,12 @@ const getColumn = async (line, x, measure) => {
|
|
|
3512
3541
|
let high = columns.length - 1;
|
|
3513
3542
|
while (low < high) {
|
|
3514
3543
|
const middle = Math.floor((low + high) / 2);
|
|
3515
|
-
const left = await getPosition(line, columns[middle], measure,
|
|
3516
|
-
|
|
3544
|
+
const left = await getPosition(line, columns[middle], measure, {
|
|
3545
|
+
runs
|
|
3546
|
+
});
|
|
3547
|
+
const right = await getPosition(line, columns[middle + 1], measure, {
|
|
3548
|
+
runs
|
|
3549
|
+
});
|
|
3517
3550
|
if (x < (left + right) / 2) {
|
|
3518
3551
|
high = middle;
|
|
3519
3552
|
} else {
|
|
@@ -4043,15 +4076,15 @@ const safeTokenizeLine = (languageId, tokenizeLine, line, lineStateAtStart, hasA
|
|
|
4043
4076
|
};
|
|
4044
4077
|
|
|
4045
4078
|
/**
|
|
4046
|
-
|
|
4047
|
-
|
|
4079
|
+
@enum number
|
|
4080
|
+
*/
|
|
4048
4081
|
const State = {
|
|
4049
4082
|
TopLevelContent: 1
|
|
4050
4083
|
};
|
|
4051
4084
|
|
|
4052
4085
|
/**
|
|
4053
|
-
|
|
4054
|
-
|
|
4086
|
+
@enum number
|
|
4087
|
+
*/
|
|
4055
4088
|
const TokenType = {
|
|
4056
4089
|
Text: 1
|
|
4057
4090
|
};
|
|
@@ -4189,7 +4222,7 @@ const register = tokenizer => {
|
|
|
4189
4222
|
|
|
4190
4223
|
const getEmbeddedTokenization = (langageId, line, embeddedLanguage, embeddedLanguageStart, embeddedLanguageEnd, topContexts, tokenizersToLoad) => {
|
|
4191
4224
|
const embeddedTokenizer = getTokenizer(embeddedLanguage);
|
|
4192
|
-
if (
|
|
4225
|
+
if (embeddedTokenizer && embeddedTokenizer !== TokenizePlainText && embeddedLanguageStart !== line.length) {
|
|
4193
4226
|
const isFull = embeddedLanguageStart === 0 && embeddedLanguageEnd === line.length;
|
|
4194
4227
|
const partialLine = line.slice(embeddedLanguageStart, embeddedLanguageEnd);
|
|
4195
4228
|
const embedResult = safeTokenizeLine(langageId, embeddedTokenizer.tokenizeLine, partialLine, topContexts[embeddedLanguage] || getInitialLineState(embeddedTokenizer.initialLineState), embeddedTokenizer.hasArrayReturn);
|
|
@@ -4265,12 +4298,11 @@ const getTokensViewport = (editor, startLineIndex, endLineIndex) => {
|
|
|
4265
4298
|
lines,
|
|
4266
4299
|
tokenizerId
|
|
4267
4300
|
} = editor;
|
|
4268
|
-
const tokenizer = get$5(tokenizerId);
|
|
4269
4301
|
const {
|
|
4270
4302
|
hasArrayReturn,
|
|
4271
4303
|
initialLineState,
|
|
4272
4304
|
tokenizeLine
|
|
4273
|
-
} =
|
|
4305
|
+
} = get$5(tokenizerId);
|
|
4274
4306
|
const tokenizeStartIndex = invalidStartIndex;
|
|
4275
4307
|
const tokenizeEndIndex = getTokenizeEndIndex(invalidStartIndex, endLineIndex, tokenizeStartIndex);
|
|
4276
4308
|
const tokenizersToLoad = [];
|
|
@@ -4282,10 +4314,11 @@ const getTokensViewport = (editor, startLineIndex, endLineIndex) => {
|
|
|
4282
4314
|
const result = safeTokenizeLine(languageId, tokenizeLine, line, lineState, hasArrayReturn);
|
|
4283
4315
|
// TODO if lineCacheEnd matches the one before, skip tokenizing lines after
|
|
4284
4316
|
lineCache[i + 1] = result;
|
|
4285
|
-
if (result.embeddedLanguage) {
|
|
4286
|
-
|
|
4287
|
-
linesWithEmbed.push(i);
|
|
4317
|
+
if (!result.embeddedLanguage) {
|
|
4318
|
+
continue;
|
|
4288
4319
|
}
|
|
4320
|
+
result.embeddedResultIndex = linesWithEmbed.length;
|
|
4321
|
+
linesWithEmbed.push(i);
|
|
4289
4322
|
}
|
|
4290
4323
|
const visibleLines = lineCache.slice(startLineIndex + 1, endLineIndex + 1);
|
|
4291
4324
|
if (linesWithEmbed.length > 0) {
|
|
@@ -11475,12 +11508,12 @@ const measureTextWidthFast = async (text, charWidth) => {
|
|
|
11475
11508
|
};
|
|
11476
11509
|
|
|
11477
11510
|
const measureTextWidthSlow = async (text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth) => {
|
|
11478
|
-
const width = await
|
|
11511
|
+
const width = await measureTextWidth$1(text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth);
|
|
11479
11512
|
return width;
|
|
11480
11513
|
};
|
|
11481
11514
|
|
|
11482
11515
|
const measureTextWidthsSlow = async (texts, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth) => {
|
|
11483
|
-
return await
|
|
11516
|
+
return await measureTextWidths$1(texts, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth);
|
|
11484
11517
|
};
|
|
11485
11518
|
|
|
11486
11519
|
const measureTextWidth = async (text, fontWeight, fontSize, fontFamily, letterSpacing, isMonoSpaceFont, charWidth) => {
|
|
@@ -11551,9 +11584,9 @@ const insertInto = (array, start, newItems) => {
|
|
|
11551
11584
|
};
|
|
11552
11585
|
|
|
11553
11586
|
/**
|
|
11554
|
-
|
|
11555
|
-
|
|
11556
|
-
|
|
11587
|
+
Alternative to the native Array.splice method, it
|
|
11588
|
+
can only support limited number of items due to the maximum call stack size limit.
|
|
11589
|
+
*/
|
|
11557
11590
|
// @ts-ignore
|
|
11558
11591
|
const spliceLargeArray = (array, start, deleteCount, newItems) => {
|
|
11559
11592
|
const result = array.splice(start, deleteCount);
|
|
@@ -11569,7 +11602,7 @@ const RE_WHITESPACE = /^\s+/;
|
|
|
11569
11602
|
|
|
11570
11603
|
// TODO this doesn't belong here
|
|
11571
11604
|
const getIndent = line => {
|
|
11572
|
-
const whitespaceMatch =
|
|
11605
|
+
const whitespaceMatch = RE_WHITESPACE.exec(line);
|
|
11573
11606
|
if (!whitespaceMatch) {
|
|
11574
11607
|
return '';
|
|
11575
11608
|
}
|
|
@@ -11820,14 +11853,16 @@ const getLineInfoEmbeddedFull = (embeddedResults, tokenResults, line, decoration
|
|
|
11820
11853
|
const relativeEnd = relativeStart + decorationLength;
|
|
11821
11854
|
|
|
11822
11855
|
// Only include decorations that overlap with this line
|
|
11823
|
-
|
|
11824
|
-
|
|
11825
|
-
|
|
11826
|
-
|
|
11827
|
-
|
|
11828
|
-
|
|
11829
|
-
|
|
11830
|
-
|
|
11856
|
+
const overlapsLine = relativeStart < line.length && relativeEnd > 0;
|
|
11857
|
+
if (!overlapsLine) {
|
|
11858
|
+
continue;
|
|
11859
|
+
}
|
|
11860
|
+
const decorationClassName = getDecorationClassName(decorationType);
|
|
11861
|
+
if (decorationClassName) {
|
|
11862
|
+
decorationMap.set(Math.max(0, relativeStart), {
|
|
11863
|
+
className: decorationClassName,
|
|
11864
|
+
end: Math.min(line.length, relativeEnd)
|
|
11865
|
+
});
|
|
11831
11866
|
}
|
|
11832
11867
|
}
|
|
11833
11868
|
const embeddedResult = embeddedResults[tokenResults.embeddedResultIndex];
|
|
@@ -11940,14 +11975,16 @@ const getLineInfoDefault = (line, tokenResults, embeddedResults, decorations, To
|
|
|
11940
11975
|
const relativeEnd = relativeStart + decorationLength;
|
|
11941
11976
|
|
|
11942
11977
|
// Only include decorations that overlap with this line
|
|
11943
|
-
|
|
11944
|
-
|
|
11945
|
-
|
|
11946
|
-
|
|
11947
|
-
|
|
11948
|
-
|
|
11949
|
-
|
|
11950
|
-
|
|
11978
|
+
const overlapsLine = relativeStart < line.length && relativeEnd > 0;
|
|
11979
|
+
if (!overlapsLine) {
|
|
11980
|
+
continue;
|
|
11981
|
+
}
|
|
11982
|
+
const decorationClassName = getDecorationClassName(decorationType);
|
|
11983
|
+
if (decorationClassName) {
|
|
11984
|
+
decorationMap.set(Math.max(0, relativeStart), {
|
|
11985
|
+
className: decorationClassName,
|
|
11986
|
+
end: Math.min(line.length, relativeEnd)
|
|
11987
|
+
});
|
|
11951
11988
|
}
|
|
11952
11989
|
}
|
|
11953
11990
|
const {
|
|
@@ -12245,10 +12282,7 @@ const setDeltaY$1 = async (state, value) => {
|
|
|
12245
12282
|
const emptyIncrementalEdits = [];
|
|
12246
12283
|
|
|
12247
12284
|
const getIncrementalEdits = async (oldState, newState) => {
|
|
12248
|
-
if (newState.lifecycle?.disposed || !newState.undoStack) {
|
|
12249
|
-
return emptyIncrementalEdits;
|
|
12250
|
-
}
|
|
12251
|
-
if (oldState.undoStack === newState.undoStack) {
|
|
12285
|
+
if (newState.lifecycle?.disposed || !newState.undoStack || oldState.undoStack === newState.undoStack) {
|
|
12252
12286
|
return emptyIncrementalEdits;
|
|
12253
12287
|
}
|
|
12254
12288
|
const lastChanges = newState.undoStack.at(-1);
|
|
@@ -12299,11 +12333,11 @@ const getIncrementalEdits = async (oldState, newState) => {
|
|
|
12299
12333
|
};
|
|
12300
12334
|
|
|
12301
12335
|
/**
|
|
12302
|
-
|
|
12303
|
-
|
|
12304
|
-
|
|
12305
|
-
|
|
12306
|
-
|
|
12336
|
+
Gets all regex matches for a given text and regex pattern
|
|
12337
|
+
@param text The text to match against
|
|
12338
|
+
@param regex The regex pattern to use (should have global flag)
|
|
12339
|
+
@returns Array of regex matches
|
|
12340
|
+
*/
|
|
12307
12341
|
const getRegexMatches = (text, regex) => {
|
|
12308
12342
|
return text.matchAll(regex).toArray();
|
|
12309
12343
|
};
|
|
@@ -12360,10 +12394,10 @@ const trimTrailingPunctuation = url => {
|
|
|
12360
12394
|
};
|
|
12361
12395
|
|
|
12362
12396
|
/**
|
|
12363
|
-
|
|
12364
|
-
|
|
12365
|
-
|
|
12366
|
-
|
|
12397
|
+
Detects links in a given text and returns their positions
|
|
12398
|
+
@param text The text to scan for links
|
|
12399
|
+
@returns Array of links with their start position and length
|
|
12400
|
+
*/
|
|
12367
12401
|
const detectLinks = text => {
|
|
12368
12402
|
const matches = getRegexMatches(text, URL_PATTERN);
|
|
12369
12403
|
const links = [];
|
|
@@ -12382,8 +12416,8 @@ const detectLinks = text => {
|
|
|
12382
12416
|
const isValidPosition = (lines, rowIndex, columnIndex) => rowIndex >= 0 && rowIndex < lines.length && columnIndex >= 0 && columnIndex <= lines[rowIndex].length;
|
|
12383
12417
|
|
|
12384
12418
|
/**
|
|
12385
|
-
|
|
12386
|
-
|
|
12419
|
+
Converts the provider links stored on the editor into document offset ranges.
|
|
12420
|
+
*/
|
|
12387
12421
|
const getProviderLinkRanges = editor => {
|
|
12388
12422
|
const {
|
|
12389
12423
|
documentLinks,
|
|
@@ -12418,11 +12452,11 @@ const getProviderLinkRanges = editor => {
|
|
|
12418
12452
|
const overlapsAny = (offset, length, ranges) => ranges.some(range => offset < range.offset + range.length && range.offset < offset + length);
|
|
12419
12453
|
|
|
12420
12454
|
/**
|
|
12421
|
-
|
|
12422
|
-
|
|
12423
|
-
|
|
12424
|
-
|
|
12425
|
-
|
|
12455
|
+
Detects all links in an editor and returns them as decorations.
|
|
12456
|
+
Links from document link providers take precedence over overlapping regex-detected links.
|
|
12457
|
+
@param editor The editor containing lines to scan
|
|
12458
|
+
@returns Flat array of decorations in format [offset, length, type, modifiers, ...]
|
|
12459
|
+
*/
|
|
12426
12460
|
const detectAllLinksAsDecorations = editor => {
|
|
12427
12461
|
const decorations = [];
|
|
12428
12462
|
if (editor.largeFile) {
|
|
@@ -12438,12 +12472,13 @@ const detectAllLinksAsDecorations = editor => {
|
|
|
12438
12472
|
const links = detectLinks(line);
|
|
12439
12473
|
for (const link of links) {
|
|
12440
12474
|
const linkOffset = offset + link.start;
|
|
12441
|
-
if (providerRanges.length
|
|
12442
|
-
|
|
12443
|
-
length: link.length,
|
|
12444
|
-
offset: linkOffset
|
|
12445
|
-
});
|
|
12475
|
+
if (providerRanges.length > 0 && overlapsAny(linkOffset, link.length, providerRanges)) {
|
|
12476
|
+
continue;
|
|
12446
12477
|
}
|
|
12478
|
+
ranges.push({
|
|
12479
|
+
length: link.length,
|
|
12480
|
+
offset: linkOffset
|
|
12481
|
+
});
|
|
12447
12482
|
}
|
|
12448
12483
|
offset += line.length + 1; // +1 for newline
|
|
12449
12484
|
}
|
|
@@ -12458,11 +12493,11 @@ const detectAllLinksAsDecorations = editor => {
|
|
|
12458
12493
|
};
|
|
12459
12494
|
|
|
12460
12495
|
/**
|
|
12461
|
-
|
|
12462
|
-
|
|
12463
|
-
|
|
12464
|
-
|
|
12465
|
-
|
|
12496
|
+
Gets the document link from a document link provider at a given offset
|
|
12497
|
+
@param editor The editor
|
|
12498
|
+
@param offset The offset in the document
|
|
12499
|
+
@returns The provider link at the offset, or undefined
|
|
12500
|
+
*/
|
|
12466
12501
|
const getDocumentLinkAtOffset = (editor, offset) => {
|
|
12467
12502
|
if (editor.largeFile) {
|
|
12468
12503
|
return undefined;
|
|
@@ -12476,11 +12511,11 @@ const getDocumentLinkAtOffset = (editor, offset) => {
|
|
|
12476
12511
|
};
|
|
12477
12512
|
|
|
12478
12513
|
/**
|
|
12479
|
-
|
|
12480
|
-
|
|
12481
|
-
|
|
12482
|
-
|
|
12483
|
-
|
|
12514
|
+
Gets the URL text at a given offset in the editor if it's a link
|
|
12515
|
+
@param editor The editor
|
|
12516
|
+
@param offset The offset in the document
|
|
12517
|
+
@returns The URL string if the offset is on a link, or undefined
|
|
12518
|
+
*/
|
|
12484
12519
|
const getUrlAtOffset = (editor, offset) => {
|
|
12485
12520
|
const {
|
|
12486
12521
|
decorations,
|
|
@@ -12494,19 +12529,21 @@ const getUrlAtOffset = (editor, offset) => {
|
|
|
12494
12529
|
const decorationType = decorations[i + 2];
|
|
12495
12530
|
|
|
12496
12531
|
// Check if this decoration is a link and if the offset falls within it
|
|
12497
|
-
|
|
12498
|
-
|
|
12499
|
-
|
|
12500
|
-
|
|
12501
|
-
|
|
12502
|
-
|
|
12503
|
-
|
|
12504
|
-
|
|
12505
|
-
|
|
12506
|
-
|
|
12507
|
-
|
|
12508
|
-
|
|
12532
|
+
const isLinkAtOffset = decorationType === Link && offset >= decorationOffset && offset < decorationOffset + decorationLength;
|
|
12533
|
+
if (!isLinkAtOffset) {
|
|
12534
|
+
continue;
|
|
12535
|
+
}
|
|
12536
|
+
// Extract the URL text from the editor content
|
|
12537
|
+
let currentOffset = 0;
|
|
12538
|
+
for (const line of lines) {
|
|
12539
|
+
const lineLength = line.length + 1; // +1 for newline
|
|
12540
|
+
if (currentOffset + lineLength > decorationOffset) {
|
|
12541
|
+
// The link starts in this line
|
|
12542
|
+
const linkStartInLine = decorationOffset - currentOffset;
|
|
12543
|
+
const url = line.slice(linkStartInLine, linkStartInLine + decorationLength);
|
|
12544
|
+
return url;
|
|
12509
12545
|
}
|
|
12546
|
+
currentOffset += lineLength;
|
|
12510
12547
|
}
|
|
12511
12548
|
}
|
|
12512
12549
|
return undefined;
|
|
@@ -12603,7 +12640,7 @@ const getX = async (line, column, fontWeight, fontSize, fontFamily, isMonospaceF
|
|
|
12603
12640
|
const normalizedLine = normalizeText(line, normalize, tabSize);
|
|
12604
12641
|
const tabCount = getTabCount(line.slice(0, column));
|
|
12605
12642
|
const partialText = normalizedLine.slice(0, column + tabCount * (tabSize - 1));
|
|
12606
|
-
const textWidth = column === line.length
|
|
12643
|
+
const textWidth = measuredLineWidth !== undefined && column === line.length ? measuredLineWidth : await measureTextWidth(partialText, fontWeight, fontSize, fontFamily, letterSpacing, isMonospaceFont, averageCharWidth);
|
|
12607
12644
|
return Math.min(width, textWidth - halfCursorWidth + difference);
|
|
12608
12645
|
};
|
|
12609
12646
|
|
|
@@ -13169,9 +13206,9 @@ const matchesWordPattern = (value, wordPattern) => {
|
|
|
13169
13206
|
const compareRanges = (a, b) => a.rowIndex - b.rowIndex || a.startColumnIndex - b.startColumnIndex;
|
|
13170
13207
|
|
|
13171
13208
|
/**
|
|
13172
|
-
|
|
13173
|
-
|
|
13174
|
-
|
|
13209
|
+
Converts provider ranges (document offsets) to sorted single line ranges. Returns undefined
|
|
13210
|
+
when the ranges are invalid or don't contain the given offset.
|
|
13211
|
+
*/
|
|
13175
13212
|
const toLinkedEditingRanges = (lines, ranges, offset) => {
|
|
13176
13213
|
if (!Array.isArray(ranges) || ranges.length === 0 || lines.length === 0) {
|
|
13177
13214
|
return undefined;
|
|
@@ -13227,15 +13264,15 @@ const getActiveLinkedEditing = editor => {
|
|
|
13227
13264
|
linkedEditing,
|
|
13228
13265
|
selections
|
|
13229
13266
|
} = editor;
|
|
13230
|
-
if (!linkedEditing || !editor.linkedEditingEnabled ||
|
|
13267
|
+
if (!selections || !linkedEditing || !editor.linkedEditingEnabled || selections.length !== 4 || linkedEditing.lines !== lines) {
|
|
13231
13268
|
return undefined;
|
|
13232
13269
|
}
|
|
13233
13270
|
return linkedEditing;
|
|
13234
13271
|
};
|
|
13235
13272
|
|
|
13236
13273
|
/**
|
|
13237
|
-
|
|
13238
|
-
|
|
13274
|
+
Returns the linked ranges when they are still current and the single cursor (or selection) is inside one of them.
|
|
13275
|
+
*/
|
|
13239
13276
|
const getActiveRanges = editor => {
|
|
13240
13277
|
const linkedEditing = getActiveLinkedEditing(editor);
|
|
13241
13278
|
if (!linkedEditing) {
|
|
@@ -13250,9 +13287,9 @@ const getActiveRanges = editor => {
|
|
|
13250
13287
|
const isTypingChange = change => change.origin === EditorType && change.deleted.length === 1 && change.deleted[0] === '' && change.inserted[0].length > 0;
|
|
13251
13288
|
|
|
13252
13289
|
/**
|
|
13253
|
-
|
|
13254
|
-
|
|
13255
|
-
|
|
13290
|
+
Applies a single line edit inside one linked range to all other linked ranges.
|
|
13291
|
+
Returns undefined when the edit can't be mirrored, which ends linked editing.
|
|
13292
|
+
*/
|
|
13256
13293
|
const getLinkedEdit = (editor, changes, selectionChanges) => {
|
|
13257
13294
|
const linkedEditing = getActiveLinkedEditing(editor);
|
|
13258
13295
|
if (!linkedEditing || changes.length !== 1) {
|
|
@@ -13345,8 +13382,8 @@ const getLinkedEdit = (editor, changes, selectionChanges) => {
|
|
|
13345
13382
|
};
|
|
13346
13383
|
|
|
13347
13384
|
/**
|
|
13348
|
-
|
|
13349
|
-
|
|
13385
|
+
Merges consecutive linked typing edits into one undo step, like single cursor typing.
|
|
13386
|
+
*/
|
|
13350
13387
|
const mergeTypingGroups = (previous, changes) => {
|
|
13351
13388
|
if (!previous || previous.length !== changes.length || previous.length < 2) {
|
|
13352
13389
|
return undefined;
|
|
@@ -13402,10 +13439,10 @@ const flush = async delivery => {
|
|
|
13402
13439
|
}
|
|
13403
13440
|
let update = status;
|
|
13404
13441
|
if (delivery.hasBaseline) {
|
|
13405
|
-
if (!
|
|
13442
|
+
if (!status && !delivery.baseline) {
|
|
13406
13443
|
continue;
|
|
13407
13444
|
}
|
|
13408
|
-
if (delivery.baseline
|
|
13445
|
+
if (status && delivery.baseline) {
|
|
13409
13446
|
const delta = getDelta(delivery.baseline, status);
|
|
13410
13447
|
if (Object.keys(delta).length === 0) {
|
|
13411
13448
|
continue;
|
|
@@ -13443,10 +13480,11 @@ const start = delivery => {
|
|
|
13443
13480
|
};
|
|
13444
13481
|
const dispose$5 = rpcId => {
|
|
13445
13482
|
const delivery = deliveries.get(rpcId);
|
|
13446
|
-
if (delivery) {
|
|
13447
|
-
|
|
13448
|
-
deliveries.delete(rpcId);
|
|
13483
|
+
if (!delivery) {
|
|
13484
|
+
return;
|
|
13449
13485
|
}
|
|
13486
|
+
delivery.disposed = true;
|
|
13487
|
+
deliveries.delete(rpcId);
|
|
13450
13488
|
};
|
|
13451
13489
|
const send = (rpcId, rpc, status) => {
|
|
13452
13490
|
let delivery = deliveries.get(rpcId);
|
|
@@ -13472,10 +13510,10 @@ const send = (rpcId, rpc, status) => {
|
|
|
13472
13510
|
const state$9 = Object.create(null);
|
|
13473
13511
|
|
|
13474
13512
|
/**
|
|
13475
|
-
|
|
13476
|
-
|
|
13477
|
-
|
|
13478
|
-
|
|
13513
|
+
Register a listener for a specific event type
|
|
13514
|
+
@param listenerType - The type of event to listen for
|
|
13515
|
+
@param rpcId - The RPC ID of the listener
|
|
13516
|
+
*/
|
|
13479
13517
|
const registerListener$1 = (listenerType, rpcId) => {
|
|
13480
13518
|
number(listenerType);
|
|
13481
13519
|
number(rpcId);
|
|
@@ -13490,40 +13528,41 @@ const registerListener$1 = (listenerType, rpcId) => {
|
|
|
13490
13528
|
};
|
|
13491
13529
|
|
|
13492
13530
|
/**
|
|
13493
|
-
|
|
13494
|
-
|
|
13495
|
-
|
|
13496
|
-
|
|
13531
|
+
Unregister a listener for a specific event type
|
|
13532
|
+
@param listenerType - The type of event to listen for
|
|
13533
|
+
@param rpcId - The RPC ID of the listener
|
|
13534
|
+
*/
|
|
13497
13535
|
const unregisterListener$1 = (listenerType, rpcId) => {
|
|
13498
13536
|
number(listenerType);
|
|
13499
13537
|
number(rpcId);
|
|
13500
13538
|
if (listenerType === EditorSelection$1) {
|
|
13501
13539
|
dispose$5(rpcId);
|
|
13502
13540
|
}
|
|
13503
|
-
if (Object.hasOwn(state$9, listenerType)) {
|
|
13504
|
-
|
|
13505
|
-
|
|
13506
|
-
|
|
13507
|
-
|
|
13541
|
+
if (!Object.hasOwn(state$9, listenerType)) {
|
|
13542
|
+
return;
|
|
13543
|
+
}
|
|
13544
|
+
const index = state$9[listenerType].indexOf(rpcId);
|
|
13545
|
+
if (index !== -1) {
|
|
13546
|
+
state$9[listenerType].splice(index, 1);
|
|
13508
13547
|
}
|
|
13509
13548
|
};
|
|
13510
13549
|
|
|
13511
13550
|
/**
|
|
13512
|
-
|
|
13513
|
-
|
|
13514
|
-
|
|
13515
|
-
|
|
13551
|
+
Get all registered listeners for a specific event type
|
|
13552
|
+
@param listenerType - The type of event
|
|
13553
|
+
@returns Array of RPC IDs
|
|
13554
|
+
*/
|
|
13516
13555
|
const getListeners = listenerType => {
|
|
13517
13556
|
number(listenerType);
|
|
13518
13557
|
return state$9[listenerType] || [];
|
|
13519
13558
|
};
|
|
13520
13559
|
|
|
13521
13560
|
/**
|
|
13522
|
-
|
|
13523
|
-
|
|
13524
|
-
|
|
13525
|
-
|
|
13526
|
-
|
|
13561
|
+
Notify all registered listeners of a specific event type
|
|
13562
|
+
@param listenerType - The type of event that occurred
|
|
13563
|
+
@param method - The method name to invoke on the listener
|
|
13564
|
+
@param params - Parameters to pass to the listener method
|
|
13565
|
+
*/
|
|
13527
13566
|
const notifyListeners = async (listenerType, method, ...params) => {
|
|
13528
13567
|
number(listenerType);
|
|
13529
13568
|
string(method);
|
|
@@ -13750,7 +13789,7 @@ const enqueue = async (uid, callback) => {
|
|
|
13750
13789
|
};
|
|
13751
13790
|
|
|
13752
13791
|
const logError = async (error, prefix) => {
|
|
13753
|
-
const prettyError = await
|
|
13792
|
+
const prettyError = await prepare(error);
|
|
13754
13793
|
await invoke$i('Errors.print', prettyError, prefix);
|
|
13755
13794
|
};
|
|
13756
13795
|
const logFallback = (error, prefix) => {
|
|
@@ -13841,9 +13880,9 @@ const getVisibleDiagnostics = async (editor, diagnostics) => {
|
|
|
13841
13880
|
const invoke$7 = (...args) => invoke$e(...args);
|
|
13842
13881
|
|
|
13843
13882
|
/**
|
|
13844
|
-
|
|
13845
|
-
|
|
13846
|
-
|
|
13883
|
+
Merges link decorations with diagnostic decorations
|
|
13884
|
+
Links should always be present, but we also need to include any diagnostic decorations
|
|
13885
|
+
*/
|
|
13847
13886
|
const mergeLinksWithDiagnosticDecorations = (editor, diagnosticDecorations) => {
|
|
13848
13887
|
// Get link decorations
|
|
13849
13888
|
const linkDecorations = detectAllLinksAsDecorations(editor);
|
|
@@ -14083,18 +14122,19 @@ const updateDiagnostics = async (editor, timeoutMs = 0) => {
|
|
|
14083
14122
|
if (finished) {
|
|
14084
14123
|
return;
|
|
14085
14124
|
}
|
|
14086
|
-
if (
|
|
14087
|
-
|
|
14088
|
-
throw new Error('Diagnostic provider does not support completion and error reporting');
|
|
14089
|
-
}
|
|
14090
|
-
providers.set('legacy', {
|
|
14091
|
-
diagnostics: response,
|
|
14092
|
-
providerIndex: 0
|
|
14093
|
-
});
|
|
14094
|
-
await commitDiagnostics(editor, generation, response, () => saveProviderResults(editor, providers));
|
|
14095
|
-
port1.close();
|
|
14096
|
-
completed.resolve();
|
|
14125
|
+
if (!(providerCount === -1 && Array.isArray(response))) {
|
|
14126
|
+
return;
|
|
14097
14127
|
}
|
|
14128
|
+
if (strict) {
|
|
14129
|
+
throw new Error('Diagnostic provider does not support completion and error reporting');
|
|
14130
|
+
}
|
|
14131
|
+
providers.set('legacy', {
|
|
14132
|
+
diagnostics: response,
|
|
14133
|
+
providerIndex: 0
|
|
14134
|
+
});
|
|
14135
|
+
await commitDiagnostics(editor, generation, response, () => saveProviderResults(editor, providers));
|
|
14136
|
+
port1.close();
|
|
14137
|
+
completed.resolve();
|
|
14098
14138
|
};
|
|
14099
14139
|
try {
|
|
14100
14140
|
await Promise.all([request(), completed.promise]);
|
|
@@ -14195,7 +14235,7 @@ const applyAutoClosingRangesEdit = (editor, changes) => {
|
|
|
14195
14235
|
const autoStartColumnIndex = autoClosingRanges[i + 1];
|
|
14196
14236
|
const autoEndRowIndex = autoClosingRanges[i + 2];
|
|
14197
14237
|
const autoEndColumnIndex = autoClosingRanges[i + 3];
|
|
14198
|
-
if (changeEndRowIndex === autoEndRowIndex && changeEndColumnIndex === autoEndColumnIndex || changeStartRowIndex === autoStartRowIndex &&
|
|
14238
|
+
if (changeEndRowIndex === autoEndRowIndex && changeEndColumnIndex === autoEndColumnIndex || changeStartRowIndex === autoStartRowIndex && changeEndRowIndex === autoEndRowIndex && changeStartColumnIndex >= autoStartColumnIndex && changeEndColumnIndex <= autoEndColumnIndex) {
|
|
14199
14239
|
const delta = change.inserted[0].length - change.deleted[0].length;
|
|
14200
14240
|
newAutoClosingRanges.push(autoStartRowIndex, autoStartColumnIndex, autoEndRowIndex, autoEndColumnIndex + delta);
|
|
14201
14241
|
}
|
|
@@ -14232,13 +14272,16 @@ const updateLines = (editor, lines) => {
|
|
|
14232
14272
|
};
|
|
14233
14273
|
|
|
14234
14274
|
/**
|
|
14235
|
-
|
|
14236
|
-
|
|
14237
|
-
|
|
14238
|
-
|
|
14239
|
-
|
|
14240
|
-
|
|
14241
|
-
const scheduleDocumentAndCursorsSelections = async (editor, changes,
|
|
14275
|
+
TODO make this synchronous maybe?
|
|
14276
|
+
@param {any} editor
|
|
14277
|
+
@param {any[]} changes
|
|
14278
|
+
@param {Uint32Array|undefined} selectionChanges
|
|
14279
|
+
@returns
|
|
14280
|
+
*/
|
|
14281
|
+
const scheduleDocumentAndCursorsSelections = async (editor, changes, {
|
|
14282
|
+
options = {},
|
|
14283
|
+
selectionChanges = undefined
|
|
14284
|
+
} = {}) => {
|
|
14242
14285
|
object(editor);
|
|
14243
14286
|
array(changes);
|
|
14244
14287
|
if (changes.length === 0) {
|
|
@@ -14275,7 +14318,7 @@ const scheduleDocumentAndCursorsSelections = async (editor, changes, selectionCh
|
|
|
14275
14318
|
const canCoalesceTyping = linkedEdit ? linkedEdit.canCoalesceTyping : changes.length === 1 && change.origin === EditorType && change.deleted[0] === '' && change.inserted[0].length > 0 && change.inserted.length === 1 && change.start.rowIndex === change.end.rowIndex && change.start.columnIndex === change.end.columnIndex;
|
|
14276
14319
|
const previousGroup = editor.undoStack.at(-1);
|
|
14277
14320
|
const previous = previousGroup?.[0];
|
|
14278
|
-
const mergedLinkedGroup = linkedEdit &&
|
|
14321
|
+
const mergedLinkedGroup = linkedEdit && canCoalesceTyping && editor.canCoalesceTyping ? mergeTypingGroups(previousGroup, changes) : undefined;
|
|
14279
14322
|
if (mergedLinkedGroup) {
|
|
14280
14323
|
Object.defineProperty(mergedLinkedGroup, 'selectionHistory', {
|
|
14281
14324
|
configurable: true,
|
|
@@ -15022,9 +15065,7 @@ const findEnclosingBrackets = (lines, rowIndex, columnIndex) => {
|
|
|
15022
15065
|
});
|
|
15023
15066
|
} else if (isClosingBracket(character)) {
|
|
15024
15067
|
const openingBracket = stack.at(-1);
|
|
15025
|
-
if (
|
|
15026
|
-
stack.length = 0;
|
|
15027
|
-
} else {
|
|
15068
|
+
if (openingBracket && openingBracket.character === openingBrackets[character]) {
|
|
15028
15069
|
stack.pop();
|
|
15029
15070
|
if (!enclosingPair && isBefore$1(openingBracket.position, cursor) && isBefore$1(cursor, position)) {
|
|
15030
15071
|
enclosingPair = {
|
|
@@ -15033,6 +15074,8 @@ const findEnclosingBrackets = (lines, rowIndex, columnIndex) => {
|
|
|
15033
15074
|
sourceIsBeforeCursor: false
|
|
15034
15075
|
};
|
|
15035
15076
|
}
|
|
15077
|
+
} else {
|
|
15078
|
+
stack.length = 0;
|
|
15036
15079
|
}
|
|
15037
15080
|
}
|
|
15038
15081
|
}
|
|
@@ -15187,9 +15230,9 @@ const isSingleCursorIn = (highlights, selections) => {
|
|
|
15187
15230
|
};
|
|
15188
15231
|
|
|
15189
15232
|
/**
|
|
15190
|
-
|
|
15191
|
-
|
|
15192
|
-
|
|
15233
|
+
Highlights are cleared on edits until the provider refreshes them. Moving the cursor
|
|
15234
|
+
inside a highlighted range keeps them to avoid flicker while a new request is pending.
|
|
15235
|
+
*/
|
|
15193
15236
|
const getRetainedDocumentHighlights = (oldState, newState) => {
|
|
15194
15237
|
const highlights = newState.documentHighlights || emptyDocumentHighlights;
|
|
15195
15238
|
if (highlights.length === 0 || !newState.documentHighlightsEnabled) {
|
|
@@ -15282,10 +15325,11 @@ const getVisibleDocumentHighlights = async editor => {
|
|
|
15282
15325
|
const to = Math.min(highlight.endRowIndex, lastVisibleRow, lines.length - 1);
|
|
15283
15326
|
for (let rowIndex = from; rowIndex <= to; rowIndex++) {
|
|
15284
15327
|
const visibleIndex = visibleIndexByRow.get(rowIndex);
|
|
15285
|
-
if (visibleIndex
|
|
15286
|
-
|
|
15287
|
-
pending.push(getInfo(editor, highlight, rowIndex, differences?.[visibleIndex] ?? 0, y));
|
|
15328
|
+
if (visibleIndex === undefined) {
|
|
15329
|
+
continue;
|
|
15288
15330
|
}
|
|
15331
|
+
const y = (getVisualRow(rowIndex) - startVisualRow) * rowHeight;
|
|
15332
|
+
pending.push(getInfo(editor, highlight, rowIndex, differences?.[visibleIndex] ?? 0, y));
|
|
15289
15333
|
}
|
|
15290
15334
|
}
|
|
15291
15335
|
const infos = await Promise.all(pending);
|
|
@@ -15512,7 +15556,10 @@ const getColorPickerWorkerCommandMap = () => ({
|
|
|
15512
15556
|
|
|
15513
15557
|
const ModuleWorkerAndWorkaroundForChromeDevtoolsBug = 6;
|
|
15514
15558
|
|
|
15515
|
-
const launchWorker = async (name, url,
|
|
15559
|
+
const launchWorker = async (name, url, {
|
|
15560
|
+
commandMap = {},
|
|
15561
|
+
intializeCommand
|
|
15562
|
+
} = {}) => {
|
|
15516
15563
|
const rpc = await create$g({
|
|
15517
15564
|
commandMap,
|
|
15518
15565
|
isMessagePortOpen: true,
|
|
@@ -15535,7 +15582,9 @@ const launchWorker = async (name, url, intializeCommand, commandMap = {}) => {
|
|
|
15535
15582
|
const launchColorPickerWorker = async () => {
|
|
15536
15583
|
const name = 'Color Picker Worker';
|
|
15537
15584
|
const url = 'colorPickerWorkerMain.js';
|
|
15538
|
-
return launchWorker(name, url,
|
|
15585
|
+
return launchWorker(name, url, {
|
|
15586
|
+
commandMap: getColorPickerWorkerCommandMap()
|
|
15587
|
+
});
|
|
15539
15588
|
};
|
|
15540
15589
|
|
|
15541
15590
|
const state$8 = {};
|
|
@@ -15629,7 +15678,7 @@ const isCurrent$1 = (snapshot, current) => {
|
|
|
15629
15678
|
return true;
|
|
15630
15679
|
};
|
|
15631
15680
|
const merge = (current, snapshot, result) => {
|
|
15632
|
-
if (
|
|
15681
|
+
if (result === snapshot || result === current || !isCurrent$1(snapshot, current)) {
|
|
15633
15682
|
return current;
|
|
15634
15683
|
}
|
|
15635
15684
|
if (current === snapshot) {
|
|
@@ -16067,7 +16116,10 @@ const applyDocumentEdits$1 = (editor, edits, options = {}) => {
|
|
|
16067
16116
|
...editor
|
|
16068
16117
|
}, documentEdits);
|
|
16069
16118
|
const selections = getFormattingSelections(editor.lines, newLines, editor.selections);
|
|
16070
|
-
return scheduleDocumentAndCursorsSelections(editor, documentEdits,
|
|
16119
|
+
return scheduleDocumentAndCursorsSelections(editor, documentEdits, {
|
|
16120
|
+
options,
|
|
16121
|
+
selectionChanges: selections
|
|
16122
|
+
});
|
|
16071
16123
|
};
|
|
16072
16124
|
|
|
16073
16125
|
const getFormattingEdits$1 = async editor => {
|
|
@@ -16316,8 +16368,8 @@ const at = async (editor, eventX, eventY) => {
|
|
|
16316
16368
|
};
|
|
16317
16369
|
|
|
16318
16370
|
/**
|
|
16319
|
-
|
|
16320
|
-
|
|
16371
|
+
@deprecated this doesn't account for variable-width characters, gutters, or horizontal scrolling.
|
|
16372
|
+
*/
|
|
16321
16373
|
const x = (editor, rowIndex, columnIndex) => {
|
|
16322
16374
|
const {
|
|
16323
16375
|
columnWidth,
|
|
@@ -16356,14 +16408,14 @@ const y = (editor, rowIndex) => {
|
|
|
16356
16408
|
const defaultMessageDelay = 3000;
|
|
16357
16409
|
|
|
16358
16410
|
/**
|
|
16359
|
-
|
|
16360
|
-
|
|
16361
|
-
|
|
16362
|
-
|
|
16363
|
-
|
|
16364
|
-
|
|
16365
|
-
|
|
16366
|
-
|
|
16411
|
+
|
|
16412
|
+
@param {any} editor
|
|
16413
|
+
@param {number} rowIndex
|
|
16414
|
+
@param {number} columnIndex
|
|
16415
|
+
@param {string} message
|
|
16416
|
+
@param {boolean} isError
|
|
16417
|
+
@returns
|
|
16418
|
+
*/
|
|
16367
16419
|
// @ts-ignore
|
|
16368
16420
|
const editorShowMessage = async (editor, rowIndex, columnIndex, message, _isError) => {
|
|
16369
16421
|
object(editor);
|
|
@@ -16416,13 +16468,13 @@ const editorShowMessage = async (editor, rowIndex, columnIndex, message, _isErro
|
|
|
16416
16468
|
};
|
|
16417
16469
|
|
|
16418
16470
|
/**
|
|
16419
|
-
|
|
16420
|
-
|
|
16421
|
-
|
|
16422
|
-
|
|
16423
|
-
|
|
16424
|
-
|
|
16425
|
-
|
|
16471
|
+
|
|
16472
|
+
@param {any} editor
|
|
16473
|
+
@param {number} rowIndex
|
|
16474
|
+
@param {number} columnIndex
|
|
16475
|
+
@param {string} message
|
|
16476
|
+
@returns
|
|
16477
|
+
*/
|
|
16426
16478
|
// @ts-ignore
|
|
16427
16479
|
const showErrorMessage = async (editor, rowIndex, columnIndex, message) => {
|
|
16428
16480
|
return await editorShowMessage(editor, rowIndex, columnIndex, message);
|
|
@@ -16468,7 +16520,7 @@ const applyLineEndings = (content, endOfLine) => {
|
|
|
16468
16520
|
};
|
|
16469
16521
|
|
|
16470
16522
|
const getNewEditor = async (editor, skipFormatting = false) => {
|
|
16471
|
-
if (editor.formatOnSave
|
|
16523
|
+
if (!skipFormatting && editor.formatOnSave) {
|
|
16472
16524
|
return format(editor);
|
|
16473
16525
|
}
|
|
16474
16526
|
return editor;
|
|
@@ -16743,10 +16795,11 @@ const request$2 = async uid => {
|
|
|
16743
16795
|
};
|
|
16744
16796
|
const cancel = uid => {
|
|
16745
16797
|
const timeout = timeouts$2.get(uid);
|
|
16746
|
-
if (timeout
|
|
16747
|
-
|
|
16748
|
-
timeouts$2.delete(uid);
|
|
16798
|
+
if (timeout === undefined) {
|
|
16799
|
+
return;
|
|
16749
16800
|
}
|
|
16801
|
+
clearTimeout(timeout);
|
|
16802
|
+
timeouts$2.delete(uid);
|
|
16750
16803
|
};
|
|
16751
16804
|
const scheduleIfChanged = (oldState, newState) => {
|
|
16752
16805
|
const {
|
|
@@ -16769,8 +16822,8 @@ const scheduleIfChanged = (oldState, newState) => {
|
|
|
16769
16822
|
const isValidLink = (link, textLength) => Boolean(link) && Number.isSafeInteger(link.startOffset) && Number.isSafeInteger(link.endOffset) && link.startOffset >= 0 && link.startOffset < link.endOffset && link.endOffset <= textLength && typeof link.target === 'string' && link.target.length > 0;
|
|
16770
16823
|
|
|
16771
16824
|
/**
|
|
16772
|
-
|
|
16773
|
-
|
|
16825
|
+
Converts provider offsets (end exclusive) into row/column ranges in one pass over the lines.
|
|
16826
|
+
*/
|
|
16774
16827
|
const toDocumentLinks = (lines, result) => {
|
|
16775
16828
|
if (!Array.isArray(result) || result.length === 0) {
|
|
16776
16829
|
return [];
|
|
@@ -16839,8 +16892,8 @@ const linksEqual = (left, right) => left.length === right.length && left.every((
|
|
|
16839
16892
|
});
|
|
16840
16893
|
|
|
16841
16894
|
/**
|
|
16842
|
-
|
|
16843
|
-
|
|
16895
|
+
Replaces the link decorations of an editor, keeping other decorations such as diagnostics.
|
|
16896
|
+
*/
|
|
16844
16897
|
const updateLinkDecorations = editor => {
|
|
16845
16898
|
const linkDecorations = detectAllLinksAsDecorations(editor);
|
|
16846
16899
|
const decorations = editor.decorations || [];
|
|
@@ -16910,10 +16963,11 @@ const schedule$2 = (uid, delay) => {
|
|
|
16910
16963
|
};
|
|
16911
16964
|
const clear$3 = uid => {
|
|
16912
16965
|
const timeout = timeouts$1.get(uid);
|
|
16913
|
-
if (timeout
|
|
16914
|
-
|
|
16915
|
-
timeouts$1.delete(uid);
|
|
16966
|
+
if (timeout === undefined) {
|
|
16967
|
+
return;
|
|
16916
16968
|
}
|
|
16969
|
+
clearTimeout(timeout);
|
|
16970
|
+
timeouts$1.delete(uid);
|
|
16917
16971
|
};
|
|
16918
16972
|
const requestIfChanged$1 = (oldState, newState) => {
|
|
16919
16973
|
if (newState.initial || newState.largeFile || newState.loadError) {
|
|
@@ -16993,9 +17047,9 @@ const schedule$1 = uid => {
|
|
|
16993
17047
|
};
|
|
16994
17048
|
|
|
16995
17049
|
/**
|
|
16996
|
-
|
|
16997
|
-
|
|
16998
|
-
|
|
17050
|
+
Fetches linked editing ranges (debounced) after the cursor or the document changed,
|
|
17051
|
+
unless the cursor is still inside the current linked ranges.
|
|
17052
|
+
*/
|
|
16999
17053
|
const requestIfChanged = (oldState, newState) => {
|
|
17000
17054
|
if (newState.linkedEditingEnabled !== true || newState.initial || newState.largeFile || newState.loadError || !newState.selections || newState.selections.length !== 4) {
|
|
17001
17055
|
return;
|
|
@@ -17169,10 +17223,11 @@ const schedule = editor => {
|
|
|
17169
17223
|
refreshes.set(lifecycle, request);
|
|
17170
17224
|
}
|
|
17171
17225
|
request.pending = editor;
|
|
17172
|
-
if (
|
|
17173
|
-
|
|
17174
|
-
void refresh(request);
|
|
17226
|
+
if (request.running) {
|
|
17227
|
+
return;
|
|
17175
17228
|
}
|
|
17229
|
+
request.running = true;
|
|
17230
|
+
void refresh(request);
|
|
17176
17231
|
};
|
|
17177
17232
|
|
|
17178
17233
|
const cursorUndoLimit = 100;
|
|
@@ -17287,7 +17342,7 @@ const wrapCommand$1 = (fn, preservesTypingCoalescing = false, returnState = true
|
|
|
17287
17342
|
...newEditor,
|
|
17288
17343
|
cursorUndoStack: []
|
|
17289
17344
|
};
|
|
17290
|
-
} else if (selections && newEditor.selections &&
|
|
17345
|
+
} else if (!isSelecting && selections && newEditor.selections && newEditor.cursorUndoStack === cursorUndoStack && (!selectionsEqual(selections, newEditor.selections) || newEditor.isSelecting)) {
|
|
17291
17346
|
const previousCursorUndoStack = cursorUndoStack || [];
|
|
17292
17347
|
newEditor = {
|
|
17293
17348
|
...newEditor,
|
|
@@ -18183,10 +18238,11 @@ const diff2 = uid => {
|
|
|
18183
18238
|
const dismissals = new Map();
|
|
18184
18239
|
const clear$2 = editorUid => {
|
|
18185
18240
|
const dismissal = dismissals.get(editorUid);
|
|
18186
|
-
if (dismissal) {
|
|
18187
|
-
|
|
18188
|
-
dismissals.delete(editorUid);
|
|
18241
|
+
if (!dismissal) {
|
|
18242
|
+
return;
|
|
18189
18243
|
}
|
|
18244
|
+
clearTimeout(dismissal.timeout);
|
|
18245
|
+
dismissals.delete(editorUid);
|
|
18190
18246
|
};
|
|
18191
18247
|
const set$3 = (editorUid, dismissal) => {
|
|
18192
18248
|
clear$2(editorUid);
|
|
@@ -18840,7 +18896,9 @@ const acceptMergeConflict = async (state, action, rowIndexValue) => {
|
|
|
18840
18896
|
inserted,
|
|
18841
18897
|
origin: Unknown$2,
|
|
18842
18898
|
start
|
|
18843
|
-
}],
|
|
18899
|
+
}], {
|
|
18900
|
+
selectionChanges: selections
|
|
18901
|
+
});
|
|
18844
18902
|
return {
|
|
18845
18903
|
...result,
|
|
18846
18904
|
incrementalEdits: emptyIncrementalEdits
|
|
@@ -18908,7 +18966,9 @@ const addCursorBelow = editor => {
|
|
|
18908
18966
|
const applyEdit = async (editor, changes, selectionChanges) => {
|
|
18909
18967
|
object(editor);
|
|
18910
18968
|
array(changes);
|
|
18911
|
-
return scheduleDocumentAndCursorsSelections(editor, changes,
|
|
18969
|
+
return scheduleDocumentAndCursorsSelections(editor, changes, {
|
|
18970
|
+
selectionChanges
|
|
18971
|
+
});
|
|
18912
18972
|
};
|
|
18913
18973
|
|
|
18914
18974
|
const isPersistentWidget = widgetId => {
|
|
@@ -19314,7 +19374,9 @@ const changeSelectedValue = async (editor, delta) => {
|
|
|
19314
19374
|
rowDeltas.set(target.rowIndex, columnDelta + replacement.length - target.value.length);
|
|
19315
19375
|
}
|
|
19316
19376
|
const newSelections = getNewSelections$b(editor, selectionTargetsWithChanges, changedTargets, replacements);
|
|
19317
|
-
return scheduleDocumentAndCursorsSelections(editor, changes,
|
|
19377
|
+
return scheduleDocumentAndCursorsSelections(editor, changes, {
|
|
19378
|
+
selectionChanges: newSelections
|
|
19379
|
+
});
|
|
19318
19380
|
};
|
|
19319
19381
|
|
|
19320
19382
|
const decrementSelection = editor => {
|
|
@@ -19384,10 +19446,9 @@ const closeRename = async editor => {
|
|
|
19384
19446
|
}
|
|
19385
19447
|
const renameWidget = widgets[renameWidgetIndex];
|
|
19386
19448
|
await invoke$5('Rename.close', renameWidget.newState.uid);
|
|
19387
|
-
const latest = get$9(uid);
|
|
19388
19449
|
const {
|
|
19389
19450
|
newState
|
|
19390
|
-
} =
|
|
19451
|
+
} = get$9(uid);
|
|
19391
19452
|
return {
|
|
19392
19453
|
...newState,
|
|
19393
19454
|
widgetRevision: Math.max(newState.widgetRevision || 0, widgetRevision)
|
|
@@ -19618,7 +19679,7 @@ const getCopyLineOperations = selections => {
|
|
|
19618
19679
|
const operations = [];
|
|
19619
19680
|
for (let i = 0; i < selections.length; i += 4) {
|
|
19620
19681
|
const [startRowIndex,, selectionEndRowIndex, endColumnIndex] = getSelectionPairs(selections, i);
|
|
19621
|
-
const endRowIndex =
|
|
19682
|
+
const endRowIndex = endColumnIndex === 0 && startRowIndex < selectionEndRowIndex ? selectionEndRowIndex - 1 : selectionEndRowIndex;
|
|
19622
19683
|
operations.push({
|
|
19623
19684
|
endRowIndex,
|
|
19624
19685
|
startRowIndex
|
|
@@ -19678,7 +19739,9 @@ const copyLineDown = async editor => {
|
|
|
19678
19739
|
selectionChanges[i + 2] = selections[i + 2] + getRowOffset(selections[i + 2]);
|
|
19679
19740
|
selectionChanges[i + 3] = selections[i + 3];
|
|
19680
19741
|
}
|
|
19681
|
-
const newEditor = await scheduleDocumentAndCursorsSelections(editor, changes,
|
|
19742
|
+
const newEditor = await scheduleDocumentAndCursorsSelections(editor, changes, {
|
|
19743
|
+
selectionChanges
|
|
19744
|
+
});
|
|
19682
19745
|
return typeof newEditor.finalDeltaY === 'number' ? scheduleSelections(newEditor, selectionChanges) : newEditor;
|
|
19683
19746
|
};
|
|
19684
19747
|
|
|
@@ -19707,10 +19770,7 @@ const getLineLength = line => {
|
|
|
19707
19770
|
/* eslint-disable sonarjs/super-linear-regex */
|
|
19708
19771
|
|
|
19709
19772
|
const characterLeft = (line, columnIndex) => {
|
|
19710
|
-
if (!supported()) {
|
|
19711
|
-
return 1;
|
|
19712
|
-
}
|
|
19713
|
-
if (columnIndex > line.length) {
|
|
19773
|
+
if (!supported() || columnIndex > line.length) {
|
|
19714
19774
|
return 1;
|
|
19715
19775
|
}
|
|
19716
19776
|
const segmenter = create$8();
|
|
@@ -20239,10 +20299,11 @@ const cutLine = async editor => {
|
|
|
20239
20299
|
const rows = [];
|
|
20240
20300
|
for (let i = 0; i < selections.length; i += 4) {
|
|
20241
20301
|
const [startRowIndex] = getSelectionPairs(selections, i);
|
|
20242
|
-
if (
|
|
20243
|
-
|
|
20244
|
-
rows.push(startRowIndex);
|
|
20302
|
+
if (seenRows.has(startRowIndex)) {
|
|
20303
|
+
continue;
|
|
20245
20304
|
}
|
|
20305
|
+
seenRows.add(startRowIndex);
|
|
20306
|
+
rows.push(startRowIndex);
|
|
20246
20307
|
}
|
|
20247
20308
|
rows.sort((a, b) => a - b);
|
|
20248
20309
|
const ranges = [];
|
|
@@ -20262,7 +20323,7 @@ const cutLine = async editor => {
|
|
|
20262
20323
|
}
|
|
20263
20324
|
const previous = ranges.at(-1);
|
|
20264
20325
|
if (previous && (range[0] < previous[2] || range[0] === previous[2] && range[1] <= previous[3])) {
|
|
20265
|
-
if (row === lines.length - 1 &&
|
|
20326
|
+
if (line === '' && row === lines.length - 1 && previous[0] > 0 && lines[previous[0]] === '') {
|
|
20266
20327
|
previous[0]--;
|
|
20267
20328
|
previous[1] = lines[previous[0]].length;
|
|
20268
20329
|
}
|
|
@@ -20299,7 +20360,9 @@ const cutLine = async editor => {
|
|
|
20299
20360
|
selectionChanges[i * 4 + 2] = cursorRow;
|
|
20300
20361
|
}
|
|
20301
20362
|
await writeText(joinLines(cutLines));
|
|
20302
|
-
return scheduleDocumentAndCursorsSelections(editor, changes,
|
|
20363
|
+
return scheduleDocumentAndCursorsSelections(editor, changes, {
|
|
20364
|
+
selectionChanges
|
|
20365
|
+
});
|
|
20303
20366
|
};
|
|
20304
20367
|
|
|
20305
20368
|
const cutSelectedText = async editor => {
|
|
@@ -20376,10 +20439,7 @@ const getChanges$5 = (lines, selections, getDelta) => {
|
|
|
20376
20439
|
};
|
|
20377
20440
|
|
|
20378
20441
|
const isAutoClosingPairDelete = (autoClosingRanges, startRowIndex, startColumnIndex, endRowIndex, endColumnIndex) => {
|
|
20379
|
-
if (!isEmpty$1(startRowIndex, startColumnIndex, endRowIndex, endColumnIndex)) {
|
|
20380
|
-
return false;
|
|
20381
|
-
}
|
|
20382
|
-
if (startColumnIndex < 1) {
|
|
20442
|
+
if (!isEmpty$1(startRowIndex, startColumnIndex, endRowIndex, endColumnIndex) || startColumnIndex < 1) {
|
|
20383
20443
|
return false;
|
|
20384
20444
|
}
|
|
20385
20445
|
for (let j = 0; j < autoClosingRanges.length; j += 4) {
|
|
@@ -20497,7 +20557,7 @@ const getDeleteLineOperations = selections => {
|
|
|
20497
20557
|
const operations = [];
|
|
20498
20558
|
for (let i = 0; i < selections.length; i += 4) {
|
|
20499
20559
|
const [startRowIndex,, selectionEndRowIndex, endColumnIndex] = getSelectionPairs(selections, i);
|
|
20500
|
-
const endRowIndex =
|
|
20560
|
+
const endRowIndex = endColumnIndex === 0 && startRowIndex < selectionEndRowIndex ? selectionEndRowIndex - 1 : selectionEndRowIndex;
|
|
20501
20561
|
operations.push({
|
|
20502
20562
|
endRowIndex,
|
|
20503
20563
|
positionColumnIndex: selections[i + 3],
|
|
@@ -20577,7 +20637,9 @@ const deleteLine$1 = async editor => {
|
|
|
20577
20637
|
selectionChanges[offset + 3] = cursorColumnIndex;
|
|
20578
20638
|
linesDeleted += operation.endRowIndex - operation.startRowIndex + 1;
|
|
20579
20639
|
}
|
|
20580
|
-
return scheduleDocumentAndCursorsSelections(editor, changes,
|
|
20640
|
+
return scheduleDocumentAndCursorsSelections(editor, changes, {
|
|
20641
|
+
selectionChanges
|
|
20642
|
+
});
|
|
20581
20643
|
};
|
|
20582
20644
|
|
|
20583
20645
|
const deleteWordLeft = editor => {
|
|
@@ -20599,8 +20661,7 @@ const deleteWordRight = editor => {
|
|
|
20599
20661
|
};
|
|
20600
20662
|
|
|
20601
20663
|
const findAllReferences$1 = async editor => {
|
|
20602
|
-
|
|
20603
|
-
await invoke$e('SideBar.show', 'References', /* focus */true);
|
|
20664
|
+
await showSideBar('References', /* focus */true);
|
|
20604
20665
|
return editor;
|
|
20605
20666
|
};
|
|
20606
20667
|
|
|
@@ -20723,9 +20784,9 @@ const RE_WORD_START$1 = /^[\w\-]+/;
|
|
|
20723
20784
|
const RE_WORD_END$1 = /[\w\-]+$/;
|
|
20724
20785
|
const getWordAt$2 = (line, columnIndex) => {
|
|
20725
20786
|
const before = line.slice(0, columnIndex);
|
|
20726
|
-
const matchBefore =
|
|
20787
|
+
const matchBefore = RE_WORD_END$1.exec(before);
|
|
20727
20788
|
const after = line.slice(columnIndex);
|
|
20728
|
-
const matchAfter =
|
|
20789
|
+
const matchAfter = RE_WORD_START$1.exec(after);
|
|
20729
20790
|
let word = EmptyString;
|
|
20730
20791
|
if (matchBefore) {
|
|
20731
20792
|
word += matchBefore[0];
|
|
@@ -20739,7 +20800,7 @@ const getWordAt$2 = (line, columnIndex) => {
|
|
|
20739
20800
|
};
|
|
20740
20801
|
const getWordBefore$1 = (line, columnIndex) => {
|
|
20741
20802
|
const before = line.slice(0, columnIndex);
|
|
20742
|
-
const matchBefore =
|
|
20803
|
+
const matchBefore = RE_WORD_END$1.exec(before);
|
|
20743
20804
|
if (matchBefore) {
|
|
20744
20805
|
return matchBefore[0];
|
|
20745
20806
|
}
|
|
@@ -20863,6 +20924,10 @@ const Undo = 'Undo';
|
|
|
20863
20924
|
const Unfold = 'Editor: Unfold';
|
|
20864
20925
|
const UnfoldAll = 'Editor: Unfold All';
|
|
20865
20926
|
const ViewToggleMinimap = 'View: Toggle Minimap';
|
|
20927
|
+
const Breadcrumbs = 'Breadcrumbs';
|
|
20928
|
+
const EditorRoleDescription = 'editor';
|
|
20929
|
+
const GutterDecorationOnLine = '{PH1} line {PH2}';
|
|
20930
|
+
const MergeConflictActionAtLine = '{PH1} at line {PH2}';
|
|
20866
20931
|
|
|
20867
20932
|
const goToDefinition$1 = () => {
|
|
20868
20933
|
return i18nString(GoToDefinition);
|
|
@@ -21027,6 +21092,21 @@ const editorCopyLineDown = () => {
|
|
|
21027
21092
|
const editorCopyLineUp = () => {
|
|
21028
21093
|
return i18nString(EditorCopyLineUp);
|
|
21029
21094
|
};
|
|
21095
|
+
const breadcrumbs = () => {
|
|
21096
|
+
return i18nString(Breadcrumbs);
|
|
21097
|
+
};
|
|
21098
|
+
const gutterDecorationOnLine = (label, lineNumber) => {
|
|
21099
|
+
return i18nString(GutterDecorationOnLine, {
|
|
21100
|
+
PH1: label,
|
|
21101
|
+
PH2: String(lineNumber)
|
|
21102
|
+
});
|
|
21103
|
+
};
|
|
21104
|
+
const mergeConflictActionAtLine = (label, lineNumber) => {
|
|
21105
|
+
return i18nString(MergeConflictActionAtLine, {
|
|
21106
|
+
PH1: label,
|
|
21107
|
+
PH2: String(lineNumber)
|
|
21108
|
+
});
|
|
21109
|
+
};
|
|
21030
21110
|
|
|
21031
21111
|
// @ts-ignore
|
|
21032
21112
|
const goTo = async ({
|
|
@@ -21573,7 +21653,7 @@ const handleMouseDown = async (state, button, altKey, ctrlKey, x, y, detail, shi
|
|
|
21573
21653
|
};
|
|
21574
21654
|
|
|
21575
21655
|
const editorHoverDismissDelay = 500;
|
|
21576
|
-
const handleMouseLeave = (viewletUid, editorUidValue) => {
|
|
21656
|
+
const handleMouseLeave = (viewletUid, editorUidValue = viewletUid) => {
|
|
21577
21657
|
const targetEditorUid = editorUidValue ?? viewletUid;
|
|
21578
21658
|
const editorUid = Number(targetEditorUid);
|
|
21579
21659
|
const instance = get$9(editorUid);
|
|
@@ -21615,7 +21695,7 @@ const handleMouseLeave = (viewletUid, editorUidValue) => {
|
|
|
21615
21695
|
timeout
|
|
21616
21696
|
});
|
|
21617
21697
|
};
|
|
21618
|
-
const handleMouseEnter = (viewletUid, editorUidValue) => {
|
|
21698
|
+
const handleMouseEnter = (viewletUid, editorUidValue = viewletUid) => {
|
|
21619
21699
|
const targetEditorUid = editorUidValue ?? viewletUid;
|
|
21620
21700
|
clear$2(Number(targetEditorUid));
|
|
21621
21701
|
};
|
|
@@ -22737,7 +22817,9 @@ const moveTextDrag = async (editor, data, target) => {
|
|
|
22737
22817
|
if (!result) {
|
|
22738
22818
|
return editor;
|
|
22739
22819
|
}
|
|
22740
|
-
return scheduleDocumentAndCursorsSelections(editor, [result.change],
|
|
22820
|
+
return scheduleDocumentAndCursorsSelections(editor, [result.change], {
|
|
22821
|
+
selectionChanges: result.selections
|
|
22822
|
+
});
|
|
22741
22823
|
};
|
|
22742
22824
|
|
|
22743
22825
|
const handlePointerUp = async editor => {
|
|
@@ -23037,7 +23119,10 @@ const getIndentString = ({
|
|
|
23037
23119
|
insertSpaces,
|
|
23038
23120
|
tabSize
|
|
23039
23121
|
}) => {
|
|
23040
|
-
|
|
23122
|
+
const useTabs = insertSpaces === false;
|
|
23123
|
+
const indentCharacter = useTabs ? '\t' : ' ';
|
|
23124
|
+
const indentWidth = useTabs ? 1 : tabSize || 2;
|
|
23125
|
+
return indentCharacter.repeat(indentWidth);
|
|
23041
23126
|
};
|
|
23042
23127
|
|
|
23043
23128
|
const getChanges$1 = (selections, indent) => {
|
|
@@ -23168,7 +23253,9 @@ const insertLineBreak = async editor => {
|
|
|
23168
23253
|
changes,
|
|
23169
23254
|
selectionChanges
|
|
23170
23255
|
} = getChanges(lines, selections, languageConfiguration, getIndentString(editor));
|
|
23171
|
-
return scheduleDocumentAndCursorsSelections(editor, changes,
|
|
23256
|
+
return scheduleDocumentAndCursorsSelections(editor, changes, {
|
|
23257
|
+
selectionChanges
|
|
23258
|
+
});
|
|
23172
23259
|
};
|
|
23173
23260
|
|
|
23174
23261
|
const compareDiagnostics = (left, right) => {
|
|
@@ -23327,7 +23414,7 @@ const addWidget = (widget, id, render) => {
|
|
|
23327
23414
|
};
|
|
23328
23415
|
|
|
23329
23416
|
const setFocus = async focusKey => {
|
|
23330
|
-
await
|
|
23417
|
+
await setFocus$1(focusKey);
|
|
23331
23418
|
};
|
|
23332
23419
|
const unsetAdditionalFocus = async focusKey => {
|
|
23333
23420
|
if (!focusKey) {
|
|
@@ -23392,7 +23479,9 @@ const getFindWidgetWorkerCommandMap = () => ({
|
|
|
23392
23479
|
const launchFindWidgetWorker = async () => {
|
|
23393
23480
|
const name = 'Find Widget Worker';
|
|
23394
23481
|
const url = 'findWidgetWorkerMain.js';
|
|
23395
|
-
return launchWorker(name, url,
|
|
23482
|
+
return launchWorker(name, url, {
|
|
23483
|
+
commandMap: getFindWidgetWorkerCommandMap()
|
|
23484
|
+
});
|
|
23396
23485
|
};
|
|
23397
23486
|
|
|
23398
23487
|
const rpcId = 9002;
|
|
@@ -23424,7 +23513,9 @@ const launchHoverWorker = async () => {
|
|
|
23424
23513
|
const name = 'Hover Worker';
|
|
23425
23514
|
const url = 'hoverWorkerMain.js';
|
|
23426
23515
|
const intializeCommand = 'Hover.initialize';
|
|
23427
|
-
const rpc = await launchWorker(name, url,
|
|
23516
|
+
const rpc = await launchWorker(name, url, {
|
|
23517
|
+
intializeCommand
|
|
23518
|
+
});
|
|
23428
23519
|
return rpc;
|
|
23429
23520
|
};
|
|
23430
23521
|
|
|
@@ -23444,7 +23535,9 @@ const launchSourceActionWorker = async () => {
|
|
|
23444
23535
|
const name = 'Source Action Worker';
|
|
23445
23536
|
const url = 'sourceActionWorkerMain.js';
|
|
23446
23537
|
const intializeCommand = 'SourceActions.initialize';
|
|
23447
|
-
const rpc = await launchWorker(name, url,
|
|
23538
|
+
const rpc = await launchWorker(name, url, {
|
|
23539
|
+
intializeCommand
|
|
23540
|
+
});
|
|
23448
23541
|
return rpc;
|
|
23449
23542
|
};
|
|
23450
23543
|
|
|
@@ -23730,13 +23823,12 @@ const loadContent$2 = async (state, parentUid, savedState) => {
|
|
|
23730
23823
|
const {
|
|
23731
23824
|
uid
|
|
23732
23825
|
} = state;
|
|
23733
|
-
const editor = getEditor$1(parentUid);
|
|
23734
23826
|
const {
|
|
23735
23827
|
height,
|
|
23736
23828
|
width,
|
|
23737
23829
|
x,
|
|
23738
23830
|
y
|
|
23739
|
-
} =
|
|
23831
|
+
} = getEditor$1(parentUid);
|
|
23740
23832
|
await launch();
|
|
23741
23833
|
await invoke$3('FindWidget.create', uid, x, y, width, height, parentUid);
|
|
23742
23834
|
await invoke$3('FindWidget.loadContent', uid, savedState);
|
|
@@ -24507,7 +24599,9 @@ const selectNextOccurrence = editor => {
|
|
|
24507
24599
|
}
|
|
24508
24600
|
// TODO what is this magic number 5?
|
|
24509
24601
|
// const deltaY = (revealRangeStartRowIndex - 5) * editor.rowHeight
|
|
24510
|
-
return scheduleDocumentAndCursorsSelections(editor, [],
|
|
24602
|
+
return scheduleDocumentAndCursorsSelections(editor, [], {
|
|
24603
|
+
selectionChanges: selectionEdits
|
|
24604
|
+
});
|
|
24511
24605
|
};
|
|
24512
24606
|
|
|
24513
24607
|
// @ts-ignore
|
|
@@ -25113,7 +25207,9 @@ const editorSnippet = async (editor, snippet) => {
|
|
|
25113
25207
|
selectionChanges,
|
|
25114
25208
|
tabStops
|
|
25115
25209
|
} = getSnippetChanges(lines, selections, snippet);
|
|
25116
|
-
const newEditor = await scheduleDocumentAndCursorsSelections(editor, changes,
|
|
25210
|
+
const newEditor = await scheduleDocumentAndCursorsSelections(editor, changes, {
|
|
25211
|
+
selectionChanges
|
|
25212
|
+
});
|
|
25117
25213
|
if (selections.length !== 4 || tabStops.length < 2) {
|
|
25118
25214
|
return newEditor;
|
|
25119
25215
|
}
|
|
@@ -25228,22 +25324,7 @@ const getBlockCommentEdits = (editor, blockComment) => {
|
|
|
25228
25324
|
startRowIndex--;
|
|
25229
25325
|
}
|
|
25230
25326
|
const changes = [];
|
|
25231
|
-
if (startColumnIndex
|
|
25232
|
-
changes.push(...getRemoveBlockCommentEdits(rowIndex, startRowIndex, startColumnIndex, endRowIndex, endColumnIndex, blockCommentStart, blockCommentEnd));
|
|
25233
|
-
|
|
25234
|
-
// const oldRow1 = TextDocument.getLine(editor, startRowIndex)
|
|
25235
|
-
// const newRow1 =
|
|
25236
|
-
// oldRow1.slice(0, startColumnIndex) +
|
|
25237
|
-
// oldRow1.slice(startColumnIndex + blockCommentStart.length)
|
|
25238
|
-
// const oldRow2 = TextDocument.getLine(editor, endRowIndex)
|
|
25239
|
-
// const newRow2 =
|
|
25240
|
-
// oldRow2.slice(0, endColumnIndex) +
|
|
25241
|
-
// oldRow2.slice(endColumnIndex + blockCommentEnd.length)
|
|
25242
|
-
// // TODO use applyEdit to have undo functionality
|
|
25243
|
-
// TextDocument.setLine(editor, startRowIndex, newRow1)
|
|
25244
|
-
// TextDocument.setLine(editor, endRowIndex, newRow2)
|
|
25245
|
-
// TODO move cursors
|
|
25246
|
-
} else {
|
|
25327
|
+
if (startColumnIndex === -1 || endColumnIndex === -1) {
|
|
25247
25328
|
const whitespaceAtStart = line.match(RE_WHITESPACE_AT_START$1);
|
|
25248
25329
|
const whitespaceAtEnd = line.match(RE_WHITESPACE_AT_END);
|
|
25249
25330
|
let startColumnIndex = 0;
|
|
@@ -25300,6 +25381,21 @@ const getBlockCommentEdits = (editor, blockComment) => {
|
|
|
25300
25381
|
// columnIndex: newColumnIndex,
|
|
25301
25382
|
// }
|
|
25302
25383
|
// })
|
|
25384
|
+
} else {
|
|
25385
|
+
changes.push(...getRemoveBlockCommentEdits(rowIndex, startRowIndex, startColumnIndex, endRowIndex, endColumnIndex, blockCommentStart, blockCommentEnd));
|
|
25386
|
+
|
|
25387
|
+
// const oldRow1 = TextDocument.getLine(editor, startRowIndex)
|
|
25388
|
+
// const newRow1 =
|
|
25389
|
+
// oldRow1.slice(0, startColumnIndex) +
|
|
25390
|
+
// oldRow1.slice(startColumnIndex + blockCommentStart.length)
|
|
25391
|
+
// const oldRow2 = TextDocument.getLine(editor, endRowIndex)
|
|
25392
|
+
// const newRow2 =
|
|
25393
|
+
// oldRow2.slice(0, endColumnIndex) +
|
|
25394
|
+
// oldRow2.slice(endColumnIndex + blockCommentEnd.length)
|
|
25395
|
+
// // TODO use applyEdit to have undo functionality
|
|
25396
|
+
// TextDocument.setLine(editor, startRowIndex, newRow1)
|
|
25397
|
+
// TextDocument.setLine(editor, endRowIndex, newRow2)
|
|
25398
|
+
// TODO move cursors
|
|
25303
25399
|
}
|
|
25304
25400
|
// if (line.startsWith(blockComment[0]) && line.endsWith(blockComment[1])) {
|
|
25305
25401
|
// lines[rowIndex] = line.slice(
|
|
@@ -25350,7 +25446,7 @@ const getLineComment = async editor => {
|
|
|
25350
25446
|
|
|
25351
25447
|
const RE_WHITESPACE_AT_START = /^\s+/;
|
|
25352
25448
|
const getLineCommentEdit = (rowIndex, line, lineComment) => {
|
|
25353
|
-
const whitespaceMatch =
|
|
25449
|
+
const whitespaceMatch = RE_WHITESPACE_AT_START.exec(line);
|
|
25354
25450
|
const index = whitespaceMatch ? whitespaceMatch[0].length : 0;
|
|
25355
25451
|
if (line.slice(index).startsWith(lineComment)) {
|
|
25356
25452
|
// TODO also check tab character
|
|
@@ -25408,7 +25504,7 @@ const getSelectedLineCommentEdits = (editor, lineComment, origin = ToggleBlockCo
|
|
|
25408
25504
|
const startRow = Math.min(selections[i], selections[i + 2]);
|
|
25409
25505
|
let endRow = Math.max(selections[i], selections[i + 2]);
|
|
25410
25506
|
const endColumn = selections[i + (selections[i] > selections[i + 2] ? 1 : 3)];
|
|
25411
|
-
if (
|
|
25507
|
+
if (endColumn === 0 && endRow > startRow) {
|
|
25412
25508
|
endRow--;
|
|
25413
25509
|
}
|
|
25414
25510
|
for (let row = startRow; row <= endRow; row++) {
|
|
@@ -25584,7 +25680,9 @@ const typeWithAutoClosingBracket = (editor, text) => {
|
|
|
25584
25680
|
lineDelta += change.inserted.length - change.deleted.length;
|
|
25585
25681
|
}
|
|
25586
25682
|
// @ts-ignore
|
|
25587
|
-
return scheduleDocumentAndCursorsSelections(editor, changes,
|
|
25683
|
+
return scheduleDocumentAndCursorsSelections(editor, changes, {
|
|
25684
|
+
selectionChanges
|
|
25685
|
+
});
|
|
25588
25686
|
};
|
|
25589
25687
|
|
|
25590
25688
|
// @ts-ignore
|
|
@@ -25622,7 +25720,9 @@ const typeWithAutoClosingQuote = (editor, text) => {
|
|
|
25622
25720
|
// @ts-ignore
|
|
25623
25721
|
changes[0].end.columnIndex + 1]);
|
|
25624
25722
|
// @ts-ignore
|
|
25625
|
-
return scheduleDocumentAndCursorsSelections(editor, changes,
|
|
25723
|
+
return scheduleDocumentAndCursorsSelections(editor, changes, {
|
|
25724
|
+
selectionChanges
|
|
25725
|
+
});
|
|
25626
25726
|
};
|
|
25627
25727
|
|
|
25628
25728
|
const typeWithAutoClosingTag = async (editor, text) => {
|
|
@@ -26634,14 +26734,14 @@ const getEditorBreadcrumbsVirtualDom = state => {
|
|
|
26634
26734
|
const {
|
|
26635
26735
|
breadcrumbFileIcon
|
|
26636
26736
|
} = state;
|
|
26637
|
-
const breadcrumbs = getEditorBreadcrumbs(state);
|
|
26737
|
+
const breadcrumbs$1 = getEditorBreadcrumbs(state);
|
|
26638
26738
|
const children = [];
|
|
26639
|
-
for (let index = 0; index < breadcrumbs.length; index++) {
|
|
26640
|
-
const breadcrumb = breadcrumbs[index];
|
|
26739
|
+
for (let index = 0; index < breadcrumbs$1.length; index++) {
|
|
26740
|
+
const breadcrumb = breadcrumbs$1[index];
|
|
26641
26741
|
if (index > 0) {
|
|
26642
26742
|
children.push(separator);
|
|
26643
26743
|
}
|
|
26644
|
-
const isFile = breadcrumb.kind === 'file' && breadcrumbs[index + 1]?.kind !== 'file';
|
|
26744
|
+
const isFile = breadcrumb.kind === 'file' && breadcrumbs$1[index + 1]?.kind !== 'file';
|
|
26645
26745
|
const icon = breadcrumb.kind === 'symbol' ? {
|
|
26646
26746
|
ariaHidden: True,
|
|
26647
26747
|
childCount: 0,
|
|
@@ -26662,8 +26762,8 @@ const getEditorBreadcrumbsVirtualDom = state => {
|
|
|
26662
26762
|
}, ...(icon ? [icon] : []), text(breadcrumb.label));
|
|
26663
26763
|
}
|
|
26664
26764
|
return [{
|
|
26665
|
-
ariaLabel:
|
|
26666
|
-
childCount: breadcrumbs.length > 0 ? breadcrumbs.length * 2 - 1 : 0,
|
|
26765
|
+
ariaLabel: breadcrumbs(),
|
|
26766
|
+
childCount: breadcrumbs$1.length > 0 ? breadcrumbs$1.length * 2 - 1 : 0,
|
|
26667
26767
|
className: 'EditorBreadcrumbs',
|
|
26668
26768
|
type: Nav
|
|
26669
26769
|
}, ...children];
|
|
@@ -26677,7 +26777,7 @@ const editorInputNode = {
|
|
|
26677
26777
|
const editorTextAreaNode = {
|
|
26678
26778
|
ariaAutoComplete: 'list',
|
|
26679
26779
|
ariaMultiLine: True,
|
|
26680
|
-
ariaRoleDescription:
|
|
26780
|
+
ariaRoleDescription: EditorRoleDescription,
|
|
26681
26781
|
autocapitalize: 'off',
|
|
26682
26782
|
autocomplete: 'off',
|
|
26683
26783
|
autocorrect: 'off',
|
|
@@ -26865,9 +26965,10 @@ const mergeConflictActions = [{
|
|
|
26865
26965
|
}];
|
|
26866
26966
|
const getUnnecessaryRanges = (diagnostics, rowIndex, textLength, visibleStartColumn, line, hasLine, tabSize, segments) => {
|
|
26867
26967
|
const visibleStart = hasLine ? getHorizontalDisplayColumn(line, visibleStartColumn, tabSize, segments) : visibleStartColumn;
|
|
26868
|
-
|
|
26869
|
-
|
|
26870
|
-
|
|
26968
|
+
const ranges = [];
|
|
26969
|
+
for (const diagnostic of diagnostics) {
|
|
26970
|
+
if (!diagnostic.tags?.includes(DiagnosticTag.Unnecessary) || rowIndex < diagnostic.rowIndex || rowIndex > diagnostic.endRowIndex) {
|
|
26971
|
+
continue;
|
|
26871
26972
|
}
|
|
26872
26973
|
const diagnosticStart = rowIndex === diagnostic.rowIndex ? diagnostic.columnIndex : 0;
|
|
26873
26974
|
const diagnosticEnd = rowIndex === diagnostic.endRowIndex ? diagnostic.endColumnIndex : line.length;
|
|
@@ -26875,11 +26976,14 @@ const getUnnecessaryRanges = (diagnostics, rowIndex, textLength, visibleStartCol
|
|
|
26875
26976
|
const endColumn = hasLine ? getHorizontalDisplayColumn(line, diagnosticEnd, tabSize, segments) : diagnosticEnd;
|
|
26876
26977
|
const start = Math.max(0, startColumn - visibleStart);
|
|
26877
26978
|
const end = Math.min(textLength, endColumn - visibleStart);
|
|
26878
|
-
|
|
26879
|
-
|
|
26880
|
-
|
|
26881
|
-
|
|
26882
|
-
|
|
26979
|
+
if (start < end) {
|
|
26980
|
+
ranges.push({
|
|
26981
|
+
end,
|
|
26982
|
+
start
|
|
26983
|
+
});
|
|
26984
|
+
}
|
|
26985
|
+
}
|
|
26986
|
+
return ranges.toSorted((left, right) => left.start - right.start);
|
|
26883
26987
|
};
|
|
26884
26988
|
const getTokenParts = (textInfos, ranges) => {
|
|
26885
26989
|
const parts = [];
|
|
@@ -26935,7 +27039,7 @@ const addMergeConflictActions = (dom, rowIndex) => {
|
|
|
26935
27039
|
label
|
|
26936
27040
|
} of mergeConflictActions) {
|
|
26937
27041
|
dom.push({
|
|
26938
|
-
ariaLabel:
|
|
27042
|
+
ariaLabel: mergeConflictActionAtLine(label, rowIndex + 1),
|
|
26939
27043
|
childCount: 1,
|
|
26940
27044
|
className: 'MergeConflictAction',
|
|
26941
27045
|
'data-action': action,
|
|
@@ -26975,7 +27079,24 @@ const addCodeLenses = (dom, codeLensRows, rowIndex) => {
|
|
|
26975
27079
|
}, text(label));
|
|
26976
27080
|
}
|
|
26977
27081
|
};
|
|
26978
|
-
const getEditorRowsVirtualDom$1 = (textInfos, differences,
|
|
27082
|
+
const getEditorRowsVirtualDom$1 = (textInfos, differences, {
|
|
27083
|
+
charWidth = 1,
|
|
27084
|
+
codeLensRows = {},
|
|
27085
|
+
deltaX = 0,
|
|
27086
|
+
diagnostics = [],
|
|
27087
|
+
endOfLineDecorations = [],
|
|
27088
|
+
highlightedLine = -1,
|
|
27089
|
+
horizontalVirtualizationThreshold = 500,
|
|
27090
|
+
horizontalVisibleRanges = [],
|
|
27091
|
+
lineNumbers = true,
|
|
27092
|
+
lines = [],
|
|
27093
|
+
problemsHighlightedRow = -1,
|
|
27094
|
+
rtl = false,
|
|
27095
|
+
tabSize = 2,
|
|
27096
|
+
visibleLineIndices = [],
|
|
27097
|
+
visibleViewLineIndices = [],
|
|
27098
|
+
width = Infinity
|
|
27099
|
+
} = {}) => {
|
|
26979
27100
|
const dom = [];
|
|
26980
27101
|
const actualViewRows = visibleViewLineIndices.length === 0 ? Array.from({
|
|
26981
27102
|
length: textInfos.length
|
|
@@ -27067,8 +27188,38 @@ const getEditorRowsVirtualDom$1 = (textInfos, differences, lineNumbers = true, h
|
|
|
27067
27188
|
return dom;
|
|
27068
27189
|
};
|
|
27069
27190
|
|
|
27070
|
-
const getEditorRowsVirtualDom = (textInfos, differences,
|
|
27071
|
-
|
|
27191
|
+
const getEditorRowsVirtualDom = (textInfos, differences, {
|
|
27192
|
+
codeLensRows,
|
|
27193
|
+
endOfLineDecorations = [],
|
|
27194
|
+
highlightedLine = -1,
|
|
27195
|
+
horizontalVisibleRanges = [],
|
|
27196
|
+
lineNumbers = true,
|
|
27197
|
+
lines = [],
|
|
27198
|
+
problemsHighlightedRow = -1,
|
|
27199
|
+
rtl = false,
|
|
27200
|
+
tabSize = 2,
|
|
27201
|
+
unnecessaryDiagnostics = [],
|
|
27202
|
+
visibleLineIndices = [],
|
|
27203
|
+
visibleViewLineIndices = []
|
|
27204
|
+
} = {}) => {
|
|
27205
|
+
const rowsDom = getEditorRowsVirtualDom$1(textInfos, differences, {
|
|
27206
|
+
charWidth: 1,
|
|
27207
|
+
codeLensRows,
|
|
27208
|
+
deltaX: 0,
|
|
27209
|
+
diagnostics: unnecessaryDiagnostics,
|
|
27210
|
+
endOfLineDecorations,
|
|
27211
|
+
highlightedLine,
|
|
27212
|
+
horizontalVirtualizationThreshold: 500,
|
|
27213
|
+
horizontalVisibleRanges,
|
|
27214
|
+
lineNumbers,
|
|
27215
|
+
lines,
|
|
27216
|
+
problemsHighlightedRow,
|
|
27217
|
+
rtl,
|
|
27218
|
+
tabSize,
|
|
27219
|
+
visibleLineIndices,
|
|
27220
|
+
visibleViewLineIndices,
|
|
27221
|
+
width: Infinity
|
|
27222
|
+
});
|
|
27072
27223
|
return [{
|
|
27073
27224
|
childCount: visibleViewLineIndices.length || textInfos.length,
|
|
27074
27225
|
className: 'EditorRows',
|
|
@@ -27165,8 +27316,40 @@ const editorLayersNode = {
|
|
|
27165
27316
|
className: 'EditorLayers',
|
|
27166
27317
|
type: Div
|
|
27167
27318
|
};
|
|
27168
|
-
const getEditorLayersVirtualDom = (selectionInfos, textInfos, differences,
|
|
27169
|
-
|
|
27319
|
+
const getEditorLayersVirtualDom = (selectionInfos, textInfos, differences, {
|
|
27320
|
+
bracketMatchInfos = [],
|
|
27321
|
+
codeLensRows,
|
|
27322
|
+
cursorInfos = [],
|
|
27323
|
+
diagnostics = [],
|
|
27324
|
+
endOfLineDecorations = [],
|
|
27325
|
+
focused = true,
|
|
27326
|
+
highlightedLine = -1,
|
|
27327
|
+
horizontalVisibleRanges = [],
|
|
27328
|
+
lineNumbers = true,
|
|
27329
|
+
lines = [],
|
|
27330
|
+
problemsHighlightedRow = -1,
|
|
27331
|
+
roundedSelection = false,
|
|
27332
|
+
rtl = false,
|
|
27333
|
+
tabSize = 2,
|
|
27334
|
+
textDecorationDom = [],
|
|
27335
|
+
unnecessaryDiagnostics = [],
|
|
27336
|
+
visibleLineIndices = [],
|
|
27337
|
+
visibleViewLineIndices = []
|
|
27338
|
+
} = {}) => {
|
|
27339
|
+
return [editorLayersNode, ...getEditorSelectionsVirtualDom(selectionInfos, focused, roundedSelection), ...getEditorRowsVirtualDom(textInfos, differences, {
|
|
27340
|
+
codeLensRows,
|
|
27341
|
+
endOfLineDecorations,
|
|
27342
|
+
highlightedLine,
|
|
27343
|
+
horizontalVisibleRanges,
|
|
27344
|
+
lineNumbers,
|
|
27345
|
+
lines,
|
|
27346
|
+
problemsHighlightedRow,
|
|
27347
|
+
rtl,
|
|
27348
|
+
tabSize,
|
|
27349
|
+
unnecessaryDiagnostics,
|
|
27350
|
+
visibleLineIndices,
|
|
27351
|
+
visibleViewLineIndices
|
|
27352
|
+
}), ...getEditorCursorsVirtualDom(cursorInfos, focused), ...getEditorDiagnosticsVirtualDom(diagnostics, bracketMatchInfos, textDecorationDom)];
|
|
27170
27353
|
};
|
|
27171
27354
|
|
|
27172
27355
|
const getEditorScrollBarDiagnosticsVirtualDom = scrollBarDiagnostics => {
|
|
@@ -27264,7 +27447,26 @@ const getEditorContentVirtualDom = ({
|
|
|
27264
27447
|
return [{
|
|
27265
27448
|
...editorContentNode,
|
|
27266
27449
|
className: breadcrumbsEnabled ? 'EditorContent EditorBreadcrumbsOffset' : 'EditorContent'
|
|
27267
|
-
}, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences,
|
|
27450
|
+
}, ...getEditorInputVirtualDom(), ...getEditorLayersVirtualDom(selectionInfos, textInfos, differences, {
|
|
27451
|
+
bracketMatchInfos,
|
|
27452
|
+
codeLensRows,
|
|
27453
|
+
cursorInfos,
|
|
27454
|
+
diagnostics,
|
|
27455
|
+
endOfLineDecorations,
|
|
27456
|
+
focused,
|
|
27457
|
+
highlightedLine,
|
|
27458
|
+
horizontalVisibleRanges,
|
|
27459
|
+
lineNumbers,
|
|
27460
|
+
lines,
|
|
27461
|
+
problemsHighlightedRow,
|
|
27462
|
+
roundedSelection,
|
|
27463
|
+
rtl,
|
|
27464
|
+
tabSize,
|
|
27465
|
+
textDecorationDom,
|
|
27466
|
+
unnecessaryDiagnostics,
|
|
27467
|
+
visibleLineIndices,
|
|
27468
|
+
visibleViewLineIndices
|
|
27469
|
+
}), ...getEditorScrollBarDiagnosticsVirtualDom(scrollBarDiagnostics), ...getScrollBarVirtualDom(scrollBarHeight, scrollBarWidth, scrollBarLeft)];
|
|
27268
27470
|
};
|
|
27269
27471
|
|
|
27270
27472
|
const getGutterInfoVirtualDom = (gutterInfo, activeLineNumber) => {
|
|
@@ -27299,10 +27501,10 @@ const getGutterInfoVirtualDom = (gutterInfo, activeLineNumber) => {
|
|
|
27299
27501
|
}),
|
|
27300
27502
|
type: Span
|
|
27301
27503
|
}, ...gutterDecorations.map(decoration => ({
|
|
27302
|
-
ariaLabel:
|
|
27504
|
+
ariaLabel: gutterDecorationOnLine(decoration.type[0].toUpperCase() + decoration.type.slice(1), lineNumber),
|
|
27303
27505
|
childCount: 0,
|
|
27304
27506
|
className: mergeClassNames('EditorGutterDecoration', `EditorGutterDecoration${decoration.type[0].toUpperCase()}${decoration.type.slice(1)}`),
|
|
27305
|
-
title:
|
|
27507
|
+
title: gutterDecorationOnLine(decoration.type[0].toUpperCase() + decoration.type.slice(1), lineNumber),
|
|
27306
27508
|
type: Span
|
|
27307
27509
|
})), text(isMergeConflictActions || isLightBulb ? '' : isBreakpoint ? '●' : showLineNumber ? lineNumber : '')];
|
|
27308
27510
|
};
|
|
@@ -27464,7 +27666,7 @@ const getEditorVirtualDom = ({
|
|
|
27464
27666
|
}, textEditorErrorIconNode, textEditorErrorMessageNode, text(loadError)];
|
|
27465
27667
|
}
|
|
27466
27668
|
const gutterLineIndices = visibleViewLineIndices.length > 0 ? visibleViewLineIndices : visibleLineIndices;
|
|
27467
|
-
const visibleGutterInfos = breakPoints.length > 0 || gutterDecorations.length > 0
|
|
27669
|
+
const visibleGutterInfos = visibleLineIndices || breakPoints.length > 0 || gutterDecorations.length > 0 ? getGutterInfos(minLineY, maxLineY, breakPoints, lineNumbers, gutterLineIndices, lightBulbRowIndex, gutterDecorations) : gutterInfos;
|
|
27468
27670
|
const showGutter = lineNumbers || breakPoints.length > 0 || lightBulbRowIndex >= 0 || gutterDecorations.length > 0;
|
|
27469
27671
|
const primaryCursorRowIndex = getPrimaryCursorRowIndex(selections, primarySelectionIndex);
|
|
27470
27672
|
const activeLineNumber = highlightActiveLineNumber ? primaryCursorRowIndex + 1 : -1;
|
|
@@ -27553,11 +27755,11 @@ const getTextAppendPaths = dom => {
|
|
|
27553
27755
|
numberOfRows++;
|
|
27554
27756
|
const span = dom[index + 1];
|
|
27555
27757
|
const text = dom[index + 2];
|
|
27556
|
-
if (node.childCount
|
|
27557
|
-
numberOfRows = -100;
|
|
27558
|
-
} else {
|
|
27758
|
+
if (node.childCount === 1 && span?.type === Span && span.childCount === 1 && text?.type === Text) {
|
|
27559
27759
|
textIndex = index + 2;
|
|
27560
27760
|
textPath = [...path, 0, 0];
|
|
27761
|
+
} else {
|
|
27762
|
+
numberOfRows = -100;
|
|
27561
27763
|
}
|
|
27562
27764
|
}
|
|
27563
27765
|
if (node.className === 'EditorCursor') {
|
|
@@ -27577,7 +27779,7 @@ const getTextAppendPaths = dom => {
|
|
|
27577
27779
|
return nextIndex;
|
|
27578
27780
|
};
|
|
27579
27781
|
const endIndex = visit(0, []);
|
|
27580
|
-
if (
|
|
27782
|
+
if (numberOfRows !== 1 || numberOfCursors !== 1 || textIndex < 0 || cursorIndex < 0 || endIndex !== dom.length) {
|
|
27581
27783
|
return undefined;
|
|
27582
27784
|
}
|
|
27583
27785
|
return {
|
|
@@ -27612,13 +27814,7 @@ const canRenderPlainTextAppend = (oldState, newState) => {
|
|
|
27612
27814
|
}
|
|
27613
27815
|
const oldLine = oldLines[0];
|
|
27614
27816
|
const newLine = newLines[0];
|
|
27615
|
-
if (oldState.rtl !== newState.rtl || isBidi(oldLine, oldState.rtl) || isBidi(newLine, newState.rtl)) {
|
|
27616
|
-
return false;
|
|
27617
|
-
}
|
|
27618
|
-
if (newLine.length <= oldLine.length || !newLine.startsWith(oldLine) || /[\r\n]/.test(newLine.slice(oldLine.length))) {
|
|
27619
|
-
return false;
|
|
27620
|
-
}
|
|
27621
|
-
if (oldState.initial || newState.initial || !oldState.focused || !newState.focused || oldState.uid !== newState.uid || oldTextInfos[0][1] !== newTextInfos[0][1] || oldState.cursorInfos.length !== 1 || newState.cursorInfos.length !== 1 || oldState.selectionInfos.length > 0 || newState.selectionInfos.length > 0 || oldState.selections.length !== 4 || newState.selections.length !== 4 || oldState.selections[0] !== 0 || oldState.selections[1] !== oldLine.length || oldState.selections[2] !== 0 || oldState.selections[3] !== oldLine.length || newState.selections[0] !== 0 || newState.selections[1] !== newLine.length || newState.selections[2] !== 0 || newState.selections[3] !== newLine.length) {
|
|
27817
|
+
if (oldState.rtl !== newState.rtl || isBidi(oldLine, oldState.rtl) || isBidi(newLine, newState.rtl) || newLine.length <= oldLine.length || !newLine.startsWith(oldLine) || /[\r\n]/.test(newLine.slice(oldLine.length)) || oldState.initial || newState.initial || !oldState.focused || !newState.focused || oldState.uid !== newState.uid || oldTextInfos[0][1] !== newTextInfos[0][1] || oldState.cursorInfos.length !== 1 || newState.cursorInfos.length !== 1 || oldState.selectionInfos.length > 0 || newState.selectionInfos.length > 0 || oldState.selections.length !== 4 || newState.selections.length !== 4 || oldState.selections[0] !== 0 || oldState.selections[1] !== oldLine.length || oldState.selections[2] !== 0 || oldState.selections[3] !== oldLine.length || newState.selections[0] !== 0 || newState.selections[1] !== newLine.length || newState.selections[2] !== 0 || newState.selections[3] !== newLine.length) {
|
|
27622
27818
|
return false;
|
|
27623
27819
|
}
|
|
27624
27820
|
if (oldState.breadcrumbsEnabled || newState.breadcrumbsEnabled || oldState.minimapEnabled || newState.minimapEnabled || oldState.lineNumbers !== newState.lineNumbers || oldState.highlightActiveLineNumber !== newState.highlightActiveLineNumber || oldState.highlightedLine !== newState.highlightedLine || oldState.problemsHighlightedRow !== newState.problemsHighlightedRow || oldState.focused !== newState.focused || oldState.roundedSelection !== newState.roundedSelection || oldState.deltaX !== newState.deltaX || oldState.gutterWidth !== newState.gutterWidth || (newState.deltaX ?? 0) !== 0 && oldState.longestLineWidth !== newState.longestLineWidth || oldState.width !== newState.width || oldState.height !== newState.height || oldState.minimumSliderSize !== newState.minimumSliderSize || getScrollBarSize(getHorizontalScrollDimensions(oldState).width, oldState.longestLineWidth, oldState.minimumSliderSize) !== getScrollBarSize(getHorizontalScrollDimensions(newState).width, newState.longestLineWidth, newState.minimumSliderSize) || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || !sameValues(oldState.visibleLineIndices, newState.visibleLineIndices) || !sameValues(oldState.visibleViewLineIndices, newState.visibleViewLineIndices) || oldState.differences !== newState.differences && !sameValues(oldState.differences, newState.differences) || oldState.scrollBarHeight !== newState.scrollBarHeight || oldState.uri !== newState.uri || oldState.workspaceUri !== newState.workspaceUri || oldState.assetDir !== newState.assetDir || oldState.loadError !== newState.loadError || oldState.combineWhitespaceTokens !== newState.combineWhitespaceTokens || oldState.widgets?.length > 0 || newState.widgets?.length > 0 || Boolean(oldState.codeLensRows) || Boolean(newState.codeLensRows) || oldState.mergeConflicts.length > 0 || newState.mergeConflicts.length > 0 || !isEmpty(oldState.diagnostics) || !isEmpty(newState.diagnostics) || !isEmpty(oldState.textDecorationDom) || !isEmpty(newState.textDecorationDom) || !isEmpty(oldState.visualDecorations) || !isEmpty(newState.visualDecorations) || !isEmpty(oldState.bracketMatchInfos) || !isEmpty(newState.bracketMatchInfos) || !isEmpty(oldState.documentHighlightInfos) || !isEmpty(newState.documentHighlightInfos) || !isEmpty(oldState.endOfLineDecorations) || !isEmpty(newState.endOfLineDecorations) || !isEmpty(oldState.gutterDecorations) || !isEmpty(newState.gutterDecorations) || !isEmpty(oldState.breakPoints) || !isEmpty(newState.breakPoints)) {
|
|
@@ -27631,13 +27827,11 @@ const getTextAppendPatches = (state, paths) => {
|
|
|
27631
27827
|
cursorInfos,
|
|
27632
27828
|
lines
|
|
27633
27829
|
} = state;
|
|
27634
|
-
|
|
27635
|
-
|
|
27636
|
-
|
|
27637
|
-
|
|
27638
|
-
|
|
27639
|
-
}); // NavigateChild
|
|
27640
|
-
}
|
|
27830
|
+
// NavigateChild
|
|
27831
|
+
const patches = Array.from(paths.textPath, index => ({
|
|
27832
|
+
index,
|
|
27833
|
+
type: 7
|
|
27834
|
+
}));
|
|
27641
27835
|
patches.push({
|
|
27642
27836
|
type: 1,
|
|
27643
27837
|
value: lines[0]
|
|
@@ -28052,10 +28246,9 @@ const getWordBefore2 = (editorUid, rowIndex, columnIndex) => {
|
|
|
28052
28246
|
return word;
|
|
28053
28247
|
};
|
|
28054
28248
|
const getLines2 = editorUid => {
|
|
28055
|
-
const editor = getEditor$1(editorUid);
|
|
28056
28249
|
const {
|
|
28057
28250
|
lines
|
|
28058
|
-
} =
|
|
28251
|
+
} = getEditor$1(editorUid);
|
|
28059
28252
|
return lines;
|
|
28060
28253
|
};
|
|
28061
28254
|
const getVisibleLineRange = editorUid => {
|
|
@@ -28066,10 +28259,9 @@ const getVisibleLineRange = editorUid => {
|
|
|
28066
28259
|
return [minLineY, maxLineY];
|
|
28067
28260
|
};
|
|
28068
28261
|
const getSelections2 = editorUid => {
|
|
28069
|
-
const editor = getEditor$1(editorUid);
|
|
28070
28262
|
const {
|
|
28071
28263
|
selections
|
|
28072
|
-
} =
|
|
28264
|
+
} = getEditor$1(editorUid);
|
|
28073
28265
|
return selections;
|
|
28074
28266
|
};
|
|
28075
28267
|
const setSelections2 = async (editorUid, selections, reveal = true) => {
|
|
@@ -28138,15 +28330,14 @@ const getSourceActions = async editorUid => {
|
|
|
28138
28330
|
return actions;
|
|
28139
28331
|
};
|
|
28140
28332
|
const getDiagnostics = async editorUid => {
|
|
28141
|
-
const editor = getEditor$1(editorUid);
|
|
28142
28333
|
const {
|
|
28143
28334
|
diagnostics
|
|
28144
|
-
} =
|
|
28335
|
+
} = getEditor$1(editorUid);
|
|
28145
28336
|
return diagnostics;
|
|
28146
28337
|
};
|
|
28147
28338
|
|
|
28148
28339
|
const ensure = async (fontName, fontUrl) => {
|
|
28149
|
-
await
|
|
28340
|
+
await ensureFont(fontName, fontUrl);
|
|
28150
28341
|
setLoaded(fontName);
|
|
28151
28342
|
};
|
|
28152
28343
|
|
|
@@ -28578,8 +28769,8 @@ const getKeys = () => {
|
|
|
28578
28769
|
};
|
|
28579
28770
|
|
|
28580
28771
|
/**
|
|
28581
|
-
|
|
28582
|
-
|
|
28772
|
+
@enum {string}
|
|
28773
|
+
*/
|
|
28583
28774
|
const UiStrings = {
|
|
28584
28775
|
CommandPalette: 'Command Palette'};
|
|
28585
28776
|
const commandPalette = () => {
|
|
@@ -28796,19 +28987,17 @@ const getQuickPickMenuEntries = () => {
|
|
|
28796
28987
|
};
|
|
28797
28988
|
|
|
28798
28989
|
const getSelections = editorUid => {
|
|
28799
|
-
const editor = getEditor$1(editorUid);
|
|
28800
28990
|
const {
|
|
28801
28991
|
selections
|
|
28802
|
-
} =
|
|
28992
|
+
} = getEditor$1(editorUid);
|
|
28803
28993
|
return selections;
|
|
28804
28994
|
};
|
|
28805
28995
|
|
|
28806
28996
|
const getText = editorUid => {
|
|
28807
28997
|
number(editorUid);
|
|
28808
|
-
const editor = getEditor$1(editorUid);
|
|
28809
28998
|
const {
|
|
28810
28999
|
lines
|
|
28811
|
-
} =
|
|
29000
|
+
} = getEditor$1(editorUid);
|
|
28812
29001
|
return lines.join(NewLine);
|
|
28813
29002
|
};
|
|
28814
29003
|
|
|
@@ -28853,10 +29042,11 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
28853
29042
|
commandMap: {},
|
|
28854
29043
|
messagePort: port
|
|
28855
29044
|
});
|
|
28856
|
-
if (rpcId) {
|
|
28857
|
-
|
|
28858
|
-
await initializeListener(rpcId);
|
|
29045
|
+
if (!rpcId) {
|
|
29046
|
+
return;
|
|
28859
29047
|
}
|
|
29048
|
+
set$m(rpcId, rpc);
|
|
29049
|
+
await initializeListener(rpcId);
|
|
28860
29050
|
};
|
|
28861
29051
|
const handleDirectMessagePort = async (port, commands) => {
|
|
28862
29052
|
const rpc = await create$h({
|
|
@@ -28916,7 +29106,7 @@ const isAutoClosingTagsEnabled = async () => {
|
|
|
28916
29106
|
};
|
|
28917
29107
|
const getRowHeight = async applicationId => {
|
|
28918
29108
|
const [lineHeight, fontSize] = await Promise.all([getPreference(kLineHeight, applicationId), getFontSize(applicationId)]);
|
|
28919
|
-
if (typeof lineHeight !== 'number' || !Number.isFinite(lineHeight)
|
|
29109
|
+
if (typeof lineHeight !== 'number' || lineHeight === 0 || !Number.isFinite(lineHeight)) {
|
|
28920
29110
|
lastWarnings.delete(kLineHeight);
|
|
28921
29111
|
return fontSize;
|
|
28922
29112
|
}
|
|
@@ -29012,10 +29202,10 @@ const getHorizontalVirtualizationThreshold = value => {
|
|
|
29012
29202
|
return Math.floor(threshold);
|
|
29013
29203
|
};
|
|
29014
29204
|
const getEditorPreferences = async applicationId => {
|
|
29015
|
-
const [diagnosticsEnabled, fontFamily, fontSize, fontWeight, formatOnSave, formatActions, hoverEnabled, hoverDelay, horizontalVirtualizationThreshold, messageDelay, isAutoClosingBracketsEnabled$1, isAutoClosingQuotesEnabled$1, isAutoClosingTagsEnabled$1, isQuickSuggestionsEnabled$1, lineNumbers, highlightActiveLineNumber, rowHeight, tabSize, letterSpacing, completionTriggerCharacters, minimapEnabled, mergeConflictActionsEnabled, rtl, breadcrumbsEnabled, codeLensEnabled, occurrencesHighlight, insertSpaces, dragAndDropEnabled, roundedSelection, combineWhitespaceTokens, selectedTextOccurrenceMatching, disableMonospaceOptimizations, syntaxHighlightingCacheEnabled, linkedEditingEnabled] = await Promise.all([get$2('editor.diagnostics', applicationId), getFontFamily(applicationId), getFontSize(applicationId), getFontWeight(applicationId), get$2('editor.formatOnSave', applicationId), get$2('editor.formatActions', applicationId), get$2('editor.hover', applicationId), get$2('editor.hoverDelay', applicationId), get$2('editor.horizontalVirtualizationThreshold', applicationId), get$2('editor.messageDelay', applicationId), isAutoClosingBracketsEnabled(applicationId), isAutoClosingQuotesEnabled(applicationId), isAutoClosingTagsEnabled(), isQuickSuggestionsEnabled(applicationId), getLineNumbers(applicationId), getHighlightActiveLineNumber(applicationId), getRowHeight(applicationId), getTabSize(applicationId), getLetterSpacing(applicationId), getCompletionTriggerCharacters(), getMinimapEnabled(applicationId), getMergeConflictActionsEnabled(applicationId), get$2('editor.rtl', applicationId), get$2('breadcrumbs.enabled', applicationId), get$2('editor.extensionCodeLens', applicationId), get$2('editor.occurrencesHighlight', applicationId), get$2('editor.insertSpaces', applicationId), get$2('editor.dragAndDrop', applicationId), get$2('editor.roundedSelection', applicationId), get$2('editor.combineWhitespaceTokens', applicationId), get$2('editor.selectedTextOccurrenceMatching', applicationId), get$2('editor.disableMonospaceOptimizations', applicationId), get$2('editor.syntaxHighlightingCache', applicationId), get$2('editor.linkedEditing', applicationId)]);
|
|
29205
|
+
const [diagnosticsEnabled, fontFamily, fontSize, fontWeight, formatOnSave, formatActions, hoverEnabled, hoverDelay, horizontalVirtualizationThreshold, messageDelay, isAutoClosingBracketsEnabled$1, isAutoClosingQuotesEnabled$1, isAutoClosingTagsEnabled$1, isQuickSuggestionsEnabled$1, lineNumbers, highlightActiveLineNumber, rowHeight, tabSize, letterSpacing, completionTriggerCharacters, minimapEnabled, mergeConflictActionsEnabled, rtl, breadcrumbsEnabled, codeLensEnabled, legacyCodeLensEnabled, occurrencesHighlight, insertSpaces, dragAndDropEnabled, roundedSelection, combineWhitespaceTokens, selectedTextOccurrenceMatching, disableMonospaceOptimizations, syntaxHighlightingCacheEnabled, linkedEditingEnabled] = await Promise.all([get$2('editor.diagnostics', applicationId), getFontFamily(applicationId), getFontSize(applicationId), getFontWeight(applicationId), get$2('editor.formatOnSave', applicationId), get$2('editor.formatActions', applicationId), get$2('editor.hover', applicationId), get$2('editor.hoverDelay', applicationId), get$2('editor.horizontalVirtualizationThreshold', applicationId), get$2('editor.messageDelay', applicationId), isAutoClosingBracketsEnabled(applicationId), isAutoClosingQuotesEnabled(applicationId), isAutoClosingTagsEnabled(), isQuickSuggestionsEnabled(applicationId), getLineNumbers(applicationId), getHighlightActiveLineNumber(applicationId), getRowHeight(applicationId), getTabSize(applicationId), getLetterSpacing(applicationId), getCompletionTriggerCharacters(), getMinimapEnabled(applicationId), getMergeConflictActionsEnabled(applicationId), get$2('editor.rtl', applicationId), get$2('breadcrumbs.enabled', applicationId), get$2('editor.codeLens', applicationId), get$2('editor.extensionCodeLens', applicationId), get$2('editor.occurrencesHighlight', applicationId), get$2('editor.insertSpaces', applicationId), get$2('editor.dragAndDrop', applicationId), get$2('editor.roundedSelection', applicationId), get$2('editor.combineWhitespaceTokens', applicationId), get$2('editor.selectedTextOccurrenceMatching', applicationId), get$2('editor.disableMonospaceOptimizations', applicationId), get$2('editor.syntaxHighlightingCache', applicationId), get$2('editor.linkedEditing', applicationId)]);
|
|
29016
29206
|
return {
|
|
29017
29207
|
breadcrumbsEnabled: breadcrumbsEnabled ?? false,
|
|
29018
|
-
codeLensEnabled: codeLensEnabled === true,
|
|
29208
|
+
codeLensEnabled: (codeLensEnabled ?? legacyCodeLensEnabled) === true,
|
|
29019
29209
|
combineWhitespaceTokens: combineWhitespaceTokens ?? true,
|
|
29020
29210
|
completionTriggerCharacters,
|
|
29021
29211
|
diagnosticsEnabled: diagnosticsEnabled ?? false,
|
|
@@ -29420,7 +29610,9 @@ const launchCompletionWorker = async () => {
|
|
|
29420
29610
|
const name = 'Completion Worker';
|
|
29421
29611
|
const url = 'completionWorkerMain.js';
|
|
29422
29612
|
const intializeCommand = 'Completions.initialize';
|
|
29423
|
-
const rpc = await launchWorker(name, url,
|
|
29613
|
+
const rpc = await launchWorker(name, url, {
|
|
29614
|
+
intializeCommand
|
|
29615
|
+
});
|
|
29424
29616
|
return rpc;
|
|
29425
29617
|
};
|
|
29426
29618
|
|
|
@@ -29567,10 +29759,7 @@ const getSavedHistory = (savedState, content) => {
|
|
|
29567
29759
|
redoStack,
|
|
29568
29760
|
undoStack
|
|
29569
29761
|
} = savedState;
|
|
29570
|
-
if (!Array.isArray(lines) || lines.some(line => typeof line !== 'string') || lines.join('\n') !== content) {
|
|
29571
|
-
return undefined;
|
|
29572
|
-
}
|
|
29573
|
-
if (!Array.isArray(redoStack) || !Array.isArray(undoStack)) {
|
|
29762
|
+
if (!Array.isArray(lines) || lines.some(line => typeof line !== 'string') || lines.join('\n') !== content || !Array.isArray(redoStack) || !Array.isArray(undoStack)) {
|
|
29574
29763
|
return undefined;
|
|
29575
29764
|
}
|
|
29576
29765
|
return {
|
|
@@ -29585,10 +29774,7 @@ const getSavedLanguageId = (savedState, languages) => {
|
|
|
29585
29774
|
const {
|
|
29586
29775
|
explicitLanguageId
|
|
29587
29776
|
} = savedState;
|
|
29588
|
-
if (typeof explicitLanguageId !== 'string' || !explicitLanguageId) {
|
|
29589
|
-
return undefined;
|
|
29590
|
-
}
|
|
29591
|
-
if (languages.every(language => language?.id !== explicitLanguageId)) {
|
|
29777
|
+
if (typeof explicitLanguageId !== 'string' || !explicitLanguageId || languages.every(language => language?.id !== explicitLanguageId)) {
|
|
29592
29778
|
return undefined;
|
|
29593
29779
|
}
|
|
29594
29780
|
return explicitLanguageId;
|
|
@@ -29806,7 +29992,7 @@ const loadContent = async (state, savedState, largeFile = false, focus = true, f
|
|
|
29806
29992
|
|
|
29807
29993
|
const getSelectedLineRange = (selections, primarySelectionIndex) => {
|
|
29808
29994
|
const [startRowIndex,, selectionEndRowIndex, endColumnIndex] = getSelectionPairs(selections, primarySelectionIndex);
|
|
29809
|
-
const endRowIndex =
|
|
29995
|
+
const endRowIndex = endColumnIndex === 0 && startRowIndex < selectionEndRowIndex ? selectionEndRowIndex - 1 : selectionEndRowIndex;
|
|
29810
29996
|
return {
|
|
29811
29997
|
endRowIndex,
|
|
29812
29998
|
startRowIndex
|
|
@@ -29843,7 +30029,7 @@ const moveLines = (editor, direction) => {
|
|
|
29843
30029
|
startRowIndex
|
|
29844
30030
|
} = getSelectedLineRange(selections, primarySelectionIndex);
|
|
29845
30031
|
const lastRowIndex = lines.length - 1;
|
|
29846
|
-
if (
|
|
30032
|
+
if (startRowIndex === 0 && direction < 0 || endRowIndex === lastRowIndex && direction > 0) {
|
|
29847
30033
|
return editor;
|
|
29848
30034
|
}
|
|
29849
30035
|
const editStartRowIndex = direction < 0 ? startRowIndex - 1 : startRowIndex;
|
|
@@ -29864,7 +30050,9 @@ const moveLines = (editor, direction) => {
|
|
|
29864
30050
|
}
|
|
29865
30051
|
}];
|
|
29866
30052
|
const selectionChanges = getSelectionChanges(lines, selections, primarySelectionIndex, direction);
|
|
29867
|
-
return scheduleDocumentAndCursorsSelections(editor, changes,
|
|
30053
|
+
return scheduleDocumentAndCursorsSelections(editor, changes, {
|
|
30054
|
+
selectionChanges
|
|
30055
|
+
});
|
|
29868
30056
|
};
|
|
29869
30057
|
|
|
29870
30058
|
const moveLineDown = editor => {
|
|
@@ -29885,26 +30073,27 @@ const refreshGutterDecorations = async editor => {
|
|
|
29885
30073
|
const refreshGutterDecorationsAll = async () => {
|
|
29886
30074
|
for (const key of getKeys$1()) {
|
|
29887
30075
|
const editor = get$9(Number(key))?.newState;
|
|
29888
|
-
if (editor) {
|
|
29889
|
-
|
|
29890
|
-
const latest = get$9(editor.id);
|
|
29891
|
-
if (!latest) {
|
|
29892
|
-
continue;
|
|
29893
|
-
}
|
|
29894
|
-
set$b(editor.id, latest.oldState, {
|
|
29895
|
-
...latest.newState,
|
|
29896
|
-
gutterDecorations: refreshedEditor.gutterDecorations
|
|
29897
|
-
});
|
|
29898
|
-
await invoke$e('Editor.renderPending', editor.id);
|
|
30076
|
+
if (!editor) {
|
|
30077
|
+
continue;
|
|
29899
30078
|
}
|
|
30079
|
+
const refreshedEditor = await refreshGutterDecorations(editor);
|
|
30080
|
+
const latest = get$9(editor.id);
|
|
30081
|
+
if (!latest) {
|
|
30082
|
+
continue;
|
|
30083
|
+
}
|
|
30084
|
+
set$b(editor.id, latest.oldState, {
|
|
30085
|
+
...latest.newState,
|
|
30086
|
+
gutterDecorations: refreshedEditor.gutterDecorations
|
|
30087
|
+
});
|
|
30088
|
+
await invoke$e('Editor.renderPending', editor.id);
|
|
29900
30089
|
}
|
|
29901
30090
|
};
|
|
29902
30091
|
|
|
29903
30092
|
/**
|
|
29904
|
-
|
|
29905
|
-
|
|
29906
|
-
|
|
29907
|
-
|
|
30093
|
+
Register a listener for editor events
|
|
30094
|
+
@param listenerType - The type of event to listen for (from ListenerType enum)
|
|
30095
|
+
@param rpcId - The RPC ID of the listener that will be notified
|
|
30096
|
+
*/
|
|
29908
30097
|
const registerListener = async (listenerType, rpcId) => {
|
|
29909
30098
|
number(listenerType);
|
|
29910
30099
|
number(rpcId);
|
|
@@ -29932,7 +30121,24 @@ const renderLines = {
|
|
|
29932
30121
|
visibleLineIndices,
|
|
29933
30122
|
visibleViewLineIndices
|
|
29934
30123
|
} = newState;
|
|
29935
|
-
const dom = getEditorRowsVirtualDom$1(textInfos, differences,
|
|
30124
|
+
const dom = getEditorRowsVirtualDom$1(textInfos, differences, {
|
|
30125
|
+
charWidth: newState.charWidth,
|
|
30126
|
+
codeLensRows: newState.codeLensRows,
|
|
30127
|
+
deltaX: newState.deltaX,
|
|
30128
|
+
diagnostics: diagnostics || [],
|
|
30129
|
+
endOfLineDecorations,
|
|
30130
|
+
highlightedLine,
|
|
30131
|
+
horizontalVirtualizationThreshold: newState.horizontalVirtualizationThreshold,
|
|
30132
|
+
horizontalVisibleRanges: newState.horizontalVisibleRanges,
|
|
30133
|
+
lineNumbers: true,
|
|
30134
|
+
lines: newState.lines,
|
|
30135
|
+
problemsHighlightedRow: newState.problemsHighlightedRow,
|
|
30136
|
+
rtl: newState.rtl,
|
|
30137
|
+
tabSize: newState.tabSize,
|
|
30138
|
+
visibleLineIndices,
|
|
30139
|
+
visibleViewLineIndices,
|
|
30140
|
+
width: newState.width
|
|
30141
|
+
});
|
|
29936
30142
|
return [/* method */'setText', dom];
|
|
29937
30143
|
},
|
|
29938
30144
|
isEqual: (oldState, newState) => oldState.lines === newState.lines && oldState.codeLensRows === newState.codeLensRows && oldState.foldingRanges === newState.foldingRanges && oldState.visibleViewLineIndices === newState.visibleViewLineIndices && oldState.tokenizerId === newState.tokenizerId && oldState.minLineY === newState.minLineY && oldState.decorations === newState.decorations && oldState.embeds === newState.embeds && oldState.endOfLineDecorations === newState.endOfLineDecorations && oldState.diagnostics === newState.diagnostics && oldState.deltaX === newState.deltaX && oldState.charWidth === newState.charWidth && oldState.tabSize === newState.tabSize && oldState.rtl === newState.rtl && oldState.gutterWidth === newState.gutterWidth && oldState.horizontalVirtualizationThreshold === newState.horizontalVirtualizationThreshold && oldState.fontFamily === newState.fontFamily && oldState.fontSize === newState.fontSize && oldState.fontWeight === newState.fontWeight && oldState.letterSpacing === newState.letterSpacing && oldState.isMonospaceFont === newState.isMonospaceFont && oldState.width === newState.width && oldState.highlightedLine === newState.highlightedLine && oldState.problemsHighlightedRow === newState.problemsHighlightedRow && oldState.debugEnabled === newState.debugEnabled
|
|
@@ -29991,7 +30197,7 @@ const renderGutterInfo = {
|
|
|
29991
30197
|
visibleLineIndices,
|
|
29992
30198
|
visibleViewLineIndices = []
|
|
29993
30199
|
} = newState;
|
|
29994
|
-
if (!lineNumbers &&
|
|
30200
|
+
if (!lineNumbers && lightBulbRowIndex === -1 && breakPoints.length === 0 && gutterDecorations.length === 0) {
|
|
29995
30201
|
return ['renderGutter', []];
|
|
29996
30202
|
}
|
|
29997
30203
|
const gutterLineIndices = visibleViewLineIndices.length > 0 ? visibleViewLineIndices : visibleLineIndices;
|
|
@@ -30332,10 +30538,10 @@ const toggleMinimap = async () => {
|
|
|
30332
30538
|
};
|
|
30333
30539
|
|
|
30334
30540
|
/**
|
|
30335
|
-
|
|
30336
|
-
|
|
30337
|
-
|
|
30338
|
-
|
|
30541
|
+
Unregister a listener for editor events
|
|
30542
|
+
@param listenerType - The type of event to stop listening for
|
|
30543
|
+
@param rpcId - The RPC ID of the listener to unregister
|
|
30544
|
+
*/
|
|
30339
30545
|
const unregisterListener = (listenerType, rpcId) => {
|
|
30340
30546
|
number(listenerType);
|
|
30341
30547
|
number(rpcId);
|
|
@@ -30373,7 +30579,7 @@ const updateDebugInfo = async debugId => {
|
|
|
30373
30579
|
};
|
|
30374
30580
|
set$b(key, oldState, newEditor);
|
|
30375
30581
|
// @ts-ignore
|
|
30376
|
-
await
|
|
30582
|
+
await rerenderEditor(key);
|
|
30377
30583
|
};
|
|
30378
30584
|
|
|
30379
30585
|
const handleMouseDownAndRender = (uid, ...args) => {
|