@codingame/monaco-vscode-interactive-service-override 9.0.3 → 10.0.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/package.json +2 -2
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactive.contribution.js +97 -94
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveEditor.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/interactive/browser/interactiveEditor.js +30 -18
- package/vscode/src/vs/workbench/contrib/interactive/browser/replInputHintContentWidget.js +11 -10
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/interactiveEditor.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/media/interactive.css.js +6 -0
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditor.js +50 -0
- package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorInput.js +133 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@codingame/monaco-vscode-interactive-service-override",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.0.1",
|
|
4
4
|
"keywords": [],
|
|
5
5
|
"author": {
|
|
6
6
|
"name": "CodinGame",
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
}
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"vscode": "npm:@codingame/monaco-vscode-api@
|
|
29
|
+
"vscode": "npm:@codingame/monaco-vscode-api@10.0.1"
|
|
30
30
|
}
|
|
31
31
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
2
|
import { Iterable } from 'vscode/vscode/vs/base/common/iterator';
|
|
3
|
-
import { KeyMod, KeyCode } from 'vscode/vscode/vs/base/common/keyCodes';
|
|
4
3
|
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
4
|
import { parse } from 'vscode/vscode/vs/base/common/marshalling';
|
|
6
5
|
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
@@ -21,9 +20,7 @@ import { Extensions } from 'vscode/vscode/vs/platform/configuration/common/confi
|
|
|
21
20
|
import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
22
21
|
import { EditorActivation } from 'vscode/vscode/vs/platform/editor/common/editor';
|
|
23
22
|
import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
|
|
24
|
-
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
25
23
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
26
|
-
import { KeybindingWeight } from 'vscode/vscode/vs/platform/keybinding/common/keybindingsRegistry';
|
|
27
24
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
28
25
|
import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
|
|
29
26
|
import { registerColor, ifDefinedThenElse } from 'vscode/vscode/vs/platform/theme/common/colorUtils';
|
|
@@ -38,8 +35,8 @@ import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
|
|
|
38
35
|
import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
|
|
39
36
|
import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
|
|
40
37
|
import { EditorPaneDescriptor } from 'vscode/vscode/vs/workbench/browser/editor';
|
|
41
|
-
import { registerWorkbenchContribution2
|
|
42
|
-
import { EditorExtensions
|
|
38
|
+
import { registerWorkbenchContribution2 } from 'vscode/vscode/vs/workbench/common/contributions';
|
|
39
|
+
import { EditorExtensions } from 'vscode/vscode/vs/workbench/common/editor';
|
|
43
40
|
import { PANEL_BORDER } from 'vscode/vscode/vs/workbench/common/theme';
|
|
44
41
|
import { ResourceNotebookCellEdit } from 'vscode/vscode/vs/workbench/contrib/bulkEdit/browser/bulkCellEdits';
|
|
45
42
|
import { INTERACTIVE_INPUT_CURSOR_BOUNDARY, InteractiveWindowSetting } from './interactiveCommon.js';
|
|
@@ -52,8 +49,8 @@ import { IInteractiveHistoryService } from 'vscode/vscode/vs/workbench/contrib/i
|
|
|
52
49
|
import { NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
|
|
53
50
|
import { executeIcon } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookIcons';
|
|
54
51
|
import { INotebookEditorService } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService.service';
|
|
55
|
-
import { INTERACTIVE_WINDOW_EDITOR_ID, CellUri, NotebookWorkingCopyTypeIdentifier,
|
|
56
|
-
import { InteractiveWindowOpen } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
|
|
52
|
+
import { INTERACTIVE_WINDOW_EDITOR_ID, CellUri, NotebookWorkingCopyTypeIdentifier, CellKind, NotebookSetting } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
53
|
+
import { IS_COMPOSITE_NOTEBOOK, NOTEBOOK_EDITOR_FOCUSED, InteractiveWindowOpen } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
|
|
57
54
|
import { INotebookKernelService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookKernelService.service';
|
|
58
55
|
import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService.service';
|
|
59
56
|
import { columnToEditorGroup } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupColumn';
|
|
@@ -63,8 +60,11 @@ import { IEditorResolverService } from 'vscode/vscode/vs/workbench/services/edit
|
|
|
63
60
|
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
64
61
|
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
65
62
|
import { IWorkingCopyEditorService } from 'vscode/vscode/vs/workbench/services/workingCopy/common/workingCopyEditorService.service';
|
|
63
|
+
import { isReplEditorControl } from '../../replNotebook/browser/replEditor.js';
|
|
64
|
+
import { InlineChatController } from 'vscode/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatController';
|
|
65
|
+
import { IsWindowsContext, IsLinuxContext } from 'vscode/vscode/vs/platform/contextkey/common/contextkeys';
|
|
66
66
|
|
|
67
|
-
const interactiveWindowCategory = ( localize2(
|
|
67
|
+
const interactiveWindowCategory = ( localize2(2350, "Interactive Window"));
|
|
68
68
|
( (Registry.as(EditorExtensions.EditorPane))).registerEditorPane(EditorPaneDescriptor.create(InteractiveEditor, INTERACTIVE_WINDOW_EDITOR_ID, 'Interactive Window'), [
|
|
69
69
|
( (new SyncDescriptor(InteractiveEditorInput)))
|
|
70
70
|
]);
|
|
@@ -91,7 +91,7 @@ let InteractiveDocumentContribution = class InteractiveDocumentContribution exte
|
|
|
91
91
|
singlePerResource: true
|
|
92
92
|
}, {
|
|
93
93
|
createEditorInput: ({ resource }) => {
|
|
94
|
-
const editorInput = editorService.getEditors(
|
|
94
|
+
const editorInput = editorService.getEditors(1 ).find(editor => editor.editor instanceof InteractiveEditorInput && ( (editor.editor.inputResource.toString())) === ( (resource.toString())));
|
|
95
95
|
return editorInput;
|
|
96
96
|
}
|
|
97
97
|
});
|
|
@@ -216,7 +216,7 @@ let InteractiveWindowWorkingCopyEditorHandler = class InteractiveWindowWorkingCo
|
|
|
216
216
|
this._register(this._workingCopyEditorService.registerHandler(this));
|
|
217
217
|
}
|
|
218
218
|
_getViewType(workingCopy) {
|
|
219
|
-
return NotebookWorkingCopyTypeIdentifier.parse(workingCopy.typeId);
|
|
219
|
+
return NotebookWorkingCopyTypeIdentifier.parse(workingCopy.typeId)?.viewType;
|
|
220
220
|
}
|
|
221
221
|
};
|
|
222
222
|
InteractiveWindowWorkingCopyEditorHandler = ( (__decorate([
|
|
@@ -224,7 +224,7 @@ InteractiveWindowWorkingCopyEditorHandler = ( (__decorate([
|
|
|
224
224
|
( (__param(1, IWorkingCopyEditorService))),
|
|
225
225
|
( (__param(2, IExtensionService)))
|
|
226
226
|
], InteractiveWindowWorkingCopyEditorHandler)));
|
|
227
|
-
registerWorkbenchContribution2(InteractiveDocumentContribution.ID, InteractiveDocumentContribution,
|
|
227
|
+
registerWorkbenchContribution2(InteractiveDocumentContribution.ID, InteractiveDocumentContribution, 2 );
|
|
228
228
|
registerWorkbenchContribution2(InteractiveInputContentProvider.ID, InteractiveInputContentProvider, {
|
|
229
229
|
editorTypeId: INTERACTIVE_WINDOW_EDITOR_ID
|
|
230
230
|
});
|
|
@@ -269,11 +269,11 @@ registerAction2(class extends Action2 {
|
|
|
269
269
|
constructor() {
|
|
270
270
|
super({
|
|
271
271
|
id: '_interactive.open',
|
|
272
|
-
title: ( localize2(
|
|
272
|
+
title: ( localize2(2351, 'Open Interactive Window')),
|
|
273
273
|
f1: false,
|
|
274
274
|
category: interactiveWindowCategory,
|
|
275
275
|
metadata: {
|
|
276
|
-
description: ( localize(
|
|
276
|
+
description: ( localize(2351, 'Open Interactive Window')),
|
|
277
277
|
args: [
|
|
278
278
|
{
|
|
279
279
|
name: 'showOptions',
|
|
@@ -341,7 +341,7 @@ registerAction2(class extends Action2 {
|
|
|
341
341
|
}
|
|
342
342
|
}
|
|
343
343
|
const existingNotebookDocument = ( (new Set()));
|
|
344
|
-
editorService.getEditors(
|
|
344
|
+
editorService.getEditors(1 ).forEach(editor => {
|
|
345
345
|
if (editor.editor.resource) {
|
|
346
346
|
existingNotebookDocument.add(( (editor.editor.resource.toString())));
|
|
347
347
|
}
|
|
@@ -377,25 +377,25 @@ registerAction2(class extends Action2 {
|
|
|
377
377
|
constructor() {
|
|
378
378
|
super({
|
|
379
379
|
id: 'interactive.execute',
|
|
380
|
-
title: ( localize2(
|
|
380
|
+
title: ( localize2(2352, 'Execute Code')),
|
|
381
381
|
category: interactiveWindowCategory,
|
|
382
382
|
keybinding: [{
|
|
383
383
|
when: ( (ContextKeyExpr.equals('activeEditor', 'workbench.editor.interactive'))),
|
|
384
|
-
primary:
|
|
384
|
+
primary: 2048 | 3 ,
|
|
385
385
|
weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT
|
|
386
386
|
}, {
|
|
387
387
|
when: ( (ContextKeyExpr.and(
|
|
388
388
|
(ContextKeyExpr.equals('activeEditor', 'workbench.editor.interactive')),
|
|
389
389
|
(ContextKeyExpr.equals('config.interactiveWindow.executeWithShiftEnter', true))
|
|
390
390
|
))),
|
|
391
|
-
primary:
|
|
391
|
+
primary: 1024 | 3 ,
|
|
392
392
|
weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT
|
|
393
393
|
}, {
|
|
394
394
|
when: ( (ContextKeyExpr.and(
|
|
395
395
|
(ContextKeyExpr.equals('activeEditor', 'workbench.editor.interactive')),
|
|
396
396
|
(ContextKeyExpr.equals('config.interactiveWindow.executeWithShiftEnter', false))
|
|
397
397
|
))),
|
|
398
|
-
primary:
|
|
398
|
+
primary: 3 ,
|
|
399
399
|
weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT
|
|
400
400
|
}],
|
|
401
401
|
menu: [
|
|
@@ -437,9 +437,9 @@ registerAction2(class extends Action2 {
|
|
|
437
437
|
else {
|
|
438
438
|
editorControl = editorService.activeEditorPane?.getControl();
|
|
439
439
|
}
|
|
440
|
-
if (editorControl && editorControl
|
|
440
|
+
if (editorControl && isReplEditorControl(editorControl) && editorControl.notebookEditor) {
|
|
441
441
|
const notebookDocument = editorControl.notebookEditor.textModel;
|
|
442
|
-
const textModel = editorControl.
|
|
442
|
+
const textModel = editorControl.activeCodeEditor.getModel();
|
|
443
443
|
const activeKernel = editorControl.notebookEditor.activeKernel;
|
|
444
444
|
const language = activeKernel?.supportedLanguages[0] ?? PLAINTEXT_LANGUAGE_ID;
|
|
445
445
|
if (notebookDocument && textModel) {
|
|
@@ -448,6 +448,10 @@ registerAction2(class extends Action2 {
|
|
|
448
448
|
if (isFalsyOrWhitespace(value)) {
|
|
449
449
|
return;
|
|
450
450
|
}
|
|
451
|
+
const ctrl = InlineChatController.get(editorControl.activeCodeEditor);
|
|
452
|
+
if (ctrl) {
|
|
453
|
+
ctrl.acceptHunk();
|
|
454
|
+
}
|
|
451
455
|
historyService.replaceLast(notebookDocument.uri, value);
|
|
452
456
|
historyService.addToHistory(notebookDocument.uri, '');
|
|
453
457
|
textModel.setValue('');
|
|
@@ -459,7 +463,7 @@ registerAction2(class extends Action2 {
|
|
|
459
463
|
undefined;
|
|
460
464
|
await bulkEditService.apply([
|
|
461
465
|
( (new ResourceNotebookCellEdit(notebookDocument.uri, {
|
|
462
|
-
editType:
|
|
466
|
+
editType: 1 ,
|
|
463
467
|
index: index,
|
|
464
468
|
count: 0,
|
|
465
469
|
cells: [{
|
|
@@ -489,7 +493,7 @@ registerAction2(class extends Action2 {
|
|
|
489
493
|
constructor() {
|
|
490
494
|
super({
|
|
491
495
|
id: 'interactive.input.clear',
|
|
492
|
-
title: ( localize2(
|
|
496
|
+
title: ( localize2(2353, 'Clear the interactive window input editor contents')),
|
|
493
497
|
category: interactiveWindowCategory,
|
|
494
498
|
f1: false
|
|
495
499
|
});
|
|
@@ -497,12 +501,12 @@ registerAction2(class extends Action2 {
|
|
|
497
501
|
async run(accessor) {
|
|
498
502
|
const editorService = accessor.get(IEditorService);
|
|
499
503
|
const editorControl = editorService.activeEditorPane?.getControl();
|
|
500
|
-
if (editorControl && editorControl
|
|
504
|
+
if (editorControl && isReplEditorControl(editorControl) && editorControl.notebookEditor) {
|
|
501
505
|
const notebookDocument = editorControl.notebookEditor.textModel;
|
|
502
|
-
const textModel = editorControl.
|
|
503
|
-
const range = editorControl.
|
|
506
|
+
const textModel = editorControl.activeCodeEditor.getModel();
|
|
507
|
+
const range = editorControl.activeCodeEditor.getModel()?.getFullModelRange();
|
|
504
508
|
if (notebookDocument && textModel && range) {
|
|
505
|
-
editorControl.
|
|
509
|
+
editorControl.activeCodeEditor.executeEdits('', [EditOperation.replace(range, null)]);
|
|
506
510
|
}
|
|
507
511
|
}
|
|
508
512
|
}
|
|
@@ -511,37 +515,28 @@ registerAction2(class extends Action2 {
|
|
|
511
515
|
constructor() {
|
|
512
516
|
super({
|
|
513
517
|
id: 'interactive.history.previous',
|
|
514
|
-
title: ( localize2(
|
|
518
|
+
title: ( localize2(2354, 'Previous value in history')),
|
|
515
519
|
category: interactiveWindowCategory,
|
|
516
520
|
f1: false,
|
|
517
|
-
keybinding:
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
when: ( (ContextKeyExpr.and(
|
|
528
|
-
(ContextKeyExpr.equals('activeEditor', 'workbench.editor.repl')),
|
|
529
|
-
(INTERACTIVE_INPUT_CURSOR_BOUNDARY.notEqualsTo('bottom')),
|
|
530
|
-
(INTERACTIVE_INPUT_CURSOR_BOUNDARY.notEqualsTo('none')),
|
|
531
|
-
(Context.Visible.toNegated())
|
|
532
|
-
))),
|
|
533
|
-
primary: KeyCode.UpArrow,
|
|
534
|
-
weight: KeybindingWeight.WorkbenchContrib
|
|
535
|
-
}]
|
|
521
|
+
keybinding: {
|
|
522
|
+
when: ( (ContextKeyExpr.and(
|
|
523
|
+
(INTERACTIVE_INPUT_CURSOR_BOUNDARY.notEqualsTo('bottom')),
|
|
524
|
+
(INTERACTIVE_INPUT_CURSOR_BOUNDARY.notEqualsTo('none')),
|
|
525
|
+
(Context.Visible.toNegated())
|
|
526
|
+
))),
|
|
527
|
+
primary: 16 ,
|
|
528
|
+
weight: 200
|
|
529
|
+
},
|
|
530
|
+
precondition: ( (ContextKeyExpr.and(IS_COMPOSITE_NOTEBOOK, (NOTEBOOK_EDITOR_FOCUSED.negate()))))
|
|
536
531
|
});
|
|
537
532
|
}
|
|
538
533
|
async run(accessor) {
|
|
539
534
|
const editorService = accessor.get(IEditorService);
|
|
540
535
|
const historyService = accessor.get(IInteractiveHistoryService);
|
|
541
536
|
const editorControl = editorService.activeEditorPane?.getControl();
|
|
542
|
-
if (editorControl && editorControl
|
|
537
|
+
if (editorControl && isReplEditorControl(editorControl) && editorControl.notebookEditor) {
|
|
543
538
|
const notebookDocument = editorControl.notebookEditor.textModel;
|
|
544
|
-
const textModel = editorControl.
|
|
539
|
+
const textModel = editorControl.activeCodeEditor.getModel();
|
|
545
540
|
if (notebookDocument && textModel) {
|
|
546
541
|
const previousValue = historyService.getPreviousValue(notebookDocument.uri);
|
|
547
542
|
if (previousValue) {
|
|
@@ -555,37 +550,28 @@ registerAction2(class extends Action2 {
|
|
|
555
550
|
constructor() {
|
|
556
551
|
super({
|
|
557
552
|
id: 'interactive.history.next',
|
|
558
|
-
title: ( localize2(
|
|
553
|
+
title: ( localize2(2355, 'Next value in history')),
|
|
559
554
|
category: interactiveWindowCategory,
|
|
560
555
|
f1: false,
|
|
561
|
-
keybinding:
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
when: ( (ContextKeyExpr.and(
|
|
572
|
-
(ContextKeyExpr.equals('activeEditor', 'workbench.editor.repl')),
|
|
573
|
-
(INTERACTIVE_INPUT_CURSOR_BOUNDARY.notEqualsTo('top')),
|
|
574
|
-
(INTERACTIVE_INPUT_CURSOR_BOUNDARY.notEqualsTo('none')),
|
|
575
|
-
(Context.Visible.toNegated())
|
|
576
|
-
))),
|
|
577
|
-
primary: KeyCode.DownArrow,
|
|
578
|
-
weight: KeybindingWeight.WorkbenchContrib
|
|
579
|
-
}],
|
|
556
|
+
keybinding: {
|
|
557
|
+
when: ( (ContextKeyExpr.and(
|
|
558
|
+
(INTERACTIVE_INPUT_CURSOR_BOUNDARY.notEqualsTo('top')),
|
|
559
|
+
(INTERACTIVE_INPUT_CURSOR_BOUNDARY.notEqualsTo('none')),
|
|
560
|
+
(Context.Visible.toNegated())
|
|
561
|
+
))),
|
|
562
|
+
primary: 18 ,
|
|
563
|
+
weight: 200
|
|
564
|
+
},
|
|
565
|
+
precondition: ( (ContextKeyExpr.and(IS_COMPOSITE_NOTEBOOK, (NOTEBOOK_EDITOR_FOCUSED.negate()))))
|
|
580
566
|
});
|
|
581
567
|
}
|
|
582
568
|
async run(accessor) {
|
|
583
569
|
const editorService = accessor.get(IEditorService);
|
|
584
570
|
const historyService = accessor.get(IInteractiveHistoryService);
|
|
585
571
|
const editorControl = editorService.activeEditorPane?.getControl();
|
|
586
|
-
if (editorControl && editorControl
|
|
572
|
+
if (editorControl && isReplEditorControl(editorControl) && editorControl.notebookEditor) {
|
|
587
573
|
const notebookDocument = editorControl.notebookEditor.textModel;
|
|
588
|
-
const textModel = editorControl.
|
|
574
|
+
const textModel = editorControl.activeCodeEditor.getModel();
|
|
589
575
|
if (notebookDocument && textModel) {
|
|
590
576
|
const nextValue = historyService.getNextValue(notebookDocument.uri);
|
|
591
577
|
if (nextValue !== null) {
|
|
@@ -599,12 +585,12 @@ registerAction2(class extends Action2 {
|
|
|
599
585
|
constructor() {
|
|
600
586
|
super({
|
|
601
587
|
id: 'interactive.scrollToTop',
|
|
602
|
-
title: ( localize(
|
|
588
|
+
title: ( localize(2356, 'Scroll to Top')),
|
|
603
589
|
keybinding: {
|
|
604
590
|
when: ( (ContextKeyExpr.equals('activeEditor', 'workbench.editor.interactive'))),
|
|
605
|
-
primary:
|
|
606
|
-
mac: { primary:
|
|
607
|
-
weight:
|
|
591
|
+
primary: 2048 | 14 ,
|
|
592
|
+
mac: { primary: 2048 | 16 },
|
|
593
|
+
weight: 200
|
|
608
594
|
},
|
|
609
595
|
category: interactiveWindowCategory,
|
|
610
596
|
});
|
|
@@ -612,7 +598,7 @@ registerAction2(class extends Action2 {
|
|
|
612
598
|
async run(accessor) {
|
|
613
599
|
const editorService = accessor.get(IEditorService);
|
|
614
600
|
const editorControl = editorService.activeEditorPane?.getControl();
|
|
615
|
-
if (editorControl && editorControl
|
|
601
|
+
if (editorControl && isReplEditorControl(editorControl) && editorControl.notebookEditor) {
|
|
616
602
|
if (editorControl.notebookEditor.getLength() === 0) {
|
|
617
603
|
return;
|
|
618
604
|
}
|
|
@@ -624,12 +610,12 @@ registerAction2(class extends Action2 {
|
|
|
624
610
|
constructor() {
|
|
625
611
|
super({
|
|
626
612
|
id: 'interactive.scrollToBottom',
|
|
627
|
-
title: ( localize(
|
|
613
|
+
title: ( localize(2357, 'Scroll to Bottom')),
|
|
628
614
|
keybinding: {
|
|
629
615
|
when: ( (ContextKeyExpr.equals('activeEditor', 'workbench.editor.interactive'))),
|
|
630
|
-
primary:
|
|
631
|
-
mac: { primary:
|
|
632
|
-
weight:
|
|
616
|
+
primary: 2048 | 13 ,
|
|
617
|
+
mac: { primary: 2048 | 18 },
|
|
618
|
+
weight: 200
|
|
633
619
|
},
|
|
634
620
|
category: interactiveWindowCategory,
|
|
635
621
|
});
|
|
@@ -637,7 +623,7 @@ registerAction2(class extends Action2 {
|
|
|
637
623
|
async run(accessor) {
|
|
638
624
|
const editorService = accessor.get(IEditorService);
|
|
639
625
|
const editorControl = editorService.activeEditorPane?.getControl();
|
|
640
|
-
if (editorControl && editorControl
|
|
626
|
+
if (editorControl && isReplEditorControl(editorControl) && editorControl.notebookEditor) {
|
|
641
627
|
if (editorControl.notebookEditor.getLength() === 0) {
|
|
642
628
|
return;
|
|
643
629
|
}
|
|
@@ -650,30 +636,34 @@ registerAction2(class extends Action2 {
|
|
|
650
636
|
constructor() {
|
|
651
637
|
super({
|
|
652
638
|
id: 'interactive.input.focus',
|
|
653
|
-
title: ( localize2(
|
|
639
|
+
title: ( localize2(2358, 'Focus Input Editor')),
|
|
654
640
|
category: interactiveWindowCategory,
|
|
655
641
|
menu: {
|
|
656
642
|
id: MenuId.CommandPalette,
|
|
657
643
|
when: InteractiveWindowOpen,
|
|
658
644
|
},
|
|
659
|
-
|
|
645
|
+
keybinding: {
|
|
646
|
+
when: ( (ContextKeyExpr.and(IS_COMPOSITE_NOTEBOOK, NOTEBOOK_EDITOR_FOCUSED))),
|
|
647
|
+
weight: 200 + 5,
|
|
648
|
+
primary: 2048 | 18
|
|
649
|
+
}
|
|
660
650
|
});
|
|
661
651
|
}
|
|
662
652
|
async run(accessor) {
|
|
663
653
|
const editorService = accessor.get(IEditorService);
|
|
664
654
|
const editorControl = editorService.activeEditorPane?.getControl();
|
|
665
|
-
if (editorControl && editorControl
|
|
655
|
+
if (editorControl && isReplEditorControl(editorControl) && editorControl.notebookEditor) {
|
|
666
656
|
editorService.activeEditorPane?.focus();
|
|
667
657
|
}
|
|
668
658
|
else {
|
|
669
|
-
const openEditors = editorService.getEditors(
|
|
659
|
+
const openEditors = editorService.getEditors(0 );
|
|
670
660
|
const interactiveWindow = Iterable.find(openEditors, identifier => { return identifier.editor.typeId === InteractiveEditorInput.ID; });
|
|
671
661
|
if (interactiveWindow) {
|
|
672
662
|
const editorInput = interactiveWindow.editor;
|
|
673
663
|
const currentGroup = interactiveWindow.groupId;
|
|
674
664
|
const editor = await editorService.openEditor(editorInput, currentGroup);
|
|
675
665
|
const editorControl = editor?.getControl();
|
|
676
|
-
if (editorControl && editorControl
|
|
666
|
+
if (editorControl && isReplEditorControl(editorControl) && editorControl.notebookEditor) {
|
|
677
667
|
editorService.activeEditorPane?.focus();
|
|
678
668
|
}
|
|
679
669
|
}
|
|
@@ -684,19 +674,32 @@ registerAction2(class extends Action2 {
|
|
|
684
674
|
constructor() {
|
|
685
675
|
super({
|
|
686
676
|
id: 'interactive.history.focus',
|
|
687
|
-
title: ( localize2(
|
|
677
|
+
title: ( localize2(2359, 'Focus History')),
|
|
688
678
|
category: interactiveWindowCategory,
|
|
689
679
|
menu: {
|
|
690
680
|
id: MenuId.CommandPalette,
|
|
691
681
|
when: ( (ContextKeyExpr.equals('activeEditor', 'workbench.editor.interactive'))),
|
|
692
682
|
},
|
|
693
|
-
|
|
683
|
+
keybinding: [{
|
|
684
|
+
when: ( (ContextKeyExpr.and(
|
|
685
|
+
(INTERACTIVE_INPUT_CURSOR_BOUNDARY.notEqualsTo('bottom')),
|
|
686
|
+
(INTERACTIVE_INPUT_CURSOR_BOUNDARY.notEqualsTo('none'))
|
|
687
|
+
))),
|
|
688
|
+
weight: 200 + 5,
|
|
689
|
+
primary: 2048 | 16
|
|
690
|
+
},
|
|
691
|
+
{
|
|
692
|
+
when: ( (ContextKeyExpr.or(IsWindowsContext, IsLinuxContext))),
|
|
693
|
+
weight: 200 ,
|
|
694
|
+
primary: 2048 | 16 ,
|
|
695
|
+
}],
|
|
696
|
+
precondition: ( (ContextKeyExpr.and(IS_COMPOSITE_NOTEBOOK, (NOTEBOOK_EDITOR_FOCUSED.negate()))))
|
|
694
697
|
});
|
|
695
698
|
}
|
|
696
699
|
async run(accessor) {
|
|
697
700
|
const editorService = accessor.get(IEditorService);
|
|
698
701
|
const editorControl = editorService.activeEditorPane?.getControl();
|
|
699
|
-
if (editorControl && editorControl
|
|
702
|
+
if (editorControl && isReplEditorControl(editorControl) && editorControl.notebookEditor) {
|
|
700
703
|
editorControl.notebookEditor.focus();
|
|
701
704
|
}
|
|
702
705
|
}
|
|
@@ -707,7 +710,7 @@ registerColor('interactive.activeCodeBorder', {
|
|
|
707
710
|
hcDark: contrastBorder,
|
|
708
711
|
hcLight: contrastBorder
|
|
709
712
|
}, ( localize(
|
|
710
|
-
|
|
713
|
+
2360,
|
|
711
714
|
'The border color for the current interactive code cell when the editor has focus.'
|
|
712
715
|
)));
|
|
713
716
|
registerColor('interactive.inactiveCodeBorder', {
|
|
@@ -716,7 +719,7 @@ registerColor('interactive.inactiveCodeBorder', {
|
|
|
716
719
|
hcDark: PANEL_BORDER,
|
|
717
720
|
hcLight: PANEL_BORDER
|
|
718
721
|
}, ( localize(
|
|
719
|
-
|
|
722
|
+
2361,
|
|
720
723
|
'The border color for the current interactive code cell when the editor does not have focus.'
|
|
721
724
|
)));
|
|
722
725
|
( (Registry.as(Extensions.Configuration))).registerConfiguration({
|
|
@@ -728,7 +731,7 @@ registerColor('interactive.inactiveCodeBorder', {
|
|
|
728
731
|
type: 'boolean',
|
|
729
732
|
default: true,
|
|
730
733
|
markdownDescription: ( localize(
|
|
731
|
-
|
|
734
|
+
2362,
|
|
732
735
|
"Automatically scroll the interactive window to show the output of the last statement executed. If this value is false, the window will only scroll if the last cell was already the one scrolled to."
|
|
733
736
|
))
|
|
734
737
|
},
|
|
@@ -736,7 +739,7 @@ registerColor('interactive.inactiveCodeBorder', {
|
|
|
736
739
|
type: 'boolean',
|
|
737
740
|
default: false,
|
|
738
741
|
markdownDescription: ( localize(
|
|
739
|
-
|
|
742
|
+
2363,
|
|
740
743
|
"Prompt to save the interactive window when it is closed. Only new interactive windows will be affected by this setting change."
|
|
741
744
|
))
|
|
742
745
|
},
|
|
@@ -744,7 +747,7 @@ registerColor('interactive.inactiveCodeBorder', {
|
|
|
744
747
|
type: 'boolean',
|
|
745
748
|
default: false,
|
|
746
749
|
markdownDescription: ( localize(
|
|
747
|
-
|
|
750
|
+
2364,
|
|
748
751
|
"Execute the Interactive Window (REPL) input box with shift+enter, so that enter can be used to create a newline."
|
|
749
752
|
)),
|
|
750
753
|
tags: ['replExecute']
|
|
@@ -753,7 +756,7 @@ registerColor('interactive.inactiveCodeBorder', {
|
|
|
753
756
|
type: 'boolean',
|
|
754
757
|
default: true,
|
|
755
758
|
markdownDescription: ( localize(
|
|
756
|
-
|
|
759
|
+
2365,
|
|
757
760
|
"Display a hint in the Interactive Window (REPL) input box to indicate how to execute code."
|
|
758
761
|
)),
|
|
759
762
|
tags: ['replExecute']
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import n from 'vscode/external/rollup-plugin-styles/dist/runtime/inject-css.js';
|
|
2
2
|
|
|
3
|
-
var css = ".interactive-editor .input-cell-container:focus-within .input-editor-container
|
|
3
|
+
var css = ".interactive-editor .input-cell-container:focus-within .input-editor-container>.monaco-editor{outline:solid 1px var(--vscode-notebook-focusedCellBorder)}.interactive-editor .input-cell-container .input-editor-container>.monaco-editor{outline:solid 1px var(--vscode-notebook-inactiveFocusedCellBorder)}.interactive-editor .input-cell-container .input-focus-indicator{top:8px}.interactive-editor .input-cell-container .margin-view-overlays,.interactive-editor .input-cell-container .monaco-editor-background{background-color:var(--vscode-notebook-cellEditorBackground,var(--vscode-editor-background))}";
|
|
4
4
|
n(css,{});
|
|
5
5
|
|
|
6
6
|
export { css, css as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
2
|
import './media/interactive.css.js';
|
|
3
3
|
import { $, append, createStyleSheet, Dimension } from 'vscode/vscode/vs/base/browser/dom';
|
|
4
|
-
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
4
|
+
import { Emitter, Event } from 'vscode/vscode/vs/base/common/event';
|
|
5
5
|
import { DisposableStore, MutableDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
6
6
|
import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
|
|
7
7
|
import { CodeEditorWidget } from 'vscode/vscode/vs/editor/browser/widget/codeEditor/codeEditorWidget';
|
|
@@ -11,12 +11,10 @@ import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storag
|
|
|
11
11
|
import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
12
12
|
import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService.service';
|
|
13
13
|
import { EditorPane } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorPane';
|
|
14
|
-
import { EditorPaneSelectionChangeReason } from 'vscode/vscode/vs/workbench/common/editor';
|
|
15
14
|
import { getSimpleEditorOptions } from 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/simpleEditorOptions';
|
|
16
15
|
import { InteractiveEditorInput } from 'vscode/vscode/vs/workbench/contrib/interactive/browser/interactiveEditorInput';
|
|
17
16
|
import { NotebookEditorExtensionsRegistry } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
|
|
18
17
|
import { INotebookEditorService } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService.service';
|
|
19
|
-
import { GroupsOrder } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService';
|
|
20
18
|
import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
|
|
21
19
|
import { ExecutionStateCellStatusBarContrib, TimerCellStatusBarContrib } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController';
|
|
22
20
|
import { INotebookKernelService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookKernelService.service';
|
|
@@ -41,7 +39,6 @@ import { SnippetController2 } from 'vscode/vscode/vs/editor/contrib/snippet/brow
|
|
|
41
39
|
import { TabCompletionController } from 'vscode/vscode/vs/workbench/contrib/snippets/browser/tabCompletion';
|
|
42
40
|
import { MarkerController } from 'vscode/vscode/vs/editor/contrib/gotoError/browser/gotoError';
|
|
43
41
|
import { ITextResourceConfigurationService } from 'vscode/vscode/vs/editor/common/services/textResourceConfiguration';
|
|
44
|
-
import { TextEditorSelectionSource } from 'vscode/vscode/vs/platform/editor/common/editor';
|
|
45
42
|
import { NotebookExecutionType } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService';
|
|
46
43
|
import { INotebookExecutionStateService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService.service';
|
|
47
44
|
import { NOTEBOOK_KERNEL } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
|
|
@@ -51,10 +48,11 @@ import { NotebookFindContrib } from 'vscode/vscode/vs/workbench/contrib/notebook
|
|
|
51
48
|
import { INTERACTIVE_WINDOW_EDITOR_ID } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
52
49
|
import './interactiveEditor.css.js';
|
|
53
50
|
import { deepClone } from 'vscode/vscode/vs/base/common/objects';
|
|
54
|
-
import { ContentHoverController } from 'vscode/vscode/vs/editor/contrib/hover/browser/
|
|
55
|
-
import {
|
|
51
|
+
import { ContentHoverController } from 'vscode/vscode/vs/editor/contrib/hover/browser/contentHoverController';
|
|
52
|
+
import { GlyphHoverController } from 'vscode/vscode/vs/editor/contrib/hover/browser/glyphHoverController';
|
|
56
53
|
import { ReplInputHintContentWidget } from './replInputHintContentWidget.js';
|
|
57
54
|
import { ServiceCollection } from 'vscode/vscode/vs/platform/instantiation/common/serviceCollection';
|
|
55
|
+
import { INLINE_CHAT_ID } from 'vscode/vscode/vs/workbench/contrib/inlineChat/common/inlineChat';
|
|
58
56
|
|
|
59
57
|
const DECORATION_KEY = 'interactiveInputDecoration';
|
|
60
58
|
const INTERACTIVE_EDITOR_VIEW_STATE_PREFERENCE_KEY = 'InteractiveEditorViewState';
|
|
@@ -240,7 +238,7 @@ let InteractiveEditor = class InteractiveEditor extends EditorPane {
|
|
|
240
238
|
if (result) {
|
|
241
239
|
return result;
|
|
242
240
|
}
|
|
243
|
-
for (const group of this._editorGroupService.getGroups(
|
|
241
|
+
for (const group of this._editorGroupService.getGroups(1 )) {
|
|
244
242
|
if (group.activeEditorPane !== this && group.activeEditorPane === this && group.activeEditor?.matches(input)) {
|
|
245
243
|
const notebook = this._notebookWidget.value?.getEditorViewState();
|
|
246
244
|
const input = this._codeEditorWidget.saveViewState();
|
|
@@ -258,7 +256,7 @@ let InteractiveEditor = class InteractiveEditor extends EditorPane {
|
|
|
258
256
|
this._codeEditorWidget?.dispose();
|
|
259
257
|
this._widgetDisposableStore.clear();
|
|
260
258
|
this._notebookWidget = this._instantiationService.invokeFunction(this._notebookWidgetService.retrieveWidget, this.group.id, notebookInput, {
|
|
261
|
-
|
|
259
|
+
isReplHistory: true,
|
|
262
260
|
isReadOnly: true,
|
|
263
261
|
contributions: NotebookEditorExtensionsRegistry.getSomeEditorContributions([
|
|
264
262
|
ExecutionStateCellStatusBarContrib.id,
|
|
@@ -278,7 +276,7 @@ let InteractiveEditor = class InteractiveEditor extends EditorPane {
|
|
|
278
276
|
SelectionClipboardContributionID,
|
|
279
277
|
ContextMenuController.ID,
|
|
280
278
|
ContentHoverController.ID,
|
|
281
|
-
|
|
279
|
+
GlyphHoverController.ID,
|
|
282
280
|
MarkerController.ID
|
|
283
281
|
]),
|
|
284
282
|
options: this._notebookOptions,
|
|
@@ -296,8 +294,9 @@ let InteractiveEditor = class InteractiveEditor extends EditorPane {
|
|
|
296
294
|
SnippetController2.ID,
|
|
297
295
|
TabCompletionController.ID,
|
|
298
296
|
ContentHoverController.ID,
|
|
299
|
-
|
|
300
|
-
MarkerController.ID
|
|
297
|
+
GlyphHoverController.ID,
|
|
298
|
+
MarkerController.ID,
|
|
299
|
+
INLINE_CHAT_ID
|
|
301
300
|
])
|
|
302
301
|
}
|
|
303
302
|
});
|
|
@@ -362,7 +361,7 @@ let InteractiveEditor = class InteractiveEditor extends EditorPane {
|
|
|
362
361
|
}
|
|
363
362
|
}));
|
|
364
363
|
this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeCursorPosition(e => this._onDidChangeSelection.fire({ reason: this._toEditorPaneSelectionChangeReason(e) })));
|
|
365
|
-
this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeModelContent(() => this._onDidChangeSelection.fire({ reason:
|
|
364
|
+
this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeModelContent(() => this._onDidChangeSelection.fire({ reason: 3 })));
|
|
366
365
|
this._widgetDisposableStore.add(this._notebookKernelService.onDidChangeNotebookAffinity(this._syncWithKernel, this));
|
|
367
366
|
this._widgetDisposableStore.add(this._notebookKernelService.onDidChangeSelectedNotebooks(this._syncWithKernel, this));
|
|
368
367
|
this._widgetDisposableStore.add(this.themeService.onDidColorThemeChange(() => {
|
|
@@ -375,6 +374,11 @@ let InteractiveEditor = class InteractiveEditor extends EditorPane {
|
|
|
375
374
|
this._updateInputHint();
|
|
376
375
|
}
|
|
377
376
|
}));
|
|
377
|
+
this._codeEditorWidget.onDidChangeModelDecorations(() => {
|
|
378
|
+
if (this.isVisible()) {
|
|
379
|
+
this._updateInputHint();
|
|
380
|
+
}
|
|
381
|
+
});
|
|
378
382
|
this._widgetDisposableStore.add(this._codeEditorWidget.onDidChangeModel(() => {
|
|
379
383
|
this._updateInputHint();
|
|
380
384
|
}));
|
|
@@ -433,10 +437,10 @@ let InteractiveEditor = class InteractiveEditor extends EditorPane {
|
|
|
433
437
|
}
|
|
434
438
|
_toEditorPaneSelectionChangeReason(e) {
|
|
435
439
|
switch (e.source) {
|
|
436
|
-
case
|
|
437
|
-
case
|
|
438
|
-
case
|
|
439
|
-
default: return
|
|
440
|
+
case "api" : return 1 ;
|
|
441
|
+
case "code.navigation" : return 4 ;
|
|
442
|
+
case "code.jump" : return 5 ;
|
|
443
|
+
default: return 2 ;
|
|
440
444
|
}
|
|
441
445
|
}
|
|
442
446
|
_cellAtBottom(cell) {
|
|
@@ -502,13 +506,20 @@ let InteractiveEditor = class InteractiveEditor extends EditorPane {
|
|
|
502
506
|
_validateDimension(width, height) {
|
|
503
507
|
return new Dimension(Math.max(0, width), Math.max(0, height));
|
|
504
508
|
}
|
|
509
|
+
_hasConflictingDecoration() {
|
|
510
|
+
return Boolean(this._codeEditorWidget.getLineDecorations(1)?.find((d) => d.options.beforeContentClassName
|
|
511
|
+
|| d.options.afterContentClassName
|
|
512
|
+
|| d.options.before?.content
|
|
513
|
+
|| d.options.after?.content));
|
|
514
|
+
}
|
|
505
515
|
_updateInputHint() {
|
|
506
516
|
if (!this._codeEditorWidget) {
|
|
507
517
|
return;
|
|
508
518
|
}
|
|
509
519
|
const shouldHide = !this._codeEditorWidget.hasModel() ||
|
|
510
520
|
this._configurationService.getValue(InteractiveWindowSetting.showExecutionHint) === false ||
|
|
511
|
-
this._codeEditorWidget.getModel().getValueLength() !== 0
|
|
521
|
+
this._codeEditorWidget.getModel().getValueLength() !== 0 ||
|
|
522
|
+
this._hasConflictingDecoration();
|
|
512
523
|
if (!this._hintElement && !shouldHide) {
|
|
513
524
|
this._hintElement = this._instantiationService.createInstance(ReplInputHintContentWidget, this._codeEditorWidget);
|
|
514
525
|
}
|
|
@@ -558,7 +569,8 @@ let InteractiveEditor = class InteractiveEditor extends EditorPane {
|
|
|
558
569
|
getControl() {
|
|
559
570
|
return {
|
|
560
571
|
notebookEditor: this._notebookWidget.value,
|
|
561
|
-
|
|
572
|
+
activeCodeEditor: this._codeEditorWidget,
|
|
573
|
+
onDidChangeActiveEditor: Event.None
|
|
562
574
|
};
|
|
563
575
|
}
|
|
564
576
|
};
|
|
@@ -5,12 +5,9 @@ import { KeybindingLabel } from 'vscode/vscode/vs/base/browser/ui/keybindingLabe
|
|
|
5
5
|
import { Event } from 'vscode/vscode/vs/base/common/event';
|
|
6
6
|
import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
7
7
|
import { OS } from 'vscode/vscode/vs/base/common/platform';
|
|
8
|
-
import { ContentWidgetPositionPreference } from 'vscode/vscode/vs/editor/browser/editorBrowser';
|
|
9
|
-
import { EditorOption } from 'vscode/vscode/vs/editor/common/config/editorOptions';
|
|
10
8
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
11
9
|
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
12
10
|
import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding.service';
|
|
13
|
-
import { AccessibilityVerbositySettingId } from 'vscode/vscode/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration';
|
|
14
11
|
import { InteractiveWindowSetting } from './interactiveCommon.js';
|
|
15
12
|
|
|
16
13
|
var ReplInputHintContentWidget_1;
|
|
@@ -24,13 +21,13 @@ let ReplInputHintContentWidget = class ReplInputHintContentWidget extends Dispos
|
|
|
24
21
|
this.keybindingService = keybindingService;
|
|
25
22
|
this.ariaLabel = '';
|
|
26
23
|
this._register(this.editor.onDidChangeConfiguration((e) => {
|
|
27
|
-
if (this.domNode && e.hasChanged(
|
|
24
|
+
if (this.domNode && e.hasChanged(52 )) {
|
|
28
25
|
this.editor.applyFontInfo(this.domNode);
|
|
29
26
|
}
|
|
30
27
|
}));
|
|
31
28
|
const onDidFocusEditorText = Event.debounce(this.editor.onDidFocusEditorText, () => undefined, 500);
|
|
32
29
|
this._register(onDidFocusEditorText(() => {
|
|
33
|
-
if (this.editor.hasTextFocus() && this.ariaLabel && configurationService.getValue(
|
|
30
|
+
if (this.editor.hasTextFocus() && this.ariaLabel && configurationService.getValue("accessibility.verbosity.replInputHint" )) {
|
|
34
31
|
status(this.ariaLabel);
|
|
35
32
|
}
|
|
36
33
|
}));
|
|
@@ -47,7 +44,7 @@ let ReplInputHintContentWidget = class ReplInputHintContentWidget extends Dispos
|
|
|
47
44
|
getPosition() {
|
|
48
45
|
return {
|
|
49
46
|
position: { lineNumber: 1, column: 1 },
|
|
50
|
-
preference: [
|
|
47
|
+
preference: [0 ]
|
|
51
48
|
};
|
|
52
49
|
}
|
|
53
50
|
getDomNode() {
|
|
@@ -76,7 +73,7 @@ let ReplInputHintContentWidget = class ReplInputHintContentWidget extends Dispos
|
|
|
76
73
|
const keybinding = this.getKeybinding();
|
|
77
74
|
const keybindingHintLabel = keybinding?.getLabel();
|
|
78
75
|
if (keybinding && keybindingHintLabel) {
|
|
79
|
-
const actionPart = ( localize(
|
|
76
|
+
const actionPart = ( localize(10246, 'Press {0} to execute. ', keybindingHintLabel));
|
|
80
77
|
const [before, after] = ( (actionPart.split(keybindingHintLabel).map((fragment) => {
|
|
81
78
|
const hintPart = $('span', undefined, fragment);
|
|
82
79
|
hintPart.style.fontStyle = 'italic';
|
|
@@ -89,10 +86,14 @@ let ReplInputHintContentWidget = class ReplInputHintContentWidget extends Dispos
|
|
|
89
86
|
label.element.style.display = 'inline';
|
|
90
87
|
hintElement.appendChild(after);
|
|
91
88
|
this.domNode.append(hintElement);
|
|
92
|
-
|
|
93
|
-
|
|
89
|
+
const helpKeybinding = this.keybindingService.lookupKeybinding("editor.action.accessibilityHelp" )?.getLabel();
|
|
90
|
+
const helpInfo = helpKeybinding
|
|
91
|
+
? ( localize(10247, "Use {0} for accessibility help. ", helpKeybinding))
|
|
92
|
+
: ( localize(10248, "Run the Open Accessibility Help command for more information. "));
|
|
93
|
+
this.ariaLabel = helpInfo.concat(actionPart, ( localize(
|
|
94
|
+
10249,
|
|
94
95
|
' Toggle {0} in settings to disable this hint.',
|
|
95
|
-
|
|
96
|
+
"accessibility.verbosity.replInputHint"
|
|
96
97
|
)));
|
|
97
98
|
}
|
|
98
99
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import n from 'vscode/external/rollup-plugin-styles/dist/runtime/inject-css.js';
|
|
2
|
+
|
|
3
|
+
var css = ".interactive-editor .input-cell-container:focus-within .input-editor-container>.monaco-editor{outline:solid 1px var(--vscode-notebook-focusedCellBorder)}.interactive-editor .input-cell-container .input-editor-container>.monaco-editor{outline:solid 1px var(--vscode-notebook-inactiveFocusedCellBorder)}.interactive-editor .input-cell-container .input-focus-indicator{top:8px}.interactive-editor .input-cell-container .margin-view-overlays,.interactive-editor .input-cell-container .monaco-editor-background{background-color:var(--vscode-notebook-cellEditorBackground,var(--vscode-editor-background))}";
|
|
4
|
+
n(css,{});
|
|
5
|
+
|
|
6
|
+
export { css, css as default };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import n from 'vscode/external/rollup-plugin-styles/dist/runtime/inject-css.js';
|
|
2
|
+
|
|
3
|
+
var css = ".interactive-editor .input-cell-container{box-sizing:border-box}.interactive-editor .input-cell-container .input-focus-indicator{height:19px;left:0;position:absolute}.interactive-editor .input-cell-container .input-focus-indicator:before{border-left:3px solid transparent;border-radius:2px;content:\"\";height:100%;left:0;margin-left:4px;position:absolute;top:0;width:0;z-index:10}.interactive-editor .input-cell-container .run-button-container{position:absolute}.interactive-editor .input-cell-container .run-button-container .monaco-toolbar .actions-container{justify-content:center}";
|
|
4
|
+
n(css,{});
|
|
5
|
+
|
|
6
|
+
export { css, css as default };
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import './media/interactive.css.js';
|
|
2
|
+
import 'vscode/vscode/vs/base/browser/dom';
|
|
3
|
+
import 'vscode/vscode/vs/base/common/event';
|
|
4
|
+
import 'vscode/vscode/vs/base/common/lifecycle';
|
|
5
|
+
import 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
6
|
+
import { CodeEditorWidget } from 'vscode/vscode/vs/editor/browser/widget/codeEditor/codeEditorWidget';
|
|
7
|
+
import 'vscode/vscode/vs/workbench/browser/parts/editor/editorPane';
|
|
8
|
+
import 'vscode/vscode/vs/editor/contrib/contextmenu/browser/contextmenu';
|
|
9
|
+
import 'vscode/vscode/vs/editor/contrib/snippet/browser/snippetController2';
|
|
10
|
+
import 'vscode/vscode/vs/editor/contrib/suggest/browser/suggestController';
|
|
11
|
+
import 'vscode/vscode/vs/workbench/contrib/codeEditor/browser/menuPreventer';
|
|
12
|
+
import 'vscode/vscode/vs/workbench/contrib/snippets/browser/tabCompletion';
|
|
13
|
+
import 'vscode/vscode/vs/editor/browser/editorExtensions';
|
|
14
|
+
import 'vscode/vscode/vs/platform/theme/common/themeService';
|
|
15
|
+
import 'vscode/vscode/vs/platform/theme/common/colorUtils';
|
|
16
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
|
|
17
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/chartsColors';
|
|
18
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
|
|
19
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/inputColors';
|
|
20
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/listColors';
|
|
21
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/menuColors';
|
|
22
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/minimapColors';
|
|
23
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/miscColors';
|
|
24
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
|
|
25
|
+
import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
|
|
26
|
+
import 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
|
|
27
|
+
import { NotebookEditorWidget } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookEditorWidget';
|
|
28
|
+
import 'vscode/vscode/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/executionStatusBarItemController';
|
|
29
|
+
import 'vscode/vscode/vs/platform/actions/common/actions';
|
|
30
|
+
import 'vscode/vscode/vs/platform/contextkey/common/contextkey';
|
|
31
|
+
import 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookOptions';
|
|
32
|
+
import 'vscode/vscode/vs/base/browser/ui/toolbar/toolbar';
|
|
33
|
+
import 'vscode/vscode/vs/platform/actions/browser/menuEntryActionViewItem';
|
|
34
|
+
import 'vscode/vscode/vs/editor/contrib/gotoError/browser/gotoError';
|
|
35
|
+
import 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookExecutionStateService';
|
|
36
|
+
import 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
37
|
+
import 'vscode/vscode/vs/base/common/resources';
|
|
38
|
+
import 'vscode/vscode/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget';
|
|
39
|
+
import './interactiveEditor.css.js';
|
|
40
|
+
import 'vscode/vscode/vs/editor/contrib/hover/browser/glyphHoverController';
|
|
41
|
+
import 'vscode/vscode/vs/editor/contrib/hover/browser/contentHoverController';
|
|
42
|
+
import './replEditorInput.js';
|
|
43
|
+
import '../../interactive/browser/replInputHintContentWidget.js';
|
|
44
|
+
|
|
45
|
+
function isReplEditorControl(control) {
|
|
46
|
+
const candidate = control;
|
|
47
|
+
return candidate?.activeCodeEditor instanceof CodeEditorWidget && candidate?.notebookEditor instanceof NotebookEditorWidget;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export { isReplEditorControl };
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
|
+
import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
|
|
3
|
+
import { ITextResourceConfigurationService } from 'vscode/vscode/vs/editor/common/services/textResourceConfiguration';
|
|
4
|
+
import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
|
|
5
|
+
import { IFileDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
6
|
+
import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
|
|
7
|
+
import { ILabelService } from 'vscode/vscode/vs/platform/label/common/label.service';
|
|
8
|
+
import { IInteractiveHistoryService } from 'vscode/vscode/vs/workbench/contrib/interactive/browser/interactiveHistoryService.service';
|
|
9
|
+
import { NotebookSetting, CellKind } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
|
|
10
|
+
import { NotebookEditorInput } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput';
|
|
11
|
+
import { INotebookEditorModelResolverService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookEditorModelResolverService.service';
|
|
12
|
+
import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService.service';
|
|
13
|
+
import { ICustomEditorLabelService } from 'vscode/vscode/vs/workbench/services/editor/common/customEditorLabelService.service';
|
|
14
|
+
import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
|
|
15
|
+
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
16
|
+
import { IFilesConfigurationService } from 'vscode/vscode/vs/workbench/services/filesConfiguration/common/filesConfigurationService.service';
|
|
17
|
+
import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
|
|
18
|
+
import { localize } from 'vscode/vscode/vs/nls';
|
|
19
|
+
import { registerIcon } from 'vscode/vscode/vs/platform/theme/common/iconRegistry';
|
|
20
|
+
|
|
21
|
+
var ReplEditorInput_1;
|
|
22
|
+
const replTabIcon = registerIcon('repl-editor-label-icon', Codicon.debugLineByLine, ( localize(10250, 'Icon of the REPL editor label.')));
|
|
23
|
+
let ReplEditorInput = class ReplEditorInput extends NotebookEditorInput {
|
|
24
|
+
static { ReplEditorInput_1 = this; }
|
|
25
|
+
static { this.ID = 'workbench.editorinputs.replEditorInput'; }
|
|
26
|
+
constructor(resource, label, _notebookService, _notebookModelResolverService, _fileDialogService, labelService, fileService, filesConfigurationService, extensionService, editorService, textResourceConfigurationService, customEditorLabelService, historyService, _textModelService, configurationService) {
|
|
27
|
+
super(resource, undefined, 'jupyter-notebook', {}, _notebookService, _notebookModelResolverService, _fileDialogService, labelService, fileService, filesConfigurationService, extensionService, editorService, textResourceConfigurationService, customEditorLabelService);
|
|
28
|
+
this.historyService = historyService;
|
|
29
|
+
this._textModelService = _textModelService;
|
|
30
|
+
this.isDisposing = false;
|
|
31
|
+
this.isScratchpad = resource.scheme === 'untitled' && configurationService.getValue(NotebookSetting.InteractiveWindowPromptToSave) !== true;
|
|
32
|
+
this.label = label ?? this.createEditorLabel(resource);
|
|
33
|
+
}
|
|
34
|
+
getIcon() {
|
|
35
|
+
return replTabIcon;
|
|
36
|
+
}
|
|
37
|
+
createEditorLabel(resource) {
|
|
38
|
+
if (!resource) {
|
|
39
|
+
return 'REPL';
|
|
40
|
+
}
|
|
41
|
+
if (resource.scheme === 'untitled') {
|
|
42
|
+
const match = ( (new RegExp('Untitled-(\\d+)\.'))).exec(resource.path);
|
|
43
|
+
if (match?.length === 2) {
|
|
44
|
+
return `REPL - ${match[1]}`;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
const filename = resource.path.split('/').pop();
|
|
48
|
+
return filename ? `REPL - ${filename}` : 'REPL';
|
|
49
|
+
}
|
|
50
|
+
get typeId() {
|
|
51
|
+
return ReplEditorInput_1.ID;
|
|
52
|
+
}
|
|
53
|
+
get editorId() {
|
|
54
|
+
return 'repl';
|
|
55
|
+
}
|
|
56
|
+
getName() {
|
|
57
|
+
return this.label;
|
|
58
|
+
}
|
|
59
|
+
get editorInputs() {
|
|
60
|
+
return [this];
|
|
61
|
+
}
|
|
62
|
+
get capabilities() {
|
|
63
|
+
const capabilities = super.capabilities;
|
|
64
|
+
const scratchPad = this.isScratchpad ? 512 : 0;
|
|
65
|
+
return capabilities
|
|
66
|
+
| 2
|
|
67
|
+
| scratchPad;
|
|
68
|
+
}
|
|
69
|
+
async resolve() {
|
|
70
|
+
const model = await super.resolve();
|
|
71
|
+
if (model) {
|
|
72
|
+
await this.ensureInputBoxCell(model.notebook);
|
|
73
|
+
}
|
|
74
|
+
return model;
|
|
75
|
+
}
|
|
76
|
+
async ensureInputBoxCell(notebook) {
|
|
77
|
+
const lastCell = notebook.cells[notebook.cells.length - 1];
|
|
78
|
+
if (!lastCell || lastCell.cellKind === CellKind.Markup || lastCell.outputs.length > 0 || lastCell.internalMetadata.executionOrder !== undefined) {
|
|
79
|
+
notebook.applyEdits([
|
|
80
|
+
{
|
|
81
|
+
editType: 1 ,
|
|
82
|
+
index: notebook.cells.length,
|
|
83
|
+
count: 0,
|
|
84
|
+
cells: [
|
|
85
|
+
{
|
|
86
|
+
cellKind: CellKind.Code,
|
|
87
|
+
language: 'python',
|
|
88
|
+
mime: undefined,
|
|
89
|
+
outputs: [],
|
|
90
|
+
source: ''
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
], true, undefined, () => undefined, undefined, false);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
async resolveInput(notebook) {
|
|
98
|
+
if (this.inputModelRef) {
|
|
99
|
+
return this.inputModelRef.object.textEditorModel;
|
|
100
|
+
}
|
|
101
|
+
const lastCell = notebook.cells[notebook.cells.length - 1];
|
|
102
|
+
if (!lastCell) {
|
|
103
|
+
throw ( (new Error('The REPL editor requires at least one cell for the input box.')));
|
|
104
|
+
}
|
|
105
|
+
this.inputModelRef = await this._textModelService.createModelReference(lastCell.uri);
|
|
106
|
+
return this.inputModelRef.object.textEditorModel;
|
|
107
|
+
}
|
|
108
|
+
dispose() {
|
|
109
|
+
if (!this.isDisposing) {
|
|
110
|
+
this.isDisposing = true;
|
|
111
|
+
this.editorModelReference?.object.revert({ soft: true });
|
|
112
|
+
this.inputModelRef?.dispose();
|
|
113
|
+
super.dispose();
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
ReplEditorInput = ReplEditorInput_1 = ( (__decorate([
|
|
118
|
+
( (__param(2, INotebookService))),
|
|
119
|
+
( (__param(3, INotebookEditorModelResolverService))),
|
|
120
|
+
( (__param(4, IFileDialogService))),
|
|
121
|
+
( (__param(5, ILabelService))),
|
|
122
|
+
( (__param(6, IFileService))),
|
|
123
|
+
( (__param(7, IFilesConfigurationService))),
|
|
124
|
+
( (__param(8, IExtensionService))),
|
|
125
|
+
( (__param(9, IEditorService))),
|
|
126
|
+
( (__param(10, ITextResourceConfigurationService))),
|
|
127
|
+
( (__param(11, ICustomEditorLabelService))),
|
|
128
|
+
( (__param(12, IInteractiveHistoryService))),
|
|
129
|
+
( (__param(13, ITextModelService))),
|
|
130
|
+
( (__param(14, IConfigurationService)))
|
|
131
|
+
], ReplEditorInput)));
|
|
132
|
+
|
|
133
|
+
export { ReplEditorInput };
|