@codingame/monaco-vscode-notebook-service-override 3.2.3 → 4.1.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 (80) hide show
  1. package/notebook.js +13 -13
  2. package/package.json +2 -2
  3. package/external/rollup-plugin-styles/dist/runtime/inject-css.js +0 -3
  4. package/external/tslib/tslib.es6.js +0 -11
  5. package/override/vs/platform/dialogs/common/dialogs.js +0 -8
  6. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.css.js +0 -6
  7. package/vscode/src/vs/workbench/contrib/codeEditor/browser/emptyTextEditorHint/emptyTextEditorHint.js +0 -389
  8. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellCommands/cellCommands.js +0 -608
  9. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/contributedStatusBarItemController.js +0 -109
  10. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/cellStatusBar/statusBarProviders.js +0 -173
  11. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/clipboard/notebookClipboard.js +0 -488
  12. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookBreakpoints.js +0 -106
  13. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookCellPausing.js +0 -67
  14. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/debug/notebookDebugDecorations.js +0 -165
  15. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorHint/emptyCellEditorHint.js +0 -67
  16. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.js +0 -320
  17. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/execute/executionEditorProgress.js +0 -72
  18. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/media/notebookFind.css.js +0 -6
  19. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/find/notebookFind.js +0 -168
  20. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/format/formatting.js +0 -209
  21. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted.js +0 -84
  22. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/kernelDetection/notebookKernelDetection.js +0 -82
  23. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions.js +0 -67
  24. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/marker/markerProvider.js +0 -91
  25. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/navigation/arrow.js +0 -393
  26. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariableContextKeys.js +0 -5
  27. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariables.js +0 -97
  28. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesDataSource.js +0 -118
  29. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesTree.js +0 -59
  30. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/notebookVariables/notebookVariablesView.js +0 -148
  31. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/outline/notebookOutline.js +0 -383
  32. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/profile/notebookProfile.js +0 -77
  33. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/saveParticipants/saveParticipants.js +0 -511
  34. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/troubleshoot/layout.js +0 -159
  35. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/undoRedo/notebookUndoRedo.js +0 -56
  36. package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/viewportWarmup/viewportWarmup.js +0 -94
  37. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/apiActions.js +0 -51
  38. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +0 -565
  39. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +0 -31
  40. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatController.js +0 -744
  41. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/executeActions.js +0 -707
  42. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/insertCellActions.js +0 -351
  43. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/layoutActions.js +0 -267
  44. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffCellEditorOptions.js +0 -45
  45. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffComponents.js +0 -1297
  46. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementOutputs.js +0 -284
  47. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffElementViewModel.js +0 -563
  48. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/diffNestedCellViewModel.js +0 -108
  49. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/eventDispatcher.js +0 -39
  50. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiff.css.js +0 -6
  51. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffActions.js +0 -313
  52. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditor.js +0 -890
  53. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffEditorBrowser.js +0 -13
  54. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffList.js +0 -393
  55. package/vscode/src/vs/workbench/contrib/notebook/browser/diff/notebookDiffOverviewRuler.js +0 -175
  56. package/vscode/src/vs/workbench/contrib/notebook/browser/notebook.contribution.js +0 -1174
  57. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookAccessibility.js +0 -159
  58. package/vscode/src/vs/workbench/contrib/notebook/browser/notebookExtensionPoint.js +0 -451
  59. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookEditorServiceImpl.js +0 -192
  60. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionServiceImpl.js +0 -106
  61. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookExecutionStateServiceImpl.js +0 -509
  62. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelHistoryServiceImpl.js +0 -130
  63. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKernelServiceImpl.js +0 -341
  64. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookKeymapServiceImpl.js +0 -111
  65. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookLoggingServiceImpl.js +0 -28
  66. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookRendererMessagingServiceImpl.js +0 -65
  67. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookServiceImpl.js +0 -641
  68. package/vscode/src/vs/workbench/contrib/notebook/browser/services/notebookWorkerServiceImpl.js +0 -200
  69. package/vscode/src/vs/workbench/contrib/notebook/common/model/cellEdit.js +0 -80
  70. package/vscode/src/vs/workbench/contrib/notebook/common/model/notebookTextModel.js +0 -1003
  71. package/vscode/src/vs/workbench/contrib/notebook/common/notebookDiffEditorInput.js +0 -103
  72. package/vscode/src/vs/workbench/contrib/notebook/common/notebookEditorModelResolverServiceImpl.js +0 -202
  73. package/vscode/src/vs/workbench/contrib/notebook/common/notebookOutputRenderer.js +0 -80
  74. package/vscode/src/vs/workbench/contrib/notebook/common/notebookProvider.js +0 -98
  75. package/vscode/src/vs/workbench/contrib/search/browser/notebookSearch/notebookSearchService.js +0 -237
  76. package/vscode/src/vs/workbench/services/workingCopy/common/abstractFileWorkingCopyManager.js +0 -89
  77. package/vscode/src/vs/workbench/services/workingCopy/common/fileWorkingCopyManager.js +0 -376
  78. package/vscode/src/vs/workbench/services/workingCopy/common/storedFileWorkingCopyManager.js +0 -408
  79. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopy.js +0 -144
  80. package/vscode/src/vs/workbench/services/workingCopy/common/untitledFileWorkingCopyManager.js +0 -129
