-
Notifications
You must be signed in to change notification settings - Fork 308
/
Copy pathcommands.ts
197 lines (192 loc) · 8.88 KB
/
commands.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
import {
CancellationToken,
NotebookCell,
NotebookDocument,
NotebookEditor,
Position,
TextDocument,
Uri,
ViewColumn
} from 'vscode';
import { IShowDataViewerFromVariablePanel } from './platform/messageTypes';
import { Commands as DSCommands } from './platform/common/constants';
import { PythonEnvironment } from './platform/pythonEnvironments/info';
import { CommandSource } from './platform/testing/common/constants';
import { Channel } from './platform/common/application/types';
import { SelectJupyterUriCommandSource } from './kernels/jupyter/serverSelector';
export type CommandsWithoutArgs = keyof ICommandNameWithoutArgumentTypeMapping;
/**
* Mapping between commands and list or arguments.
* These commands do NOT have any arguments.
* @interface ICommandNameWithoutArgumentTypeMapping
*/
interface ICommandNameWithoutArgumentTypeMapping {
['workbench.action.showCommands']: [];
['workbench.action.debug.continue']: [];
['workbench.action.debug.stepOver']: [];
['workbench.action.debug.stop']: [];
['workbench.action.reloadWindow']: [];
['workbench.action.closeActiveEditor']: [];
['editor.action.formatDocument']: [];
['editor.action.rename']: [];
['jupyter.selectJupyterInterpreter']: [];
['jupyterViewVariables.focus']: [];
[DSCommands.RunCurrentCell]: [];
[DSCommands.RunCurrentCellAdvance]: [];
[DSCommands.CreateNewInteractive]: [];
[DSCommands.InterruptKernel]: [{ notebookEditor: { notebookUri: Uri } } | undefined];
[DSCommands.RestartKernel]: [{ notebookEditor: { notebookUri: Uri } } | undefined];
[DSCommands.NotebookEditorUndoCells]: [];
[DSCommands.NotebookEditorRedoCells]: [];
[DSCommands.NotebookEditorRemoveAllCells]: [];
[DSCommands.NotebookEditorRestartKernel]: [{ notebookEditor: { notebookUri: Uri } } | undefined | Uri];
[DSCommands.NotebookEditorRunAllCells]: [];
[DSCommands.NotebookEditorAddCellBelow]: [];
[DSCommands.ExpandAllCells]: [];
[DSCommands.CollapseAllCells]: [];
[DSCommands.ExportOutputAsNotebook]: [];
[DSCommands.AddCellBelow]: [];
[DSCommands.CreateNewNotebook]: [];
[DSCommands.EnableDebugLogging]: [];
[DSCommands.ResetLoggingLevel]: [];
[DSCommands.OpenVariableView]: [];
[DSCommands.OpenOutlineView]: [];
[DSCommands.InteractiveClearAll]: [{ notebookEditor: { notebookUri: Uri } }];
[DSCommands.InteractiveRemoveCell]: [NotebookCell];
[DSCommands.InteractiveGoToCode]: [NotebookCell];
[DSCommands.InteractiveCopyCell]: [NotebookCell];
[DSCommands.InteractiveExportAsNotebook]: [{ notebookEditor: { notebookUri: Uri } }];
[DSCommands.InteractiveExportAs]: [{ notebookEditor: { notebookUri: Uri } }];
['notebook.cell.quitEdit']: [];
['notebook.cell.executeAndSelectBelow']: [];
['notebook.cell.collapseCellOutput']: [];
['notebook.cell.expandCellOutput']: [];
}
/**
* Mapping between commands and list of arguments.
* Used to provide strong typing for command & args.
* @export
* @interface ICommandNameArgumentTypeMapping
* @extends {ICommandNameWithoutArgumentTypeMapping}
*/
export interface ICommandNameArgumentTypeMapping extends ICommandNameWithoutArgumentTypeMapping {
['vscode.openWith']: [Uri, string];
['jupyter.filterKernels']: [never];
['workbench.action.quickOpen']: [string];
['workbench.extensions.installExtension']: [Uri | 'ms-toolsai.jupyter' | 'ms-python.python'];
['workbench.action.files.openFolder']: [];
['workbench.action.openWorkspace']: [];
['extension.open']: [string];
['setContext']: [string, boolean] | ['jupyter.vscode.channel', Channel];
['jupyter.reloadVSCode']: [string];
['jupyter.runInDedicatedExtensionHost']: [string];
['revealLine']: [{ lineNumber: number; at: 'top' | 'center' | 'bottom' }];
['python._loadLanguageServerExtension']: {}[];
['python.SelectAndInsertDebugConfiguration']: [TextDocument, Position, CancellationToken];
['vscode.open']: [Uri];
['notebook.execute']: [];
['notebook.cell.edit']: [];
['notebook.cell.execute']:
| []
| [{ ranges: { start: number; end: number }[]; document?: Uri; autoReveal?: boolean }]; // TODO update this
['notebook.cell.insertCodeCellBelow']: [];
['notebook.undo']: [];
['notebook.redo']: [];
['notebook.toggleBreakpointMargin']: [NotebookDocument];
['vscode.open']: [Uri];
['workbench.action.files.saveAs']: [Uri];
['workbench.action.files.save']: [Uri];
['notebook.selectKernel']:
| [
// This set of args will set the kernel/controller to the one with the id provided.
| { id: string; extension: string }
// This set of args will display the kernel picker.
| { notebookEditor: NotebookEditor }
]
| [];
['undo']: [];
['interactive.open']: [
{ preserveFocus?: boolean; viewColumn?: ViewColumn },
Uri | undefined,
string | undefined,
string | undefined
];
['interactive.execute']: [string];
['outline.focus']: [];
['vscode.executeCompletionItemProvider']: [Uri, Position];
['notebook.cell.collapseCellInput']: [
{ ranges: { start: number; end: number }[]; document?: Uri; autoReveal?: boolean }
];
['notebook.cell.expandCellInput']: [
{ ranges: { start: number; end: number }[]; document?: Uri; autoReveal?: boolean }
];
[DSCommands.NotebookEditorInterruptKernel]: [{ notebookEditor: { notebookUri: Uri } } | undefined | Uri];
[DSCommands.ExportFileAndOutputAsNotebook]: [Uri];
[DSCommands.RunAllCells]: [Uri];
[DSCommands.RunCell]: [Uri, number, number, number, number];
[DSCommands.RunAllCellsAbove]: [Uri, number, number];
[DSCommands.RunCellAndAllBelow]: [Uri, number, number];
[DSCommands.RunAllCellsAbovePalette]: [];
[DSCommands.RunCellAndAllBelowPalette]: [];
[DSCommands.DebugCurrentCellPalette]: [];
[DSCommands.RunToLine]: [Uri, number, number];
[DSCommands.RunFromLine]: [Uri, number, number];
[DSCommands.ImportNotebook]: [undefined | Uri, undefined | CommandSource];
[DSCommands.ImportNotebookFile]: [undefined | Uri, undefined | CommandSource];
[DSCommands.ExportFileAsNotebook]: [undefined | Uri, undefined | CommandSource];
[DSCommands.ExecSelectionInInteractiveWindow]: [string | undefined];
[DSCommands.RunFileInInteractiveWindows]: [Uri];
[DSCommands.DebugFileInInteractiveWindows]: [Uri];
[DSCommands.DebugCell]: [Uri, number, number, number, number];
[DSCommands.DebugStepOver]: [Uri];
[DSCommands.DebugStop]: [Uri];
[DSCommands.DebugContinue]: [Uri];
[DSCommands.RunCurrentCellAndAddBelow]: [Uri];
[DSCommands.InsertCellBelowPosition]: [];
[DSCommands.InsertCellBelow]: [];
[DSCommands.InsertCellAbove]: [];
[DSCommands.DeleteCells]: [];
[DSCommands.SelectCell]: [];
[DSCommands.SelectCellContents]: [];
[DSCommands.ExtendSelectionByCellAbove]: [];
[DSCommands.ExtendSelectionByCellBelow]: [];
[DSCommands.MoveCellsUp]: [];
[DSCommands.MoveCellsDown]: [];
[DSCommands.ChangeCellToMarkdown]: [];
[DSCommands.ChangeCellToCode]: [];
[DSCommands.GotoNextCellInFile]: [];
[DSCommands.GotoPrevCellInFile]: [];
[DSCommands.ScrollToCell]: [Uri, string];
[DSCommands.ViewJupyterOutput]: [];
[DSCommands.ExportAsPythonScript]: [NotebookDocument | undefined, PythonEnvironment | undefined];
[DSCommands.ExportToHTML]: [NotebookDocument | undefined, string | undefined, PythonEnvironment | undefined];
[DSCommands.ExportToPDF]: [NotebookDocument | undefined, string | undefined, PythonEnvironment | undefined];
[DSCommands.Export]: [NotebookDocument | undefined, string | undefined, PythonEnvironment | undefined];
[DSCommands.NativeNotebookExport]: [Uri | undefined | { notebookEditor: { notebookUri: Uri } }];
[DSCommands.SelectJupyterCommandLine]: [undefined | Uri];
[DSCommands.LatestExtension]: [string];
[DSCommands.EnableLoadingWidgetsFrom3rdPartySource]: [];
[DSCommands.NotebookEditorExpandAllCells]: [];
[DSCommands.NotebookEditorCollapseAllCells]: [];
[DSCommands.ShowDataViewer]: [IShowDataViewerFromVariablePanel];
[DSCommands.RefreshDataViewer]: [];
[DSCommands.ClearSavedJupyterUris]: [];
[DSCommands.SelectJupyterURI]: [
boolean | undefined,
Uri | SelectJupyterUriCommandSource | undefined,
NotebookDocument | undefined
];
[DSCommands.SelectNativeJupyterUriFromToolBar]: [];
[DSCommands.DebugNotebook]: [];
[DSCommands.RunByLine]: [NotebookCell];
[DSCommands.RunAndDebugCell]: [NotebookCell];
[DSCommands.RunByLineNext]: [NotebookCell];
[DSCommands.RunByLineStop]: [];
[DSCommands.ReplayPylanceLog]: [Uri];
[DSCommands.ReplayPylanceLogStep]: [];
[DSCommands.InstallPythonExtensionViaKernelPicker]: [];
[DSCommands.InstallPythonViaKernelPicker]: [];
}