@codingame/monaco-vscode-notebook-service-override 22.1.8 → 23.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (99) hide show
  1. package/index.js +2 -1
  2. package/package.json +25 -23
  3. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +7 -7
  4. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +24 -24
  5. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticEditorContrib.d.ts +1 -1
  6. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/cellDiagnosticsActions.js +8 -6
  7. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.d.ts +1 -1
  8. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellDiagnostics/diagnosticCellStatusBarContrib.js +2 -2
  9. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.d.ts +1 -1
  10. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +1 -1
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +4 -4
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.d.ts +1 -1
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +7 -7
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +1 -1
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.d.ts +1 -1
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +1 -1
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +1 -1
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +11 -11
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.d.ts +1 -1
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +104 -13
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +5 -5
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +2 -2
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +1 -1
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +1 -1
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.d.ts +1 -1
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/multicursor/notebookMulticursor.js +7 -7
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +21 -29
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookInlineVariables.d.ts +1 -1
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookInlineVariables.js +1 -1
  30. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +2 -2
  31. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +9 -10
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +3 -3
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +2 -2
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.d.ts +2 -2
  35. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +11 -11
  36. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +1 -1
  37. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.d.ts +1 -1
  38. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +14 -14
  39. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.d.ts +1 -1
  40. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +4 -4
  41. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +1 -1
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +2 -2
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +17 -387
  44. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.d.ts +1 -1
  45. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +16 -14
  46. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.d.ts +2 -0
  47. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +7 -0
  48. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/editActions.js +28 -28
  49. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +26 -39
  50. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +26 -27
  51. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +18 -19
  52. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.d.ts +5 -5
  53. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/notebookIndentationActions.js +8 -8
  54. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.d.ts +1 -1
  55. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/sectionActions.js +14 -14
  56. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/variablesActions.js +1 -1
  57. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +21 -21
  58. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +70 -70
  59. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibilityHelp.js +10 -10
  60. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibleView.js +1 -1
  61. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +33 -33
  62. package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditor.d.ts +1 -1
  63. package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditor.js +6 -6
  64. package/vscode/src/vs/workbench/contrib/notebook/browser/outputEditor/notebookOutputEditorInput.js +1 -1
  65. package/vscode/src/vs/workbench/contrib/notebook/browser/replEditorAccessibleView.d.ts +15 -0
  66. package/vscode/src/vs/workbench/contrib/notebook/browser/replEditorAccessibleView.js +49 -0
  67. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.d.ts +3 -1
  68. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +11 -1
  69. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +1 -1
  70. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +1 -1
  71. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +3 -3
  72. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.d.ts +1 -0
  73. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +4 -1
  74. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.d.ts +3 -3
  75. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +3 -3
  76. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/OutlineEntry.d.ts +1 -1
  77. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSource.d.ts +2 -2
  78. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSource.js +1 -1
  79. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineDataSourceFactory.d.ts +1 -1
  80. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.d.ts +1 -1
  81. package/vscode/src/vs/workbench/contrib/notebook/browser/viewModel/notebookOutlineEntryFactory.js +1 -1
  82. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.d.ts +3 -2
  83. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +28 -31
  84. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +1 -1
  85. package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +1 -1
  86. package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +5 -10
  87. package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWebWorker.d.ts +1 -1
  88. package/vscode/src/vs/workbench/contrib/notebook/common/services/notebookWebWorker.js +2 -1
  89. package/vscode/src/vs/workbench/contrib/replNotebook/browser/repl.contribution.d.ts +15 -0
  90. package/vscode/src/vs/workbench/contrib/replNotebook/browser/repl.contribution.js +405 -0
  91. package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorAccessibilityHelp.d.ts +17 -0
  92. package/vscode/src/vs/workbench/contrib/replNotebook/browser/replEditorAccessibilityHelp.js +120 -0
  93. package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.d.ts +1 -1
  94. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.d.ts +2 -2
  95. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +15 -15
  96. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.d.ts +1 -1
  97. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +3 -3
  98. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.d.ts +2 -2
  99. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +2 -2
