Skip to content

Commit

Permalink
Update labels in debug configuration prompts (#3771)
Browse files Browse the repository at this point in the history
* Update messages
* Refactor
  • Loading branch information
DonJayamanne authored Dec 21, 2018
1 parent 444befa commit 77d6f27
Show file tree
Hide file tree
Showing 8 changed files with 52 additions and 51 deletions.
18 changes: 9 additions & 9 deletions package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -143,22 +143,22 @@
"debug.selectConfigurationTitle": "Select a debug configuration",
"debug.selectConfigurationPlaceholder": "Debug Configuration",
"debug.debugFileConfigurationLabel": "Python File",
"debug.debugFileConfigurationDescription": "Debug 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.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.djangoEnterManagePyPathPrompt": "Enter path to manage.py ('${workspaceFolderToken}' points to the root of the current workspace folder)",
"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.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",
Expand All @@ -167,9 +167,9 @@
"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.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"
"debug.attachRemoteHostPrompt": "Enter a host name or IP address",
"debug.attachRemoteHostValidationError": "Enter a valid host name or IP address"
}
21 changes: 11 additions & 10 deletions src/client/common/utils/localize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,26 +105,27 @@ export namespace DataScience {
export const sysInfoURILabel = localize('DataScience.sysInfoURILabel', 'Jupyter Server URI: ');
}

