Skip to content

Commit b25eeed

Browse files
thomasgassmannKartik Raj
authored andcommitted
Update naming of console type to be consistent with vscode (#5245)
* Added new Diagnostic code * update naming of console type from none to internalConsole * add news item for change * Modify intellisense to show internalConsole instead of none * Modified diagnostic file names
1 parent eb60646 commit b25eeed

17 files changed

Lines changed: 76 additions & 34 deletions

File tree

news/3 Code Health/4321.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update launch.json to use internalConsole instead of none

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@
10521052
},
10531053
"console": {
10541054
"enum": [
1055-
"none",
1055+
"internalConsole",
10561056
"integratedTerminal",
10571057
"externalTerminal"
10581058
],

package.nls.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@
175175
"diagnostics.invalidPythonPathInDebuggerSettings": "You need to select a Python interpreter before you start debugging.\n\nTip: click on \"Select Python Interpreter\" in the status bar.",
176176
"diagnostics.invalidPythonPathInDebuggerLaunch": "The Python path in your debug configuration is invalid.",
177177
"diagnostics.invalidDebuggerTypeDiagnostic": "Your launch.json file needs to be updated to change the \"pythonExperimental\" debug configurations to use the \"python\" debugger type, otherwise Python debugging may not work. Would you like to automatically update your launch.json file now?",
178+
"diagnostics.consoleTypeDiagnostic": "Your launch.json file needs to be updated to change the console type string from \"none\" to \"internalConsole\", otherwise Python debugging may not work. Would you like to automatically update your launch.json file now?",
178179
"diagnostics.justMyCodeDiagnostic": "Configuration \"debugStdLib\" in launch.json is no longer supported. It's recommended to replace it with \"justMyCode\", which is the exact opposite of using \"debugStdLib\". Would you like to automatically update your launch.json file to do that?",
179180
"diagnostics.yesUpdateLaunch": "Yes, update launch.json",
180181
"diagnostics.bannerLabelNo": "No, I will do it later",
@@ -250,4 +251,4 @@
250251
"DataScience.liveShareInvalid": "One or more guests in the session do not have the Python [extension](https://marketplace.visualstudio.com/itemdetails?itemName=ms-python.python) installed.\r\nYour Live Share session cannot continue and will be closed.",
251252
"diagnostics.updateSettings": "Yes, update settings",
252253
"Common.noIWillDoItLater": "No, I will do it later"
253-
}
254+
}

src/client/application/diagnostics/checks/invalidDebuggerType.ts renamed to src/client/application/diagnostics/checks/invalidLaunchJsonDebugger.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,13 @@ const messages = {
2121
[DiagnosticCodes.InvalidDebuggerTypeDiagnostic]:
2222
Diagnostics.invalidDebuggerTypeDiagnostic(),
2323
[DiagnosticCodes.JustMyCodeDiagnostic]:
24-
Diagnostics.justMyCodeDiagnostic()
24+
Diagnostics.justMyCodeDiagnostic(),
25+
[DiagnosticCodes.ConsoleTypeDiagnostic]:
26+
Diagnostics.consoleTypeDiagnostic()
2527
};
2628