@@ -1,168 +0,0 @@
1
- import './media/notebookFind.css.js';
2
- import { Schemas } from 'vscode/vscode/vs/base/common/network';
3
- import { isEqual } from 'vscode/vscode/vs/base/common/resources';
4
- import { ICodeEditorService } from 'vscode/vscode/vs/editor/browser/services/codeEditorService';
5
- import { EditorContextKeys } from 'vscode/vscode/vs/editor/common/editorContextKeys';
6
- import { StartFindAction, StartFindReplaceAction, getSelectionSearchString } from 'vscode/vscode/vs/editor/contrib/find/browser/findController';
7
- import { localize2WithPath } from 'vscode/vscode/vs/nls';
8
- import { registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
9
- import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
10
- import { NotebookFindContrib } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/contrib/find/notebookFindWidget';
11
- import { getNotebookEditorFromEditorPane } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
12
- import { registerNotebookContribution } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookEditorExtensions';
13
- import { CellUri } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
14
- import { NOTEBOOK_EDITOR_FOCUSED, KEYBINDING_CONTEXT_NOTEBOOK_FIND_WIDGET_FOCUSED, NOTEBOOK_IS_ACTIVE_EDITOR, INTERACTIVE_WINDOW_IS_ACTIVE_EDITOR } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
15
- import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
16
-
17
- registerNotebookContribution(NotebookFindContrib.id, NotebookFindContrib);
18
- registerAction2(class extends Action2 {
19
- constructor() {
20
- super({
21
- id: 'notebook.hideFind',
22
- title: ( localize2WithPath(
23
- 'vs/workbench/contrib/notebook/browser/contrib/find/notebookFind',
24
- 'notebookActions.hideFind',
25
- 'Hide Find in Notebook'
26
- )),
27
- keybinding: {
28
- when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, KEYBINDING_CONTEXT_NOTEBOOK_FIND_WIDGET_FOCUSED)),
29
- primary: 9 ,
30
- weight: 200
31
- }
32
- });
33
- }
34
- async run(accessor) {
35
- const editorService = accessor.get(IEditorService);
36
- const editor = getNotebookEditorFromEditorPane(editorService.activeEditorPane);
37
- if (!editor) {
38
- return;
39
- }
40
- const controller = editor.getContribution(NotebookFindContrib.id);
41
- controller.hide();
42
- editor.focus();
43
- }
44
- });
45
- registerAction2(class extends Action2 {
46
- constructor() {
47
- super({
48
- id: 'notebook.find',
49
- title: ( localize2WithPath(
50
- 'vs/workbench/contrib/notebook/browser/contrib/find/notebookFind',
51
- 'notebookActions.findInNotebook',
52
- 'Find in Notebook'
53
- )),
54
- keybinding: {
55
- when: ( ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ( ContextKeyExpr.or(NOTEBOOK_IS_ACTIVE_EDITOR, INTERACTIVE_WINDOW_IS_ACTIVE_EDITOR)), ( EditorContextKeys.focus.toNegated()))),
56
- primary: 36 | 2048 ,
57
- weight: 200
58
- }
59
- });
60
- }
61
- async run(accessor) {
62
- const editorService = accessor.get(IEditorService);
63
- const editor = getNotebookEditorFromEditorPane(editorService.activeEditorPane);
64
- if (!editor) {
65
- return;
66
- }
67
- const controller = editor.getContribution(NotebookFindContrib.id);
68
- controller.show();
69
- }
70
- });
71
- function notebookContainsTextModel(uri, textModel) {
72
- if (textModel.uri.scheme === Schemas.vscodeNotebookCell) {
73
- const cellUri = CellUri.parse(textModel.uri);
74
- if (cellUri && isEqual(cellUri.notebook, uri)) {
75
- return true;
76
- }
77
- }
78
- return false;
79
- }
80
- function getSearchStringOptions(editor, opts) {
81
- if (opts.seedSearchStringFromSelection === 'single') {
82
- const selectionSearchString = getSelectionSearchString(editor, opts.seedSearchStringFromSelection, opts.seedSearchStringFromNonEmptySelection);
83
- if (selectionSearchString) {
84
- return {
85
- searchString: selectionSearchString,
86
- selection: editor.getSelection()
87
- };
88
- }
89
- }
90
- else if (opts.seedSearchStringFromSelection === 'multiple' && !opts.updateSearchScope) {
91
- const selectionSearchString = getSelectionSearchString(editor, opts.seedSearchStringFromSelection);
92
- if (selectionSearchString) {
93
- return {
94
- searchString: selectionSearchString,
95
- selection: editor.getSelection()
96
- };
97
- }
98
- }
99
- return undefined;
100
- }
101
- StartFindAction.addImplementation(100, (accessor, codeEditor, args) => {
102
- const editorService = accessor.get(IEditorService);
103
- const editor = getNotebookEditorFromEditorPane(editorService.activeEditorPane);
104
- if (!editor) {
105
- return false;
106
- }
107
- if (!codeEditor.hasModel()) {
108
- return false;
109
- }
110
- if (!editor.hasEditorFocus() && !editor.hasWebviewFocus()) {
111
- const codeEditorService = accessor.get(ICodeEditorService);
112
- const textEditor = codeEditorService.getFocusedCodeEditor() || codeEditorService.getActiveCodeEditor();
113
- if (editor.hasModel() && textEditor && textEditor.hasModel() && notebookContainsTextModel(editor.textModel.uri, textEditor.getModel())) ;
114
- else {
115
- return false;
116
- }
117
- }
118
- const controller = editor.getContribution(NotebookFindContrib.id);
119
- const searchStringOptions = getSearchStringOptions(codeEditor, {
120
- forceRevealReplace: false,
121
- seedSearchStringFromSelection: codeEditor.getOption(41 ).seedSearchStringFromSelection !== 'never' ? 'single' : 'none',
122
- seedSearchStringFromNonEmptySelection: codeEditor.getOption(41 ).seedSearchStringFromSelection === 'selection',
123
- seedSearchStringFromGlobalClipboard: codeEditor.getOption(41 ).globalFindClipboard,
124
- shouldFocus: 1 ,
125
- shouldAnimate: true,
126
- updateSearchScope: false,
127
- loop: codeEditor.getOption(41 ).loop
128
- });
129
- let options = undefined;
130
- const uri = codeEditor.getModel().uri;
131
- const data = CellUri.parse(uri);
132
- if (searchStringOptions?.selection && data) {
133
- const cell = editor.getCellByHandle(data.handle);
134
- if (cell) {
135
- options = {
136
- searchStringSeededFrom: { cell, range: searchStringOptions.selection },
137
- };
138
- }
139
- }
140
- controller.show(searchStringOptions?.searchString, options);
141
- return true;
142
- });
143
- StartFindReplaceAction.addImplementation(100, (accessor, codeEditor, args) => {
144
- const editorService = accessor.get(IEditorService);
145
- const editor = getNotebookEditorFromEditorPane(editorService.activeEditorPane);
146
- if (!editor) {
147
- return false;
148
- }
149
- if (!codeEditor.hasModel()) {
150
- return false;
151
- }
152
- const controller = editor.getContribution(NotebookFindContrib.id);
153
- const searchStringOptions = getSearchStringOptions(codeEditor, {
154
- forceRevealReplace: false,
155
- seedSearchStringFromSelection: codeEditor.getOption(41 ).seedSearchStringFromSelection !== 'never' ? 'single' : 'none',
156
- seedSearchStringFromNonEmptySelection: codeEditor.getOption(41 ).seedSearchStringFromSelection === 'selection',
157
- seedSearchStringFromGlobalClipboard: codeEditor.getOption(41 ).globalFindClipboard,
158
- shouldFocus: 1 ,
159
- shouldAnimate: true,
160
- updateSearchScope: false,
161
- loop: codeEditor.getOption(41 ).loop
162
- });
163
- if (controller) {
164
- controller.replace(searchStringOptions?.searchString);
165
- return true;
166
- }
167
- return false;
168
- });
@@ -1,209 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
2
- import { localize2WithPath, localizeWithPath } from 'vscode/vscode/vs/nls';
3
- import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
4
- import { DisposableStore, Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
5
- import { registerEditorAction, EditorAction } from 'vscode/vscode/vs/editor/browser/editorExtensions';
6
- import { IBulkEditService, ResourceTextEdit } from 'vscode/vscode/vs/editor/browser/services/bulkEditService';
7
- import { EditorContextKeys } from 'vscode/vscode/vs/editor/common/editorContextKeys';
8
- import { IEditorWorkerService } from 'vscode/vscode/vs/editor/common/services/editorWorker';
9
- import { ILanguageFeaturesService } from 'vscode/vscode/vs/editor/common/services/languageFeatures';
10
- import { ITextModelService } from 'vscode/vscode/vs/editor/common/services/resolverService';
11
- import { getDocumentFormattingEditsUntilResult, formatDocumentWithSelectedProvider } from 'vscode/vscode/vs/editor/contrib/format/browser/format';
12
- import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
13
- import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
14
- import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
15
- import { Progress } from 'vscode/vscode/vs/platform/progress/common/progress';
16
- import { NOTEBOOK_ACTIONS_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
17
- import { getNotebookEditorFromEditorPane } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/notebookBrowser';
18
- import { NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_EDITOR_EDITABLE } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
19
- import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
20
- import { INotebookExecutionService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookExecutionService';
21
- import { NotebookSetting } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
22
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
23
- import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
24
- import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
25
- import { INotebookService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookService';
26
-
27
- registerAction2(class extends Action2 {
28
- constructor() {
29
- super({
30
- id: 'notebook.format',
31
- title: ( localize2WithPath(
32
- 'vs/workbench/contrib/notebook/browser/contrib/format/formatting',
33
- 'format.title',
34
- 'Format Notebook'
35
- )),
36
- category: NOTEBOOK_ACTIONS_CATEGORY,
37
- precondition: ( ContextKeyExpr.and(NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_EDITOR_EDITABLE)),
38
- keybinding: {
39
- when: ( EditorContextKeys.editorTextFocus.toNegated()),
40
- primary: 1024 | 512 | 36 ,
41
- linux: { primary: 2048 | 1024 | 39 },
42
- weight: 200
43
- },
44
- f1: true,
45
- menu: {
46
- id: MenuId.EditorContext,
47
- when: ( ContextKeyExpr.and(
48
- EditorContextKeys.inCompositeEditor,
49
- EditorContextKeys.hasDocumentFormattingProvider
50
- )),
51
- group: '1_modification',
52
- order: 1.3
53
- }
54
- });
55
- }
56
- async run(accessor) {
57
- const editorService = accessor.get(IEditorService);
58
- const textModelService = accessor.get(ITextModelService);
59
- const editorWorkerService = accessor.get(IEditorWorkerService);
60
- const languageFeaturesService = accessor.get(ILanguageFeaturesService);
61
- const bulkEditService = accessor.get(IBulkEditService);
62
- const editor = getNotebookEditorFromEditorPane(editorService.activeEditorPane);
63
- if (!editor || !editor.hasModel()) {
64
- return;
65
- }
66
- const notebook = editor.textModel;
67
- const disposable = ( new DisposableStore());
68
- try {
69
- const allCellEdits = await Promise.all(( notebook.cells.map(async (cell) => {
70
- const ref = await textModelService.createModelReference(cell.uri);
71
- disposable.add(ref);
72
- const model = ref.object.textEditorModel;
73
- const formatEdits = await getDocumentFormattingEditsUntilResult(editorWorkerService, languageFeaturesService, model, model.getOptions(), CancellationToken.None);
74
- const edits = [];
75
- if (formatEdits) {
76
- for (const edit of formatEdits) {
77
- edits.push(( new ResourceTextEdit(model.uri, edit, model.getVersionId())));
78
- }
79
- return edits;
80
- }
81
- return [];
82
- })));
83
- await bulkEditService.apply( allCellEdits.flat(), { label: ( localizeWithPath(
84
- 'vs/workbench/contrib/notebook/browser/contrib/format/formatting',
85
- 'label',
86
- "Format Notebook"
87
- )), code: 'undoredo.formatNotebook', });
88
- }
89
- finally {
90
- disposable.dispose();
91
- }
92
- }
93
- });
94
- registerEditorAction(class FormatCellAction extends EditorAction {
95
- constructor() {
96
- super({
97
- id: 'notebook.formatCell',
98
- label: ( localizeWithPath(
99
- 'vs/workbench/contrib/notebook/browser/contrib/format/formatting',
100
- 'formatCell.label',
101
- "Format Cell"
102
- )),
103
- alias: 'Format Cell',
104
- precondition: ( ContextKeyExpr.and(
105
- NOTEBOOK_IS_ACTIVE_EDITOR,
106
- NOTEBOOK_EDITOR_EDITABLE,
107
- EditorContextKeys.inCompositeEditor,
108
- EditorContextKeys.writable,
109
- EditorContextKeys.hasDocumentFormattingProvider
110
- )),
111
- kbOpts: {
112
- kbExpr: ( ContextKeyExpr.and(EditorContextKeys.editorTextFocus)),
113
- primary: 1024 | 512 | 36 ,
114
- linux: { primary: 2048 | 1024 | 39 },
115
- weight: 100
116
- },
117
- contextMenuOpts: {
118
- group: '1_modification',
119
- order: 1.301
120
- }
121
- });
122
- }
123
- async run(accessor, editor) {
124
- if (editor.hasModel()) {
125
- const instaService = accessor.get(IInstantiationService);
126
- await instaService.invokeFunction(formatDocumentWithSelectedProvider, editor, 1 , Progress.None, CancellationToken.None, true);
127
- }
128
- }
129
- });
130
- let FormatOnCellExecutionParticipant = class FormatOnCellExecutionParticipant {
131
- constructor(bulkEditService, languageFeaturesService, textModelService, editorWorkerService, configurationService, _notebookService) {
132
- this.bulkEditService = bulkEditService;
133
- this.languageFeaturesService = languageFeaturesService;
134
- this.textModelService = textModelService;
135
- this.editorWorkerService = editorWorkerService;
136
- this.configurationService = configurationService;
137
- this._notebookService = _notebookService;
138
- }
139
- async onWillExecuteCell(executions) {
140
- const enabled = this.configurationService.getValue(NotebookSetting.formatOnCellExecution);
141
- if (!enabled) {
142
- return;
143
- }
144
- const disposable = ( new DisposableStore());
145
- try {
146
- const allCellEdits = await Promise.all(( executions.map(async (cellExecution) => {
147
- const nbModel = this._notebookService.getNotebookTextModel(cellExecution.notebook);
148
- if (!nbModel) {
149
- return [];
150
- }
151
- let activeCell;
152
- for (const cell of nbModel.cells) {
153
- if (cell.handle === cellExecution.cellHandle) {
154
- activeCell = cell;
155
- break;
156
- }
157
- }
158
- if (!activeCell) {
159
- return [];
160
- }
161
- const ref = await this.textModelService.createModelReference(activeCell.uri);
162
- disposable.add(ref);
163
- const model = ref.object.textEditorModel;
164
- const formatEdits = await getDocumentFormattingEditsUntilResult(this.editorWorkerService, this.languageFeaturesService, model, model.getOptions(), CancellationToken.None);
165
- const edits = [];
166
- if (formatEdits) {
167
- edits.push(...( formatEdits.map(edit => ( new ResourceTextEdit(model.uri, edit, model.getVersionId())))));
168
- return edits;
169
- }
170
- return [];
171
- })));
172
- await this.bulkEditService.apply( allCellEdits.flat(), { label: ( localizeWithPath(
173
- 'vs/workbench/contrib/notebook/browser/contrib/format/formatting',
174
- 'formatCells.label',
175
- "Format Cells"
176
- )), code: 'undoredo.notebooks.onWillExecuteFormat', });
177
- }
178
- finally {
179
- disposable.dispose();
180
- }
181
- }
182
- };
183
- FormatOnCellExecutionParticipant = ( __decorate([
184
- ( __param(0, IBulkEditService)),
185
- ( __param(1, ILanguageFeaturesService)),
186
- ( __param(2, ITextModelService)),
187
- ( __param(3, IEditorWorkerService)),
188
- ( __param(4, IConfigurationService)),
189
- ( __param(5, INotebookService))
190
- ], FormatOnCellExecutionParticipant));
191
- let CellExecutionParticipantsContribution = class CellExecutionParticipantsContribution extends Disposable {
192
- constructor(instantiationService, notebookExecutionService) {
193
- super();
194
- this.instantiationService = instantiationService;
195
- this.notebookExecutionService = notebookExecutionService;
196
- this.registerKernelExecutionParticipants();
197
- }
198
- registerKernelExecutionParticipants() {
199
- this._register(this.notebookExecutionService.registerExecutionParticipant(this.instantiationService.createInstance(FormatOnCellExecutionParticipant)));
200
- }
201
- };
202
- CellExecutionParticipantsContribution = ( __decorate([
203
- ( __param(0, IInstantiationService)),
204
- ( __param(1, INotebookExecutionService))
205
- ], CellExecutionParticipantsContribution));
206
- const workbenchContributionsRegistry = ( Registry.as(Extensions.Workbench));
207
- workbenchContributionsRegistry.registerWorkbenchContribution(CellExecutionParticipantsContribution, 3 );
208
-
209
- export { CellExecutionParticipantsContribution };
@@ -1,84 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
2
- import { Disposable } from 'vscode/vscode/vs/base/common/lifecycle';
3
- import { localize2WithPath } from 'vscode/vscode/vs/nls';
4
- import { Categories } from 'vscode/vscode/vs/platform/action/common/actionCommonCategories';
5
- import { registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
6
- import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands';
7
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
8
- import { ContextKeyExpr, IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
9
- import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
10
- import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage';
11
- import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
12
- import { Memento } from 'vscode/vscode/vs/workbench/common/memento';
13
- import { NotebookSetting } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
14
- import { HAS_OPENED_NOTEBOOK } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookContextKeys';
15
- import { NotebookEditorInput } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookEditorInput';
16
- import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService';
17
-
18
- const hasOpenedNotebookKey = 'hasOpenedNotebook';
19
- const hasShownGettingStartedKey = 'hasShownNotebookGettingStarted';
20
- let NotebookGettingStarted = class NotebookGettingStarted extends Disposable {
21
- constructor(_editorService, _storageService, _contextKeyService, _commandService, _configurationService) {
22
- super();
23
- const hasOpenedNotebook = HAS_OPENED_NOTEBOOK.bindTo(_contextKeyService);
24
- const memento = ( new Memento('notebookGettingStarted2', _storageService));
25
- const storedValue = memento.getMemento(0 , 0 );
26
- if (storedValue[hasOpenedNotebookKey]) {
27
- hasOpenedNotebook.set(true);
28
- }
29
- const needToShowGettingStarted = _configurationService.getValue(NotebookSetting.openGettingStarted) && !storedValue[hasShownGettingStartedKey];
30
- if (!storedValue[hasOpenedNotebookKey] || needToShowGettingStarted) {
31
- const onDidOpenNotebook = () => {
32
- hasOpenedNotebook.set(true);
33
- storedValue[hasOpenedNotebookKey] = true;
34
- if (needToShowGettingStarted) {
35
- _commandService.executeCommand('workbench.action.openWalkthrough', { category: 'notebooks', step: 'notebookProfile' }, true);
36
- storedValue[hasShownGettingStartedKey] = true;
37
- }
38
- memento.saveMemento();
39
- };
40
- if (_editorService.activeEditor?.typeId === NotebookEditorInput.ID) {
41
- onDidOpenNotebook();
42
- return;
43
- }
44
- const listener = this._register(_editorService.onDidActiveEditorChange(() => {
45
- if (_editorService.activeEditor?.typeId === NotebookEditorInput.ID) {
46
- listener.dispose();
47
- onDidOpenNotebook();
48
- }
49
- }));
50
- }
51
- }
52
- };
53
- NotebookGettingStarted = ( __decorate([
54
- ( __param(0, IEditorService)),
55
- ( __param(1, IStorageService)),
56
- ( __param(2, IContextKeyService)),
57
- ( __param(3, ICommandService)),
58
- ( __param(4, IConfigurationService))
59
- ], NotebookGettingStarted));
60
- ( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(NotebookGettingStarted, 3 );
61
- registerAction2(class NotebookClearNotebookLayoutAction extends Action2 {
62
- constructor() {
63
- super({
64
- id: 'workbench.notebook.layout.gettingStarted',
65
- title: ( localize2WithPath(
66
- 'vs/workbench/contrib/notebook/browser/contrib/gettingStarted/notebookGettingStarted',
67
- 'workbench.notebook.layout.gettingStarted.label',
68
- "Reset notebook getting started"
69
- )),
70
- f1: true,
71
- precondition: ( ContextKeyExpr.equals(`config.${NotebookSetting.openGettingStarted}`, true)),
72
- category: Categories.Developer,
73
- });
74
- }
75
- run(accessor) {
76
- const storageService = accessor.get(IStorageService);
77
- const memento = ( new Memento('notebookGettingStarted', storageService));
78
- const storedValue = memento.getMemento(0 , 0 );
79
- storedValue[hasOpenedNotebookKey] = undefined;
80
- memento.saveMemento();
81
- }
82
- });
83
-
84
- export { NotebookGettingStarted };
@@ -1,82 +0,0 @@
1
- import { __decorate, __param } from '../../../../../../../../../external/tslib/tslib.es6.js';
2
- import { Disposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
3
- import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
4
- import { Extensions } from 'vscode/vscode/vs/workbench/common/contributions';
5
- import { INotebookKernelService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookKernelService';
6
- import { INotebookLoggingService } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookLoggingService';
7
- import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions';
8
-
9
- let NotebookKernelDetection = class NotebookKernelDetection extends Disposable {
10
- constructor(_notebookKernelService, _extensionService, _notebookLoggingService) {
11
- super();
12
- this._notebookKernelService = _notebookKernelService;
13
- this._extensionService = _extensionService;
14
- this._notebookLoggingService = _notebookLoggingService;
15
- this._detectionMap = ( new Map());
16
- this._localDisposableStore = this._register(( new DisposableStore()));
17
- this._registerListeners();
18
- }
19
- _registerListeners() {
20
- this._localDisposableStore.clear();
21
- this._localDisposableStore.add(this._extensionService.onWillActivateByEvent(e => {
22
- if (e.event.startsWith('onNotebook:')) {
23
- if (this._extensionService.activationEventIsDone(e.event)) {
24
- return;
25
- }
26
- const notebookType = e.event.substring('onNotebook:'.length);
27
- if (notebookType === '*') {
28
- return;
29
- }
30
- let shouldStartDetection = false;
31
- const extensionStatus = this._extensionService.getExtensionsStatus();
32
- this._extensionService.extensions.forEach(extension => {
33
- if (extensionStatus[extension.identifier.value].activationTimes) {
34
- return;
35
- }
36
- if (extension.activationEvents?.includes(e.event)) {
37
- shouldStartDetection = true;
38
- }
39
- });
40
- if (shouldStartDetection && !( this._detectionMap.has(notebookType))) {
41
- this._notebookLoggingService.debug('KernelDetection', `start extension activation for ${notebookType}`);
42
- const task = this._notebookKernelService.registerNotebookKernelDetectionTask({
43
- notebookType: notebookType
44
- });
45
- this._detectionMap.set(notebookType, task);
46
- }
47
- }
48
- }));
49
- let timer = null;
50
- this._localDisposableStore.add(this._extensionService.onDidChangeExtensionsStatus(() => {
51
- if (timer) {
52
- clearTimeout(timer);
53
- }
54
- timer = setTimeout(() => {
55
- const taskToDelete = [];
56
- for (const [notebookType, task] of this._detectionMap) {
57
- if (this._extensionService.activationEventIsDone(`onNotebook:${notebookType}`)) {
58
- this._notebookLoggingService.debug('KernelDetection', `finish extension activation for ${notebookType}`);
59
- taskToDelete.push(notebookType);
60
- task.dispose();
61
- }
62
- }
63
- taskToDelete.forEach(notebookType => {
64
- this._detectionMap.delete(notebookType);
65
- });
66
- });
67
- }));
68
- this._localDisposableStore.add({
69
- dispose: () => {
70
- if (timer) {
71
- clearTimeout(timer);
72
- }
73
- }
74
- });
75
- }
76
- };
77
- NotebookKernelDetection = ( __decorate([
78
- ( __param(0, INotebookKernelService)),
79
- ( __param(1, IExtensionService)),
80
- ( __param(2, INotebookLoggingService))
81
- ], NotebookKernelDetection));
82
- ( Registry.as(Extensions.Workbench)).registerWorkbenchContribution(NotebookKernelDetection, 3 );
@@ -1,67 +0,0 @@
1
- import { localize2WithPath } from 'vscode/vscode/vs/nls';
2
- import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
3
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration';
4
- import { NOTEBOOK_ACTIONS_CATEGORY } from 'vscode/vscode/vs/workbench/contrib/notebook/browser/controller/coreActions';
5
- import { NotebookSetting } from 'vscode/vscode/vs/workbench/contrib/notebook/common/notebookCommon';
6
-
7
- const TOGGLE_CELL_TOOLBAR_POSITION = 'notebook.toggleCellToolbarPosition';
8
- class ToggleCellToolbarPositionAction extends Action2 {
9
- constructor() {
10
- super({
11
- id: TOGGLE_CELL_TOOLBAR_POSITION,
12
- title: ( localize2WithPath(
13
- 'vs/workbench/contrib/notebook/browser/contrib/layout/layoutActions',
14
- 'notebook.toggleCellToolbarPosition',
15
- 'Toggle Cell Toolbar Position'
16
- )),
17
- menu: [{
18
- id: MenuId.NotebookCellTitle,
19
- group: 'View',
20
- order: 1
21
- }],
22
- category: NOTEBOOK_ACTIONS_CATEGORY,
23
- f1: false
24
- });
25
- }
26
- async run(accessor, context) {
27
- const editor = context && context.ui ? context.notebookEditor : undefined;
28
- if (editor && editor.hasModel()) {
29
- const viewType = editor.textModel.viewType;
30
- const configurationService = accessor.get(IConfigurationService);
31
- const toolbarPosition = configurationService.getValue(NotebookSetting.cellToolbarLocation);
32
- const newConfig = this.togglePosition(viewType, toolbarPosition);
33
- await configurationService.updateValue(NotebookSetting.cellToolbarLocation, newConfig);
34
- }
35
- }
36
- togglePosition(viewType, toolbarPosition) {
37
- if (typeof toolbarPosition === 'string') {
38
- if (['left', 'right', 'hidden'].indexOf(toolbarPosition) >= 0) {
39
- const newViewValue = toolbarPosition === 'right' ? 'left' : 'right';
40
- const config = {
41
- default: toolbarPosition
42
- };
43
- config[viewType] = newViewValue;
44
- return config;
45
- }
46
- else {
47
- const config = {
48
- default: 'right',
49
- };
50
- config[viewType] = 'left';
51
- return config;
52
- }
53
- }
54
- else {
55
- const oldValue = toolbarPosition[viewType] ?? toolbarPosition['default'] ?? 'right';
56
- const newViewValue = oldValue === 'right' ? 'left' : 'right';
57
- const newConfig = {
58
- ...toolbarPosition
59
- };
60
- newConfig[viewType] = newViewValue;
61
- return newConfig;
62
- }
63
- }
64
- }
65
- registerAction2(ToggleCellToolbarPositionAction);
66
-
67
- export { ToggleCellToolbarPositionAction };