@lvce-editor/editor-worker 19.38.0 → 19.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/editorWorkerMain.js +481 -112
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -1032,6 +1032,34 @@ const listen$1 = async (module, options) => {
|
|
|
1032
1032
|
return ipc;
|
|
1033
1033
|
};
|
|
1034
1034
|
|
|
1035
|
+
const createSharedLazyRpc = factory => {
|
|
1036
|
+
let rpcPromise;
|
|
1037
|
+
const getOrCreate = () => {
|
|
1038
|
+
if (!rpcPromise) {
|
|
1039
|
+
rpcPromise = factory();
|
|
1040
|
+
}
|
|
1041
|
+
return rpcPromise;
|
|
1042
|
+
};
|
|
1043
|
+
return {
|
|
1044
|
+
async dispose() {
|
|
1045
|
+
const rpc = await getOrCreate();
|
|
1046
|
+
await rpc.dispose();
|
|
1047
|
+
},
|
|
1048
|
+
async invoke(method, ...params) {
|
|
1049
|
+
const rpc = await getOrCreate();
|
|
1050
|
+
return rpc.invoke(method, ...params);
|
|
1051
|
+
},
|
|
1052
|
+
async invokeAndTransfer(method, ...params) {
|
|
1053
|
+
const rpc = await getOrCreate();
|
|
1054
|
+
return rpc.invokeAndTransfer(method, ...params);
|
|
1055
|
+
},
|
|
1056
|
+
async send(method, ...params) {
|
|
1057
|
+
const rpc = await getOrCreate();
|
|
1058
|
+
rpc.send(method, ...params);
|
|
1059
|
+
}
|
|
1060
|
+
};
|
|
1061
|
+
};
|
|
1062
|
+
|
|
1035
1063
|
const create$f = async ({
|
|
1036
1064
|
commandMap,
|
|
1037
1065
|
isMessagePortOpen = true,
|
|
@@ -1067,34 +1095,6 @@ const create$e = async ({
|
|
|
1067
1095
|
});
|
|
1068
1096
|
};
|
|
1069
1097
|
|
|
1070
|
-
const createSharedLazyRpc = factory => {
|
|
1071
|
-
let rpcPromise;
|
|
1072
|
-
const getOrCreate = () => {
|
|
1073
|
-
if (!rpcPromise) {
|
|
1074
|
-
rpcPromise = factory();
|
|
1075
|
-
}
|
|
1076
|
-
return rpcPromise;
|
|
1077
|
-
};
|
|
1078
|
-
return {
|
|
1079
|
-
async dispose() {
|
|
1080
|
-
const rpc = await getOrCreate();
|
|
1081
|
-
await rpc.dispose();
|
|
1082
|
-
},
|
|
1083
|
-
async invoke(method, ...params) {
|
|
1084
|
-
const rpc = await getOrCreate();
|
|
1085
|
-
return rpc.invoke(method, ...params);
|
|
1086
|
-
},
|
|
1087
|
-
async invokeAndTransfer(method, ...params) {
|
|
1088
|
-
const rpc = await getOrCreate();
|
|
1089
|
-
return rpc.invokeAndTransfer(method, ...params);
|
|
1090
|
-
},
|
|
1091
|
-
async send(method, ...params) {
|
|
1092
|
-
const rpc = await getOrCreate();
|
|
1093
|
-
rpc.send(method, ...params);
|
|
1094
|
-
}
|
|
1095
|
-
};
|
|
1096
|
-
};
|
|
1097
|
-
|
|
1098
1098
|
const create$d = async ({
|
|
1099
1099
|
commandMap,
|
|
1100
1100
|
isMessagePortOpen,
|
|
@@ -1228,7 +1228,7 @@ const Article = 27;
|
|
|
1228
1228
|
const Aside = 28;
|
|
1229
1229
|
const Footer = 29;
|
|
1230
1230
|
const Header = 30;
|
|
1231
|
-
const Nav = 40;
|
|
1231
|
+
const Nav$1 = 40;
|
|
1232
1232
|
const Section = 41;
|
|
1233
1233
|
const Search = 42;
|
|
1234
1234
|
const Dd = 43;
|
|
@@ -1332,7 +1332,7 @@ const VirtualDomElements = {
|
|
|
1332
1332
|
Line,
|
|
1333
1333
|
Main,
|
|
1334
1334
|
Meta,
|
|
1335
|
-
Nav,
|
|
1335
|
+
Nav: Nav$1,
|
|
1336
1336
|
Ol,
|
|
1337
1337
|
Option,
|
|
1338
1338
|
P,
|
|
@@ -1406,6 +1406,7 @@ const KeyZ = 54;
|
|
|
1406
1406
|
const F2 = 58;
|
|
1407
1407
|
const F3 = 59;
|
|
1408
1408
|
const F4 = 60;
|
|
1409
|
+
const F8 = 64;
|
|
1409
1410
|
const F9 = 65;
|
|
1410
1411
|
const F12 = 68;
|
|
1411
1412
|
const Period = 87;
|
|
@@ -3566,8 +3567,9 @@ const resize = (state, dimensions, columnWidth = state.columnWidth) => {
|
|
|
3566
3567
|
const x = dimensions.x ?? state.x;
|
|
3567
3568
|
const y = dimensions.y ?? state.y;
|
|
3568
3569
|
const outerWidth = dimensions.width ?? state.outerWidth ?? state.width;
|
|
3570
|
+
const outerHeight = dimensions.height ?? state.outerHeight ?? state.height;
|
|
3569
3571
|
const width$1 = Math.max(outerWidth - (state.minimapEnabled ? width : 0), 0);
|
|
3570
|
-
const height =
|
|
3572
|
+
const height = Math.max(outerHeight - (state.breadcrumbsEnabled ? 22 : 0), 0);
|
|
3571
3573
|
const numberOfVisibleLines = Math.floor(height / state.itemHeight);
|
|
3572
3574
|
if (!('foldingRanges' in state)) {
|
|
3573
3575
|
const total = state.lines.length;
|
|
@@ -3591,6 +3593,9 @@ const resize = (state, dimensions, columnWidth = state.columnWidth) => {
|
|
|
3591
3593
|
...('outerWidth' in state && {
|
|
3592
3594
|
outerWidth
|
|
3593
3595
|
}),
|
|
3596
|
+
...('outerHeight' in state && {
|
|
3597
|
+
outerHeight
|
|
3598
|
+
}),
|
|
3594
3599
|
scrollBarHeight,
|
|
3595
3600
|
width: width$1,
|
|
3596
3601
|
x,
|
|
@@ -3605,6 +3610,9 @@ const resize = (state, dimensions, columnWidth = state.columnWidth) => {
|
|
|
3605
3610
|
...('outerWidth' in state && {
|
|
3606
3611
|
outerWidth
|
|
3607
3612
|
}),
|
|
3613
|
+
...('outerHeight' in state && {
|
|
3614
|
+
outerHeight
|
|
3615
|
+
}),
|
|
3608
3616
|
width: width$1,
|
|
3609
3617
|
x,
|
|
3610
3618
|
y
|
|
@@ -4352,6 +4360,69 @@ const updateColorPickerValue$1 = async (editor, value) => {
|
|
|
4352
4360
|
};
|
|
4353
4361
|
};
|
|
4354
4362
|
|
|
4363
|
+
const diagnosticContainsPosition = (diagnostic, rowIndex, columnIndex) => {
|
|
4364
|
+
const {
|
|
4365
|
+
columnIndex: startColumnIndex,
|
|
4366
|
+
endColumnIndex,
|
|
4367
|
+
endRowIndex,
|
|
4368
|
+
rowIndex: startRowIndex
|
|
4369
|
+
} = diagnostic;
|
|
4370
|
+
if (rowIndex < startRowIndex || rowIndex > endRowIndex) {
|
|
4371
|
+
return false;
|
|
4372
|
+
}
|
|
4373
|
+
if (startRowIndex === endRowIndex && startColumnIndex === endColumnIndex) {
|
|
4374
|
+
return rowIndex === startRowIndex && columnIndex === startColumnIndex;
|
|
4375
|
+
}
|
|
4376
|
+
if (rowIndex === startRowIndex && columnIndex < startColumnIndex) {
|
|
4377
|
+
return false;
|
|
4378
|
+
}
|
|
4379
|
+
if (rowIndex === endRowIndex && columnIndex >= endColumnIndex) {
|
|
4380
|
+
return false;
|
|
4381
|
+
}
|
|
4382
|
+
return true;
|
|
4383
|
+
};
|
|
4384
|
+
|
|
4385
|
+
const getOffsetAtCursor$1 = editor => {
|
|
4386
|
+
const {
|
|
4387
|
+
selections
|
|
4388
|
+
} = editor;
|
|
4389
|
+
const rowIndex = selections[0];
|
|
4390
|
+
const columnIndex = selections[1];
|
|
4391
|
+
const offset = offsetAt(editor, rowIndex, columnIndex);
|
|
4392
|
+
return offset;
|
|
4393
|
+
};
|
|
4394
|
+
|
|
4395
|
+
const hasDiagnosticAtPosition = (diagnostics, rowIndex, columnIndex) => diagnostics.some(diagnostic => diagnosticContainsPosition(diagnostic, rowIndex, columnIndex));
|
|
4396
|
+
const getLightBulbRowIndex = async editor => {
|
|
4397
|
+
const {
|
|
4398
|
+
diagnostics = [],
|
|
4399
|
+
languageId,
|
|
4400
|
+
selections,
|
|
4401
|
+
uri
|
|
4402
|
+
} = editor;
|
|
4403
|
+
if (!selections || selections.length !== 4 || selections[0] !== selections[2] || selections[1] !== selections[3]) {
|
|
4404
|
+
return -1;
|
|
4405
|
+
}
|
|
4406
|
+
const rowIndex = selections[0];
|
|
4407
|
+
const columnIndex = selections[1];
|
|
4408
|
+
if (!hasDiagnosticAtPosition(diagnostics, rowIndex, columnIndex)) {
|
|
4409
|
+
return -1;
|
|
4410
|
+
}
|
|
4411
|
+
const textDocument = {
|
|
4412
|
+
documentId: editor.uid,
|
|
4413
|
+
languageId,
|
|
4414
|
+
text: getText$1(editor),
|
|
4415
|
+
uri
|
|
4416
|
+
};
|
|
4417
|
+
const offset = getOffsetAtCursor$1(editor);
|
|
4418
|
+
try {
|
|
4419
|
+
const actions = await invoke$d('Extensions.executeCodeActionProviders', textDocument, offset);
|
|
4420
|
+
return Array.isArray(actions) && actions.length > 0 ? rowIndex : -1;
|
|
4421
|
+
} catch {
|
|
4422
|
+
return -1;
|
|
4423
|
+
}
|
|
4424
|
+
};
|
|
4425
|
+
|
|
4355
4426
|
const maxTokenizerLoadPasses = 10;
|
|
4356
4427
|
const getLine = (lineState, embeddedResults, tokenMap, lineLength) => {
|
|
4357
4428
|
const embeddedResult = embeddedResults[lineState?.embeddedResultIndex];
|
|
@@ -4435,6 +4506,7 @@ const shouldUpdateDiagnosticData = (oldState, newState) => {
|
|
|
4435
4506
|
const shouldUpdateSelectionData = (oldState, newState) => {
|
|
4436
4507
|
return oldState.selections !== newState.selections || oldState.focused !== newState.focused || oldState.minLineY !== newState.minLineY || oldState.maxLineY !== newState.maxLineY || oldState.foldingRanges !== newState.foldingRanges || oldState.differences !== newState.differences || oldState.charWidth !== newState.charWidth || oldState.cursorWidth !== newState.cursorWidth || oldState.fontFamily !== newState.fontFamily || oldState.fontSize !== newState.fontSize || oldState.fontWeight !== newState.fontWeight || oldState.isMonospaceFont !== newState.isMonospaceFont || oldState.letterSpacing !== newState.letterSpacing || oldState.lines !== newState.lines || oldState.rowHeight !== newState.rowHeight || oldState.tabSize !== newState.tabSize || oldState.width !== newState.width;
|
|
4437
4508
|
};
|
|
4509
|
+
const shouldUpdateLightBulb = (oldState, newState) => oldState.diagnostics !== newState.diagnostics || oldState.languageId !== newState.languageId || oldState.selections !== newState.selections || oldState.uri !== newState.uri;
|
|
4438
4510
|
const shouldUpdateVisibleTextData = (oldState, newState) => {
|
|
4439
4511
|
if (oldState.textInfos !== newState.textInfos || oldState.differences !== newState.differences) {
|
|
4440
4512
|
return false;
|
|
@@ -4481,6 +4553,17 @@ const updateDerivedState = async (oldState, newState) => {
|
|
|
4481
4553
|
visualDecorations
|
|
4482
4554
|
};
|
|
4483
4555
|
}
|
|
4556
|
+
if (oldState.lines !== nextState.lines) {
|
|
4557
|
+
finalState = {
|
|
4558
|
+
...finalState,
|
|
4559
|
+
lightBulbRowIndex: -1
|
|
4560
|
+
};
|
|
4561
|
+
} else if (shouldUpdateLightBulb(oldState, nextState)) {
|
|
4562
|
+
finalState = {
|
|
4563
|
+
...finalState,
|
|
4564
|
+
lightBulbRowIndex: await getLightBulbRowIndex(finalState)
|
|
4565
|
+
};
|
|
4566
|
+
}
|
|
4484
4567
|
if (!shouldUpdateSelectionData(oldState, nextState)) {
|
|
4485
4568
|
return finalState;
|
|
4486
4569
|
}
|
|
@@ -4590,6 +4673,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
|
|
|
4590
4673
|
const editor = {
|
|
4591
4674
|
additionalFocus: 0,
|
|
4592
4675
|
assetDir,
|
|
4676
|
+
breadcrumbsEnabled: false,
|
|
4593
4677
|
breakPoints: [],
|
|
4594
4678
|
charWidth: 0,
|
|
4595
4679
|
columnWidth: 0,
|
|
@@ -4605,6 +4689,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
|
|
|
4605
4689
|
diagnostics: [],
|
|
4606
4690
|
diagnosticsEnabled: false,
|
|
4607
4691
|
differences: [],
|
|
4692
|
+
documentSymbols: [],
|
|
4608
4693
|
embeds: [],
|
|
4609
4694
|
endOfLineDecorations: [],
|
|
4610
4695
|
finalDeltaY: 0,
|
|
@@ -4635,6 +4720,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
|
|
|
4635
4720
|
itemHeight: 20,
|
|
4636
4721
|
languageId: '',
|
|
4637
4722
|
letterSpacing: 0,
|
|
4723
|
+
lightBulbRowIndex: -1,
|
|
4638
4724
|
lineCache: [],
|
|
4639
4725
|
lineNumbers: false,
|
|
4640
4726
|
lines: [],
|
|
@@ -4648,6 +4734,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
|
|
|
4648
4734
|
modified: false,
|
|
4649
4735
|
numberOfLines: 0,
|
|
4650
4736
|
numberOfVisibleLines: 0,
|
|
4737
|
+
outerHeight: height,
|
|
4651
4738
|
outerWidth: width,
|
|
4652
4739
|
platform,
|
|
4653
4740
|
primarySelectionIndex: 0,
|
|
@@ -4678,6 +4765,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
|
|
|
4678
4765
|
widgetRevision: 0,
|
|
4679
4766
|
widgets: [],
|
|
4680
4767
|
width,
|
|
4768
|
+
workspaceUri: '',
|
|
4681
4769
|
x,
|
|
4682
4770
|
y
|
|
4683
4771
|
};
|
|
@@ -4685,6 +4773,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
|
|
|
4685
4773
|
};
|
|
4686
4774
|
|
|
4687
4775
|
const emptyEditor = {
|
|
4776
|
+
breadcrumbsEnabled: false,
|
|
4688
4777
|
breakPoints: [],
|
|
4689
4778
|
cursorInfos: [],
|
|
4690
4779
|
debugEnabled: false,
|
|
@@ -4693,6 +4782,7 @@ const emptyEditor = {
|
|
|
4693
4782
|
deltaY: 0,
|
|
4694
4783
|
diagnostics: [],
|
|
4695
4784
|
differences: [],
|
|
4785
|
+
documentSymbols: [],
|
|
4696
4786
|
embeds: [],
|
|
4697
4787
|
endOfLineDecorations: [],
|
|
4698
4788
|
focused: false,
|
|
@@ -4712,6 +4802,7 @@ const emptyEditor = {
|
|
|
4712
4802
|
minimapLines: [],
|
|
4713
4803
|
minimapRevision: 0,
|
|
4714
4804
|
minLineY: 0,
|
|
4805
|
+
outerHeight: 0,
|
|
4715
4806
|
outerWidth: 0,
|
|
4716
4807
|
redoStack: [],
|
|
4717
4808
|
scrollBarHeight: 0,
|
|
@@ -4731,6 +4822,7 @@ const emptyEditor = {
|
|
|
4731
4822
|
uri: '',
|
|
4732
4823
|
visibleLineIndices: [],
|
|
4733
4824
|
width: 0,
|
|
4825
|
+
workspaceUri: '',
|
|
4734
4826
|
x: 0,
|
|
4735
4827
|
y: 0
|
|
4736
4828
|
};
|
|
@@ -5062,7 +5154,7 @@ const isEqual$3 = (oldState, newState) => {
|
|
|
5062
5154
|
};
|
|
5063
5155
|
|
|
5064
5156
|
const isEqual$2 = (oldState, newState) => {
|
|
5065
|
-
return oldState.breakPoints === newState.breakPoints && oldState.cursorInfos === newState.cursorInfos && oldState.diagnostics === newState.diagnostics && oldState.endOfLineDecorations === newState.endOfLineDecorations && oldState.highlightedLine === newState.highlightedLine && oldState.lineNumbers === newState.lineNumbers && oldState.loadError === newState.loadError && oldState.textInfos === newState.textInfos && oldState.differences === newState.differences && oldState.initial === newState.initial && oldState.selectionInfos === newState.selectionInfos;
|
|
5157
|
+
return oldState.breadcrumbsEnabled === newState.breadcrumbsEnabled && oldState.breakPoints === newState.breakPoints && oldState.cursorInfos === newState.cursorInfos && oldState.diagnostics === newState.diagnostics && oldState.documentSymbols === newState.documentSymbols && oldState.endOfLineDecorations === newState.endOfLineDecorations && oldState.highlightedLine === newState.highlightedLine && oldState.lineNumbers === newState.lineNumbers && oldState.loadError === newState.loadError && oldState.textInfos === newState.textInfos && oldState.differences === newState.differences && oldState.initial === newState.initial && oldState.selectionInfos === newState.selectionInfos && oldState.selections === newState.selections && oldState.workspaceUri === newState.workspaceUri;
|
|
5066
5158
|
};
|
|
5067
5159
|
|
|
5068
5160
|
const isEqual$1 = (oldState, newState) => {
|
|
@@ -8320,6 +8412,52 @@ const handleMouseMoveWithAltKey = async (editor, x, y) => {
|
|
|
8320
8412
|
}
|
|
8321
8413
|
};
|
|
8322
8414
|
|
|
8415
|
+
const getDiagnosticHoverDetail = ({
|
|
8416
|
+
code,
|
|
8417
|
+
source
|
|
8418
|
+
}) => {
|
|
8419
|
+
if (code === undefined) {
|
|
8420
|
+
return source || '';
|
|
8421
|
+
}
|
|
8422
|
+
if (!source) {
|
|
8423
|
+
return String(code);
|
|
8424
|
+
}
|
|
8425
|
+
return `${source} (${code})`;
|
|
8426
|
+
};
|
|
8427
|
+
|
|
8428
|
+
const measureTextBlockHeight = async (text, fontFamily, fontSize, lineHeight, width) => {
|
|
8429
|
+
// @ts-ignore
|
|
8430
|
+
return invoke$a('MeasureTextHeight.measureTextBlockHeight', text, fontFamily, fontSize, lineHeight, width);
|
|
8431
|
+
};
|
|
8432
|
+
|
|
8433
|
+
const maximumWidth = 600;
|
|
8434
|
+
const horizontalPadding = 18;
|
|
8435
|
+
const getDiagnosticHoverInfo = async (editor, diagnostic) => {
|
|
8436
|
+
const {
|
|
8437
|
+
columnIndex,
|
|
8438
|
+
message,
|
|
8439
|
+
rowIndex
|
|
8440
|
+
} = diagnostic;
|
|
8441
|
+
const width = Math.min(maximumWidth, editor.width);
|
|
8442
|
+
const detail = getDiagnosticHoverDetail(diagnostic);
|
|
8443
|
+
const diagnosticText = detail ? `${message} ${detail}` : message;
|
|
8444
|
+
const measuredHeight = await measureTextBlockHeight(diagnosticText, editor.fontFamily, editor.fontSize, `${editor.rowHeight}px`, width - horizontalPadding);
|
|
8445
|
+
const height = Math.min(measuredHeight + 10, editor.height);
|
|
8446
|
+
const positionX = editor.x + columnIndex * editor.columnWidth - (editor.deltaX || 0);
|
|
8447
|
+
const x = Math.max(editor.x, Math.min(positionX, editor.x + editor.width - width));
|
|
8448
|
+
const rowBottom = editor.y + (rowIndex + 1) * editor.rowHeight - (editor.deltaY || 0);
|
|
8449
|
+
const y = rowBottom + height <= editor.y + editor.height ? rowBottom : Math.max(editor.y, rowBottom - editor.rowHeight - height);
|
|
8450
|
+
return {
|
|
8451
|
+
diagnostics: [diagnostic],
|
|
8452
|
+
documentation: '',
|
|
8453
|
+
height,
|
|
8454
|
+
lineInfos: [],
|
|
8455
|
+
width,
|
|
8456
|
+
x,
|
|
8457
|
+
y
|
|
8458
|
+
};
|
|
8459
|
+
};
|
|
8460
|
+
|
|
8323
8461
|
const create$5 = () => {
|
|
8324
8462
|
const uid = create$8();
|
|
8325
8463
|
const widget = {
|
|
@@ -8380,11 +8518,6 @@ const getHover = async (editor, offset) => {
|
|
|
8380
8518
|
return hover;
|
|
8381
8519
|
};
|
|
8382
8520
|
|
|
8383
|
-
const measureTextBlockHeight = async (text, fontFamily, fontSize, lineHeight, width) => {
|
|
8384
|
-
// @ts-ignore
|
|
8385
|
-
return invoke$a('MeasureTextHeight.measureTextBlockHeight', text, fontFamily, fontSize, lineHeight, width);
|
|
8386
|
-
};
|
|
8387
|
-
|
|
8388
8521
|
const getLineInfo = (line, tokens, TokenMap) => {
|
|
8389
8522
|
const tokensLength = tokens.length;
|
|
8390
8523
|
let end = 0;
|
|
@@ -8435,28 +8568,10 @@ const tokenizeCodeBlock = async (codeBlock, languageId, tokenizerPath) => {
|
|
|
8435
8568
|
return lineInfos;
|
|
8436
8569
|
};
|
|
8437
8570
|
|
|
8438
|
-
const containsPosition = (diagnostic, rowIndex, columnIndex) => {
|
|
8439
|
-
const {
|
|
8440
|
-
columnIndex: startColumnIndex,
|
|
8441
|
-
endColumnIndex,
|
|
8442
|
-
endRowIndex,
|
|
8443
|
-
rowIndex: startRowIndex
|
|
8444
|
-
} = diagnostic;
|
|
8445
|
-
if (rowIndex < startRowIndex || rowIndex > endRowIndex) {
|
|
8446
|
-
return false;
|
|
8447
|
-
}
|
|
8448
|
-
if (rowIndex === startRowIndex && columnIndex < startColumnIndex) {
|
|
8449
|
-
return false;
|
|
8450
|
-
}
|
|
8451
|
-
if (rowIndex === endRowIndex && columnIndex >= endColumnIndex) {
|
|
8452
|
-
return false;
|
|
8453
|
-
}
|
|
8454
|
-
return true;
|
|
8455
|
-
};
|
|
8456
8571
|
const getMatchingDiagnostics = (diagnostics, rowIndex, columnIndex) => {
|
|
8457
8572
|
const matching = [];
|
|
8458
8573
|
for (const diagnostic of diagnostics) {
|
|
8459
|
-
if (
|
|
8574
|
+
if (diagnosticContainsPosition(diagnostic, rowIndex, columnIndex)) {
|
|
8460
8575
|
matching.push(diagnostic);
|
|
8461
8576
|
}
|
|
8462
8577
|
}
|
|
@@ -8573,10 +8688,17 @@ const updateWidget = (editor, widgetId, newState) => {
|
|
|
8573
8688
|
const getHoverWidgetIndex = widgets => {
|
|
8574
8689
|
return widgets.findIndex(widget => widget.id === Hover);
|
|
8575
8690
|
};
|
|
8576
|
-
const
|
|
8691
|
+
const applyHoverContent = async (editor, getNewState) => {
|
|
8692
|
+
const {
|
|
8693
|
+
widgets = []
|
|
8694
|
+
} = editor;
|
|
8695
|
+
const widgetIndex = getHoverWidgetIndex(widgets);
|
|
8696
|
+
if (widgetIndex === -1) {
|
|
8697
|
+
return addWidgetToEditor(Hover, FocusEditorHover, editor, create$5, getNewState);
|
|
8698
|
+
}
|
|
8577
8699
|
const widgetRevision = next(editor.uid);
|
|
8578
|
-
const widget =
|
|
8579
|
-
const newState = await
|
|
8700
|
+
const widget = widgets[widgetIndex];
|
|
8701
|
+
const newState = await getNewState(widget.newState);
|
|
8580
8702
|
if (get$2(editor.uid) !== widgetRevision) {
|
|
8581
8703
|
return editor;
|
|
8582
8704
|
}
|
|
@@ -8595,17 +8717,20 @@ const updateHover = async (editor, widgetIndex, position) => {
|
|
|
8595
8717
|
};
|
|
8596
8718
|
};
|
|
8597
8719
|
const showHover$1 = async (editor, position) => {
|
|
8598
|
-
const {
|
|
8599
|
-
widgets = []
|
|
8600
|
-
} = editor;
|
|
8601
|
-
const widgetIndex = getHoverWidgetIndex(widgets);
|
|
8602
|
-
if (widgetIndex !== -1) {
|
|
8603
|
-
return updateHover(editor, widgetIndex, position);
|
|
8604
|
-
}
|
|
8605
8720
|
const newStateGenerator = async state => {
|
|
8606
8721
|
return loadHoverContent(state, position);
|
|
8607
8722
|
};
|
|
8608
|
-
return
|
|
8723
|
+
return applyHoverContent(editor, newStateGenerator);
|
|
8724
|
+
};
|
|
8725
|
+
const showDiagnostic = async (editor, diagnostic) => {
|
|
8726
|
+
const newStateGenerator = async state => {
|
|
8727
|
+
const hoverInfo = await getDiagnosticHoverInfo(editor, diagnostic);
|
|
8728
|
+
return {
|
|
8729
|
+
...state,
|
|
8730
|
+
...hoverInfo
|
|
8731
|
+
};
|
|
8732
|
+
};
|
|
8733
|
+
return applyHoverContent(editor, newStateGenerator);
|
|
8609
8734
|
};
|
|
8610
8735
|
|
|
8611
8736
|
const showHover = async (editor, position, token) => {
|
|
@@ -9333,6 +9458,74 @@ const insertLineBreak = async editor => {
|
|
|
9333
9458
|
return scheduleDocumentAndCursorsSelections(editor, changes, selectionChanges);
|
|
9334
9459
|
};
|
|
9335
9460
|
|
|
9461
|
+
const compareDiagnostics = (left, right) => {
|
|
9462
|
+
return left.rowIndex - right.rowIndex || left.columnIndex - right.columnIndex || left.endRowIndex - right.endRowIndex || left.endColumnIndex - right.endColumnIndex || left.message.localeCompare(right.message) || left.source.localeCompare(right.source) || String(left.code).localeCompare(String(right.code));
|
|
9463
|
+
};
|
|
9464
|
+
const isSelectionAtDiagnostic = (selections, diagnostic) => {
|
|
9465
|
+
return selections.length >= 4 && selections[0] === diagnostic.rowIndex && selections[1] === diagnostic.columnIndex && selections[2] === diagnostic.endRowIndex && selections[3] === diagnostic.endColumnIndex;
|
|
9466
|
+
};
|
|
9467
|
+
const comparePosition = (diagnostic, rowIndex, columnIndex) => {
|
|
9468
|
+
return diagnostic.rowIndex - rowIndex || diagnostic.columnIndex - columnIndex;
|
|
9469
|
+
};
|
|
9470
|
+
const getDiagnosticNavigationIndex = (diagnostics, selections, currentDiagnostic, direction) => {
|
|
9471
|
+
if (diagnostics.length === 0) {
|
|
9472
|
+
return undefined;
|
|
9473
|
+
}
|
|
9474
|
+
const orderedDiagnostics = diagnostics.toSorted(compareDiagnostics);
|
|
9475
|
+
const currentIndex = currentDiagnostic ? orderedDiagnostics.indexOf(currentDiagnostic) : -1;
|
|
9476
|
+
if (currentDiagnostic && currentIndex !== -1 && isSelectionAtDiagnostic(selections, currentDiagnostic)) {
|
|
9477
|
+
const index = (currentIndex + direction + orderedDiagnostics.length) % orderedDiagnostics.length;
|
|
9478
|
+
return {
|
|
9479
|
+
diagnostic: orderedDiagnostics[index],
|
|
9480
|
+
index
|
|
9481
|
+
};
|
|
9482
|
+
}
|
|
9483
|
+
const rowIndex = selections[2] ?? selections[0] ?? 0;
|
|
9484
|
+
const columnIndex = selections[3] ?? selections[1] ?? 0;
|
|
9485
|
+
if (direction === 1) {
|
|
9486
|
+
const index = orderedDiagnostics.findIndex(diagnostic => comparePosition(diagnostic, rowIndex, columnIndex) > 0);
|
|
9487
|
+
const wrappedIndex = index === -1 ? 0 : index;
|
|
9488
|
+
return {
|
|
9489
|
+
diagnostic: orderedDiagnostics[wrappedIndex],
|
|
9490
|
+
index: wrappedIndex
|
|
9491
|
+
};
|
|
9492
|
+
}
|
|
9493
|
+
const index = orderedDiagnostics.findLastIndex(diagnostic => comparePosition(diagnostic, rowIndex, columnIndex) < 0);
|
|
9494
|
+
const wrappedIndex = index === -1 ? orderedDiagnostics.length - 1 : index;
|
|
9495
|
+
return {
|
|
9496
|
+
diagnostic: orderedDiagnostics[wrappedIndex],
|
|
9497
|
+
index: wrappedIndex
|
|
9498
|
+
};
|
|
9499
|
+
};
|
|
9500
|
+
|
|
9501
|
+
const navigateDiagnostic = async (editor, direction) => {
|
|
9502
|
+
const {
|
|
9503
|
+
diagnostics = [],
|
|
9504
|
+
problemNavigationDiagnostic,
|
|
9505
|
+
selections
|
|
9506
|
+
} = editor;
|
|
9507
|
+
const result = getDiagnosticNavigationIndex(diagnostics, selections, problemNavigationDiagnostic, direction);
|
|
9508
|
+
if (!result) {
|
|
9509
|
+
return editor;
|
|
9510
|
+
}
|
|
9511
|
+
const {
|
|
9512
|
+
diagnostic
|
|
9513
|
+
} = result;
|
|
9514
|
+
const newSelections = new Uint32Array([diagnostic.rowIndex, diagnostic.columnIndex, diagnostic.endRowIndex, diagnostic.endColumnIndex]);
|
|
9515
|
+
const editorWithSelection = scheduleSelections(editor, newSelections);
|
|
9516
|
+
const editorWithNavigationState = {
|
|
9517
|
+
...editorWithSelection,
|
|
9518
|
+
problemNavigationDiagnostic: diagnostic
|
|
9519
|
+
};
|
|
9520
|
+
return showDiagnostic(editorWithNavigationState, diagnostic);
|
|
9521
|
+
};
|
|
9522
|
+
const nextDiagnostic = editor => {
|
|
9523
|
+
return navigateDiagnostic(editor, 1);
|
|
9524
|
+
};
|
|
9525
|
+
const previousDiagnostic = editor => {
|
|
9526
|
+
return navigateDiagnostic(editor, -1);
|
|
9527
|
+
};
|
|
9528
|
+
|
|
9336
9529
|
const Script = 2;
|
|
9337
9530
|
const Unknown$1 = 0;
|
|
9338
9531
|
|
|
@@ -9904,16 +10097,6 @@ const openFind = async state => {
|
|
|
9904
10097
|
return openFind2(state);
|
|
9905
10098
|
};
|
|
9906
10099
|
|
|
9907
|
-
const getOffsetAtCursor$1 = editor => {
|
|
9908
|
-
const {
|
|
9909
|
-
selections
|
|
9910
|
-
} = editor;
|
|
9911
|
-
const rowIndex = selections[0];
|
|
9912
|
-
const columnIndex = selections[1];
|
|
9913
|
-
const offset = offsetAt(editor, rowIndex, columnIndex);
|
|
9914
|
-
return offset;
|
|
9915
|
-
};
|
|
9916
|
-
|
|
9917
10100
|
const getPositionAtCursor$1 = editor => {
|
|
9918
10101
|
const {
|
|
9919
10102
|
selections
|
|
@@ -11777,24 +11960,13 @@ const HandleScrollBarVerticalPointerMove = 31;
|
|
|
11777
11960
|
const HandleScrollBarVerticalPointerUp = 32;
|
|
11778
11961
|
const HandleWheel = 33;
|
|
11779
11962
|
const HandleKeyUp = 34;
|
|
11780
|
-
|
|
11781
|
-
const getDiagnosticHoverDetail = ({
|
|
11782
|
-
code,
|
|
11783
|
-
source
|
|
11784
|
-
}) => {
|
|
11785
|
-
if (code === undefined) {
|
|
11786
|
-
return source || '';
|
|
11787
|
-
}
|
|
11788
|
-
if (!source) {
|
|
11789
|
-
return String(code);
|
|
11790
|
-
}
|
|
11791
|
-
return `${source} (${code})`;
|
|
11792
|
-
};
|
|
11963
|
+
const HandleLightBulbClick = 35;
|
|
11793
11964
|
|
|
11794
11965
|
const Div = 4;
|
|
11795
11966
|
const Input = 6;
|
|
11796
11967
|
const Span = 8;
|
|
11797
11968
|
const Text = 12;
|
|
11969
|
+
const Nav = 40;
|
|
11798
11970
|
const TextArea = 62;
|
|
11799
11971
|
|
|
11800
11972
|
const text = data => {
|
|
@@ -12240,6 +12412,14 @@ const getFindWidgetFocusKeyBindings = () => {
|
|
|
12240
12412
|
};
|
|
12241
12413
|
const getKeyBindings = () => {
|
|
12242
12414
|
return [{
|
|
12415
|
+
command: 'Editor.nextDiagnostic',
|
|
12416
|
+
key: F8,
|
|
12417
|
+
when: FocusEditorText
|
|
12418
|
+
}, {
|
|
12419
|
+
command: 'Editor.previousDiagnostic',
|
|
12420
|
+
key: Shift | F8,
|
|
12421
|
+
when: FocusEditorText
|
|
12422
|
+
}, {
|
|
12243
12423
|
command: 'Editor.closeColorPicker',
|
|
12244
12424
|
key: Escape,
|
|
12245
12425
|
when: FocusColorPicker
|
|
@@ -12851,6 +13031,21 @@ const handleMessagePort = async (port, rpcId) => {
|
|
|
12851
13031
|
}
|
|
12852
13032
|
};
|
|
12853
13033
|
|
|
13034
|
+
const getDocumentSymbols = async editor => {
|
|
13035
|
+
try {
|
|
13036
|
+
const result = await execute({
|
|
13037
|
+
args: [],
|
|
13038
|
+
editor,
|
|
13039
|
+
kind: 'document symbol',
|
|
13040
|
+
method: 'provideDocumentSymbols',
|
|
13041
|
+
noProviderFoundResult: []
|
|
13042
|
+
});
|
|
13043
|
+
return Array.isArray(result) ? result : [];
|
|
13044
|
+
} catch {
|
|
13045
|
+
return [];
|
|
13046
|
+
}
|
|
13047
|
+
};
|
|
13048
|
+
|
|
12854
13049
|
const kLineHeight = 'editor.lineHeight';
|
|
12855
13050
|
const kFontSize = 'editor.fontSize';
|
|
12856
13051
|
const kFontFamily = 'editor.fontFamily';
|
|
@@ -12864,6 +13059,7 @@ const kAutoClosingBrackets = 'editor.autoclosingBrackets';
|
|
|
12864
13059
|
const kFontWeight = 'editor.fontWeight';
|
|
12865
13060
|
const kHover = 'editor.hover';
|
|
12866
13061
|
const kMinimapEnabled = 'editor.minimap.enabled';
|
|
13062
|
+
const kBreadcrumbsEnabled = 'breadcrumbs.enabled';
|
|
12867
13063
|
const isAutoClosingBracketsEnabled = async () => {
|
|
12868
13064
|
return Boolean(await get$3(kAutoClosingBrackets));
|
|
12869
13065
|
};
|
|
@@ -12912,10 +13108,14 @@ const getFontWeight = async () => {
|
|
|
12912
13108
|
const getMinimapEnabled = async () => {
|
|
12913
13109
|
return (await get$3(kMinimapEnabled)) ?? false;
|
|
12914
13110
|
};
|
|
13111
|
+
const getBreadcrumbsEnabled = async () => {
|
|
13112
|
+
return (await get$3(kBreadcrumbsEnabled)) ?? false;
|
|
13113
|
+
};
|
|
12915
13114
|
|
|
12916
13115
|
const getEditorPreferences = async () => {
|
|
12917
|
-
const [diagnosticsEnabled$1, fontFamily, fontSize, fontWeight, hoverEnabled, isAutoClosingBracketsEnabled$1, isAutoClosingQuotesEnabled$1, isAutoClosingTagsEnabled$1, isQuickSuggestionsEnabled$1, lineNumbers, rowHeight, tabSize, letterSpacing, completionTriggerCharacters, minimapEnabled] = await Promise.all([diagnosticsEnabled(), getFontFamily(), getFontSize(), getFontWeight(), getHoverEnabled(), isAutoClosingBracketsEnabled(), isAutoClosingQuotesEnabled(), isAutoClosingTagsEnabled(), isQuickSuggestionsEnabled(), getLineNumbers(), getRowHeight(), getTabSize(), getLetterSpacing(), getCompletionTriggerCharacters(), getMinimapEnabled()]);
|
|
13116
|
+
const [diagnosticsEnabled$1, fontFamily, fontSize, fontWeight, hoverEnabled, isAutoClosingBracketsEnabled$1, isAutoClosingQuotesEnabled$1, isAutoClosingTagsEnabled$1, isQuickSuggestionsEnabled$1, lineNumbers, rowHeight, tabSize, letterSpacing, completionTriggerCharacters, minimapEnabled, breadcrumbsEnabled] = await Promise.all([diagnosticsEnabled(), getFontFamily(), getFontSize(), getFontWeight(), getHoverEnabled(), isAutoClosingBracketsEnabled(), isAutoClosingQuotesEnabled(), isAutoClosingTagsEnabled(), isQuickSuggestionsEnabled(), getLineNumbers(), getRowHeight(), getTabSize(), getLetterSpacing(), getCompletionTriggerCharacters(), getMinimapEnabled(), getBreadcrumbsEnabled()]);
|
|
12918
13117
|
return {
|
|
13118
|
+
breadcrumbsEnabled,
|
|
12919
13119
|
completionTriggerCharacters,
|
|
12920
13120
|
diagnosticsEnabled: diagnosticsEnabled$1,
|
|
12921
13121
|
fontFamily,
|
|
@@ -12934,9 +13134,17 @@ const getEditorPreferences = async () => {
|
|
|
12934
13134
|
};
|
|
12935
13135
|
};
|
|
12936
13136
|
|
|
13137
|
+
const getWorkspaceUri$1 = async () => {
|
|
13138
|
+
try {
|
|
13139
|
+
return await invoke$a('Workspace.getPath');
|
|
13140
|
+
} catch {
|
|
13141
|
+
return '';
|
|
13142
|
+
}
|
|
13143
|
+
};
|
|
12937
13144
|
const handleSettingsChanged = async state => {
|
|
12938
13145
|
const editorPreferences = await getEditorPreferences();
|
|
12939
13146
|
const {
|
|
13147
|
+
breadcrumbsEnabled,
|
|
12940
13148
|
diagnosticsEnabled,
|
|
12941
13149
|
fontFamily,
|
|
12942
13150
|
fontSize,
|
|
@@ -12958,7 +13166,19 @@ const handleSettingsChanged = async state => {
|
|
|
12958
13166
|
minimapRevision: (state.minimapRevision || 0) + (minimapEnabled ? 1 : 0),
|
|
12959
13167
|
visualDecorations: diagnosticsEnabled ? state.visualDecorations : []
|
|
12960
13168
|
};
|
|
12961
|
-
|
|
13169
|
+
let documentSymbols = state.documentSymbols || [];
|
|
13170
|
+
let workspaceUri = state.workspaceUri || '';
|
|
13171
|
+
if (!breadcrumbsEnabled) {
|
|
13172
|
+
documentSymbols = [];
|
|
13173
|
+
workspaceUri = '';
|
|
13174
|
+
} else if (!state.breadcrumbsEnabled) {
|
|
13175
|
+
[documentSymbols, workspaceUri] = await Promise.all([getDocumentSymbols(editorWithUpdatedSettings), getWorkspaceUri$1()]);
|
|
13176
|
+
}
|
|
13177
|
+
return resize({
|
|
13178
|
+
...editorWithUpdatedSettings,
|
|
13179
|
+
documentSymbols,
|
|
13180
|
+
workspaceUri
|
|
13181
|
+
}, {}, charWidth);
|
|
12962
13182
|
};
|
|
12963
13183
|
|
|
12964
13184
|
const applyTabCompletion = (editor, result) => {
|
|
@@ -13177,6 +13397,13 @@ const intialize = async (syntaxHighlightingEnabled, syncIncremental) => {
|
|
|
13177
13397
|
await initializeSyntaxHighlighting(syntaxHighlightingEnabled, syncIncremental);
|
|
13178
13398
|
};
|
|
13179
13399
|
|
|
13400
|
+
const getWorkspaceUri = async () => {
|
|
13401
|
+
try {
|
|
13402
|
+
return await invoke$a('Workspace.getPath');
|
|
13403
|
+
} catch {
|
|
13404
|
+
return '';
|
|
13405
|
+
}
|
|
13406
|
+
};
|
|
13180
13407
|
const getTokenizePath = (languages, languageId) => {
|
|
13181
13408
|
for (const language of languages) {
|
|
13182
13409
|
if (language?.id === languageId && language.tokenize) {
|
|
@@ -13223,6 +13450,7 @@ const loadContent = async (state, savedState) => {
|
|
|
13223
13450
|
y
|
|
13224
13451
|
} = state;
|
|
13225
13452
|
const {
|
|
13453
|
+
breadcrumbsEnabled,
|
|
13226
13454
|
completionTriggerCharacters,
|
|
13227
13455
|
diagnosticsEnabled,
|
|
13228
13456
|
fontFamily,
|
|
@@ -13251,6 +13479,7 @@ const loadContent = async (state, savedState) => {
|
|
|
13251
13479
|
set$3(newTokenizerId, tokenizer);
|
|
13252
13480
|
const newEditor0 = {
|
|
13253
13481
|
...state,
|
|
13482
|
+
breadcrumbsEnabled,
|
|
13254
13483
|
charWidth,
|
|
13255
13484
|
completionTriggerCharacters,
|
|
13256
13485
|
diagnosticsEnabled,
|
|
@@ -13309,13 +13538,23 @@ const loadContent = async (state, savedState) => {
|
|
|
13309
13538
|
...newEditor3,
|
|
13310
13539
|
decorations: linkDecorations
|
|
13311
13540
|
};
|
|
13541
|
+
let documentSymbols = state.documentSymbols || [];
|
|
13542
|
+
let workspaceUri = state.workspaceUri || '';
|
|
13543
|
+
if (breadcrumbsEnabled) {
|
|
13544
|
+
[documentSymbols, workspaceUri] = await Promise.all([getDocumentSymbols(newEditor3WithLinks), getWorkspaceUri()]);
|
|
13545
|
+
}
|
|
13546
|
+
const newEditor3WithBreadcrumbs = {
|
|
13547
|
+
...newEditor3WithLinks,
|
|
13548
|
+
documentSymbols,
|
|
13549
|
+
workspaceUri
|
|
13550
|
+
};
|
|
13312
13551
|
const syncIncremental = getEnabled();
|
|
13313
13552
|
const {
|
|
13314
13553
|
differences,
|
|
13315
13554
|
textInfos
|
|
13316
|
-
} = await getVisible$1(
|
|
13555
|
+
} = await getVisible$1(newEditor3WithBreadcrumbs, syncIncremental);
|
|
13317
13556
|
const newEditor4 = {
|
|
13318
|
-
...
|
|
13557
|
+
...newEditor3WithBreadcrumbs,
|
|
13319
13558
|
differences,
|
|
13320
13559
|
focus: FocusEditorText$1,
|
|
13321
13560
|
focused: true,
|
|
@@ -13761,6 +14000,92 @@ const Button = 'button';
|
|
|
13761
14000
|
const Code = 'code';
|
|
13762
14001
|
const TextBox = 'textbox';
|
|
13763
14002
|
|
|
14003
|
+
const getPathname = uri => {
|
|
14004
|
+
try {
|
|
14005
|
+
return decodeURIComponent(new URL(uri).pathname);
|
|
14006
|
+
} catch {
|
|
14007
|
+
return decodeURIComponent(uri);
|
|
14008
|
+
}
|
|
14009
|
+
};
|
|
14010
|
+
const getFileBreadcrumbs = (uri, workspaceUri) => {
|
|
14011
|
+
const path = getPathname(uri);
|
|
14012
|
+
const workspacePath = workspaceUri ? getPathname(workspaceUri).replace(/\/$/, '') : '';
|
|
14013
|
+
const relativePath = workspacePath && (path === workspacePath || path.startsWith(`${workspacePath}/`)) ? path.slice(workspacePath.length + 1) : path.split('/').at(-1) || path;
|
|
14014
|
+
return relativePath.split('/').filter(Boolean).map(label => ({
|
|
14015
|
+
kind: 'file',
|
|
14016
|
+
label
|
|
14017
|
+
}));
|
|
14018
|
+
};
|
|
14019
|
+
const containsOffset = (symbol, offset) => {
|
|
14020
|
+
return Number.isFinite(symbol.startOffset) && Number.isFinite(symbol.endOffset) && symbol.startOffset <= offset && offset <= symbol.endOffset;
|
|
14021
|
+
};
|
|
14022
|
+
const getSymbolBreadcrumbs = (symbols, offset) => {
|
|
14023
|
+
for (const symbol of symbols) {
|
|
14024
|
+
if (!symbol || typeof symbol.name !== 'string' || !containsOffset(symbol, offset)) {
|
|
14025
|
+
continue;
|
|
14026
|
+
}
|
|
14027
|
+
return [{
|
|
14028
|
+
kind: 'symbol',
|
|
14029
|
+
label: symbol.name,
|
|
14030
|
+
symbolKind: symbol.kind
|
|
14031
|
+
}, ...getSymbolBreadcrumbs(Array.isArray(symbol.children) ? symbol.children : [], offset)];
|
|
14032
|
+
}
|
|
14033
|
+
return [];
|
|
14034
|
+
};
|
|
14035
|
+
const getEditorBreadcrumbs = state => {
|
|
14036
|
+
const {
|
|
14037
|
+
breadcrumbsEnabled,
|
|
14038
|
+
documentSymbols,
|
|
14039
|
+
lines,
|
|
14040
|
+
primarySelectionIndex,
|
|
14041
|
+
selections,
|
|
14042
|
+
uri,
|
|
14043
|
+
workspaceUri
|
|
14044
|
+
} = state;
|
|
14045
|
+
if (!breadcrumbsEnabled) {
|
|
14046
|
+
return [];
|
|
14047
|
+
}
|
|
14048
|
+
const selectionIndex = primarySelectionIndex || 0;
|
|
14049
|
+
const rowIndex = selections[selectionIndex + 2] ?? selections[selectionIndex] ?? 0;
|
|
14050
|
+
const columnIndex = selections[selectionIndex + 3] ?? selections[selectionIndex + 1] ?? 0;
|
|
14051
|
+
const offset = offsetAt({
|
|
14052
|
+
lines
|
|
14053
|
+
}, rowIndex, columnIndex);
|
|
14054
|
+
return [...getFileBreadcrumbs(uri, workspaceUri || ''), ...getSymbolBreadcrumbs(documentSymbols || [], offset)];
|
|
14055
|
+
};
|
|
14056
|
+
|
|
14057
|
+
const separator = {
|
|
14058
|
+
ariaHidden: True,
|
|
14059
|
+
childCount: 0,
|
|
14060
|
+
className: mergeClassNames('EditorBreadcrumbSeparator', 'MaskIcon', 'MaskIconChevronRight'),
|
|
14061
|
+
type: Span
|
|
14062
|
+
};
|
|
14063
|
+
const getEditorBreadcrumbsVirtualDom = state => {
|
|
14064
|
+
const breadcrumbs = getEditorBreadcrumbs(state);
|
|
14065
|
+
const children = [];
|
|
14066
|
+
for (let index = 0; index < breadcrumbs.length; index++) {
|
|
14067
|
+
const breadcrumb = breadcrumbs[index];
|
|
14068
|
+
if (index > 0) {
|
|
14069
|
+
children.push(separator);
|
|
14070
|
+
}
|
|
14071
|
+
children.push({
|
|
14072
|
+
childCount: 1,
|
|
14073
|
+
className: mergeClassNames('EditorBreadcrumb', breadcrumb.kind === 'symbol' ? 'EditorBreadcrumbSymbol' : 'EditorBreadcrumbFile'),
|
|
14074
|
+
'data-kind': breadcrumb.kind,
|
|
14075
|
+
...(breadcrumb.symbolKind !== undefined && {
|
|
14076
|
+
'data-symbol-kind': breadcrumb.symbolKind
|
|
14077
|
+
}),
|
|
14078
|
+
type: Span
|
|
14079
|
+
}, text(breadcrumb.label));
|
|
14080
|
+
}
|
|
14081
|
+
return [{
|
|
14082
|
+
ariaLabel: 'Breadcrumbs',
|
|
14083
|
+
childCount: children.length,
|
|
14084
|
+
className: 'EditorBreadcrumbs',
|
|
14085
|
+
type: Nav
|
|
14086
|
+
}, ...children];
|
|
14087
|
+
};
|
|
14088
|
+
|
|
13764
14089
|
const editorInputNode = {
|
|
13765
14090
|
childCount: 1,
|
|
13766
14091
|
className: 'EditorInput',
|
|
@@ -14007,18 +14332,25 @@ const getEditorContentVirtualDom = ({
|
|
|
14007
14332
|
|
|
14008
14333
|
const getGutterInfoVirtualDom = gutterInfo => {
|
|
14009
14334
|
const isBreakpoint = typeof gutterInfo === 'object' && gutterInfo.isBreakpoint;
|
|
14335
|
+
const isLightBulb = typeof gutterInfo === 'object' && gutterInfo.isLightBulb;
|
|
14010
14336
|
const lineNumber = typeof gutterInfo === 'object' ? gutterInfo.lineNumber : gutterInfo;
|
|
14011
|
-
const label = `Breakpoint on line ${lineNumber}`;
|
|
14337
|
+
const label = isLightBulb ? `Show Code Actions on line ${lineNumber}` : `Breakpoint on line ${lineNumber}`;
|
|
14012
14338
|
return [{
|
|
14013
|
-
...(isBreakpoint && {
|
|
14339
|
+
...((isBreakpoint || isLightBulb) && {
|
|
14014
14340
|
ariaLabel: label,
|
|
14015
|
-
style: 'color:var(--DebugIconBreakpointForeground,#e51400)',
|
|
14016
14341
|
title: label
|
|
14017
14342
|
}),
|
|
14343
|
+
...(isBreakpoint && !isLightBulb && {
|
|
14344
|
+
style: 'color:var(--DebugIconBreakpointForeground,#e51400)'
|
|
14345
|
+
}),
|
|
14018
14346
|
childCount: 1,
|
|
14019
|
-
className: isBreakpoint ? 'LineNumber LineNumberBreakpoint' : 'LineNumber',
|
|
14347
|
+
className: isLightBulb ? 'LineNumber LineNumberLightBulb MaskIconLightBulb' : isBreakpoint ? 'LineNumber LineNumberBreakpoint' : 'LineNumber',
|
|
14348
|
+
...(isLightBulb && {
|
|
14349
|
+
onClick: HandleLightBulbClick,
|
|
14350
|
+
role: Button
|
|
14351
|
+
}),
|
|
14020
14352
|
type: Span
|
|
14021
|
-
}, text(isBreakpoint ? '●' : lineNumber)];
|
|
14353
|
+
}, text(isLightBulb ? '' : isBreakpoint ? '●' : lineNumber)];
|
|
14022
14354
|
};
|
|
14023
14355
|
const getEditorGutterVirtualDom$1 = gutterInfos => {
|
|
14024
14356
|
const dom = gutterInfos.flatMap(getGutterInfoVirtualDom);
|
|
@@ -14034,17 +14366,29 @@ const getEditorGutterVirtualDom = gutterInfos => {
|
|
|
14034
14366
|
}, ...gutterDom];
|
|
14035
14367
|
};
|
|
14036
14368
|
|
|
14037
|
-
const getGutterInfos = (minLineY, maxLineY, breakPoints, showLineNumbers = true, lineIndices) => {
|
|
14369
|
+
const getGutterInfos = (minLineY, maxLineY, breakPoints, showLineNumbers = true, lineIndices, lightBulbRowIndex = -1) => {
|
|
14038
14370
|
const gutterInfos = [];
|
|
14039
14371
|
const rows = lineIndices || Array.from({
|
|
14040
14372
|
length: maxLineY - minLineY
|
|
14041
14373
|
}, (_, index) => minLineY + index);
|
|
14042
14374
|
for (const rowIndex of rows) {
|
|
14043
14375
|
const lineNumber = rowIndex + 1;
|
|
14044
|
-
|
|
14045
|
-
|
|
14046
|
-
|
|
14047
|
-
|
|
14376
|
+
const isBreakpoint = breakPoints.includes(rowIndex);
|
|
14377
|
+
const isLightBulb = rowIndex === lightBulbRowIndex;
|
|
14378
|
+
if (isLightBulb) {
|
|
14379
|
+
gutterInfos.push({
|
|
14380
|
+
isBreakpoint,
|
|
14381
|
+
isLightBulb: true,
|
|
14382
|
+
lineNumber
|
|
14383
|
+
});
|
|
14384
|
+
} else if (isBreakpoint) {
|
|
14385
|
+
gutterInfos.push({
|
|
14386
|
+
isBreakpoint: true,
|
|
14387
|
+
lineNumber
|
|
14388
|
+
});
|
|
14389
|
+
} else {
|
|
14390
|
+
gutterInfos.push(showLineNumbers ? lineNumber : '');
|
|
14391
|
+
}
|
|
14048
14392
|
}
|
|
14049
14393
|
return gutterInfos;
|
|
14050
14394
|
};
|
|
@@ -14073,24 +14417,32 @@ const getMinimapVirtualDom = (minimapEnabled, minimapLines, minLineY) => {
|
|
|
14073
14417
|
}];
|
|
14074
14418
|
};
|
|
14075
14419
|
const getEditorVirtualDom = ({
|
|
14420
|
+
breadcrumbsEnabled = false,
|
|
14076
14421
|
breakPoints = [],
|
|
14077
14422
|
cursorInfos = [],
|
|
14078
14423
|
diagnostics = [],
|
|
14079
14424
|
differences,
|
|
14425
|
+
documentSymbols = [],
|
|
14080
14426
|
endOfLineDecorations = [],
|
|
14081
14427
|
gutterInfos = [],
|
|
14082
14428
|
highlightedLine = -1,
|
|
14429
|
+
lightBulbRowIndex = -1,
|
|
14083
14430
|
lineNumbers = true,
|
|
14431
|
+
lines = [],
|
|
14084
14432
|
loadError = '',
|
|
14085
14433
|
maxLineY = 0,
|
|
14086
14434
|
minimapEnabled = false,
|
|
14087
14435
|
minimapLines = [],
|
|
14088
14436
|
minLineY = 0,
|
|
14437
|
+
primarySelectionIndex = 0,
|
|
14089
14438
|
scrollBarDiagnostics = [],
|
|
14090
14439
|
selectionInfos = [],
|
|
14440
|
+
selections = new Uint32Array(),
|
|
14091
14441
|
textInfos,
|
|
14092
14442
|
uid,
|
|
14093
|
-
|
|
14443
|
+
uri = '',
|
|
14444
|
+
visibleLineIndices,
|
|
14445
|
+
workspaceUri = ''
|
|
14094
14446
|
}) => {
|
|
14095
14447
|
if (loadError) {
|
|
14096
14448
|
return [{
|
|
@@ -14101,18 +14453,27 @@ const getEditorVirtualDom = ({
|
|
|
14101
14453
|
type: Div
|
|
14102
14454
|
}, textEditorErrorIconNode, textEditorErrorMessageNode, text(loadError)];
|
|
14103
14455
|
}
|
|
14104
|
-
const visibleGutterInfos = breakPoints.length > 0 || visibleLineIndices ? getGutterInfos(minLineY, maxLineY, breakPoints, lineNumbers, visibleLineIndices) : gutterInfos;
|
|
14105
|
-
const showGutter = lineNumbers || breakPoints.length > 0;
|
|
14456
|
+
const visibleGutterInfos = breakPoints.length > 0 || visibleLineIndices ? getGutterInfos(minLineY, maxLineY, breakPoints, lineNumbers, visibleLineIndices, lightBulbRowIndex) : gutterInfos;
|
|
14457
|
+
const showGutter = lineNumbers || breakPoints.length > 0 || lightBulbRowIndex >= 0;
|
|
14106
14458
|
const gutterDom = showGutter ? getEditorGutterVirtualDom(visibleGutterInfos) : [];
|
|
14107
14459
|
const minimapDom = getMinimapVirtualDom(minimapEnabled, minimapLines, minLineY);
|
|
14460
|
+
const breadcrumbsDom = breadcrumbsEnabled ? getEditorBreadcrumbsVirtualDom({
|
|
14461
|
+
breadcrumbsEnabled,
|
|
14462
|
+
documentSymbols,
|
|
14463
|
+
lines,
|
|
14464
|
+
primarySelectionIndex,
|
|
14465
|
+
selections,
|
|
14466
|
+
uri,
|
|
14467
|
+
workspaceUri
|
|
14468
|
+
}) : [];
|
|
14108
14469
|
return [{
|
|
14109
|
-
childCount: (showGutter ? 2 : 1) + (minimapEnabled ? 1 : 0),
|
|
14470
|
+
childCount: (showGutter ? 2 : 1) + (minimapEnabled ? 1 : 0) + (breadcrumbsEnabled ? 1 : 0),
|
|
14110
14471
|
className: mergeClassNames('Viewlet', 'Editor'),
|
|
14111
14472
|
'data-uid': uid,
|
|
14112
14473
|
onContextMenu: HandleContextMenu,
|
|
14113
14474
|
role: Code,
|
|
14114
14475
|
type: Div
|
|
14115
|
-
}, ...gutterDom, ...getEditorContentVirtualDom({
|
|
14476
|
+
}, ...breadcrumbsDom, ...gutterDom, ...getEditorContentVirtualDom({
|
|
14116
14477
|
cursorInfos,
|
|
14117
14478
|
diagnostics,
|
|
14118
14479
|
differences,
|
|
@@ -14341,19 +14702,20 @@ const renderGutterInfo = {
|
|
|
14341
14702
|
apply(oldState, newState) {
|
|
14342
14703
|
const {
|
|
14343
14704
|
breakPoints,
|
|
14705
|
+
lightBulbRowIndex,
|
|
14344
14706
|
lineNumbers,
|
|
14345
14707
|
maxLineY,
|
|
14346
14708
|
minLineY,
|
|
14347
14709
|
visibleLineIndices
|
|
14348
14710
|
} = newState;
|
|
14349
|
-
if (!lineNumbers && breakPoints.length === 0) {
|
|
14711
|
+
if (!lineNumbers && breakPoints.length === 0 && lightBulbRowIndex === -1) {
|
|
14350
14712
|
return ['renderGutter', []];
|
|
14351
14713
|
}
|
|
14352
|
-
const gutterInfos = getGutterInfos(minLineY, maxLineY, breakPoints, lineNumbers, visibleLineIndices);
|
|
14714
|
+
const gutterInfos = getGutterInfos(minLineY, maxLineY, breakPoints, lineNumbers, visibleLineIndices, lightBulbRowIndex);
|
|
14353
14715
|
const dom = getEditorGutterVirtualDom$1(gutterInfos);
|
|
14354
14716
|
return ['renderGutter', dom];
|
|
14355
14717
|
},
|
|
14356
|
-
isEqual: (oldState, newState) => oldState.breakPoints === newState.breakPoints && oldState.foldingRanges === newState.foldingRanges && oldState.lineNumbers === newState.lineNumbers && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY
|
|
14718
|
+
isEqual: (oldState, newState) => oldState.breakPoints === newState.breakPoints && oldState.lightBulbRowIndex === newState.lightBulbRowIndex && oldState.foldingRanges === newState.foldingRanges && oldState.lineNumbers === newState.lineNumbers && oldState.minLineY === newState.minLineY && oldState.maxLineY === newState.maxLineY
|
|
14357
14719
|
};
|
|
14358
14720
|
const renderWidgets = {
|
|
14359
14721
|
apply: renderWidgets$1,
|
|
@@ -14389,6 +14751,10 @@ const renderEditor = async id => {
|
|
|
14389
14751
|
|
|
14390
14752
|
const renderEventListeners = () => {
|
|
14391
14753
|
return [{
|
|
14754
|
+
name: HandleLightBulbClick,
|
|
14755
|
+
params: ['showSourceActions3'],
|
|
14756
|
+
preventDefault: true
|
|
14757
|
+
}, {
|
|
14392
14758
|
name: HandleFocus,
|
|
14393
14759
|
params: ['handleFocus']
|
|
14394
14760
|
}, {
|
|
@@ -14593,6 +14959,7 @@ const addDiagnostics = async (editor, diagnostics) => {
|
|
|
14593
14959
|
...editor,
|
|
14594
14960
|
decorations,
|
|
14595
14961
|
diagnostics,
|
|
14962
|
+
lightBulbRowIndex: -1,
|
|
14596
14963
|
visualDecorations
|
|
14597
14964
|
};
|
|
14598
14965
|
};
|
|
@@ -14927,6 +15294,7 @@ const commandMap = {
|
|
|
14927
15294
|
'Editor.moveRectangleSelectionPx': wrapCommand(moveRectangleSelectionPx),
|
|
14928
15295
|
'Editor.moveSelection': wrapCommand(editorMoveSelection),
|
|
14929
15296
|
'Editor.moveSelectionPx': wrapCommand(moveSelectionPx),
|
|
15297
|
+
'Editor.nextDiagnostic': wrapCommand(nextDiagnostic),
|
|
14930
15298
|
'Editor.offsetAt': offsetAt,
|
|
14931
15299
|
'Editor.openCodeGenerator': wrapCommand(openCodeGenerator),
|
|
14932
15300
|
'Editor.openColorPicker': wrapCommand(openColorPicker),
|
|
@@ -14937,6 +15305,7 @@ const commandMap = {
|
|
|
14937
15305
|
'Editor.organizeImports': wrapCommand(organizeImports),
|
|
14938
15306
|
'Editor.paste': wrapCommand(paste),
|
|
14939
15307
|
'Editor.pasteText': wrapCommand(pasteText),
|
|
15308
|
+
'Editor.previousDiagnostic': wrapCommand(previousDiagnostic),
|
|
14940
15309
|
'Editor.redo': wrapCommand(redo),
|
|
14941
15310
|
'Editor.render': renderEditor,
|
|
14942
15311
|
'Editor.render2': render2,
|