Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions src/client/application/diagnostics/checks/pythonInterpreter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const messages = {
'No Python interpreter is selected. Please select a Python interpreter to enable features such as IntelliSense, linting, and debugging.',
),
[DiagnosticCodes.InvalidPythonInterpreterDiagnostic]: l10n.t(
'An Invalid Python interpreter is selected{0}, please try changing it to enable features such as IntelliSense, linting, and debugging.',
'An Invalid Python interpreter is selected{0}, please try changing it to enable features such as IntelliSense, linting, and debugging. See output for more details regarding why the interpreter is invalid.',
),
};

Expand Down Expand Up @@ -163,7 +163,7 @@ export class InvalidPythonInterpreterService extends BaseDiagnosticsService

private getCommandPrompts(diagnostic: IDiagnostic): { prompt: string; command?: IDiagnosticCommand }[] {
const commandFactory = this.serviceContainer.get<IDiagnosticsCommandFactory>(IDiagnosticsCommandFactory);
return [
const prompts = [
{
prompt: Common.selectPythonInterpreter,
command: commandFactory.createCommand(diagnostic, {
Expand All @@ -172,6 +172,16 @@ export class InvalidPythonInterpreterService extends BaseDiagnosticsService
}),
},
];
if (diagnostic.code === DiagnosticCodes.InvalidPythonInterpreterDiagnostic) {
prompts.push({
prompt: Common.openOutputPanel,
command: commandFactory.createCommand(diagnostic, {
type: 'executeVSCCommand',
options: Commands.ViewOutput,
}),
});
}
return prompts;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ suite('Application Diagnostics - Checks Python Interpreter', () => {
),
)
.returns(() => cmd)
.verifiable(typemoq.Times.once());
.verifiable(typemoq.Times.exactly(2));

await diagnosticService.handle([diagnostic]);

Expand All @@ -304,6 +304,7 @@ suite('Application Diagnostics - Checks Python Interpreter', () => {
expect(messagePrompt).not.be.equal(undefined, 'Message prompt not set');
expect(messagePrompt!.commandPrompts).to.be.deep.equal([
{ prompt: Common.selectPythonInterpreter, command: cmd },
{ prompt: Common.openOutputPanel, command: cmd },
]);
expect(messagePrompt!.onClose).be.equal(undefined, 'onClose handler should not be set.');
});
Expand Down