export namespace Debug {
export namespace DebugConfigurationPrompts {
export const selectConfigurationTitle = localize('debug.selectConfigurationTitle', 'Select a debug configuration');
export const selectConfigurationPlaceholder = localize('debug.selectConfigurationPlaceholder', 'Debug Configuration');
export const debugFileConfigurationLabel = localize('debug.debugFileConfigurationLabel', 'Python File');
export const debugFileConfigurationDescription = localize('debug.debugFileConfigurationDescription', 'Debug python file');
export const debugFileConfigurationDescription = localize('debug.debugFileConfigurationDescription', 'Debug Python file');
export const debugModuleConfigurationLabel = localize('debug.debugModuleConfigurationLabel', 'Module');
export const debugModuleConfigurationDescription = localize('debug.debugModuleConfigurationDescription', 'Debug Python module/package');
export const remoteAttachConfigurationLabel = localize('debug.remoteAttachConfigurationLabel', 'Remote Attach');
export const remoteAttachConfigurationDescription = localize('debug.remoteAttachConfigurationDescription', 'Debug a remote python program');
export const remoteAttachConfigurationDescription = localize('debug.remoteAttachConfigurationDescription', 'Debug a remote Python program');
export const debugDjangoConfigurationLabel = localize('debug.debugDjangoConfigurationLabel', 'Django');
export const debugDjangoConfigurationDescription = localize('debug.debugDjangoConfigurationDescription', 'Web Application');
export const debugFlaskConfigurationLabel = localize('debug.debugFlaskConfigurationLabel', 'Flask');
export const debugFlaskConfigurationDescription = localize('debug.debugFlaskConfigurationDescription', 'Web Application');
export const debugPyramidConfigurationLabel = localize('debug.debugPyramidConfigurationLabel', 'Pyramid');
export const debugPyramidConfigurationDescription = localize('debug.debugPyramidConfigurationDescription', 'Web Application');
export const djangoEnterManagePyPathTitle = localize('debug.djangoEnterManagePyPathTitle', 'Debug Django');
export const djangoEnterManagePyPathPrompt = localize('debug.djangoEnterManagePyPathPrompt', 'Enter path to manage.py');
export const djangoEnterManagePyPathInvalidFilePathError = localize('debug.djangoEnterManagePyPathInvalidFilePathError', 'Enter a valid python file path');
// tslint:disable-next-line:no-invalid-template-strings
export const djangoEnterManagePyPathPrompt = localize('debug.djangoEnterManagePyPathPrompt', 'Enter path to manage.py (\'${workspaceFolderToken}\' points to the root of the current workspace folder)');
export const djangoEnterManagePyPathInvalidFilePathError = localize('debug.djangoEnterManagePyPathInvalidFilePathError', 'Enter a valid Python file path');
export const flaskEnterAppPathOrNamePathTitle = localize('debug.flaskEnterAppPathOrNamePathTitle', 'Debug Flask');
export const flaskEnterAppPathOrNamePathPrompt = localize('debug.flaskEnterAppPathOrNamePathPrompt', 'Enter path to Application, e.g. \'app.py\' or \'app\'');
export const flaskEnterAppPathOrNamePathPrompt = localize('debug.flaskEnterAppPathOrNamePathPrompt', 'Enter path to application, e.g. \'app.py\' or \'app\'');
export const flaskEnterAppPathOrNamePathInvalidNameError = localize('debug.flaskEnterAppPathOrNamePathInvalidNameError', 'Enter a valid name');

export const moduleEnterModuleTitle = localize('debug.moduleEnterModuleTitle', 'Debug Module');
Expand All @@ -135,11 +136,11 @@ export namespace Debug {
export const pyramidEnterDevelopmentIniPathPrompt = localize('debug.pyramidEnterDevelopmentIniPathPrompt', '`Enter path to development.ini (\'${workspaceFolderToken}\' points to the root of the current workspace folder)`');
export const pyramidEnterDevelopmentIniPathInvalidFilePathError = localize('debug.pyramidEnterDevelopmentIniPathInvalidFilePathError', 'Enter a valid file path');
export const attachRemotePortTitle = localize('debug.attachRemotePortTitle', 'Remote Debugging');
export const attachRemotePortPrompt = localize('debug.attachRemotePortPrompt', 'Enter Port Number');
export const attachRemotePortValidationError = localize('debug.attachRemotePortValidationError', 'Enter a valid Port Number');
export const attachRemotePortPrompt = localize('debug.attachRemotePortPrompt', 'Enter port number');
export const attachRemotePortValidationError = localize('debug.attachRemotePortValidationError', 'Enter a valid port number');
export const attachRemoteHostTitle = localize('debug.attachRemoteHostTitle', 'Remote Debugging');
export const attachRemoteHostPrompt = localize('debug.attachRemoteHostPrompt', 'Enter Host Name');
export const attachRemoteHostValidationError = localize('debug.attachRemoteHostValidationError', 'Enter a Host Name or IP Address');
export const attachRemoteHostPrompt = localize('debug.attachRemoteHostPrompt', 'Enter a host name or IP address');
export const attachRemoteHostValidationError = localize('debug.attachRemoteHostValidationError', 'Enter a valid host name or IP address');
}

// Skip using vscode-nls and instead just compute our strings based on key values. Key values
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { inject, injectable, named } from 'inversify';
import { CancellationToken, DebugConfiguration, QuickPickItem, WorkspaceFolder } from 'vscode';
import { Debug } from '../../../common/utils/localize';
import { DebugConfigurationPrompts } from '../../../common/utils/localize';
import { IMultiStepInput, IMultiStepInputFactory, InputStep, IQuickPickParameters } from '../../../common/utils/multiStepInput';
import { AttachRequestArguments, DebugConfigurationArguments, LaunchRequestArguments } from '../../types';
import { DebugConfigurationState, DebugConfigurationType, IDebugConfigurationService } from '../types';
Expand Down Expand Up @@ -35,17 +35,17 @@ export class PythonDebugConfigurationService implements IDebugConfigurationServi
protected async pickDebugConfiguration(input: IMultiStepInput<DebugConfigurationState>, state: DebugConfigurationState): Promise<InputStep<DebugConfigurationState> | void> {
type DebugConfigurationQuickPickItem = QuickPickItem & { type: DebugConfigurationType };
const items: DebugConfigurationQuickPickItem[] = [
{ label: Debug.debugFileConfigurationLabel(), type: DebugConfigurationType.launchFile, description: Debug.debugFileConfigurationDescription() },
{ label: Debug.debugModuleConfigurationLabel(), type: DebugConfigurationType.launchModule, description: Debug.debugModuleConfigurationDescription() },
{ label: Debug.remoteAttachConfigurationLabel(), type: DebugConfigurationType.remoteAttach, description: Debug.remoteAttachConfigurationDescription() },
{ label: Debug.debugDjangoConfigurationLabel(), type: DebugConfigurationType.launchDjango, description: Debug.debugDjangoConfigurationDescription() },
{ label: Debug.debugFlaskConfigurationLabel(), type: DebugConfigurationType.launchFlask, description: Debug.debugFlaskConfigurationDescription() },
{ label: Debug.debugPyramidConfigurationLabel(), type: DebugConfigurationType.launchPyramid, description: Debug.debugPyramidConfigurationDescription() }
{ label: DebugConfigurationPrompts.debugFileConfigurationLabel(), type: DebugConfigurationType.launchFile, description: DebugConfigurationPrompts.debugFileConfigurationDescription() },
{ label: DebugConfigurationPrompts.debugModuleConfigurationLabel(), type: DebugConfigurationType.launchModule, description: DebugConfigurationPrompts.debugModuleConfigurationDescription() },
{ label: DebugConfigurationPrompts.remoteAttachConfigurationLabel(), type: DebugConfigurationType.remoteAttach, description: DebugConfigurationPrompts.remoteAttachConfigurationDescription() },
{ label: DebugConfigurationPrompts.debugDjangoConfigurationLabel(), type: DebugConfigurationType.launchDjango, description: DebugConfigurationPrompts.debugDjangoConfigurationDescription() },
{ label: DebugConfigurationPrompts.debugFlaskConfigurationLabel(), type: DebugConfigurationType.launchFlask, description: DebugConfigurationPrompts.debugFlaskConfigurationDescription() },
{ label: DebugConfigurationPrompts.debugPyramidConfigurationLabel(), type: DebugConfigurationType.launchPyramid, description: DebugConfigurationPrompts.debugPyramidConfigurationDescription() }
];
state.config = {};
const pick = await input.showQuickPick<DebugConfigurationQuickPickItem, IQuickPickParameters<DebugConfigurationQuickPickItem>>({
title: Debug.selectConfigurationTitle(),
placeholder: Debug.selectConfigurationPlaceholder(),
title: DebugConfigurationPrompts.selectConfigurationTitle(),
placeholder: DebugConfigurationPrompts.selectConfigurationPlaceholder(),
activeItem: items[0],
items: items
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Uri, WorkspaceFolder } from 'vscode';
import { IWorkspaceService } from '../../../../common/application/types';
import { IFileSystem } from '../../../../common/platform/types';
import { IPathUtils } from '../../../../common/types';
import { Debug, localize } from '../../../../common/utils/localize';
import { DebugConfigurationPrompts, localize } from '../../../../common/utils/localize';
import { MultiStepInput } from '../../../../common/utils/multiStepInput';
import { SystemVariables } from '../../../../common/variables/systemVariables';
import { sendTelemetryEvent } from '../../../../telemetry';
Expand Down Expand Up @@ -44,9 +44,9 @@ export class DjangoLaunchDebugConfigurationProvider implements IDebugConfigurati
};
if (!program) {
const selectedProgram = await input.showInputBox({
title: Debug.djangoEnterManagePyPathTitle(),
title: DebugConfigurationPrompts.djangoEnterManagePyPathTitle(),
value: defaultProgram,
prompt: Debug.djangoEnterManagePyPathPrompt(),
prompt: DebugConfigurationPrompts.djangoEnterManagePyPathPrompt(),
validate: value => this.validateManagePy(state.folder, defaultProgram, value)
});
if (selectedProgram) {
Expand All @@ -59,7 +59,7 @@ export class DjangoLaunchDebugConfigurationProvider implements IDebugConfigurati
Object.assign(state.config, config);
}
public async validateManagePy(folder: WorkspaceFolder | undefined, defaultValue: string, selected?: string): Promise<string | undefined> {
const error = Debug.djangoEnterManagePyPathInvalidFilePathError();
const error = DebugConfigurationPrompts.djangoEnterManagePyPathInvalidFilePathError();
if (!selected || selected.trim().length === 0) {
return error;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { inject, injectable } from 'inversify';
import * as path from 'path';
import { WorkspaceFolder } from 'vscode';
import { IFileSystem } from '../../../../common/platform/types';
import { Debug, localize } from '../../../../common/utils/localize';
import { DebugConfigurationPrompts, localize } from '../../../../common/utils/localize';
import { MultiStepInput } from '../../../../common/utils/multiStepInput';
import { sendTelemetryEvent } from '../../../../telemetry';
import { DEBUGGER_CONFIGURATION_PROMPTS } from '../../../../telemetry/constants';
Expand Down Expand Up @@ -44,10 +44,10 @@ export class FlaskLaunchDebugConfigurationProvider implements IDebugConfiguratio

if (!application) {
const selectedApp = await input.showInputBox({
title: Debug.flaskEnterAppPathOrNamePathTitle(),
title: DebugConfigurationPrompts.flaskEnterAppPathOrNamePathTitle(),
value: 'app.py',
prompt: Debug.debugFlaskConfigurationDescription(),
validate: value => Promise.resolve((value && value.trim().length > 0) ? undefined : Debug.flaskEnterAppPathOrNamePathInvalidNameError())
prompt: DebugConfigurationPrompts.debugFlaskConfigurationDescription(),
validate: value => Promise.resolve((value && value.trim().length > 0) ? undefined : DebugConfigurationPrompts.flaskEnterAppPathOrNamePathInvalidNameError())
});
if (selectedApp) {
manuallyEnteredAValue = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
'use strict';

import { injectable } from 'inversify';
import { Debug, localize } from '../../../../common/utils/localize';
import { DebugConfigurationPrompts, localize } from '../../../../common/utils/localize';
import { MultiStepInput } from '../../../../common/utils/multiStepInput';
import { sendTelemetryEvent } from '../../../../telemetry';
import { DEBUGGER_CONFIGURATION_PROMPTS } from '../../../../telemetry/constants';
Expand All @@ -23,10 +23,10 @@ export class ModuleLaunchDebugConfigurationProvider implements IDebugConfigurati
module: 'enter-your-module-name-here'
};
const selectedModule = await input.showInputBox({
title: Debug.moduleEnterModuleTitle(),
title: DebugConfigurationPrompts.moduleEnterModuleTitle(),
value: config.module || 'enter-your-module-name-here',
prompt: Debug.moduleEnterModulePrompt(),
validate: value => Promise.resolve((value && value.trim().length > 0) ? undefined : Debug.moduleEnterModuleInvalidNameError())
prompt: DebugConfigurationPrompts.moduleEnterModulePrompt(),
validate: value => Promise.resolve((value && value.trim().length > 0) ? undefined : DebugConfigurationPrompts.moduleEnterModuleInvalidNameError())
});
if (selectedModule) {
manuallyEnteredAValue = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { Uri, WorkspaceFolder } from 'vscode';
import { IWorkspaceService } from '../../../../common/application/types';
import { IFileSystem } from '../../../../common/platform/types';
import { IPathUtils } from '../../../../common/types';
import { Debug, localize } from '../../../../common/utils/localize';
import { DebugConfigurationPrompts, localize } from '../../../../common/utils/localize';
import { MultiStepInput } from '../../../../common/utils/multiStepInput';
import { SystemVariables } from '../../../../common/variables/systemVariables';
import { sendTelemetryEvent } from '../../../../telemetry';
Expand Down Expand Up @@ -44,9 +44,9 @@ export class PyramidLaunchDebugConfigurationProvider implements IDebugConfigurat

if (!iniPath) {
const selectedIniPath = await input.showInputBox({
title: Debug.pyramidEnterDevelopmentIniPathTitle(),
title: DebugConfigurationPrompts.pyramidEnterDevelopmentIniPathTitle(),
value: defaultIni,
prompt: Debug.pyramidEnterDevelopmentIniPathPrompt(),
prompt: DebugConfigurationPrompts.pyramidEnterDevelopmentIniPathPrompt(),
validate: value => this.validateIniPath(state ? state.folder : undefined, defaultIni, value)
});
if (selectedIniPath) {
Expand All @@ -62,7 +62,7 @@ export class PyramidLaunchDebugConfigurationProvider implements IDebugConfigurat
if (!folder) {
return;
}
const error = Debug.pyramidEnterDevelopmentIniPathInvalidFilePathError();
const error = DebugConfigurationPrompts.pyramidEnterDevelopmentIniPathInvalidFilePathError();
if (!selected || selected.trim().length === 0) {
return error;
}
Expand Down
Loading

0 comments on commit 77d6f27

Please sign in to comment.