2729
export class InvalidLaunchJsonDebuggerDiagnostic extends BaseDiagnostic {
28-
constructor(code: DiagnosticCodes.InvalidDebuggerTypeDiagnostic | DiagnosticCodes.JustMyCodeDiagnostic, resource: Resource) {
30+
constructor(code: DiagnosticCodes.InvalidDebuggerTypeDiagnostic | DiagnosticCodes.JustMyCodeDiagnostic | DiagnosticCodes.ConsoleTypeDiagnostic, resource: Resource) {
2931
super(
3032
code,
3133
messages[code],
@@ -50,7 +52,7 @@ export class InvalidLaunchJsonDebuggerService extends BaseDiagnosticsService {
5052
@named(DiagnosticCommandPromptHandlerServiceId)
5153
private readonly messageService: IDiagnosticHandlerService<MessageCommandPrompt>
5254
) {
53-
super([DiagnosticCodes.InvalidDebuggerTypeDiagnostic, DiagnosticCodes.JustMyCodeDiagnostic], serviceContainer, disposableRegistry, true);
55+
super([DiagnosticCodes.InvalidDebuggerTypeDiagnostic, DiagnosticCodes.JustMyCodeDiagnostic, DiagnosticCodes.ConsoleTypeDiagnostic], serviceContainer, disposableRegistry, true);
5456
}
5557
public async diagnose(resource: Resource): Promise<IDiagnostic[]> {
5658
if (!this.workspaceService.hasWorkspaceFolders) {
@@ -85,6 +87,9 @@ export class InvalidLaunchJsonDebuggerService extends BaseDiagnosticsService {
8587
if (fileContents.indexOf('"debugStdLib"') > 0) {
8688
diagnostics.push(new InvalidLaunchJsonDebuggerDiagnostic(DiagnosticCodes.JustMyCodeDiagnostic, resource));
8789
}
90+
if (fileContents.indexOf('"console": "none"') > 0) {
91+
diagnostics.push(new InvalidLaunchJsonDebuggerDiagnostic(DiagnosticCodes.ConsoleTypeDiagnostic, resource));
92+
}
8893
return diagnostics;
8994
}
9095
private async handleDiagnostic(diagnostic: IDiagnostic): Promise<void> {
@@ -125,6 +130,10 @@ export class InvalidLaunchJsonDebuggerService extends BaseDiagnosticsService {
125130
fileContents = this.findAndReplace(fileContents, '"debugStdLib": true', '"justMyCode": false');
126131
break;
127132
}
133+
case DiagnosticCodes.ConsoleTypeDiagnostic: {
134+
fileContents = this.findAndReplace(fileContents, '"console": "none"', '"console": "internalConsole"');
135+
break;
136+
}
128137
default: {
129138
return;
130139
}

src/client/application/diagnostics/constants.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,6 @@ export enum DiagnosticCodes {
1515
EnvironmentActivationInPowerShellWithBatchFilesNotSupportedDiagnostic = 'EnvironmentActivationInPowerShellWithBatchFilesNotSupportedDiagnostic',
1616
NoCurrentlySelectedPythonInterpreterDiagnostic = 'InvalidPythonInterpreterDiagnostic',
1717
LSNotSupportedDiagnostic = 'LSNotSupportedDiagnostic',
18-
JustMyCodeDiagnostic = 'JustMyCodeDiagnostic'
18+
JustMyCodeDiagnostic = 'JustMyCodeDiagnostic',
19+
ConsoleTypeDiagnostic = 'ConsoleTypeDiagnostic'
1920
}

src/client/application/diagnostics/serviceRegistry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { IServiceManager } from '../../ioc/types';
77
import { IApplicationDiagnostics } from '../types';
88
import { ApplicationDiagnostics } from './applicationDiagnostics';
99
import { EnvironmentPathVariableDiagnosticsService, EnvironmentPathVariableDiagnosticsServiceId } from './checks/envPathVariable';
10-
import { InvalidLaunchJsonDebuggerService, InvalidLaunchJsonDebuggerServiceId } from './checks/invalidDebuggerType';
10+
import { InvalidLaunchJsonDebuggerService, InvalidLaunchJsonDebuggerServiceId } from './checks/invalidLaunchJsonDebugger';
1111
import { InvalidPythonPathInDebuggerService, InvalidPythonPathInDebuggerServiceId } from './checks/invalidPythonPathInDebugger';
1212
import { LSNotSupportedDiagnosticService, LSNotSupportedDiagnosticServiceId } from './checks/lsNotSupported';
1313
import { InvalidMacPythonInterpreterService, InvalidMacPythonInterpreterServiceId } from './checks/macPythonInterpreter';

src/client/common/utils/localize.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ export namespace Diagnostics {
1717
export const invalidPythonPathInDebuggerSettings = localize('diagnostics.invalidPythonPathInDebuggerSettings', 'You need to select a Python interpreter before you start debugging.\n\nTip: click on "Select Python Interpreter" in the status bar.');
1818
export const invalidPythonPathInDebuggerLaunch = localize('diagnostics.invalidPythonPathInDebuggerLaunch', 'The Python path in your debug configuration is invalid.');
1919
export const invalidDebuggerTypeDiagnostic = localize('diagnostics.invalidDebuggerTypeDiagnostic', 'Your launch.json file needs to be updated to change the "pythonExperimental" debug configurations to use the "python" debugger type, otherwise Python debugging may not work. Would you like to automatically update your launch.json file now?');
20+
export const consoleTypeDiagnostic = localize('diagnostics.consoleTypeDiagnostic', 'Your launch.json file needs to be updated to change the console type string from \"none\" to \"internalConsole\", otherwise Python debugging may not work. Would you like to automatically update your launch.json file now?');
2021
export const justMyCodeDiagnostic = localize('diagnostics.justMyCodeDiagnostic', 'Configuration "debugStdLib" in launch.json is no longer supported. It\'s recommended to replace it with "justMyCode", which is the exact opposite of using "debugStdLib". Would you like to automatically update your launch.json file to do that?');
2122
export const yesUpdateLaunch = localize('diagnostics.yesUpdateLaunch', 'Yes, update launch.json');
2223
export const invalidTestSettings = localize('diagnostics.invalidTestSettings', 'Your settings needs to be updated to change the setting "python.unitTest." to "python.testing.", otherwise testing Python code using the extension may not work. Would you like to automatically update your settings now?');

src/client/debugger/debugAdapter/DebugClients/helper.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class DebugClientHelper {
3131
this.envParser.appendPythonPath(env, this.process.env.PYTHONPATH!);
3232
}
3333

34-
if (typeof args.console !== 'string' || args.console === 'none') {
34+
if (typeof args.console !== 'string' || args.console === 'internalConsole') {
3535
// For debugging, when not using any terminal, then we need to provide all env variables.
3636
// As we're spawning the process, we need to ensure all env variables are passed.
3737
// Including those from the current process (i.e. everything, not just custom vars).

src/client/debugger/extension/configuration/resolvers/launch.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export class LaunchConfigurationResolver extends BaseConfigurationResolver<Launc
7575
debugConfiguration.console = 'integratedTerminal';
7676
}
7777
// If using a terminal, then never open internal console.
78-
if (debugConfiguration.console !== 'none' && !debugConfiguration.internalConsoleOptions) {
78+
if (debugConfiguration.console !== 'internalConsole' && !debugConfiguration.internalConsoleOptions) {
7979
debugConfiguration.internalConsoleOptions = 'neverOpen';
8080
}
8181
if (!Array.isArray(debugConfiguration.debugOptions)) {

src/client/debugger/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,4 +76,4 @@ export interface AttachRequestArguments extends DebugProtocol.AttachRequestArgum
7676
// tslint:disable-next-line:interface-name
7777
export interface DebugConfigurationArguments extends LaunchRequestArguments, AttachRequestArguments { }
7878

79-
export type ConsoleType = 'none' | 'integratedTerminal' | 'externalTerminal';
79+
export type ConsoleType = 'internalConsole' | 'integratedTerminal' | 'externalTerminal';

0 commit comments

Comments
 (0)