Skip to content

Commit

Permalink
Simplify generation of launch.json with prompts (#3745)
Browse files Browse the repository at this point in the history
* Rename folder
* Refactor debug configuration provider
* refactor config and labels
* Revert config
* Add prompts
* Add tests
* News entry
* add telemetry
  • Loading branch information
DonJayamanne committed Dec 20, 2018
1 parent a139248 commit 444befa
Show file tree
Hide file tree
Showing 48 changed files with 1,824 additions and 102 deletions.
1 change: 1 addition & 0 deletions news/1 Enhancements/3321.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Prompt user to select a debug configuration when generating the `launch.json`.
60 changes: 1 addition & 59 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -887,65 +887,7 @@
}
}
}
},
"initialConfigurations": [
{
"name": "Python: Current File (Integrated Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
},
{
"name": "Python: Attach",
"type": "python",
"request": "attach",
"port": 5678,
"host": "localhost"
},
{
"name": "Python: Module",
"type": "python",
"request": "launch",
"module": "enter-your-module-name-here",
"console": "integratedTerminal"
},
{
"name": "Python: Django",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/manage.py",
"console": "integratedTerminal",
"args": [
"runserver",
"--noreload",
"--nothreading"
],
"django": true
},
{
"name": "Python: Flask",
"type": "python",
"request": "launch",
"module": "flask",
"env": {
"FLASK_APP": "app.py"
},
"args": [
"run",
"--no-debugger",
"--no-reload"
],
"jinja": true
},
{
"name": "Python: Current File (External Terminal)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "externalTerminal"
}
]
}
}
],
"configuration": {
Expand Down
2 changes: 1 addition & 1 deletion package.nls.de.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"python.snippet.launch.externalTerminal.description": "Python-Programm mit externem Terminal/Konsole debuggen",
"python.snippet.launch.django.label": "Python: Django",
"python.snippet.launch.django.description": "Django-Anwendung debuggen",
"python.snippet.launch.flask.label": "Python: Flask (0.11.x oder neuer)",
"python.snippet.launch.flask.label": "Python: Flask",
"python.snippet.launch.flask.description": "Flask-Anwendung debuggen",
"python.snippet.launch.flaskOld.label": "Python: Flask (0.10.x oder früher)",
"python.snippet.launch.flaskOld.description": "Ältere Flask-Anwendung debuggen",
Expand Down
2 changes: 1 addition & 1 deletion package.nls.es.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"python.snippet.launch.externalTerminal.description": "Depurar una aplicación Python usando una terminal externa",
"python.snippet.launch.django.label": "Python: Django",
"python.snippet.launch.django.description": "Depurar una aplicación de Django",
"python.snippet.launch.flask.label": "Python: Flask (Versión 0.11.x o posterior)",
"python.snippet.launch.flask.label": "Python: Flask",
"python.snippet.launch.flask.description": "Depurar una aplicación de Flask",
"python.snippet.launch.flaskOld.label": "Python: Flask (Versión 0.10.x o anterior)",
"python.snippet.launch.flaskOld.description": "Depurar una aplicación de Flask de estilo antiguo",
Expand Down
2 changes: 1 addition & 1 deletion package.nls.fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"python.snippet.launch.externalTerminal.description": "Déboguer un programme Python avec une console externe",
"python.snippet.launch.django.label": "Python : Django",
"python.snippet.launch.django.description": "Déboguer une application Django",
"python.snippet.launch.flask.label": "Python : Flask (0.11.x ou supérieur)",
"python.snippet.launch.flask.label": "Python : Flask",
"python.snippet.launch.flask.description": "Déboguer une application Flask",
"python.snippet.launch.flaskOld.label": "Python : Flask (0.10.x ou antérieur)",
"python.snippet.launch.flaskOld.description": "Déboguer une application Flask (0.10.x ou antérieur)",
Expand Down
2 changes: 1 addition & 1 deletion package.nls.it.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"python.snippet.launch.externalTerminal.description": "Esegui debug di un programma Python nel terminale esterno",
"python.snippet.launch.django.label": "Python: Django",
"python.snippet.launch.django.description": "Esegui debug applicazione Django",
"python.snippet.launch.flask.label": "Python: Flask (0.11.x o successiva)",
"python.snippet.launch.flask.label": "Python: Flask",
"python.snippet.launch.flask.description": "Esegui debug applicazione Flask",
"python.snippet.launch.flaskOld.label": "Python: Flask (0.10.x o precedente)",
"python.snippet.launch.flaskOld.description": "Esegui debug applicazione Flask in vecchio stile",
Expand Down
2 changes: 1 addition & 1 deletion package.nls.ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"python.snippet.launch.externalTerminal.description": "外部のターミナル/コンソールで Python プログラムをデバッグ",
"python.snippet.launch.django.label": "Python: Django",
"python.snippet.launch.django.description": "Django アプリケーションをデバッグ",
"python.snippet.launch.flask.label": "Python: Flask (0.11.x 以降)",
"python.snippet.launch.flask.label": "Python: Flask",
"python.snippet.launch.flask.description": "Flask アプリケーションをデバッグ",
"python.snippet.launch.flaskOld.label": "Python: Flask (0.10.x 以前)",
"python.snippet.launch.flaskOld.description": "旧式の Flask アプリケーションをデバッグ",
Expand Down
44 changes: 38 additions & 6 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
"python.snippet.launch.externalTerminal.description": "Debug a Python program with External Terminal/Console",
"python.snippet.launch.django.label": "Python: Django",
"python.snippet.launch.django.description": "Debug a Django Application",
"python.snippet.launch.flask.label": "Python: Flask (0.11.x or later)",
"python.snippet.launch.flask.label": "Python: Flask",
"python.snippet.launch.flask.description": "Debug a Flask Application",
"python.snippet.launch.flaskOld.label": "Python: Flask (0.10.x or earlier)",
"python.snippet.launch.flaskOld.description": "Debug an older styled Flask Application",
Expand Down Expand Up @@ -135,9 +135,41 @@
"Common.canceled": "Canceled",
"DataScience.importChangeDirectoryComment": "#%% Change working directory from the workspace root to the ipynb file location. Turn this addition off with the DataSciece.changeDirOnImportExport setting",
"DataScience.exportChangeDirectoryComment": "# Change directory to VSCode workspace root so that relative path loads work correctly. Turn this addition off with the DataSciece.changeDirOnImportExport setting",
"DataScience.interruptKernelStatus" : "Interrupting iPython Kernel",
"DataScience.restartKernelAfterInterruptMessage" : "Interrupting the kernel timed out. Do you want to restart the kernel instead? All variables will be lost.",
"DataScience.pythonInterruptFailedHeader" : "Keyboard interrupt crashed the kernel. Kernel restarted.",
"DataScience.sysInfoURILabel" : "Jupyter Server URI: ",
"Common.loadingPythonExtension": "Python extension loading..."
"DataScience.interruptKernelStatus": "Interrupting iPython Kernel",
"DataScience.restartKernelAfterInterruptMessage": "Interrupting the kernel timed out. Do you want to restart the kernel instead? All variables will be lost.",
"DataScience.pythonInterruptFailedHeader": "Keyboard interrupt crashed the kernel. Kernel restarted.",
"DataScience.sysInfoURILabel": "Jupyter Server URI: ",
"Common.loadingPythonExtension": "Python extension loading...",
"debug.selectConfigurationTitle": "Select a debug configuration",
"debug.selectConfigurationPlaceholder": "Debug Configuration",
"debug.debugFileConfigurationLabel": "Python File",
"debug.debugFileConfigurationDescription": "Debug python file",
"debug.debugModuleConfigurationLabel": "Module",
"debug.debugModuleConfigurationDescription": "Debug Python module/package",
"debug.remoteAttachConfigurationLabel": "Remote Attach",
"debug.remoteAttachConfigurationDescription": "Debug a remote python program",
"debug.debugDjangoConfigurationLabel": "Django",
"debug.debugDjangoConfigurationDescription": "Web Application",
"debug.debugFlaskConfigurationLabel": "Flask",
"debug.debugFlaskConfigurationDescription": "Web Application",
"debug.debugPyramidConfigurationLabel": "Pyramid",
"debug.debugPyramidConfigurationDescription": "Web Application",
"debug.djangoEnterManagePyPathTitle": "Debug Django",
"debug.djangoEnterManagePyPathPrompt": "Enter path to manage.py",
"debug.djangoEnterManagePyPathInvalidFilePathError": "Enter a valid python file path",
"debug.flaskEnterAppPathOrNamePathTitle": "Debug Flask",
"debug.flaskEnterAppPathOrNamePathPrompt": "Enter path to Application, e.g. 'app.py' or 'app'",
"debug.flaskEnterAppPathOrNamePathInvalidNameError": "Enter a valid name",
"debug.moduleEnterModuleTitle": "Debug Module",
"debug.moduleEnterModulePrompt": "Enter Python module/package name",
"debug.moduleEnterModuleInvalidNameError": "Enter a valid name",
"debug.pyramidEnterDevelopmentIniPathTitle": "Debug Pyramid",
"debug.pyramidEnterDevelopmentIniPathPrompt": "`Enter path to development.ini ('${workspaceFolderToken}' points to the root of the current workspace folder)`",
"debug.pyramidEnterDevelopmentIniPathInvalidFilePathError": "Enter a valid file path",
"debug.attachRemotePortTitle": "Remote Debugging",
"debug.attachRemotePortPrompt": "Enter Port Number",
"debug.attachRemotePortValidationError": "Enter a valid Port Number",
"debug.attachRemoteHostTitle": "Remote Debugging",
"debug.attachRemoteHostPrompt": "Enter Host Name",
"debug.attachRemoteHostValidationError": "Enter a Host Name or IP Address"
}
2 changes: 1 addition & 1 deletion package.nls.ko-kr.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
"python.snippet.launch.externalTerminal.description": "외부 터미널/콘솔에서 Python 프로그램 디버그",
"python.snippet.launch.django.label": "Python: Django",
"python.snippet.launch.django.description": "Django 응용 프로그램 디버그",
"python.snippet.launch.flask.label": "Python: Flask (0.11.x 또는 이후 버전)",
"python.snippet.launch.flask.label": "Python: Flask",
"python.snippet.launch.flask.description": "Flask 응용 프로그램 디버그",
"python.snippet.launch.flaskOld.label": "Python: Flask (0.10.x 또는 이전 버전)",
"python.snippet.launch.flaskOld.description": "이전 스타일의 Flask 응용 프로그램 디버그",
Expand Down
2 changes: 1 addition & 1 deletion package.nls.pt-br.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"python.snippet.launch.externalTerminal.description": "Depurar um Programa Python com Terminal/Console Externo",
"python.snippet.launch.django.label": "Python: Django",
"python.snippet.launch.django.description": "Depurar uma Aplicação Django",
"python.snippet.launch.flask.label": "Python: Flask (0.11.x ou superior)",
"python.snippet.launch.flask.label": "Python: Flask",
"python.snippet.launch.flask.description": "Depurar uma Aplicação Flask",
"python.snippet.launch.flaskOld.label": "Python: Flask (0.10.x ou inferior)",
"python.snippet.launch.flaskOld.description": "Depurar uma Aplicação Flask no Estilo Antigo",
Expand Down
2 changes: 1 addition & 1 deletion package.nls.ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"python.snippet.launch.externalTerminal.description": "Отладка программы Python во внешней консоли",
"python.snippet.launch.django.label": "Python: Django",
"python.snippet.launch.django.description": "Отладка приложения Django",
"python.snippet.launch.flask.label": "Python: Flask (0.11.x или новее)",
"python.snippet.launch.flask.label": "Python: Flask",
"python.snippet.launch.flask.description": "Отладка приложения Flask",
"python.snippet.launch.flaskOld.label": "Python: Flask (0.10.x или старее)",
"python.snippet.launch.flaskOld.description": "Отладка приложения Flask (старый стиль)",
Expand Down
3 changes: 1 addition & 2 deletions package.nls.zh-cn.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
"python.command.python.enableLinting.title": "启用 Linting",
"python.command.python.runLinting.title": "运行 Linting",
"python.snippet.launch.standard.label": "Python: 当前文件",
"python.snippet.launch.standard.label": "Python: Current File",
"python.snippet.launch.standard.description": "使用标准输出调试 Python 应用",
"python.snippet.launch.pyspark.label": "Python: PySpark",
"python.snippet.launch.pyspark.description": "调试 PySpark",
Expand All @@ -36,7 +35,7 @@
"python.snippet.launch.externalTerminal.description": "使用外部终端调试 Python 程序",
"python.snippet.launch.django.label": "Python: Django",
"python.snippet.launch.django.description": "调试 Django 应用",
"python.snippet.launch.flask.label": "Python: Flask (0.11.x 或以后)",
"python.snippet.launch.flask.label": "Python: Flask",
"python.snippet.launch.flask.description": "调试 Flask 应用",
"python.snippet.launch.flaskOld.label": "Python: Flask (0.10.x 或之前)",
"python.snippet.launch.flaskOld.description": "调试旧式 Flask 应用",
Expand Down
4 changes: 2 additions & 2 deletions package.nls.zh-tw.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"python.snippet.launch.externalTerminal.description": "使用外部終端機偵錯 Python 程式",
"python.snippet.launch.django.label": "Python:Django",
"python.snippet.launch.django.description": "偵錯 Django 程式",
"python.snippet.launch.flask.label": "Python:Flask(0.11.x 或以後)",
"python.snippet.launch.flask.label": "Python:Flask",
"python.snippet.launch.flask.description": "偵錯 Flask 程式",
"python.snippet.launch.flaskOld.label": "Python:Flask(0.10.x 或之前)",
"python.snippet.launch.flaskOld.description": "偵錯舊式 Flask 程式",
Expand All @@ -49,4 +49,4 @@
"python.command.python.discoverTests.title": "探索 Unit 測試項目",
"python.snippet.launch.gevent.label": "Python: Gevent",
"python.snippet.launch.gevent.description": "偵錯 Gevent 應用程式"
}
}
8 changes: 7 additions & 1 deletion src/client/common/application/applicationShell.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
const opn = require('opn');

