forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Expand file tree
/
Copy pathcommands.ts
More file actions
209 lines (204 loc) · 9.99 KB
/
commands.ts
File metadata and controls
209 lines (204 loc) · 9.99 KB
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
198
199
200
201
202
203
204
205
206
207
208
209
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
import { CancellationToken, Position, TextDocument, Uri } from 'vscode';
import { Commands as LSCommands } from '../../activation/commands';
import { Commands as DSCommands } from '../../datascience/constants';
import { IShowDataViewerFromVariablePanel } from '../../datascience/interactive-common/interactiveWindowTypes';
import { KernelConnectionMetadata } from '../../datascience/jupyter/kernels/types';
import { INotebookModel, ISwitchKernelOptions } from '../../datascience/types';
import { CommandSource } from '../../testing/common/constants';
import { TestFunction, TestsToRun } from '../../testing/common/types';
import { TestDataItem, TestWorkspaceFolder } from '../../testing/types';
import { Commands } from '../constants';
import { Channel } from './types';
export type CommandsWithoutArgs = keyof ICommandNameWithoutArgumentTypeMapping;
/**
* Mapping between commands and list or arguments.
* These commands do NOT have any arguments.
* @interface ICommandNameWithoutArgumentTypeMapping
*/
interface ICommandNameWithoutArgumentTypeMapping {
[Commands.SwitchToInsidersDaily]: [];
[Commands.SwitchToInsidersWeekly]: [];
[Commands.ClearWorkspaceInterpreter]: [];
[Commands.ResetInterpreterSecurityStorage]: [];
[Commands.SwitchOffInsidersChannel]: [];
[Commands.Set_Interpreter]: [];
[Commands.Set_ShebangInterpreter]: [];
[Commands.Run_Linter]: [];
[Commands.Enable_Linter]: [];
['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']: [];
['python.datascience.selectJupyterInterpreter']: [];
[Commands.ViewOutput]: [];
[Commands.Set_Linter]: [];
[Commands.Start_REPL]: [];
[Commands.Enable_SourceMap_Support]: [];
[Commands.Exec_Selection_In_Terminal]: [];
[Commands.Exec_Selection_In_Django_Shell]: [];
[Commands.Create_Terminal]: [];
[Commands.Tests_View_UI]: [];
[Commands.Tests_Ask_To_Stop_Discovery]: [];
[Commands.Tests_Ask_To_Stop_Test]: [];
[Commands.Tests_Discovering]: [];
[Commands.PickLocalProcess]: [];
[DSCommands.RunCurrentCell]: [];
[DSCommands.RunCurrentCellAdvance]: [];
[DSCommands.ExecSelectionInInteractiveWindow]: [];
[DSCommands.SelectJupyterURI]: [];
[DSCommands.CreateNewInteractive]: [];
[DSCommands.UndoCells]: [];
[DSCommands.RedoCells]: [];
[DSCommands.RemoveAllCells]: [];
[DSCommands.InterruptKernel]: [];
[DSCommands.RestartKernel]: [];
[DSCommands.NotebookEditorUndoCells]: [];
[DSCommands.NotebookEditorRedoCells]: [];
[DSCommands.NotebookEditorRemoveAllCells]: [];
[DSCommands.NotebookEditorInterruptKernel]: [];
[DSCommands.NotebookEditorRestartKernel]: [];
[DSCommands.NotebookEditorRunAllCells]: [];
[DSCommands.NotebookEditorRunSelectedCell]: [];
[DSCommands.NotebookEditorAddCellBelow]: [];
[DSCommands.ExpandAllCells]: [];
[DSCommands.CollapseAllCells]: [];
[DSCommands.ExportOutputAsNotebook]: [];
[DSCommands.AddCellBelow]: [];
[DSCommands.CreateNewNotebook]: [];
[Commands.OpenStartPage]: [];
[LSCommands.ClearAnalyisCache]: [];
[LSCommands.RestartLS]: [];
}
/**
* 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];
['workbench.action.quickOpen']: [string];
['workbench.extensions.installExtension']: [Uri | 'ms-python.python'];
['workbench.action.files.openFolder']: [];
['workbench.action.openWorkspace']: [];
['setContext']: [string, boolean] | ['python.vscode.channel', Channel];
['python.reloadVSCode']: [string];
['revealLine']: [{ lineNumber: number; at: 'top' | 'center' | 'bottom' }];
['python._loadLanguageServerExtension']: {}[];
['python.SelectAndInsertDebugConfiguration']: [TextDocument, Position, CancellationToken];
['vscode.open']: [Uri];
['notebook.execute']: [];
['notebook.cell.execute']: [];
['notebook.cell.insertCodeCellBelow']: [];
['notebook.undo']: [];
['notebook.redo']: [];
['python.viewLanguageServerOutput']: [];
['vscode.open']: [Uri];
['workbench.action.files.saveAs']: [Uri];
['workbench.action.files.save']: [Uri];
[Commands.GetSelectedInterpreterPath]: [{ workspaceFolder: string } | string[]];
[Commands.Build_Workspace_Symbols]: [boolean, CancellationToken];
[Commands.Sort_Imports]: [undefined, Uri];
[Commands.Exec_In_Terminal]: [undefined, Uri];
[Commands.Exec_In_Terminal_Icon]: [undefined, Uri];
[Commands.Tests_ViewOutput]: [undefined, CommandSource];
[Commands.Tests_Select_And_Run_File]: [undefined, CommandSource];
[Commands.Tests_Run_Current_File]: [undefined, CommandSource];
[Commands.Tests_Stop]: [undefined, Uri];
[Commands.Test_Reveal_Test_Item]: [TestDataItem];
// When command is invoked from a tree node, first argument is the node data.
[Commands.Tests_Run]: [
undefined | TestWorkspaceFolder,
undefined | CommandSource,
undefined | Uri,
undefined | TestsToRun
];
// When command is invoked from a tree node, first argument is the node data.
[Commands.Tests_Debug]: [
undefined | TestWorkspaceFolder,
undefined | CommandSource,
undefined | Uri,
undefined | TestsToRun
];
[Commands.Tests_Run_Parametrized]: [undefined, undefined | CommandSource, Uri, TestFunction[], boolean];
// When command is invoked from a tree node, first argument is the node data.
[Commands.Tests_Discover]: [undefined | TestWorkspaceFolder, undefined | CommandSource, undefined | Uri];
[Commands.Tests_Run_Failed]: [undefined, CommandSource, Uri];
[Commands.Tests_Select_And_Debug_Method]: [undefined, CommandSource, Uri];
[Commands.Tests_Select_And_Run_Method]: [undefined, CommandSource, Uri];
[Commands.Tests_Configure]: [undefined, undefined | CommandSource, undefined | Uri];
[Commands.Tests_Picker_UI]: [undefined, undefined | CommandSource, Uri, TestFunction[]];
[Commands.Tests_Picker_UI_Debug]: [undefined, undefined | CommandSource, Uri, TestFunction[]];
// When command is invoked from a tree node, first argument is the node data.
[Commands.runTestNode]: [TestDataItem];
// When command is invoked from a tree node, first argument is the node data.
[Commands.debugTestNode]: [TestDataItem];
// When command is invoked from a tree node, first argument is the node data.
[Commands.openTestNodeInEditor]: [TestDataItem];
[Commands.navigateToTestFile]: [Uri, TestDataItem, boolean];
[Commands.navigateToTestFunction]: [Uri, TestDataItem, boolean];
[Commands.navigateToTestSuite]: [Uri, TestDataItem, boolean];
[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.OpenNotebook]: [undefined | Uri, undefined | CommandSource];
[DSCommands.OpenNotebookInPreviewEditor]: [undefined | Uri];
[DSCommands.ExportFileAsNotebook]: [undefined | Uri, undefined | CommandSource];
[DSCommands.RunFileInInteractiveWindows]: [Uri];
[DSCommands.DebugFileInInteractiveWindows]: [Uri];
[DSCommands.DebugCell]: [Uri, number, number, number, number];
[DSCommands.DebugStepOver]: [];
[DSCommands.DebugStop]: [];
[DSCommands.DebugContinue]: [];
[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]: [INotebookModel];
[DSCommands.ExportToHTML]: [INotebookModel, string | undefined];
[DSCommands.ExportToPDF]: [INotebookModel, string | undefined];
[DSCommands.Export]: [Uri | INotebookModel, string | undefined];
[DSCommands.SetJupyterKernel]: [KernelConnectionMetadata, Uri, undefined | Uri];
[DSCommands.SwitchJupyterKernel]: [ISwitchKernelOptions | undefined];
[DSCommands.SelectJupyterCommandLine]: [undefined | Uri];
[DSCommands.SaveNotebookNonCustomEditor]: [INotebookModel];
[DSCommands.SaveAsNotebookNonCustomEditor]: [INotebookModel, Uri];
[DSCommands.OpenNotebookNonCustomEditor]: [Uri];
[DSCommands.GatherQuality]: [string];
[DSCommands.LatestExtension]: [string];
[DSCommands.EnableLoadingWidgetsFrom3rdPartySource]: [undefined | never];
[DSCommands.TrustNotebook]: [undefined | never | Uri];
[DSCommands.NotebookEditorExpandAllCells]: [];
[DSCommands.NotebookEditorCollapseAllCells]: [];
[DSCommands.ShowDataViewer]: [IShowDataViewerFromVariablePanel];
}