forked from microsoft/vscode-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommands.ts
More file actions
147 lines (140 loc) · 6.72 KB
/
commands.ts
File metadata and controls
147 lines (140 loc) · 6.72 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
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
'use strict';
import { CancellationToken, Disposable, Position, TextDocument, Uri } from 'vscode';
import { Commands as LSCommands } from '../../activation/commands';
import { TensorBoardEntrypoint, TensorBoardEntrypointTrigger } from '../../tensorBoard/constants';
import { TestDataItem, TestFunction, TestsToRun, TestWorkspaceFolder } from '../../testing/common/types';
import { Commands } from '../constants';
import { Channel, CommandSource, ICommandManager } 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']: [];
[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]: [];
[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',
{ installOnlyNewlyAddedFromExtensionPackVSIX: true },
];
['workbench.action.files.openFolder']: [];
['workbench.action.openWorkspace']: [];
['workbench.action.openIssueReporter']: [{ extensionId: string; issueBody: string }];
['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];
['jupyter.opennotebook']: [undefined | Uri, undefined | CommandSource];
['jupyter.runallcells']: [Uri];
['extension.open']: [string];
[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];
[Commands.LaunchTensorBoard]: [TensorBoardEntrypoint, TensorBoardEntrypointTrigger];
}
//export const IPythonCommandManager = Symbol('IPythonCommandManager');
export interface IPythonCommandManager extends ICommandManager {
registerCommand<E extends keyof ICommandNameArgumentTypeMapping, U extends ICommandNameArgumentTypeMapping[E]>(
command: E,
callback: (...args: U) => any,
thisArg?: any,
): Disposable;
executeCommand<T, E extends keyof ICommandNameArgumentTypeMapping, U extends ICommandNameArgumentTypeMapping[E]>(
command: E,
...rest: U
): Thenable<T | undefined>;
}