import { injectable } from 'inversify';
import { CancellationToken, Disposable, InputBoxOptions, MessageItem, MessageOptions, OpenDialogOptions, Progress, ProgressOptions, QuickPickItem, QuickPickOptions, SaveDialogOptions, StatusBarAlignment, StatusBarItem, Uri, window, WorkspaceFolder, WorkspaceFolderPickOptions } from 'vscode';
import { CancellationToken, Disposable, InputBox, InputBoxOptions, MessageItem, MessageOptions, OpenDialogOptions, Progress, ProgressOptions, QuickPick, QuickPickItem, QuickPickOptions, SaveDialogOptions, StatusBarAlignment, StatusBarItem, Uri, window, WorkspaceFolder, WorkspaceFolderPickOptions } from 'vscode';
import { IApplicationShell } from './types';

@injectable()
Expand Down Expand Up @@ -70,4 +70,10 @@ export class ApplicationShell implements IApplicationShell {
public withProgress<R>(options: ProgressOptions, task: (progress: Progress<{ message?: string; increment?: number }>, token: CancellationToken) => Thenable<R>): Thenable<R> {
return window.withProgress<R>(options, task);
}
public createQuickPick<T extends QuickPickItem>(): QuickPick<T> {
return window.createQuickPick<T>();
}
public createInputBox(): InputBox {
return window.createInputBox();
}
}
24 changes: 24 additions & 0 deletions src/client/common/application/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ import {
Event,
FileSystemWatcher,
GlobPattern,
InputBox,
InputBoxOptions,
MessageItem,
MessageOptions,
OpenDialogOptions,
Progress,
ProgressOptions,
QuickPick,
QuickPickItem,
QuickPickOptions,
SaveDialogOptions,
Expand Down Expand Up @@ -227,6 +229,28 @@ export interface IApplicationShell {
*/
showInputBox(options?: InputBoxOptions, token?: CancellationToken): Thenable<string | undefined>;

/**
* Creates a [QuickPick](#QuickPick) to let the user pick an item from a list
* of items of type T.
*
* Note that in many cases the more convenient [window.showQuickPick](#window.showQuickPick)
* is easier to use. [window.createQuickPick](#window.createQuickPick) should be used
* when [window.showQuickPick](#window.showQuickPick) does not offer the required flexibility.
*
* @return A new [QuickPick](#QuickPick).
*/
createQuickPick<T extends QuickPickItem>(): QuickPick<T>;

/**
* Creates a [InputBox](#InputBox) to let the user enter some text input.
*
* Note that in many cases the more convenient [window.showInputBox](#window.showInputBox)
* is easier to use. [window.createInputBox](#window.createInputBox) should be used
* when [window.showInputBox](#window.showInputBox) does not offer the required flexibility.
*
* @return A new [InputBox](#InputBox).
*/
createInputBox(): InputBox;
/**
* Opens URL in a default browser.
*
Expand Down
3 changes: 3 additions & 0 deletions src/client/common/platform/pathUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export class PathUtils implements IPathUtils {
public get delimiter(): string {
return path.delimiter;
}
public get separator(): string {
return path.sep;
}
// TO DO: Deprecate in favor of IPlatformService
public getPathVariableName() {
return this.isWindows ? WINDOWS_PATH_VARIABLE_NAME : NON_WINDOWS_PATH_VARIABLE_NAME;
Expand Down
2 changes: 2 additions & 0 deletions src/client/common/serviceRegistry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ import {
IRandom,
IsWindows
} from './types';
import { IMultiStepInputFactory, MultiStepInputFactory } from './utils/multiStepInput';
import { Random } from './utils/random';

export function registerTypes(serviceManager: IServiceManager) {
Expand Down Expand Up @@ -100,4 +101,5 @@ export function registerTypes(serviceManager: IServiceManager) {
serviceManager.addSingleton<IFeatureDeprecationManager>(IFeatureDeprecationManager, FeatureDeprecationManager);

serviceManager.addSingleton<IAsyncDisposableRegistry>(IAsyncDisposableRegistry, AsyncDisposableRegistry);
serviceManager.addSingleton<IMultiStepInputFactory>(IMultiStepInputFactory, MultiStepInputFactory);
}
6 changes: 6 additions & 0 deletions src/client/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,12 @@ export const IPathUtils = Symbol('IPathUtils');
export interface IPathUtils {
readonly delimiter: string;
readonly home: string;
/**
* The platform-specific file separator. '\\' or '/'.
* @type {string}
* @memberof IPathUtils
*/
readonly separator: string;
getPathVariableName(): 'Path' | 'PATH';
basename(pathValue: string, ext?: string): string;
getDisplayName(pathValue: string, cwd?: string): string;
Expand Down
Loading

0 comments on commit 444befa

Please sign in to comment.