@@ -0,0 +1,405 @@
1
+
2
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
+ import { Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
4
+ import { KeyChord, KeyMod, KeyCode } from '@codingame/monaco-vscode-api/vscode/vs/base/common/keyCodes';
5
+ import { Disposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
6
+ import { ResourceMap } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
7
+ import { parse } from '@codingame/monaco-vscode-api/vscode/vs/base/common/marshalling';
8
+ import { isEqual } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
9
+ import { isFalsyOrWhitespace } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
10
+ import { assertType } from '@codingame/monaco-vscode-api/vscode/vs/base/common/types';
11
+ import { URI } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uri';
12
+ import { IBulkEditService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/bulkEditService.service';
13
+ import { PLAINTEXT_LANGUAGE_ID } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/languages/modesRegistry';
14
+ import { localize2 } from '@codingame/monaco-vscode-api/vscode/vs/nls';
15
+ import { AccessibleViewRegistry } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibility/browser/accessibleViewRegistry';
16
+ import { registerAction2, Action2, MenuId } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
17
+ import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
18
+ import { ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
19
+ import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
20
+ import { SyncDescriptor } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/descriptors';
21
+ import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
22
+ import { KeybindingWeight, KeybindingsRegistry } from '@codingame/monaco-vscode-api/vscode/vs/platform/keybinding/common/keybindingsRegistry';
23
+ import { Registry } from '@codingame/monaco-vscode-api/vscode/vs/platform/registry/common/platform';
24
+ import { EditorPaneDescriptor } from '@codingame/monaco-vscode-60014c9d-b815-501d-83a9-4b08725c2ec2-common/vscode/vs/workbench/browser/editor';
25
+ import { registerWorkbenchContribution2, WorkbenchPhase } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/contributions';
26
+ import { EditorExtensions } from '@codingame/monaco-vscode-api/vscode/vs/workbench/common/editor';
27
+ import { RegisteredEditorPriority } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorResolverService';
28
+ import { IEditorResolverService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorResolverService.service';
29
+ import { IEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/editor/common/editorService.service';
30
+ import { IExtensionService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/extensions/common/extensions.service';
31
+ import { IViewsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/views/common/viewsService.service';
32
+ import { IWorkingCopyEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/workingCopy/common/workingCopyEditorService.service';
33
+ import { ResourceNotebookCellEdit } from '@codingame/monaco-vscode-9d2c06d1-1f89-51a5-9964-aa01fe50c198-common/vscode/vs/workbench/contrib/bulkEdit/browser/bulkCellEdits';
34
+ import { getReplView } from '@codingame/monaco-vscode-88aa9a78-75f5-5aaa-89e9-bbdd580b3b5c-common/vscode/vs/workbench/contrib/debug/browser/repl';
35
+ import { REPL_VIEW_ID } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/debug/common/debug';
36
+ import { InlineChatController } from '@codingame/monaco-vscode-a793b3ee-7ba9-5176-a019-30ec806fdd95-common/vscode/vs/workbench/contrib/inlineChat/browser/inlineChatController';
37
+ import { IInteractiveHistoryService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/interactive/browser/interactiveHistoryService.service';
38
+ import { NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT } from '@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
39
+ import { executeIcon } from '@codingame/monaco-vscode-e28ac690-06d5-5ee9-92d1-02df70296354-common/vscode/vs/workbench/contrib/notebook/browser/notebookIcons';
40
+ import { ReplEditorAccessibleView } from '../../notebook/browser/replEditorAccessibleView.js';
41
+ import { INotebookEditorService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/browser/services/notebookEditorService.service';
42
+ import { REPL_EDITOR_ID, NotebookSetting, NotebookWorkingCopyTypeIdentifier, CellKind, CellEditType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
43
+ import { MOST_RECENT_REPL_EDITOR, IS_COMPOSITE_NOTEBOOK, NOTEBOOK_CELL_LIST_FOCUSED, NOTEBOOK_EDITOR_FOCUSED } from '@codingame/monaco-vscode-eda30bac-0984-5b42-9362-c68996b85232-common/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
44
+ import { INotebookEditorModelResolverService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookEditorModelResolverService.service';
45
+ import { INotebookService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/notebook/common/notebookService.service';
46
+ import { ReplEditor, isReplEditorControl } from '@codingame/monaco-vscode-fc28fb90-97de-5e74-89a9-4cfe44128227-common/vscode/vs/workbench/contrib/replNotebook/browser/replEditor';
47
+ import { ReplEditorInputAccessibilityHelp, ReplEditorHistoryAccessibilityHelp } from './replEditorAccessibilityHelp.js';
48
+ import { ReplEditorInput } from '@codingame/monaco-vscode-fc28fb90-97de-5e74-89a9-4cfe44128227-common/vscode/vs/workbench/contrib/replNotebook/browser/replEditorInput';
49
+
50
+ class ReplEditorSerializer {
51
+ canSerialize(input) {
52
+ return input.typeId === ReplEditorInput.ID;
53
+ }
54
+ serialize(input) {
55
+ assertType(input instanceof ReplEditorInput);
56
+ const data = {
57
+ resource: input.resource,
58
+ preferredResource: input.preferredResource,
59
+ viewType: input.viewType,
60
+ options: input.options,
61
+ label: input.getName()
62
+ };
63
+ return JSON.stringify(data);
64
+ }
65
+ deserialize(instantiationService, raw) {
66
+ const data = parse(raw);
67
+ if (!data) {
68
+ return undefined;
69
+ }
70
+ const { resource, viewType } = data;
71
+ if (!data || !URI.isUri(resource) || typeof viewType !== 'string') {
72
+ return undefined;
73
+ }
74
+ const input = instantiationService.createInstance(ReplEditorInput, resource, data.label);
75
+ return input;
76
+ }
77
+ }
78
+ ( Registry.as(EditorExtensions.EditorPane)).registerEditorPane(EditorPaneDescriptor.create(ReplEditor, REPL_EDITOR_ID, 'REPL Editor'), [
79
+ ( new SyncDescriptor(ReplEditorInput))
80
+ ]);
81
+ ( Registry.as(EditorExtensions.EditorFactory)).registerEditorSerializer(ReplEditorInput.ID, ReplEditorSerializer);
82
+ let ReplDocumentContribution = class ReplDocumentContribution extends Disposable {
83
+ static { this.ID = 'workbench.contrib.replDocument'; }
84
+ constructor(notebookService, editorResolverService, notebookEditorModelResolverService, instantiationService, configurationService) {
85
+ super();
86
+ this.notebookEditorModelResolverService = notebookEditorModelResolverService;
87
+ this.instantiationService = instantiationService;
88
+ this.configurationService = configurationService;
89
+ this.editorInputCache = ( new ResourceMap());
90
+ editorResolverService.registerEditor(
91
+ ` `, {
92
+ id: 'repl',
93
+ label: 'repl Editor',
94
+ priority: RegisteredEditorPriority.option
95
+ }, {
96
+ canSupportResource: uri => notebookService.getNotebookTextModel(uri) !== undefined,
97
+ singlePerResource: true
98
+ }, {
99
+ createUntitledEditorInput: async ({ resource, options }) => {
100
+ if (resource) {
101
+ const editor = this.editorInputCache.get(resource);
102
+ if (editor && !editor.isDisposed()) {
103
+ return { editor, options };
104
+ }
105
+ else if (editor) {
106
+ this.editorInputCache.delete(resource);
107
+ }
108
+ }
109
+ const scratchpad = this.configurationService.getValue(NotebookSetting.InteractiveWindowPromptToSave) !== true;
110
+ const ref = await this.notebookEditorModelResolverService.resolve({ untitledResource: resource }, 'jupyter-notebook', { scratchpad, viewType: 'repl' });
111
+ const notebookUri = ref.object.notebook.uri;
112
+ Event.once(ref.object.notebook.onWillDispose)(() => {
113
+ ref.dispose();
114
+ });
115
+ const label = options?.label ?? undefined;
116
+ const editor = this.instantiationService.createInstance(ReplEditorInput, notebookUri, label);
117
+ this.editorInputCache.set(notebookUri, editor);
118
+ Event.once(editor.onWillDispose)(() => this.editorInputCache.delete(notebookUri));
119
+ return { editor, options };
120
+ },
121
+ createEditorInput: async ({ resource, options }) => {
122
+ if (( this.editorInputCache.has(resource))) {
123
+ return { editor: this.editorInputCache.get(resource), options };
124
+ }
125
+ const label = options?.label ?? undefined;
126
+ const editor = this.instantiationService.createInstance(ReplEditorInput, resource, label);
127
+ this.editorInputCache.set(resource, editor);
128
+ Event.once(editor.onWillDispose)(() => this.editorInputCache.delete(resource));
129
+ return { editor, options };
130
+ }
131
+ });
132
+ }
133
+ };
134
+ ReplDocumentContribution = ( __decorate([
135
+ ( __param(0, INotebookService)),
136
+ ( __param(1, IEditorResolverService)),
137
+ ( __param(2, INotebookEditorModelResolverService)),
138
+ ( __param(3, IInstantiationService)),
139
+ ( __param(4, IConfigurationService))
140
+ ], ReplDocumentContribution));
141
+ let ReplWindowWorkingCopyEditorHandler = class ReplWindowWorkingCopyEditorHandler extends Disposable {
142
+ static { this.ID = 'workbench.contrib.replWorkingCopyEditorHandler'; }
143
+ constructor(instantiationService, workingCopyEditorService, extensionService, notebookService) {
144
+ super();
145
+ this.instantiationService = instantiationService;
146
+ this.workingCopyEditorService = workingCopyEditorService;
147
+ this.extensionService = extensionService;
148
+ this.notebookService = notebookService;
149
+ this._installHandler();
150
+ }
151
+ async handles(workingCopy) {
152
+ const notebookType = this._getNotebookType(workingCopy);
153
+ if (!notebookType) {
154
+ return false;
155
+ }
156
+ return !!notebookType && notebookType.viewType === 'repl' && (await this.notebookService.canResolve(notebookType.notebookType));
157
+ }
158
+ isOpen(workingCopy, editor) {
159
+ if (!this.handles(workingCopy)) {
160
+ return false;
161
+ }
162
+ return editor instanceof ReplEditorInput && isEqual(workingCopy.resource, editor.resource);
163
+ }
164
+ createEditor(workingCopy) {
165
+ return this.instantiationService.createInstance(ReplEditorInput, workingCopy.resource, undefined);
166
+ }
167
+ async _installHandler() {
168
+ await this.extensionService.whenInstalledExtensionsRegistered();
169
+ this._register(this.workingCopyEditorService.registerHandler(this));
170
+ }
171
+ _getNotebookType(workingCopy) {
172
+ return NotebookWorkingCopyTypeIdentifier.parse(workingCopy.typeId);
173
+ }
174
+ };
175
+ ReplWindowWorkingCopyEditorHandler = ( __decorate([
176
+ ( __param(0, IInstantiationService)),
177
+ ( __param(1, IWorkingCopyEditorService)),
178
+ ( __param(2, IExtensionService)),
179
+ ( __param(3, INotebookService))
180
+ ], ReplWindowWorkingCopyEditorHandler));
181
+ registerWorkbenchContribution2(ReplWindowWorkingCopyEditorHandler.ID, ReplWindowWorkingCopyEditorHandler, WorkbenchPhase.BlockRestore);
182
+ registerWorkbenchContribution2(ReplDocumentContribution.ID, ReplDocumentContribution, WorkbenchPhase.BlockRestore);
183
+ AccessibleViewRegistry.register(( new ReplEditorInputAccessibilityHelp()));
184
+ AccessibleViewRegistry.register(( new ReplEditorHistoryAccessibilityHelp()));
185
+ registerAction2(class extends Action2 {
186
+ constructor() {
187
+ super({
188
+ id: 'repl.focusLastItemExecuted',
189
+ title: ( localize2(10228, 'Focus Most Recent REPL Execution')),
190
+ category: 'REPL',
191
+ menu: {
192
+ id: MenuId.CommandPalette,
193
+ when: MOST_RECENT_REPL_EDITOR,
194
+ },
195
+ keybinding: [{
196
+ primary: KeyChord(KeyMod.Alt | KeyCode.End, KeyMod.Alt | KeyCode.End),
197
+ weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT,
198
+ when: ( ContextKeyExpr.or(IS_COMPOSITE_NOTEBOOK, ( NOTEBOOK_CELL_LIST_FOCUSED.negate())))
199
+ }],
200
+ precondition: MOST_RECENT_REPL_EDITOR
201
+ });
202
+ }
203
+ async run(accessor, context) {
204
+ const editorService = accessor.get(IEditorService);
205
+ const editorControl = editorService.activeEditorPane?.getControl();
206
+ const contextKeyService = accessor.get(IContextKeyService);
207
+ let notebookEditor;
208
+ if (editorControl && isReplEditorControl(editorControl)) {
209
+ notebookEditor = editorControl.notebookEditor;
210
+ }
211
+ else {
212
+ const uriString = MOST_RECENT_REPL_EDITOR.getValue(contextKeyService);
213
+ const uri = uriString ? ( URI.parse(uriString)) : undefined;
214
+ if (!uri) {
215
+ return;
216
+ }
217
+ const replEditor = editorService.findEditors(uri)[0];
218
+ if (replEditor) {
219
+ const editor = await editorService.openEditor(replEditor.editor, replEditor.groupId);
220
+ const editorControl = editor?.getControl();
221
+ if (editorControl && isReplEditorControl(editorControl)) {
222
+ notebookEditor = editorControl.notebookEditor;
223
+ }
224
+ }
225
+ }
226
+ const viewModel = notebookEditor?.getViewModel();
227
+ if (notebookEditor && viewModel) {
228
+ const lastCellIndex = viewModel.length - 1;
229
+ if (lastCellIndex >= 0) {
230
+ const cell = viewModel.viewCells[lastCellIndex];
231
+ notebookEditor.focusNotebookCell(cell, 'container');
232
+ }
233
+ }
234
+ }
235
+ });
236
+ registerAction2(class extends Action2 {
237
+ constructor() {
238
+ super({
239
+ id: 'repl.input.focus',
240
+ title: ( localize2(10229, 'Focus Input Editor')),
241
+ category: 'REPL',
242
+ menu: {
243
+ id: MenuId.CommandPalette,
244
+ when: MOST_RECENT_REPL_EDITOR,
245
+ },
246
+ keybinding: [{
247
+ when: ( ContextKeyExpr.and(IS_COMPOSITE_NOTEBOOK, NOTEBOOK_EDITOR_FOCUSED)),
248
+ weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT,
249
+ primary: KeyMod.CtrlCmd | KeyCode.DownArrow
250
+ }, {
251
+ when: ( ContextKeyExpr.and(MOST_RECENT_REPL_EDITOR)),
252
+ weight: KeybindingWeight.WorkbenchContrib + 5,
253
+ primary: KeyChord(KeyMod.Alt | KeyCode.Home, KeyMod.Alt | KeyCode.Home),
254
+ }]
255
+ });
256
+ }
257
+ async run(accessor) {
258
+ const editorService = accessor.get(IEditorService);
259
+ const editorControl = editorService.activeEditorPane?.getControl();
260
+ const contextKeyService = accessor.get(IContextKeyService);
261
+ if (editorControl && isReplEditorControl(editorControl) && editorControl.notebookEditor) {
262
+ editorService.activeEditorPane?.focus();
263
+ }
264
+ else {
265
+ const uriString = MOST_RECENT_REPL_EDITOR.getValue(contextKeyService);
266
+ const uri = uriString ? ( URI.parse(uriString)) : undefined;
267
+ if (!uri) {
268
+ return;
269
+ }
270
+ const replEditor = editorService.findEditors(uri)[0];
271
+ if (replEditor) {
272
+ await editorService.openEditor({ resource: uri, options: { preserveFocus: false } }, replEditor.groupId);
273
+ }
274
+ }
275
+ }
276
+ });
277
+ registerAction2(class extends Action2 {
278
+ constructor() {
279
+ super({
280
+ id: 'repl.execute',
281
+ title: ( localize2(10230, 'Execute REPL input')),
282
+ category: 'REPL',
283
+ keybinding: [{
284
+ when: ( ContextKeyExpr.and(IS_COMPOSITE_NOTEBOOK, ( ContextKeyExpr.equals('activeEditor', 'workbench.editor.repl')), ( NOTEBOOK_CELL_LIST_FOCUSED.negate()))),
285
+ primary: KeyMod.CtrlCmd | KeyCode.Enter,
286
+ weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT
287
+ }, {
288
+ when: ( ContextKeyExpr.and(IS_COMPOSITE_NOTEBOOK, ( ContextKeyExpr.equals('activeEditor', 'workbench.editor.repl')), ( ContextKeyExpr.equals('config.interactiveWindow.executeWithShiftEnter', true)), ( NOTEBOOK_CELL_LIST_FOCUSED.negate()))),
289
+ primary: KeyMod.Shift | KeyCode.Enter,
290
+ weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT
291
+ }, {
292
+ when: ( ContextKeyExpr.and(IS_COMPOSITE_NOTEBOOK, ( ContextKeyExpr.equals('activeEditor', 'workbench.editor.repl')), ( ContextKeyExpr.equals('config.interactiveWindow.executeWithShiftEnter', false)), ( NOTEBOOK_CELL_LIST_FOCUSED.negate()))),
293
+ primary: KeyCode.Enter,
294
+ weight: NOTEBOOK_EDITOR_WIDGET_ACTION_WEIGHT
295
+ }],
296
+ menu: [
297
+ {
298
+ id: MenuId.ReplInputExecute
299
+ }
300
+ ],
301
+ icon: executeIcon,
302
+ f1: false,
303
+ metadata: {
304
+ description: 'Execute the Contents of the Input Box',
305
+ args: [
306
+ {
307
+ name: 'resource',
308
+ description: 'Interactive resource Uri',
309
+ isOptional: true
310
+ }
311
+ ]
312
+ }
313
+ });
314
+ }
315
+ async run(accessor, context) {
316
+ const editorService = accessor.get(IEditorService);
317
+ const bulkEditService = accessor.get(IBulkEditService);
318
+ const historyService = accessor.get(IInteractiveHistoryService);
319
+ const notebookEditorService = accessor.get(INotebookEditorService);
320
+ let editorControl;
321
+ if (context) {
322
+ const resourceUri = URI.revive(context);
323
+ const editors = editorService.findEditors(resourceUri);
324
+ for (const found of editors) {
325
+ if (found.editor.typeId === ReplEditorInput.ID) {
326
+ const editor = await editorService.openEditor(found.editor, found.groupId);
327
+ editorControl = editor?.getControl();
328
+ break;
329
+ }
330
+ }
331
+ }
332
+ else {
333
+ editorControl = editorService.activeEditorPane?.getControl();
334
+ }
335
+ if (isReplEditorControl(editorControl)) {
336
+ executeReplInput(bulkEditService, historyService, notebookEditorService, editorControl);
337
+ }
338
+ }
339
+ });
340
+ async function executeReplInput(bulkEditService, historyService, notebookEditorService, editorControl) {
341
+ if (editorControl && editorControl.notebookEditor && editorControl.activeCodeEditor) {
342
+ const notebookDocument = editorControl.notebookEditor.textModel;
343
+ const textModel = editorControl.activeCodeEditor.getModel();
344
+ const activeKernel = editorControl.notebookEditor.activeKernel;
345
+ const language = activeKernel?.supportedLanguages[0] ?? PLAINTEXT_LANGUAGE_ID;
346
+ if (notebookDocument && textModel) {
347
+ const index = notebookDocument.length - 1;
348
+ const value = textModel.getValue();
349
+ if (isFalsyOrWhitespace(value)) {
350
+ return;
351
+ }
352
+ const ctrl = InlineChatController.get(editorControl.activeCodeEditor);
353
+ if (ctrl) {
354
+ ctrl.acceptSession();
355
+ }
356
+ historyService.replaceLast(notebookDocument.uri, value);
357
+ historyService.addToHistory(notebookDocument.uri, '');
358
+ textModel.setValue('');
359
+ notebookDocument.cells[index].resetTextBuffer(textModel.getTextBuffer());
360
+ const collapseState = editorControl.notebookEditor.notebookOptions.getDisplayOptions().interactiveWindowCollapseCodeCells === 'fromEditor' ?
361
+ {
362
+ inputCollapsed: false,
363
+ outputCollapsed: false
364
+ } :
365
+ undefined;
366
+ await bulkEditService.apply([
367
+ ( new ResourceNotebookCellEdit(notebookDocument.uri, {
368
+ editType: CellEditType.Replace,
369
+ index: index,
370
+ count: 0,
371
+ cells: [{
372
+ cellKind: CellKind.Code,
373
+ mime: undefined,
374
+ language,
375
+ source: value,
376
+ outputs: [],
377
+ metadata: {},
378
+ collapseState
379
+ }]
380
+ }))
381
+ ]);
382
+ const range = { start: index, end: index + 1 };
383
+ editorControl.notebookEditor.revealCellRangeInView(range);
384
+ await editorControl.notebookEditor.executeNotebookCells(editorControl.notebookEditor.getCellsInRange({ start: index, end: index + 1 }));
385
+ const editor = notebookEditorService.getNotebookEditor(editorControl.notebookEditor.getId());
386
+ if (editor) {
387
+ editor.setSelections([range]);
388
+ editor.setFocus(range);
389
+ }
390
+ }
391
+ }
392
+ }
393
+ AccessibleViewRegistry.register(( new ReplEditorAccessibleView()));
394
+ KeybindingsRegistry.registerCommandAndKeybindingRule({
395
+ id: 'list.find.replInputFocus',
396
+ weight: KeybindingWeight.WorkbenchContrib + 1,
397
+ when: ( ContextKeyExpr.equals('view', REPL_VIEW_ID)),
398
+ primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.KeyF,
399
+ secondary: [KeyCode.F3],
400
+ handler: (accessor) => {
401
+ getReplView(accessor.get(IViewsService))?.openFind();
402
+ }
403
+ });
404
+
405
+ export { ReplDocumentContribution };
@@ -0,0 +1,17 @@
1
+ import { ServicesAccessor } from "@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation";
2
+ import { IAccessibleViewImplementation } from "@codingame/monaco-vscode-api/vscode/vs/platform/accessibility/browser/accessibleViewRegistry";
3
+ import { AccessibleViewType, AccessibleContentProvider } from "@codingame/monaco-vscode-api/vscode/vs/platform/accessibility/browser/accessibleView";
4
+ export declare class ReplEditorInputAccessibilityHelp implements IAccessibleViewImplementation {
5
+ readonly priority = 105;
6
+ readonly name = "REPL Editor Input";
7
+ readonly when: import("@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey").ContextKeyExpression | undefined;
8
+ readonly type: AccessibleViewType;
9
+ getProvider(accessor: ServicesAccessor): AccessibleContentProvider | undefined;
10
+ }
11
+ export declare class ReplEditorHistoryAccessibilityHelp implements IAccessibleViewImplementation {
12
+ readonly priority = 105;
13
+ readonly name = "REPL Editor History";
14
+ readonly when: import("@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey").ContextKeyExpression | undefined;
15
+ readonly type: AccessibleViewType;
16
+ getProvider(accessor: ServicesAccessor): AccessibleContentProvider | undefined;
17
+ }
@@ -0,0 +1,120 @@
1
+
2
+ import { ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
3
+ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
4
+ import { AccessibleViewType, AccessibleContentProvider, AccessibleViewProviderId } from '@codingame/monaco-vscode-api/vscode/vs/platform/accessibility/browser/accessibleView';
5
+ import { AccessibilityVerbositySettingId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/accessibility/browser/accessibilityConfiguration';
6
+ import { ICodeEditorService } from '@codingame/monaco-vscode-api/vscode/vs/editor/browser/services/codeEditorService.service';
7
+ import { IS_COMPOSITE_NOTEBOOK, NOTEBOOK_CELL_LIST_FOCUSED } from '@codingame/monaco-vscode-eda30bac-0984-5b42-9362-c68996b85232-common/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
8
+
9
+ class ReplEditorInputAccessibilityHelp {
10
+ constructor() {
11
+ this.priority = 105;
12
+ this.name = 'REPL Editor Input';
13
+ this.when = ( ContextKeyExpr.and(IS_COMPOSITE_NOTEBOOK, ( NOTEBOOK_CELL_LIST_FOCUSED.negate())));
14
+ this.type = AccessibleViewType.Help;
15
+ }
16
+ getProvider(accessor) {
17
+ return getAccessibilityHelpProvider(accessor.get(ICodeEditorService), getAccessibilityInputHelpText());
18
+ }
19
+ }
20
+ function getAccessibilityInputHelpText() {
21
+ return [
22
+ ( localize(
23
+ 10232,
24
+ 'You are in a REPL Editor Input box which will accept code to be executed in the REPL.'
25
+ )),
26
+ ( localize(
27
+ 10233,
28
+ 'The Execute command{0} will evaluate the expression in the input box.',
29
+ '<keybinding:repl.execute>'
30
+ )),
31
+ ( localize(
32
+ 10234,
33
+ 'The setting `accessibility.replEditor.readLastExecutionOutput` controls if output will be automatically read when execution completes.'
34
+ )),
35
+ ( localize(
36
+ 10235,
37
+ 'The setting `accessibility.replEditor.autoFocusReplExecution` controls if focus will automatically move to the REPL after executing code.'
38
+ )),
39
+ ( localize(
40
+ 10236,
41
+ 'The Focus Last executed command{0} will move focus to the last executed item in the REPL history.',
42
+ '<keybinding:repl.focusLastItemExecuted>'
43
+ )),
44
+ ( localize(
45
+ 10237,
46
+ 'When you run the Open Accessbility View command{0} from this input box, the output from the last execution will be shown in the accessibility view.',
47
+ '<keybinding:editor.action.accessibleView>'
48
+ )),
49
+ ( localize(
50
+ 10238,
51
+ 'The Focus Input Editor command{0} will bring the focus back to this editor.',
52
+ '<keybinding:repl.input.focus>'
53
+ )),
54
+ ].join('\n');
55
+ }
56
+ class ReplEditorHistoryAccessibilityHelp {
57
+ constructor() {
58
+ this.priority = 105;
59
+ this.name = 'REPL Editor History';
60
+ this.when = ( ContextKeyExpr.and(IS_COMPOSITE_NOTEBOOK, NOTEBOOK_CELL_LIST_FOCUSED));
61
+ this.type = AccessibleViewType.Help;
62
+ }
63
+ getProvider(accessor) {
64
+ return getAccessibilityHelpProvider(accessor.get(ICodeEditorService), getAccessibilityHistoryHelpText());
65
+ }
66
+ }
67
+ function getAccessibilityHistoryHelpText() {
68
+ return [
69
+ ( localize(
70
+ 10239,
71
+ 'You are in a REPL History which is a list of cells that have been executed in the REPL. Each cell has an input, an output, and the cell container.'
72
+ )),
73
+ ( localize(
74
+ 10240,
75
+ 'The Edit Cell command{0} will move focus to the read-only editor for the input of the cell.',
76
+ '<keybinding:notebook.cell.edit>'
77
+ )),
78
+ ( localize(
79
+ 10241,
80
+ 'The Quit Edit command{0} will move focus to the cell container, where the up and down arrows will also move focus between cells in the history.',
81
+ '<keybinding:notebook.cell.quitEdit>'
82
+ )),
83
+ ( localize(
84
+ 10242,
85
+ 'Run the Open Accessbility View command{0} while navigating the history for an accessible view of the item\'s output.',
86
+ '<keybinding:editor.action.accessibleView>'
87
+ )),
88
+ ( localize(
89
+ 10243,
90
+ 'The Focus Output command{0} will set focus on the output when focused on a previously executed item.',
91
+ '<keybinding:notebook.cell.focusInOutput>'
92
+ )),
93
+ ( localize(
94
+ 10244,
95
+ 'The Focus Input Editor command{0} will move focus to the REPL input box.',
96
+ '<keybinding:repl.input.focus>'
97
+ )),
98
+ ( localize(
99
+ 10236,
100
+ 'The Focus Last executed command{0} will move focus to the last executed item in the REPL history.',
101
+ '<keybinding:repl.focusLastItemExecuted>'
102
+ )),
103
+ ].join('\n');
104
+ }
105
+ function getAccessibilityHelpProvider(editorService, helpText) {
106
+ const activeEditor = editorService.getActiveCodeEditor()
107
+ || editorService.getFocusedCodeEditor();
108
+ if (!activeEditor) {
109
+ return;
110
+ }
111
+ return ( new AccessibleContentProvider(
112
+ AccessibleViewProviderId.ReplEditor,
113
+ { type: AccessibleViewType.Help },
114
+ () => helpText,
115
+ () => activeEditor.focus(),
116
+ AccessibilityVerbositySettingId.ReplEditor
117
+ ));
118
+ }
119
+
120
+ export { ReplEditorHistoryAccessibilityHelp, ReplEditorInputAccessibilityHelp };
@@ -4,7 +4,7 @@ import { IFileService } from "@codingame/monaco-vscode-api/vscode/vs/platform/fi
4
4
  import { URI } from "@codingame/monaco-vscode-api/vscode/vs/base/common/uri";
5
5
  import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
6
6
  import { IWorkingCopyBackupService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/workingCopy/common/workingCopyBackup.service";
7
- import { IFileWorkingCopy, IFileWorkingCopyModel } from "@codingame/monaco-vscode-bba55be6-41a2-50cd-a3cc-8bafa35bfa89-common/vscode/vs/workbench/services/workingCopy/common/fileWorkingCopy";
7
+ import { IFileWorkingCopy, IFileWorkingCopyModel } from "@codingame/monaco-vscode-6f931a91-88ea-5232-897f-a17ec3929ba5-common/vscode/vs/workbench/services/workingCopy/common/fileWorkingCopy";
8
8
  export interface IBaseFileWorkingCopyManager<M extends IFileWorkingCopyModel, W extends IFileWorkingCopy<M>> extends IDisposable {
9
9
  /**
10
10
  * An event for when a file working copy was created.
@@ -8,13 +8,13 @@ import { ISaveOptions } from "@codingame/monaco-vscode-api/vscode/vs/workbench/c
8
8
  import { IWorkbenchEnvironmentService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/environment/common/environmentService.service";
9
9
  import { IPathService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService.service";
10
10
  import { IUriIdentityService } from "@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service";
11
- import { IStoredFileWorkingCopy, IStoredFileWorkingCopyModel, IStoredFileWorkingCopyModelFactory, IStoredFileWorkingCopyResolveOptions } from "@codingame/monaco-vscode-bba55be6-41a2-50cd-a3cc-8bafa35bfa89-common/vscode/vs/workbench/services/workingCopy/common/storedFileWorkingCopy";
11
+ import { IStoredFileWorkingCopy, IStoredFileWorkingCopyModel, IStoredFileWorkingCopyModelFactory, IStoredFileWorkingCopyResolveOptions } from "@codingame/monaco-vscode-6f931a91-88ea-5232-897f-a17ec3929ba5-common/vscode/vs/workbench/services/workingCopy/common/storedFileWorkingCopy";
12
12
  import { IStoredFileWorkingCopyManager, IStoredFileWorkingCopyManagerResolveOptions } from "./storedFileWorkingCopyManager.js";
13
13
  import { IUntitledFileWorkingCopy, IUntitledFileWorkingCopyModel, IUntitledFileWorkingCopyModelFactory } from "./untitledFileWorkingCopy.js";
14
14
  import { INewOrExistingUntitledFileWorkingCopyOptions, INewUntitledFileWorkingCopyOptions, INewUntitledFileWorkingCopyWithAssociatedResourceOptions, IUntitledFileWorkingCopyManager } from "./untitledFileWorkingCopyManager.js";
15
15
  import { IWorkingCopyFileService } from "@codingame/monaco-vscode-api/vscode/vs/workbench/services/workingCopy/common/workingCopyFileService.service";
16
16
  import { IBaseFileWorkingCopyManager } from "./abstractFileWorkingCopyManager.js";
17
- import { IFileWorkingCopy } from "@codingame/monaco-vscode-bba55be6-41a2-50cd-a3cc-8bafa35bfa89-common/vscode/vs/workbench/services/workingCopy/common/fileWorkingCopy";
17
+ import { IFileWorkingCopy } from "@codingame/monaco-vscode-6f931a91-88ea-5232-897f-a17ec3929ba5-common/vscode/vs/workbench/services/workingCopy/common/fileWorkingCopy";
18
18
  import { ILabelService } from "@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service";
19
19
  import { ILogService } from "@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service";
20
20
  import { INotificationService } from "@codingame/monaco-vscode-api/vscode/vs/platform/notification/common/notification.service";