@lvce-editor/editor-worker 19.26.4 → 19.27.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/editorWorkerMain.js +472 -351
- package/package.json +1 -1
package/dist/editorWorkerMain.js
CHANGED
|
@@ -2040,6 +2040,7 @@ const createEditor2 = (id, uri, x, y, width, height, platform, assetDir) => {
|
|
|
2040
2040
|
hasListener: false,
|
|
2041
2041
|
height,
|
|
2042
2042
|
highlightedLine: -1,
|
|
2043
|
+
hoverEnabled: false,
|
|
2043
2044
|
id,
|
|
2044
2045
|
incrementalEdits: emptyIncrementalEdits,
|
|
2045
2046
|
initial: true,
|
|
@@ -4693,6 +4694,76 @@ const createEditor = async ({
|
|
|
4693
4694
|
});
|
|
4694
4695
|
};
|
|
4695
4696
|
|
|
4697
|
+
const createStandaloneEditor = async ({
|
|
4698
|
+
assetDir,
|
|
4699
|
+
charWidth,
|
|
4700
|
+
content,
|
|
4701
|
+
fontFamily,
|
|
4702
|
+
fontSize,
|
|
4703
|
+
fontWeight,
|
|
4704
|
+
height,
|
|
4705
|
+
id,
|
|
4706
|
+
languageId,
|
|
4707
|
+
letterSpacing,
|
|
4708
|
+
lineNumbers,
|
|
4709
|
+
platform,
|
|
4710
|
+
rowHeight,
|
|
4711
|
+
tabSize,
|
|
4712
|
+
tokenizePath,
|
|
4713
|
+
uri,
|
|
4714
|
+
width,
|
|
4715
|
+
x,
|
|
4716
|
+
y
|
|
4717
|
+
}) => {
|
|
4718
|
+
createEditor2(id, uri, x, y, width, height, platform, assetDir);
|
|
4719
|
+
const createdEditor = get$7(id).newState;
|
|
4720
|
+
await loadTokenizer(languageId, tokenizePath);
|
|
4721
|
+
const tokenizerId = createdEditor.tokenizerId + 1;
|
|
4722
|
+
set$4(tokenizerId, getTokenizer(languageId));
|
|
4723
|
+
const configuredEditor = {
|
|
4724
|
+
...createdEditor,
|
|
4725
|
+
charWidth,
|
|
4726
|
+
columnWidth: charWidth,
|
|
4727
|
+
completionsOnType: false,
|
|
4728
|
+
focus: FocusEditorText$1,
|
|
4729
|
+
focused: true,
|
|
4730
|
+
fontFamily,
|
|
4731
|
+
fontSize,
|
|
4732
|
+
fontWeight,
|
|
4733
|
+
initial: false,
|
|
4734
|
+
isMonospaceFont: true,
|
|
4735
|
+
itemHeight: rowHeight,
|
|
4736
|
+
languageId,
|
|
4737
|
+
letterSpacing,
|
|
4738
|
+
lineNumbers,
|
|
4739
|
+
rowHeight,
|
|
4740
|
+
selections: new Uint32Array([0, 0, 0, 0]),
|
|
4741
|
+
tabSize,
|
|
4742
|
+
tokenizerId
|
|
4743
|
+
};
|
|
4744
|
+
const boundedEditor = setBounds(configuredEditor, x, y, width, height, charWidth);
|
|
4745
|
+
const editorWithText = setText$1(boundedEditor, content);
|
|
4746
|
+
const {
|
|
4747
|
+
differences,
|
|
4748
|
+
textInfos
|
|
4749
|
+
} = await getVisible$1(editorWithText, true);
|
|
4750
|
+
const editorWithVisibleText = {
|
|
4751
|
+
...editorWithText,
|
|
4752
|
+
differences,
|
|
4753
|
+
textInfos
|
|
4754
|
+
};
|
|
4755
|
+
const {
|
|
4756
|
+
cursorInfos,
|
|
4757
|
+
selectionInfos
|
|
4758
|
+
} = await getVisible(editorWithVisibleText);
|
|
4759
|
+
const finalEditor = {
|
|
4760
|
+
...editorWithVisibleText,
|
|
4761
|
+
cursorInfos,
|
|
4762
|
+
selectionInfos
|
|
4763
|
+
};
|
|
4764
|
+
set$9(id, createdEditor, finalEditor);
|
|
4765
|
+
};
|
|
4766
|
+
|
|
4696
4767
|
const isEqual$4 = (oldState, newState) => {
|
|
4697
4768
|
return oldState.additionalFocus === newState.additionalFocus;
|
|
4698
4769
|
};
|
|
@@ -5657,7 +5728,7 @@ const hasWidget = (widgets, id) => {
|
|
|
5657
5728
|
|
|
5658
5729
|
const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGenerator, fullFocus) => {
|
|
5659
5730
|
const {
|
|
5660
|
-
widgets
|
|
5731
|
+
widgets = []
|
|
5661
5732
|
} = editor;
|
|
5662
5733
|
if (hasWidget(widgets, widgetId)) {
|
|
5663
5734
|
return editor;
|
|
@@ -5666,6 +5737,9 @@ const addWidgetToEditor = async (widgetId, focusKey, editor, factory, newStateGe
|
|
|
5666
5737
|
// @ts-ignore
|
|
5667
5738
|
widget.newState.editorUid = editor.uid;
|
|
5668
5739
|
const newState = await newStateGenerator(widget.newState, editor.uid);
|
|
5740
|
+
if (!newState) {
|
|
5741
|
+
return editor;
|
|
5742
|
+
}
|
|
5669
5743
|
// @ts-ignore
|
|
5670
5744
|
newState.editorUid = editor.uid;
|
|
5671
5745
|
const latestWidget = {
|
|
@@ -5708,12 +5782,12 @@ const create$6 = () => {
|
|
|
5708
5782
|
return widget;
|
|
5709
5783
|
};
|
|
5710
5784
|
|
|
5711
|
-
const newStateGenerator$
|
|
5785
|
+
const newStateGenerator$5 = (state, parentUid) => {
|
|
5712
5786
|
return loadContent$3(state, parentUid);
|
|
5713
5787
|
};
|
|
5714
5788
|
const openColorPicker = async editor => {
|
|
5715
5789
|
const fullFocus = true;
|
|
5716
|
-
return addWidgetToEditor(ColorPicker$1, ColorPicker, editor, create$6, newStateGenerator$
|
|
5790
|
+
return addWidgetToEditor(ColorPicker$1, ColorPicker, editor, create$6, newStateGenerator$5, fullFocus);
|
|
5717
5791
|
};
|
|
5718
5792
|
const closeColorPicker = editor => {
|
|
5719
5793
|
const {
|
|
@@ -7318,15 +7392,17 @@ const handleMouseDown = async (state, button, altKey, ctrlKey, x, y, detail) =>
|
|
|
7318
7392
|
const state$4 = {
|
|
7319
7393
|
editor: undefined,
|
|
7320
7394
|
timeout: -1,
|
|
7395
|
+
token: 0,
|
|
7321
7396
|
x: 0,
|
|
7322
7397
|
y: 0
|
|
7323
7398
|
};
|
|
7324
7399
|
const get$1 = () => {
|
|
7325
7400
|
return state$4;
|
|
7326
7401
|
};
|
|
7327
|
-
const set$1 = (editor, timeout, x, y) => {
|
|
7402
|
+
const set$1 = (editor, timeout, x, y, token) => {
|
|
7328
7403
|
state$4.editor = editor;
|
|
7329
7404
|
state$4.timeout = timeout;
|
|
7405
|
+
state$4.token = token;
|
|
7330
7406
|
state$4.x = x;
|
|
7331
7407
|
state$4.y = y;
|
|
7332
7408
|
};
|
|
@@ -7401,10 +7477,265 @@ const handleMouseMoveWithAltKey = async (editor, x, y) => {
|
|
|
7401
7477
|
}
|
|
7402
7478
|
};
|
|
7403
7479
|
|
|
7404
|
-
const
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7480
|
+
const create$5 = () => {
|
|
7481
|
+
const uid = create$8();
|
|
7482
|
+
const widget = {
|
|
7483
|
+
id: Hover,
|
|
7484
|
+
newState: {
|
|
7485
|
+
commands: [],
|
|
7486
|
+
content: '',
|
|
7487
|
+
diagnostics: [],
|
|
7488
|
+
documentation: '',
|
|
7489
|
+
editorUid: 0,
|
|
7490
|
+
height: 0,
|
|
7491
|
+
lineInfos: [],
|
|
7492
|
+
uid: uid,
|
|
7493
|
+
width: 0,
|
|
7494
|
+
x: 0,
|
|
7495
|
+
y: 0
|
|
7496
|
+
},
|
|
7497
|
+
oldState: {
|
|
7498
|
+
commands: [],
|
|
7499
|
+
content: '',
|
|
7500
|
+
diagnostics: [],
|
|
7501
|
+
documentation: '',
|
|
7502
|
+
editorUid: 0,
|
|
7503
|
+
height: 0,
|
|
7504
|
+
lineInfos: [],
|
|
7505
|
+
uid: uid,
|
|
7506
|
+
width: 0,
|
|
7507
|
+
x: 0,
|
|
7508
|
+
y: 0
|
|
7509
|
+
}
|
|
7510
|
+
};
|
|
7511
|
+
return widget;
|
|
7512
|
+
};
|
|
7513
|
+
|
|
7514
|
+
const OnDiagnostic = 'onDiagnostic';
|
|
7515
|
+
const OnHover = 'onHover';
|
|
7516
|
+
const OnTabCompletion = 'onTabCompletion';
|
|
7517
|
+
|
|
7518
|
+
const execute = async ({
|
|
7519
|
+
args,
|
|
7520
|
+
assetDir,
|
|
7521
|
+
editor,
|
|
7522
|
+
event,
|
|
7523
|
+
method,
|
|
7524
|
+
noProviderFoundMessage,
|
|
7525
|
+
noProviderFoundResult = undefined,
|
|
7526
|
+
platform
|
|
7527
|
+
}) => {
|
|
7528
|
+
const fullEvent = `${event}:${editor.languageId}`;
|
|
7529
|
+
await activateByEvent(fullEvent, assetDir, platform);
|
|
7530
|
+
const result = await invoke$6(method, editor.uid, ...args);
|
|
7531
|
+
return result;
|
|
7532
|
+
};
|
|
7533
|
+
|
|
7534
|
+
const getTextDocument$1 = editor => {
|
|
7535
|
+
return {
|
|
7536
|
+
documentId: editor.id || editor.uid,
|
|
7537
|
+
languageId: editor.languageId,
|
|
7538
|
+
text: getText$1(editor),
|
|
7539
|
+
uri: editor.uri
|
|
7540
|
+
};
|
|
7541
|
+
};
|
|
7542
|
+
const executeIsolatedHoverProvider = async (editor, offset) => {
|
|
7543
|
+
const textDocument = getTextDocument$1(editor);
|
|
7544
|
+
return invoke$e('Extensions.executeHoverProvider', textDocument, offset);
|
|
7545
|
+
};
|
|
7546
|
+
const executeHoverProvider = async (editor, offset) => {
|
|
7547
|
+
object(editor);
|
|
7548
|
+
number(offset);
|
|
7549
|
+
const isolatedHover = await executeIsolatedHoverProvider(editor, offset);
|
|
7550
|
+
if (isolatedHover) {
|
|
7551
|
+
return isolatedHover;
|
|
7552
|
+
}
|
|
7553
|
+
return execute({
|
|
7554
|
+
args: [offset],
|
|
7555
|
+
editor,
|
|
7556
|
+
event: OnHover,
|
|
7557
|
+
method: HoverExecute,
|
|
7558
|
+
noProviderFoundMessage: 'No hover provider found'
|
|
7559
|
+
});
|
|
7560
|
+
};
|
|
7561
|
+
|
|
7562
|
+
const getHover = async (editor, offset) => {
|
|
7563
|
+
object(editor);
|
|
7564
|
+
number(offset);
|
|
7565
|
+
// TODO invoke extension host worker directly
|
|
7566
|
+
const hover = await executeHoverProvider(editor, offset);
|
|
7567
|
+
return hover;
|
|
7568
|
+
};
|
|
7569
|
+
|
|
7570
|
+
const measureTextBlockHeight = async (text, fontFamily, fontSize, lineHeight, width) => {
|
|
7571
|
+
// @ts-ignore
|
|
7572
|
+
// return RendererProcess.invoke('MeasureTextBlockHeight.measureTextBlockHeight', text, fontSize, fontFamily, lineHeight, width)
|
|
7573
|
+
return 100;
|
|
7574
|
+
};
|
|
7575
|
+
|
|
7576
|
+
const getLineInfo = (line, tokens, TokenMap) => {
|
|
7577
|
+
const tokensLength = tokens.length;
|
|
7578
|
+
let end = 0;
|
|
7579
|
+
let start = 0;
|
|
7580
|
+
const lineInfo = [];
|
|
7581
|
+
for (let i = 0; i < tokensLength; i += 2) {
|
|
7582
|
+
const tokenType = tokens[i];
|
|
7583
|
+
const tokenLength = tokens[i + 1];
|
|
7584
|
+
end += tokenLength;
|
|
7585
|
+
const text = line.slice(start, end);
|
|
7586
|
+
const className = `Token ${TokenMap[tokenType] || 'Unknown'}`;
|
|
7587
|
+
const normalizedText = text;
|
|
7588
|
+
lineInfo.push(normalizedText, className);
|
|
7589
|
+
start = end;
|
|
7590
|
+
}
|
|
7591
|
+
return lineInfo;
|
|
7592
|
+
};
|
|
7593
|
+
|
|
7594
|
+
const getLineInfos = (lines, tokenizer, languageId) => {
|
|
7595
|
+
const lineInfos = [];
|
|
7596
|
+
const {
|
|
7597
|
+
hasArrayReturn,
|
|
7598
|
+
initialLineState,
|
|
7599
|
+
tokenizeLine,
|
|
7600
|
+
TokenMap
|
|
7601
|
+
} = tokenizer;
|
|
7602
|
+
let currentLineState = getInitialLineState(initialLineState);
|
|
7603
|
+
for (const line of lines) {
|
|
7604
|
+
const result = safeTokenizeLine(languageId, tokenizeLine, line, currentLineState, hasArrayReturn);
|
|
7605
|
+
const {
|
|
7606
|
+
tokens
|
|
7607
|
+
} = result;
|
|
7608
|
+
const lineInfo = getLineInfo(line, tokens, TokenMap);
|
|
7609
|
+
lineInfos.push(lineInfo);
|
|
7610
|
+
currentLineState = result;
|
|
7611
|
+
}
|
|
7612
|
+
console.error({
|
|
7613
|
+
lineInfos
|
|
7614
|
+
});
|
|
7615
|
+
return lineInfos;
|
|
7616
|
+
};
|
|
7617
|
+
|
|
7618
|
+
const tokenizeCodeBlock = async (codeBlock, languageId, tokenizerPath) => {
|
|
7619
|
+
await loadTokenizer(languageId, tokenizerPath);
|
|
7620
|
+
const tokenizer = getTokenizer(languageId);
|
|
7621
|
+
const lines = splitLines(codeBlock);
|
|
7622
|
+
const lineInfos = getLineInfos(lines, tokenizer, languageId);
|
|
7623
|
+
return lineInfos;
|
|
7624
|
+
};
|
|
7625
|
+
|
|
7626
|
+
const getHoverPosition = (position, selections) => {
|
|
7627
|
+
if (position) {
|
|
7628
|
+
return position;
|
|
7629
|
+
}
|
|
7630
|
+
const rowIndex = selections[0];
|
|
7631
|
+
const columnIndex = selections[1];
|
|
7632
|
+
return {
|
|
7633
|
+
columnIndex,
|
|
7634
|
+
rowIndex
|
|
7635
|
+
};
|
|
7636
|
+
};
|
|
7637
|
+
const getMatchingDiagnostics = (diagnostics, rowIndex, columnIndex) => {
|
|
7638
|
+
const matching = [];
|
|
7639
|
+
for (const diagnostic of diagnostics) {
|
|
7640
|
+
if (diagnostic.rowIndex === rowIndex) {
|
|
7641
|
+
matching.push(diagnostic);
|
|
7642
|
+
}
|
|
7643
|
+
}
|
|
7644
|
+
return matching;
|
|
7645
|
+
};
|
|
7646
|
+
const fallbackDisplayStringLanguageId = 'typescript'; // TODO remove this
|
|
7647
|
+
const getHoverPositionXy = (editor, rowIndex, wordStart, documentationHeight) => {
|
|
7648
|
+
const x$1 = x(editor, rowIndex, wordStart);
|
|
7649
|
+
const y$1 = editor.height - y(editor, rowIndex) + editor.y + 40;
|
|
7650
|
+
return {
|
|
7651
|
+
x: x$1,
|
|
7652
|
+
y: y$1
|
|
7653
|
+
};
|
|
7654
|
+
};
|
|
7655
|
+
const getEditorHoverInfo = async (editorUid, position) => {
|
|
7656
|
+
number(editorUid);
|
|
7657
|
+
const instance = get$7(editorUid);
|
|
7658
|
+
const editor = instance.newState;
|
|
7659
|
+
const {
|
|
7660
|
+
selections
|
|
7661
|
+
} = editor;
|
|
7662
|
+
const {
|
|
7663
|
+
columnIndex,
|
|
7664
|
+
rowIndex
|
|
7665
|
+
} = getHoverPosition(position, selections);
|
|
7666
|
+
const offset = offsetAt(editor, rowIndex, columnIndex);
|
|
7667
|
+
const hover = await getHover(editor, offset);
|
|
7668
|
+
if (!hover) {
|
|
7669
|
+
return undefined;
|
|
7670
|
+
}
|
|
7671
|
+
const {
|
|
7672
|
+
displayString,
|
|
7673
|
+
displayStringLanguageId,
|
|
7674
|
+
documentation
|
|
7675
|
+
} = hover;
|
|
7676
|
+
const tokenizerPath = '';
|
|
7677
|
+
const lineInfos = await tokenizeCodeBlock(displayString, displayStringLanguageId || fallbackDisplayStringLanguageId, tokenizerPath);
|
|
7678
|
+
const wordPart = getWordBefore(editor, rowIndex, columnIndex);
|
|
7679
|
+
const wordStart = columnIndex - wordPart.length;
|
|
7680
|
+
await measureTextBlockHeight();
|
|
7681
|
+
const {
|
|
7682
|
+
x,
|
|
7683
|
+
y
|
|
7684
|
+
} = getHoverPositionXy(editor, rowIndex, wordStart);
|
|
7685
|
+
const diagnostics = editor.diagnostics || [];
|
|
7686
|
+
const matchingDiagnostics = getMatchingDiagnostics(diagnostics, rowIndex);
|
|
7687
|
+
return {
|
|
7688
|
+
documentation,
|
|
7689
|
+
lineInfos,
|
|
7690
|
+
matchingDiagnostics,
|
|
7691
|
+
x,
|
|
7692
|
+
y
|
|
7693
|
+
};
|
|
7694
|
+
};
|
|
7695
|
+
|
|
7696
|
+
const loadHoverContent = async (state, position) => {
|
|
7697
|
+
const hoverInfo = await getEditorHoverInfo(state.editorUid, position);
|
|
7698
|
+
if (!hoverInfo) {
|
|
7699
|
+
return undefined;
|
|
7700
|
+
}
|
|
7701
|
+
const {
|
|
7702
|
+
documentation,
|
|
7703
|
+
lineInfos,
|
|
7704
|
+
matchingDiagnostics,
|
|
7705
|
+
x,
|
|
7706
|
+
y
|
|
7707
|
+
} = hoverInfo;
|
|
7708
|
+
return {
|
|
7709
|
+
...state,
|
|
7710
|
+
diagnostics: matchingDiagnostics,
|
|
7711
|
+
documentation,
|
|
7712
|
+
lineInfos,
|
|
7713
|
+
width: 600,
|
|
7714
|
+
x,
|
|
7715
|
+
y
|
|
7716
|
+
};
|
|
7717
|
+
};
|
|
7718
|
+
|
|
7719
|
+
const showHover2 = async (editor, position) => {
|
|
7720
|
+
const newStateGenerator = async state => {
|
|
7721
|
+
return loadHoverContent(state, position);
|
|
7722
|
+
};
|
|
7723
|
+
return addWidgetToEditor(Hover, FocusEditorHover, editor, create$5, newStateGenerator);
|
|
7724
|
+
};
|
|
7725
|
+
|
|
7726
|
+
const showHover$1 = async (editor, position, token) => {
|
|
7727
|
+
const instance = get$7(editor.uid);
|
|
7728
|
+
if (!instance) {
|
|
7729
|
+
return;
|
|
7730
|
+
}
|
|
7731
|
+
const latestEditor = instance.newState;
|
|
7732
|
+
const newEditor = await showHover2(latestEditor, position);
|
|
7733
|
+
const latestInstance = get$7(editor.uid);
|
|
7734
|
+
if (latestEditor === newEditor || !latestInstance || latestInstance.newState !== latestEditor || get$1().token !== token) {
|
|
7735
|
+
return;
|
|
7736
|
+
}
|
|
7737
|
+
set$9(editor.uid, latestInstance.oldState, newEditor);
|
|
7738
|
+
await invoke$b('Editor.renderPending', editor.uid);
|
|
7408
7739
|
};
|
|
7409
7740
|
|
|
7410
7741
|
// TODO several things can happen:
|
|
@@ -7415,14 +7746,22 @@ const showHover$1 = async (editor, position) => {
|
|
|
7415
7746
|
// 5. show color picker
|
|
7416
7747
|
// 6. show error info
|
|
7417
7748
|
|
|
7418
|
-
const onHoverIdle = async
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7422
|
-
|
|
7423
|
-
|
|
7424
|
-
|
|
7425
|
-
|
|
7749
|
+
const onHoverIdle = async token => {
|
|
7750
|
+
try {
|
|
7751
|
+
const {
|
|
7752
|
+
editor,
|
|
7753
|
+
token: latestToken,
|
|
7754
|
+
x,
|
|
7755
|
+
y
|
|
7756
|
+
} = get$1();
|
|
7757
|
+
if (latestToken !== token) {
|
|
7758
|
+
return;
|
|
7759
|
+
}
|
|
7760
|
+
const position = await at(editor, x, y);
|
|
7761
|
+
await showHover$1(editor, position, token);
|
|
7762
|
+
} catch {
|
|
7763
|
+
// Hover providers are optional and should not surface errors from an idle mouse event.
|
|
7764
|
+
}
|
|
7426
7765
|
};
|
|
7427
7766
|
const hoverDelay = 300;
|
|
7428
7767
|
const handleMouseMove = async (editor, x, y, altKey) => {
|
|
@@ -7437,8 +7776,9 @@ const handleMouseMove = async (editor, x, y, altKey) => {
|
|
|
7437
7776
|
if (oldState.timeout !== -1) {
|
|
7438
7777
|
clearTimeout(oldState.timeout);
|
|
7439
7778
|
}
|
|
7440
|
-
const
|
|
7441
|
-
|
|
7779
|
+
const token = create$8();
|
|
7780
|
+
const timeout = setTimeout(onHoverIdle, hoverDelay, token);
|
|
7781
|
+
set$1(editorWithoutDefinitionLink, timeout, x, y, token);
|
|
7442
7782
|
return editorWithoutDefinitionLink;
|
|
7443
7783
|
};
|
|
7444
7784
|
|
|
@@ -8155,7 +8495,7 @@ const insertLineBreak = async editor => {
|
|
|
8155
8495
|
const Script = 2;
|
|
8156
8496
|
const Unknown$1 = 0;
|
|
8157
8497
|
|
|
8158
|
-
const create$
|
|
8498
|
+
const create$4 = () => {
|
|
8159
8499
|
const completionUid = create$8();
|
|
8160
8500
|
const widget = {
|
|
8161
8501
|
id: CodeGenerator,
|
|
@@ -8183,7 +8523,7 @@ const create$5 = () => {
|
|
|
8183
8523
|
return widget;
|
|
8184
8524
|
};
|
|
8185
8525
|
|
|
8186
|
-
const newStateGenerator$
|
|
8526
|
+
const newStateGenerator$4 = async state => {
|
|
8187
8527
|
const latestState = {
|
|
8188
8528
|
...state,
|
|
8189
8529
|
height: 45,
|
|
@@ -8195,10 +8535,10 @@ const newStateGenerator$5 = async state => {
|
|
|
8195
8535
|
};
|
|
8196
8536
|
const openCodeGenerator = async editor => {
|
|
8197
8537
|
const fullFocus = true;
|
|
8198
|
-
return addWidgetToEditor(CodeGenerator, FocusCodeGenerator, editor, create$
|
|
8538
|
+
return addWidgetToEditor(CodeGenerator, FocusCodeGenerator, editor, create$4, newStateGenerator$4, fullFocus);
|
|
8199
8539
|
};
|
|
8200
8540
|
|
|
8201
|
-
const create$
|
|
8541
|
+
const create$3 = () => {
|
|
8202
8542
|
const completionUid = create$8();
|
|
8203
8543
|
const completionWidget = {
|
|
8204
8544
|
id: Completion,
|
|
@@ -8227,7 +8567,7 @@ const {
|
|
|
8227
8567
|
setFactory
|
|
8228
8568
|
} = createLazyRpc(CompletionWorker);
|
|
8229
8569
|
|
|
8230
|
-
const newStateGenerator$
|
|
8570
|
+
const newStateGenerator$3 = async (state, parentUid) => {
|
|
8231
8571
|
const {
|
|
8232
8572
|
height,
|
|
8233
8573
|
uid,
|
|
@@ -8252,7 +8592,7 @@ const newStateGenerator$4 = async (state, parentUid) => {
|
|
|
8252
8592
|
};
|
|
8253
8593
|
const openCompletion = async editor => {
|
|
8254
8594
|
const fullFocus = false;
|
|
8255
|
-
return addWidgetToEditor(Completion, EditorCompletion, editor, create$
|
|
8595
|
+
return addWidgetToEditor(Completion, EditorCompletion, editor, create$3, newStateGenerator$3, fullFocus);
|
|
8256
8596
|
};
|
|
8257
8597
|
|
|
8258
8598
|
const isFunctional = widgetId => {
|
|
@@ -8614,7 +8954,7 @@ const EditorFindWidget = {
|
|
|
8614
8954
|
toggleUseRegularExpression
|
|
8615
8955
|
};
|
|
8616
8956
|
|
|
8617
|
-
const create$
|
|
8957
|
+
const create$2 = () => {
|
|
8618
8958
|
const uid = create$8();
|
|
8619
8959
|
const widget = {
|
|
8620
8960
|
id: Find,
|
|
@@ -8673,7 +9013,7 @@ const loadContent$2 = async (state, parentUid) => {
|
|
|
8673
9013
|
};
|
|
8674
9014
|
};
|
|
8675
9015
|
|
|
8676
|
-
const newStateGenerator$
|
|
9016
|
+
const newStateGenerator$2 = (state, parentUid) => {
|
|
8677
9017
|
return loadContent$2(state, parentUid);
|
|
8678
9018
|
};
|
|
8679
9019
|
const openFind2 = async editor => {
|
|
@@ -8682,7 +9022,7 @@ const openFind2 = async editor => {
|
|
|
8682
9022
|
return editorWithFocusedFind;
|
|
8683
9023
|
}
|
|
8684
9024
|
const fullFocus = true;
|
|
8685
|
-
return addWidgetToEditor(Find, FindWidget, editor, create$
|
|
9025
|
+
return addWidgetToEditor(Find, FindWidget, editor, create$2, newStateGenerator$2, fullFocus);
|
|
8686
9026
|
};
|
|
8687
9027
|
|
|
8688
9028
|
const openFind = async state => {
|
|
@@ -8715,7 +9055,7 @@ const getPositionAtCursor$1 = editor => {
|
|
|
8715
9055
|
};
|
|
8716
9056
|
};
|
|
8717
9057
|
|
|
8718
|
-
const create$
|
|
9058
|
+
const create$1 = () => {
|
|
8719
9059
|
const completionUid = create$8();
|
|
8720
9060
|
const renameWidget = {
|
|
8721
9061
|
id: Rename$1,
|
|
@@ -8739,7 +9079,7 @@ const create$2 = () => {
|
|
|
8739
9079
|
return renameWidget;
|
|
8740
9080
|
};
|
|
8741
9081
|
|
|
8742
|
-
const newStateGenerator$
|
|
9082
|
+
const newStateGenerator$1 = async (state, parentUid) => {
|
|
8743
9083
|
const {
|
|
8744
9084
|
height,
|
|
8745
9085
|
uid,
|
|
@@ -8774,7 +9114,7 @@ const openRename = async editor => {
|
|
|
8774
9114
|
return editor;
|
|
8775
9115
|
}
|
|
8776
9116
|
const fullFocus = true;
|
|
8777
|
-
const editorWithRenameWidget = await addWidgetToEditor(Rename$1, FocusEditorRename$1, editor, create$
|
|
9117
|
+
const editorWithRenameWidget = await addWidgetToEditor(Rename$1, FocusEditorRename$1, editor, create$1, newStateGenerator$1, fullFocus);
|
|
8778
9118
|
if (editorWithRenameWidget === editor) {
|
|
8779
9119
|
return editor;
|
|
8780
9120
|
}
|
|
@@ -8786,22 +9126,6 @@ const openRename = async editor => {
|
|
|
8786
9126
|
};
|
|
8787
9127
|
};
|
|
8788
9128
|
|
|
8789
|
-
const execute = async ({
|
|
8790
|
-
args,
|
|
8791
|
-
assetDir,
|
|
8792
|
-
editor,
|
|
8793
|
-
event,
|
|
8794
|
-
method,
|
|
8795
|
-
noProviderFoundMessage,
|
|
8796
|
-
noProviderFoundResult = undefined,
|
|
8797
|
-
platform
|
|
8798
|
-
}) => {
|
|
8799
|
-
const fullEvent = `${event}:${editor.languageId}`;
|
|
8800
|
-
await activateByEvent(fullEvent, assetDir, platform);
|
|
8801
|
-
const result = await invoke$6(method, editor.uid, ...args);
|
|
8802
|
-
return result;
|
|
8803
|
-
};
|
|
8804
|
-
|
|
8805
9129
|
const getOrganizeImportEdits = async editor => {
|
|
8806
9130
|
const edits = await execute({
|
|
8807
9131
|
args: [],
|
|
@@ -9366,96 +9690,34 @@ const setLanguageId = async (editor, languageId, tokenizePath) => {
|
|
|
9366
9690
|
tokenizerId: newTokenizerId
|
|
9367
9691
|
};
|
|
9368
9692
|
};
|
|
9369
|
-
|
|
9370
|
-
const setSelections = (editor, selections) => {
|
|
9371
|
-
return scheduleSelections(editor, selections);
|
|
9372
|
-
};
|
|
9373
|
-
|
|
9374
|
-
const setText = (editor, text) => {
|
|
9375
|
-
string(text);
|
|
9376
|
-
const endRowIndex = editor.lines.length - 1;
|
|
9377
|
-
const endColumnIndex = editor.lines.at(-1).length;
|
|
9378
|
-
const start = {
|
|
9379
|
-
columnIndex: 0,
|
|
9380
|
-
rowIndex: 0
|
|
9381
|
-
};
|
|
9382
|
-
const end = {
|
|
9383
|
-
columnIndex: endColumnIndex,
|
|
9384
|
-
rowIndex: endRowIndex
|
|
9385
|
-
};
|
|
9386
|
-
const changes = [{
|
|
9387
|
-
deleted: getSelectionText(editor, {
|
|
9388
|
-
end,
|
|
9389
|
-
start
|
|
9390
|
-
}),
|
|
9391
|
-
end,
|
|
9392
|
-
inserted: splitLines(text),
|
|
9393
|
-
origin: EditorType,
|
|
9394
|
-
start
|
|
9395
|
-
}];
|
|
9396
|
-
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
9397
|
-
};
|
|
9398
|
-
|
|
9399
|
-
const create$1 = () => {
|
|
9400
|
-
const uid = create$8();
|
|
9401
|
-
const widget = {
|
|
9402
|
-
id: Hover,
|
|
9403
|
-
newState: {
|
|
9404
|
-
commands: [],
|
|
9405
|
-
content: '',
|
|
9406
|
-
diagnostics: [],
|
|
9407
|
-
documentation: '',
|
|
9408
|
-
editorUid: 0,
|
|
9409
|
-
height: 0,
|
|
9410
|
-
lineInfos: [],
|
|
9411
|
-
uid: uid,
|
|
9412
|
-
width: 0,
|
|
9413
|
-
x: 0,
|
|
9414
|
-
y: 0
|
|
9415
|
-
},
|
|
9416
|
-
oldState: {
|
|
9417
|
-
commands: [],
|
|
9418
|
-
content: '',
|
|
9419
|
-
diagnostics: [],
|
|
9420
|
-
documentation: '',
|
|
9421
|
-
editorUid: 0,
|
|
9422
|
-
height: 0,
|
|
9423
|
-
lineInfos: [],
|
|
9424
|
-
uid: uid,
|
|
9425
|
-
width: 0,
|
|
9426
|
-
x: 0,
|
|
9427
|
-
y: 0
|
|
9428
|
-
}
|
|
9429
|
-
};
|
|
9430
|
-
return widget;
|
|
9431
|
-
};
|
|
9432
|
-
|
|
9433
|
-
const newStateGenerator$1 = async (state, parentUid) => {
|
|
9434
|
-
const {
|
|
9435
|
-
height,
|
|
9436
|
-
uid,
|
|
9437
|
-
width,
|
|
9438
|
-
x,
|
|
9439
|
-
y
|
|
9440
|
-
} = state;
|
|
9441
|
-
const {
|
|
9442
|
-
newState
|
|
9443
|
-
} = get$7(parentUid);
|
|
9444
|
-
const {
|
|
9445
|
-
languageId
|
|
9446
|
-
} = newState;
|
|
9447
|
-
await invoke$2('Hover.create', uid, x, y, width, height, parentUid, languageId);
|
|
9448
|
-
await invoke$2('Hover.loadContent', uid);
|
|
9449
|
-
const diff = await invoke$2('Hover.diff2', uid);
|
|
9450
|
-
const commands = await invoke$2('Hover.render2', uid, diff);
|
|
9451
|
-
return {
|
|
9452
|
-
...state,
|
|
9453
|
-
commands
|
|
9454
|
-
};
|
|
9455
|
-
};
|
|
9456
|
-
const showHover3 = async editor => {
|
|
9457
|
-
const fullFocus = false;
|
|
9458
|
-
return addWidgetToEditor(Hover, FocusEditorHover, editor, create$1, newStateGenerator$1, fullFocus);
|
|
9693
|
+
|
|
9694
|
+
const setSelections = (editor, selections) => {
|
|
9695
|
+
return scheduleSelections(editor, selections);
|
|
9696
|
+
};
|
|
9697
|
+
|
|
9698
|
+
const setText = (editor, text) => {
|
|
9699
|
+
string(text);
|
|
9700
|
+
const endRowIndex = editor.lines.length - 1;
|
|
9701
|
+
const endColumnIndex = editor.lines.at(-1).length;
|
|
9702
|
+
const start = {
|
|
9703
|
+
columnIndex: 0,
|
|
9704
|
+
rowIndex: 0
|
|
9705
|
+
};
|
|
9706
|
+
const end = {
|
|
9707
|
+
columnIndex: endColumnIndex,
|
|
9708
|
+
rowIndex: endRowIndex
|
|
9709
|
+
};
|
|
9710
|
+
const changes = [{
|
|
9711
|
+
deleted: getSelectionText(editor, {
|
|
9712
|
+
end,
|
|
9713
|
+
start
|
|
9714
|
+
}),
|
|
9715
|
+
end,
|
|
9716
|
+
inserted: splitLines(text),
|
|
9717
|
+
origin: EditorType,
|
|
9718
|
+
start
|
|
9719
|
+
}];
|
|
9720
|
+
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
9459
9721
|
};
|
|
9460
9722
|
|
|
9461
9723
|
const EditorHover = 'EditorHover';
|
|
@@ -9580,10 +9842,6 @@ const sortLinesAscending = editor => {
|
|
|
9580
9842
|
return scheduleDocumentAndCursorsSelections(editor, changes);
|
|
9581
9843
|
};
|
|
9582
9844
|
|
|
9583
|
-
const OnDiagnostic = 'onDiagnostic';
|
|
9584
|
-
const OnHover = 'onHover';
|
|
9585
|
-
const OnTabCompletion = 'onTabCompletion';
|
|
9586
|
-
|
|
9587
9845
|
const executeTabCompletionProvider = async (editor, offset) => {
|
|
9588
9846
|
return execute({
|
|
9589
9847
|
args: [offset],
|
|
@@ -10396,168 +10654,6 @@ const EditorCompletionWidget = {
|
|
|
10396
10654
|
toggleDetails: toggleDetails$1
|
|
10397
10655
|
};
|
|
10398
10656
|
|
|
10399
|
-
const getTextDocument$1 = editor => {
|
|
10400
|
-
return {
|
|
10401
|
-
documentId: editor.id || editor.uid,
|
|
10402
|
-
languageId: editor.languageId,
|
|
10403
|
-
text: getText$1(editor),
|
|
10404
|
-
uri: editor.uri
|
|
10405
|
-
};
|
|
10406
|
-
};
|
|
10407
|
-
const executeIsolatedHoverProvider = async (editor, offset) => {
|
|
10408
|
-
const textDocument = getTextDocument$1(editor);
|
|
10409
|
-
return invoke$e('Extensions.executeHoverProvider', textDocument, offset);
|
|
10410
|
-
};
|
|
10411
|
-
const executeHoverProvider = async (editor, offset) => {
|
|
10412
|
-
object(editor);
|
|
10413
|
-
number(offset);
|
|
10414
|
-
const isolatedHover = await executeIsolatedHoverProvider(editor, offset);
|
|
10415
|
-
if (isolatedHover) {
|
|
10416
|
-
return isolatedHover;
|
|
10417
|
-
}
|
|
10418
|
-
return execute({
|
|
10419
|
-
args: [offset],
|
|
10420
|
-
editor,
|
|
10421
|
-
event: OnHover,
|
|
10422
|
-
method: HoverExecute,
|
|
10423
|
-
noProviderFoundMessage: 'No hover provider found'
|
|
10424
|
-
});
|
|
10425
|
-
};
|
|
10426
|
-
|
|
10427
|
-
const getHover = async (editor, offset) => {
|
|
10428
|
-
object(editor);
|
|
10429
|
-
number(offset);
|
|
10430
|
-
// TODO invoke extension host worker directly
|
|
10431
|
-
const hover = await executeHoverProvider(editor, offset);
|
|
10432
|
-
return hover;
|
|
10433
|
-
};
|
|
10434
|
-
|
|
10435
|
-
const measureTextBlockHeight = async (text, fontFamily, fontSize, lineHeight, width) => {
|
|
10436
|
-
// @ts-ignore
|
|
10437
|
-
// return RendererProcess.invoke('MeasureTextBlockHeight.measureTextBlockHeight', text, fontSize, fontFamily, lineHeight, width)
|
|
10438
|
-
return 100;
|
|
10439
|
-
};
|
|
10440
|
-
|
|
10441
|
-
const getLineInfo = (line, tokens, TokenMap) => {
|
|
10442
|
-
const tokensLength = tokens.length;
|
|
10443
|
-
let end = 0;
|
|
10444
|
-
let start = 0;
|
|
10445
|
-
const lineInfo = [];
|
|
10446
|
-
for (let i = 0; i < tokensLength; i += 2) {
|
|
10447
|
-
const tokenType = tokens[i];
|
|
10448
|
-
const tokenLength = tokens[i + 1];
|
|
10449
|
-
end += tokenLength;
|
|
10450
|
-
const text = line.slice(start, end);
|
|
10451
|
-
const className = `Token ${TokenMap[tokenType] || 'Unknown'}`;
|
|
10452
|
-
const normalizedText = text;
|
|
10453
|
-
lineInfo.push(normalizedText, className);
|
|
10454
|
-
start = end;
|
|
10455
|
-
}
|
|
10456
|
-
return lineInfo;
|
|
10457
|
-
};
|
|
10458
|
-
|
|
10459
|
-
const getLineInfos = (lines, tokenizer, languageId) => {
|
|
10460
|
-
const lineInfos = [];
|
|
10461
|
-
const {
|
|
10462
|
-
hasArrayReturn,
|
|
10463
|
-
initialLineState,
|
|
10464
|
-
tokenizeLine,
|
|
10465
|
-
TokenMap
|
|
10466
|
-
} = tokenizer;
|
|
10467
|
-
let currentLineState = getInitialLineState(initialLineState);
|
|
10468
|
-
for (const line of lines) {
|
|
10469
|
-
const result = safeTokenizeLine(languageId, tokenizeLine, line, currentLineState, hasArrayReturn);
|
|
10470
|
-
const {
|
|
10471
|
-
tokens
|
|
10472
|
-
} = result;
|
|
10473
|
-
const lineInfo = getLineInfo(line, tokens, TokenMap);
|
|
10474
|
-
lineInfos.push(lineInfo);
|
|
10475
|
-
currentLineState = result;
|
|
10476
|
-
}
|
|
10477
|
-
console.error({
|
|
10478
|
-
lineInfos
|
|
10479
|
-
});
|
|
10480
|
-
return lineInfos;
|
|
10481
|
-
};
|
|
10482
|
-
|
|
10483
|
-
const tokenizeCodeBlock = async (codeBlock, languageId, tokenizerPath) => {
|
|
10484
|
-
await loadTokenizer(languageId, tokenizerPath);
|
|
10485
|
-
const tokenizer = getTokenizer(languageId);
|
|
10486
|
-
const lines = splitLines(codeBlock);
|
|
10487
|
-
const lineInfos = getLineInfos(lines, tokenizer, languageId);
|
|
10488
|
-
return lineInfos;
|
|
10489
|
-
};
|
|
10490
|
-
|
|
10491
|
-
const getHoverPosition = (position, selections) => {
|
|
10492
|
-
if (position) {
|
|
10493
|
-
return position;
|
|
10494
|
-
}
|
|
10495
|
-
const rowIndex = selections[0];
|
|
10496
|
-
const columnIndex = selections[1];
|
|
10497
|
-
return {
|
|
10498
|
-
columnIndex,
|
|
10499
|
-
rowIndex
|
|
10500
|
-
};
|
|
10501
|
-
};
|
|
10502
|
-
const getMatchingDiagnostics = (diagnostics, rowIndex, columnIndex) => {
|
|
10503
|
-
const matching = [];
|
|
10504
|
-
for (const diagnostic of diagnostics) {
|
|
10505
|
-
if (diagnostic.rowIndex === rowIndex) {
|
|
10506
|
-
matching.push(diagnostic);
|
|
10507
|
-
}
|
|
10508
|
-
}
|
|
10509
|
-
return matching;
|
|
10510
|
-
};
|
|
10511
|
-
const fallbackDisplayStringLanguageId = 'typescript'; // TODO remove this
|
|
10512
|
-
const getHoverPositionXy = (editor, rowIndex, wordStart, documentationHeight) => {
|
|
10513
|
-
const x$1 = x(editor, rowIndex, wordStart);
|
|
10514
|
-
const y$1 = editor.height - y(editor, rowIndex) + editor.y + 40;
|
|
10515
|
-
return {
|
|
10516
|
-
x: x$1,
|
|
10517
|
-
y: y$1
|
|
10518
|
-
};
|
|
10519
|
-
};
|
|
10520
|
-
const getEditorHoverInfo = async (editorUid, position) => {
|
|
10521
|
-
number(editorUid);
|
|
10522
|
-
const instance = get$7(editorUid);
|
|
10523
|
-
const editor = instance.newState;
|
|
10524
|
-
const {
|
|
10525
|
-
selections
|
|
10526
|
-
} = editor;
|
|
10527
|
-
const {
|
|
10528
|
-
columnIndex,
|
|
10529
|
-
rowIndex
|
|
10530
|
-
} = getHoverPosition(position, selections);
|
|
10531
|
-
const offset = offsetAt(editor, rowIndex, columnIndex);
|
|
10532
|
-
const hover = await getHover(editor, offset);
|
|
10533
|
-
if (!hover) {
|
|
10534
|
-
return undefined;
|
|
10535
|
-
}
|
|
10536
|
-
const {
|
|
10537
|
-
displayString,
|
|
10538
|
-
displayStringLanguageId,
|
|
10539
|
-
documentation
|
|
10540
|
-
} = hover;
|
|
10541
|
-
const tokenizerPath = '';
|
|
10542
|
-
const lineInfos = await tokenizeCodeBlock(displayString, displayStringLanguageId || fallbackDisplayStringLanguageId, tokenizerPath);
|
|
10543
|
-
const wordPart = getWordBefore(editor, rowIndex, columnIndex);
|
|
10544
|
-
const wordStart = columnIndex - wordPart.length;
|
|
10545
|
-
await measureTextBlockHeight();
|
|
10546
|
-
const {
|
|
10547
|
-
x,
|
|
10548
|
-
y
|
|
10549
|
-
} = getHoverPositionXy(editor, rowIndex, wordStart);
|
|
10550
|
-
const diagnostics = editor.diagnostics || [];
|
|
10551
|
-
const matchingDiagnostics = getMatchingDiagnostics(diagnostics, rowIndex);
|
|
10552
|
-
return {
|
|
10553
|
-
documentation,
|
|
10554
|
-
lineInfos,
|
|
10555
|
-
matchingDiagnostics,
|
|
10556
|
-
x,
|
|
10557
|
-
y
|
|
10558
|
-
};
|
|
10559
|
-
};
|
|
10560
|
-
|
|
10561
10657
|
const loadContent$1 = async (editorUid, state, position) => {
|
|
10562
10658
|
const hoverInfo = await getEditorHoverInfo(editorUid, position);
|
|
10563
10659
|
if (!hoverInfo) {
|
|
@@ -10701,6 +10797,12 @@ const hoverDocumentationNode = {
|
|
|
10701
10797
|
className: HoverDocumentation,
|
|
10702
10798
|
type: Div
|
|
10703
10799
|
};
|
|
10800
|
+
const hoverSashNode = {
|
|
10801
|
+
childCount: 0,
|
|
10802
|
+
className: mergeClassNames('Sash', 'SashVertical', 'SashResize'),
|
|
10803
|
+
onPointerDown: HandleSashPointerDown,
|
|
10804
|
+
type: Div
|
|
10805
|
+
};
|
|
10704
10806
|
const getChildCount = (lineInfos, documentation, diagnostics) => {
|
|
10705
10807
|
const documentationCount = documentation ? 1 : 0;
|
|
10706
10808
|
const diagnosticsCount = diagnostics && diagnostics.length > 0 ? 1 : 0;
|
|
@@ -10734,12 +10836,7 @@ const getHoverVirtualDom = (lineInfos, documentation, diagnostics) => {
|
|
|
10734
10836
|
if (documentation) {
|
|
10735
10837
|
dom.push(hoverDocumentationNode, text(documentation));
|
|
10736
10838
|
}
|
|
10737
|
-
dom.push(
|
|
10738
|
-
childCount: 0,
|
|
10739
|
-
className: mergeClassNames('Sash', 'SashVertical', 'SashResize'),
|
|
10740
|
-
onPointerDown: HandleSashPointerDown,
|
|
10741
|
-
type: Div
|
|
10742
|
-
});
|
|
10839
|
+
dom.push(hoverSashNode);
|
|
10743
10840
|
return dom;
|
|
10744
10841
|
};
|
|
10745
10842
|
|
|
@@ -11407,6 +11504,10 @@ const getKeyBindings = () => {
|
|
|
11407
11504
|
command: 'Editor.toggleBreakpoint',
|
|
11408
11505
|
key: F9,
|
|
11409
11506
|
when: FocusEditorText
|
|
11507
|
+
}, {
|
|
11508
|
+
command: 'Editor.goToDefinition',
|
|
11509
|
+
key: F12,
|
|
11510
|
+
when: FocusEditorText
|
|
11410
11511
|
}, {
|
|
11411
11512
|
command: 'EditorRename.accept',
|
|
11412
11513
|
key: Enter,
|
|
@@ -11473,7 +11574,7 @@ const getKeyBindings = () => {
|
|
|
11473
11574
|
when: FocusEditorText
|
|
11474
11575
|
}, {
|
|
11475
11576
|
command: 'Editor.findAllReferences',
|
|
11476
|
-
key:
|
|
11577
|
+
key: Shift | F12,
|
|
11477
11578
|
when: FocusEditorText
|
|
11478
11579
|
}, {
|
|
11479
11580
|
command: 'Editor.organizeImports',
|
|
@@ -11712,6 +11813,7 @@ const kQuickSuggestions = 'editor.quickSuggestions';
|
|
|
11712
11813
|
const kAutoClosingQuotes = 'editor.autoClosingQuotes';
|
|
11713
11814
|
const kAutoClosingBrackets = 'editor.autoclosingBrackets';
|
|
11714
11815
|
const kFontWeight = 'editor.fontWeight';
|
|
11816
|
+
const kHover = 'editor.hover';
|
|
11715
11817
|
const isAutoClosingBracketsEnabled = async () => {
|
|
11716
11818
|
return Boolean(await get$2(kAutoClosingBrackets));
|
|
11717
11819
|
};
|
|
@@ -11730,6 +11832,9 @@ const getRowHeight = async () => {
|
|
|
11730
11832
|
const getFontSize = async () => {
|
|
11731
11833
|
return (await get$2(kFontSize)) || 15; // TODO find out if it is possible to use all numeric values for settings for efficiency, maybe settings could be an array
|
|
11732
11834
|
};
|
|
11835
|
+
const getHoverEnabled = async () => {
|
|
11836
|
+
return (await get$2(kHover)) ?? true;
|
|
11837
|
+
};
|
|
11733
11838
|
const getFontFamily = async () => {
|
|
11734
11839
|
return (await get$2(kFontFamily)) || 'Fira Code';
|
|
11735
11840
|
};
|
|
@@ -11756,13 +11861,14 @@ const getFontWeight = async () => {
|
|
|
11756
11861
|
};
|
|
11757
11862
|
|
|
11758
11863
|
const getEditorPreferences = async () => {
|
|
11759
|
-
const [diagnosticsEnabled$1, fontFamily, fontSize, fontWeight, isAutoClosingBracketsEnabled$1, isAutoClosingQuotesEnabled$1, isAutoClosingTagsEnabled$1, isQuickSuggestionsEnabled$1, lineNumbers, rowHeight, tabSize, letterSpacing, completionTriggerCharacters] = await Promise.all([diagnosticsEnabled(), getFontFamily(), getFontSize(), getFontWeight(), isAutoClosingBracketsEnabled(), isAutoClosingQuotesEnabled(), isAutoClosingTagsEnabled(), isQuickSuggestionsEnabled(), getLineNumbers(), getRowHeight(), getTabSize(), getLetterSpacing(), getCompletionTriggerCharacters()]);
|
|
11864
|
+
const [diagnosticsEnabled$1, fontFamily, fontSize, fontWeight, hoverEnabled, isAutoClosingBracketsEnabled$1, isAutoClosingQuotesEnabled$1, isAutoClosingTagsEnabled$1, isQuickSuggestionsEnabled$1, lineNumbers, rowHeight, tabSize, letterSpacing, completionTriggerCharacters] = await Promise.all([diagnosticsEnabled(), getFontFamily(), getFontSize(), getFontWeight(), getHoverEnabled(), isAutoClosingBracketsEnabled(), isAutoClosingQuotesEnabled(), isAutoClosingTagsEnabled(), isQuickSuggestionsEnabled(), getLineNumbers(), getRowHeight(), getTabSize(), getLetterSpacing(), getCompletionTriggerCharacters()]);
|
|
11760
11865
|
return {
|
|
11761
11866
|
completionTriggerCharacters,
|
|
11762
11867
|
diagnosticsEnabled: diagnosticsEnabled$1,
|
|
11763
11868
|
fontFamily,
|
|
11764
11869
|
fontSize,
|
|
11765
11870
|
fontWeight,
|
|
11871
|
+
hoverEnabled,
|
|
11766
11872
|
isAutoClosingBracketsEnabled: isAutoClosingBracketsEnabled$1,
|
|
11767
11873
|
isAutoClosingQuotesEnabled: isAutoClosingQuotesEnabled$1,
|
|
11768
11874
|
isAutoClosingTagsEnabled: isAutoClosingTagsEnabled$1,
|
|
@@ -12035,6 +12141,7 @@ const loadContent = async (state, savedState) => {
|
|
|
12035
12141
|
fontFamily,
|
|
12036
12142
|
fontSize,
|
|
12037
12143
|
fontWeight,
|
|
12144
|
+
hoverEnabled,
|
|
12038
12145
|
isAutoClosingBracketsEnabled,
|
|
12039
12146
|
isAutoClosingQuotesEnabled,
|
|
12040
12147
|
isAutoClosingTagsEnabled,
|
|
@@ -12062,6 +12169,7 @@ const loadContent = async (state, savedState) => {
|
|
|
12062
12169
|
fontFamily,
|
|
12063
12170
|
fontSize,
|
|
12064
12171
|
fontWeight,
|
|
12172
|
+
hoverEnabled,
|
|
12065
12173
|
isAutoClosingBracketsEnabled,
|
|
12066
12174
|
isAutoClosingQuotesEnabled,
|
|
12067
12175
|
isAutoClosingTagsEnabled,
|
|
@@ -12714,27 +12822,31 @@ const getEditorScrollBarDiagnosticsVirtualDom = scrollBarDiagnostics => {
|
|
|
12714
12822
|
}, ...getDiagnosticsVirtualDom([...scrollBarDiagnostics])];
|
|
12715
12823
|
};
|
|
12716
12824
|
|
|
12825
|
+
const verticalScrollBarNode = {
|
|
12826
|
+
childCount: 1,
|
|
12827
|
+
className: mergeClassNames('ScrollBar', 'ScrollBarVertical'),
|
|
12828
|
+
onContextMenu: HandleContextMenu,
|
|
12829
|
+
onPointerDown: HandleScrollBarVerticalPointerDown,
|
|
12830
|
+
type: Div
|
|
12831
|
+
};
|
|
12832
|
+
const verticalScrollBarThumbNode = {
|
|
12833
|
+
childCount: 0,
|
|
12834
|
+
className: mergeClassNames('ScrollBarThumb', 'ScrollBarThumbVertical'),
|
|
12835
|
+
type: Div
|
|
12836
|
+
};
|
|
12837
|
+
const horizontalScrollBarNode = {
|
|
12838
|
+
childCount: 1,
|
|
12839
|
+
className: mergeClassNames('ScrollBar', 'ScrollBarHorizontal'),
|
|
12840
|
+
onPointerDown: HandleScrollBarHorizontalPointerDown,
|
|
12841
|
+
type: Div
|
|
12842
|
+
};
|
|
12843
|
+
const horizontalScrollBarThumbNode = {
|
|
12844
|
+
childCount: 0,
|
|
12845
|
+
className: mergeClassNames('ScrollBarThumb', 'ScrollBarThumbHorizontal'),
|
|
12846
|
+
type: Div
|
|
12847
|
+
};
|
|
12717
12848
|
const getScrollBarVirtualDom = () => {
|
|
12718
|
-
return [
|
|
12719
|
-
childCount: 1,
|
|
12720
|
-
className: mergeClassNames('ScrollBar', 'ScrollBarVertical'),
|
|
12721
|
-
onContextMenu: HandleContextMenu,
|
|
12722
|
-
onPointerDown: HandleScrollBarVerticalPointerDown,
|
|
12723
|
-
type: Div
|
|
12724
|
-
}, {
|
|
12725
|
-
childCount: 0,
|
|
12726
|
-
className: mergeClassNames('ScrollBarThumb', 'ScrollBarThumbVertical'),
|
|
12727
|
-
type: Div
|
|
12728
|
-
}, {
|
|
12729
|
-
childCount: 1,
|
|
12730
|
-
className: mergeClassNames('ScrollBar', 'ScrollBarHorizontal'),
|
|
12731
|
-
onPointerDown: HandleScrollBarHorizontalPointerDown,
|
|
12732
|
-
type: Div
|
|
12733
|
-
}, {
|
|
12734
|
-
childCount: 0,
|
|
12735
|
-
className: mergeClassNames('ScrollBarThumb', 'ScrollBarThumbHorizontal'),
|
|
12736
|
-
type: Div
|
|
12737
|
-
}];
|
|
12849
|
+
return [verticalScrollBarNode, verticalScrollBarThumbNode, horizontalScrollBarNode, horizontalScrollBarThumbNode];
|
|
12738
12850
|
};
|
|
12739
12851
|
|
|
12740
12852
|
const editorContentNode = {
|
|
@@ -12802,6 +12914,11 @@ const getGutterInfos = (minLineY, maxLineY, breakPoints, showLineNumbers = true,
|
|
|
12802
12914
|
return gutterInfos;
|
|
12803
12915
|
};
|
|
12804
12916
|
|
|
12917
|
+
const textEditorErrorIconNode = {
|
|
12918
|
+
childCount: 0,
|
|
12919
|
+
className: mergeClassNames('EditorTextIcon', 'EditorTextIconError', 'MaskIcon', 'MaskIconError'),
|
|
12920
|
+
type: Div
|
|
12921
|
+
};
|
|
12805
12922
|
const textEditorErrorMessageNode = {
|
|
12806
12923
|
childCount: 1,
|
|
12807
12924
|
className: 'TextEditorErrorMessage',
|
|
@@ -12831,11 +12948,7 @@ const getEditorVirtualDom = ({
|
|
|
12831
12948
|
'data-uid': uid,
|
|
12832
12949
|
role: Code,
|
|
12833
12950
|
type: Div
|
|
12834
|
-
},
|
|
12835
|
-
childCount: 0,
|
|
12836
|
-
className: mergeClassNames('EditorTextIcon', 'EditorTextIconError', 'MaskIcon', 'MaskIconError'),
|
|
12837
|
-
type: Div
|
|
12838
|
-
}, textEditorErrorMessageNode, text(loadError)];
|
|
12951
|
+
}, textEditorErrorIconNode, textEditorErrorMessageNode, text(loadError)];
|
|
12839
12952
|
}
|
|
12840
12953
|
const visibleGutterInfos = breakPoints.length > 0 || visibleLineIndices ? getGutterInfos(minLineY, maxLineY, breakPoints, lineNumbers, visibleLineIndices) : gutterInfos;
|
|
12841
12954
|
const showGutter = lineNumbers || breakPoints.length > 0;
|
|
@@ -13420,6 +13533,7 @@ const commandMap = {
|
|
|
13420
13533
|
'Editor.copyLineUp': wrapCommand(copyLineUp),
|
|
13421
13534
|
'Editor.create': createEditor,
|
|
13422
13535
|
'Editor.create2': createEditor2,
|
|
13536
|
+
'Editor.createStandalone': createStandaloneEditor,
|
|
13423
13537
|
'Editor.cursorCharacterLeft': wrapCommand(cursorCharacterLeft),
|
|
13424
13538
|
'Editor.cursorCharacterRight': wrapCommand(cursorCharacterRight),
|
|
13425
13539
|
'Editor.cursorDocumentEnd': wrapCommand(cursorDocumentEnd),
|
|
@@ -13570,7 +13684,7 @@ const commandMap = {
|
|
|
13570
13684
|
'Editor.setSelections2': setSelections2,
|
|
13571
13685
|
'Editor.setText': wrapCommand(setText),
|
|
13572
13686
|
'Editor.showHover': showHover,
|
|
13573
|
-
'Editor.showHover2':
|
|
13687
|
+
'Editor.showHover2': wrapCommand(showHover2),
|
|
13574
13688
|
'Editor.showSourceActions': wrapCommand(showSourceActions),
|
|
13575
13689
|
'Editor.showSourceActions2': wrapCommand(showSourceActions),
|
|
13576
13690
|
'Editor.showSourceActions3': wrapCommand(showSourceActions),
|
|
@@ -13757,6 +13871,11 @@ const listen = async () => {
|
|
|
13757
13871
|
|
|
13758
13872
|
const CodeGeneratorInput = 'CodeGeneratorInput';
|
|
13759
13873
|
|
|
13874
|
+
const codeGeneratorNode = {
|
|
13875
|
+
childCount: 2,
|
|
13876
|
+
className: mergeClassNames(Viewlet, CodeGeneratorWidget),
|
|
13877
|
+
type: Div
|
|
13878
|
+
};
|
|
13760
13879
|
const codeGeneratorMessageNode = {
|
|
13761
13880
|
childCount: 1,
|
|
13762
13881
|
className: CodeGeneratorMessage,
|
|
@@ -13765,11 +13884,7 @@ const codeGeneratorMessageNode = {
|
|
|
13765
13884
|
const getCodeGeneratorVirtualDom = state => {
|
|
13766
13885
|
const escapeToClose$1 = escapeToClose();
|
|
13767
13886
|
const enterCode$1 = enterCode();
|
|
13768
|
-
return [{
|
|
13769
|
-
childCount: 2,
|
|
13770
|
-
className: mergeClassNames(Viewlet, CodeGeneratorWidget),
|
|
13771
|
-
type: Div
|
|
13772
|
-
}, {
|
|
13887
|
+
return [codeGeneratorNode, {
|
|
13773
13888
|
childCount: 0,
|
|
13774
13889
|
className: mergeClassNames(CodeGeneratorInput$1, InputBox),
|
|
13775
13890
|
name: CodeGeneratorInput,
|
|
@@ -13879,6 +13994,11 @@ const EditorColorPickerWidget = {
|
|
|
13879
13994
|
|
|
13880
13995
|
const Focusable = 0;
|
|
13881
13996
|
|
|
13997
|
+
const completionDetailNode = {
|
|
13998
|
+
childCount: 2,
|
|
13999
|
+
className: mergeClassNames('Viewlet', 'EditorCompletionDetails'),
|
|
14000
|
+
type: Div
|
|
14001
|
+
};
|
|
13882
14002
|
const completionDetailContentNode = {
|
|
13883
14003
|
childCount: 1,
|
|
13884
14004
|
className: CompletionDetailContent,
|
|
@@ -13892,16 +14012,13 @@ const completionDetailCloseButtonNode = {
|
|
|
13892
14012
|
tabIndex: Focusable,
|
|
13893
14013
|
type: Div
|
|
13894
14014
|
};
|
|
14015
|
+
const completionDetailCloseIconNode = {
|
|
14016
|
+
childCount: 0,
|
|
14017
|
+
className: mergeClassNames(MaskIcon, IconClose),
|
|
14018
|
+
type: Div
|
|
14019
|
+
};
|
|
13895
14020
|
const getCompletionDetailVirtualDom = content => {
|
|
13896
|
-
const dom = [
|
|
13897
|
-
childCount: 2,
|
|
13898
|
-
className: mergeClassNames('Viewlet', 'EditorCompletionDetails'),
|
|
13899
|
-
type: Div
|
|
13900
|
-
}, completionDetailContentNode, text(content), completionDetailCloseButtonNode, {
|
|
13901
|
-
childCount: 0,
|
|
13902
|
-
className: mergeClassNames(MaskIcon, IconClose),
|
|
13903
|
-
type: Div
|
|
13904
|
-
}];
|
|
14021
|
+
const dom = [completionDetailNode, completionDetailContentNode, text(content), completionDetailCloseButtonNode, completionDetailCloseIconNode];
|
|
13905
14022
|
return dom;
|
|
13906
14023
|
};
|
|
13907
14024
|
|
|
@@ -14006,7 +14123,11 @@ const EditorCompletionDetailWidget = {
|
|
|
14006
14123
|
|
|
14007
14124
|
const commandsToForward = [SetDom2, SetCss, AppendToBody, SetBounds2, RegisterEventListeners, SetSelectionByName, SetValueByName, SetFocusContext, SetUid, 'Viewlet.focusSelector'];
|
|
14008
14125
|
const render$1 = widget => {
|
|
14009
|
-
const
|
|
14126
|
+
const {
|
|
14127
|
+
newState,
|
|
14128
|
+
oldState
|
|
14129
|
+
} = widget;
|
|
14130
|
+
const commands = newState.commands.length > 0 ? renderFull$3(oldState, newState) : [[SetDom2, newState.uid, getHoverVirtualDom(newState.lineInfos, newState.documentation, newState.diagnostics)], [SetBounds2, newState.uid, newState.x, newState.y, newState.width, newState.height]];
|
|
14010
14131
|
const wrappedCommands = [];
|
|
14011
14132
|
const {
|
|
14012
14133
|
uid
|