Skip to content

Commit 428d2d2

Browse files
authored
Add create python file command to walkthrough and remove setting (#18740)
1 parent 760aa0e commit 428d2d2

3 files changed

Lines changed: 3 additions & 99 deletions

File tree

package.json

Lines changed: 3 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -138,84 +138,7 @@
138138
{
139139
"id": "python.createPythonFile",
140140
"title": "Create a Python file",
141-
"description": "[Open](command:toSide:workbench.action.files.openFile) or [create](command:toSide:workbench.action.files.newUntitledFile) a Python file - make sure to save it as \".py\".\n[Create Python File](command:toSide:workbench.action.files.newUntitledFile)",
142-
"media": {
143-
"svg": "resources/walkthrough/open-folder.svg",
144-
"altText": "Open a Python file or a folder with a Python project."
145-
},
146-
"when": ""
147-
},
148-
{
149-
"id": "python.selectInterpreter",
150-
"title": "Select a Python Interpreter",
151-
"description": "Choose which Python interpreter/environment you want to use for your Python project.\n[Select Python Interpreter](command:python.setInterpreter)\n**Tip**: Run the ``Python: Select Interpreter`` command in the [Command Palette](command:workbench.action.showCommands).\nReload the window if you installed Python but don't see it in the list (``Developer: Reload Window`` command). ",
152-
"media": {
153-
"svg": "resources/walkthrough/python-interpreter-v2.svg",
154-
"altText": "Selecting a python interpreter from the status bar"
155-
},
156-
"when": ""
157-
},
158-
{
159-
"id": "python.runAndDebug",
160-
"title": "Run and debug your Python file",
161-
"description": "Open your Python file and click on the play button on the top right of the editor, or press F5 when on the file and select \"Python File\" to run with the debugger. \n \n[Learn more](https://code.visualstudio.com/docs/python/python-tutorial#_run-hello-world)",
162-
"media": {
163-
"svg": "resources/walkthrough/rundebug2.svg",
164-
"altText": "How to run and debug in VS Code with F5 or the play button on the top right."
165-
},
166-
"when": ""
167-
},
168-
{
169-
"id": "python.learnMore",
170-
"title": "Explore more resources",
171-
"description": "🎨 Explore all the features the Python extension has to offer by looking for \"Python\" in the [Command Palette](command:workbench.action.showCommands). \n ✨ Take a look at our [Release Notes](https://aka.ms/AA8dxtb) to learn more about the latest features. \n \n[Learn More](https://aka.ms/AA8dqti)",
172-
"media": {
173-
"altText": "Image representing our documentation page and mailing list resources.",
174-
"svg": "resources/walkthrough/learnmore.svg"
175-
},
176-
"when": ""
177-
}
178-
]
179-
},
180-
{
181-
"id": "pythonWelcomeWithDS",
182-
"title": "Get started with Python development",
183-
"description": "Your first steps to set up a Python project with all the powerful tools and features that the Python extension has to offer!",
184-
"when": "false",
185-
"steps": [
186-
{
187-
"id": "python.installPythonWin",
188-
"title": "Install Python",
189-
"description": "The Python Extension requires Python to be installed. Install Python from the [Microsoft Store](https://aka.ms/AAd9rms).\n\n[Install Python](https://aka.ms/AAd9rms)\n",
190-
"media": {
191-
"markdown": "resources/walkthrough/install-python-windows.md"
192-
},
193-
"when": "workspacePlatform == windows"
194-
},
195-
{
196-
"id": "python.installPythonMac",
197-
"title": "Install Python",
198-
"description": "The Python Extension requires Python to be installed. Install Python 3 through the terminal.\n[Open Terminal](command:workbench.action.terminal.new)\n",
199-
"media": {
200-
"markdown": "resources/walkthrough/install-python-macos.md"
201-
},
202-
"when": "workspacePlatform == mac",
203-
"command": "workbench.action.terminal.new"
204-
},
205-
{
206-
"id": "python.installPythonLinux",
207-
"title": "Install Python",
208-
"description": "The Python Extension requires Python to be installed. Install Python 3 through the terminal.\n[Open Terminal](command:workbench.action.terminal.new)\n",
209-
"media": {
210-
"markdown": "resources/walkthrough/install-python-linux.md"
211-
},
212-
"when": "workspacePlatform == linux",
213-
"command": "workbench.action.terminal.new"
214-
},
215-
{
216-
"id": "python.createPythonFile",
217-
"title": "Create a Python file",
218-
"description": "[Open](command:toSide:workbench.action.files.openFile) or [create](command:toSide:workbench.action.files.newUntitledFile) a Python file - make sure to save it as \".py\".\n[Create Python File](command:toSide:workbench.action.files.newUntitledFile)",
141+
"description": "[Open](command:toSide:workbench.action.files.openFile) or [create](command:toSide:python.createNewFile) a Python file - make sure to save it as \".py\".\n[Create Python File](command:toSide:python.createNewFile)",
219142
"media": {
220143
"svg": "resources/walkthrough/open-folder.svg",
221144
"altText": "Open a Python file or a folder with a Python project."
@@ -323,8 +246,7 @@
323246
"title": "%python.command.python.createNewFile.title%",
324247
"shortTitle": "%python.menu.createNewFile.title%",
325248
"category": "Python",
326-
"command": "python.createNewFile",
327-
"when": "config.python.createNewFileEnabled"
249+
"command": "python.createNewFile"
328250
},
329251
{
330252
"category": "Python",
@@ -492,15 +414,6 @@
492414
"scope": "machine",
493415
"type": "string"
494416
},
495-
"python.createNewFileEnabled": {
496-
"default": "false",
497-
"description": "Enable the `Python: New Python File` command.",
498-
"scope": "machine",
499-
"type": "boolean",
500-
"tags": [
501-
"experimental"
502-
]
503-
},
504417
"python.defaultInterpreterPath": {
505418
"default": "python",
506419
"description": "Path to default Python to use when extension loads up for the first time, no longer used once an interpreter is selected for the workspace. See https://aka.ms/AAfekmf to understand when this is used.",
@@ -1830,7 +1743,7 @@
18301743
{
18311744
"command": "python.createNewFile",
18321745
"category": "file",
1833-
"when": "config.python.createNewFileEnabled"
1746+
"when": "!virtualWorkspace"
18341747
}
18351748
],
18361749
"view/title": [

src/client/common/application/commands/createFileCommand.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ export class CreatePythonFileCommandHandler implements IExtensionSingleActivatio
1616
) {}
1717

1818
public async activate(): Promise<void> {
19-
if (!this.workspaceService.getConfiguration('python').get<boolean>('createNewFileEnabled')) {
20-
return;
21-
}
2219
this.commandManager.registerCommand(Commands.CreateNewFile, this.createPythonFile, this);
2320
}
2421

src/test/common/application/commands/createNewFileCommand.unit.test.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import { Commands } from '../../../../client/common/constants';
77
import { CommandManager } from '../../../../client/common/application/commandManager';
88
import { CreatePythonFileCommandHandler } from '../../../../client/common/application/commands/createFileCommand';
99
import { IApplicationShell, ICommandManager, IWorkspaceService } from '../../../../client/common/application/types';
10-
import { MockWorkspaceConfiguration } from '../../../mocks/mockWorkspaceConfig';
1110
import { WorkspaceService } from '../../../../client/common/application/workspace';
1211
import { ApplicationShell } from '../../../../client/common/application/applicationShell';
1312

@@ -27,11 +26,6 @@ suite('Create New Python File Commmand', () => {
2726
instance(workspaceService),
2827
instance(appShell),
2928
);
30-
when(workspaceService.getConfiguration('python')).thenReturn(
31-
new MockWorkspaceConfiguration({
32-
createNewFileEnabled: true,
33-
}),
34-
);
3529
when(workspaceService.openTextDocument(deepEqual({ language: 'python' }))).thenReturn(
3630
Promise.resolve(({} as unknown) as TextDocument),
3731
);

0 commit comments

Comments
 (0)