diff --git a/package.nls.json b/package.nls.json index 54387571de6a..ad1008107c79 100644 --- a/package.nls.json +++ b/package.nls.json @@ -72,9 +72,9 @@ "LanguageService.bannerMessage": "Can you please take 2 minutes to tell us how the Python Language Server is working for you?", "LanguageService.bannerLabelYes": "Yes, take survey now", "LanguageService.bannerLabelNo": "No, thanks", - "LanguageService.lsFailedToStart": "We encountered an issue starting the Language Server. Reverting to the alternative, Jedi. Check the Output panel for details.", - "LanguageService.lsFailedToDownload": "We encountered an issue downloading the Language Server. Reverting to the alternative, Jedi. Check the Output panel for details.", - "LanguageService.lsFailedToExtract": "We encountered an issue extracting the Language Server. Reverting to the alternative, Jedi. Check the Output panel for details.", + "LanguageService.lsFailedToStart": "We encountered an issue starting the Language Server. Reverting to the alternative, Jedi. Check the Python output panel for details.", + "LanguageService.lsFailedToDownload": "We encountered an issue downloading the Language Server. Reverting to the alternative, Jedi. Check the Python output panel for details.", + "LanguageService.lsFailedToExtract": "We encountered an issue extracting the Language Server. Reverting to the alternative, Jedi. Check the Python output panel for details.", "DataScience.unknownMimeTypeFormat": "Mime type {0} is not currently supported.", "DataScience.historyTitle": "Python Interactive", "DataScience.badWebPanelFormatString": "

{0} is not a valid file name

", @@ -180,5 +180,6 @@ "debug.attachRemoteHostValidationError": "Enter a valid host name or IP address", "UnitTests.testErrorDiagnosticMessage": "Error", "UnitTests.testFailDiagnosticMessage": "Fail", - "UnitTests.testSkippedDiagnosticMessage": "Skipped" + "UnitTests.testSkippedDiagnosticMessage": "Skipped", + "Common.openOutputPanel":"Show output" } diff --git a/src/client/activation/downloader.ts b/src/client/activation/downloader.ts index 4a2ebb1828c9..78624aa2ab92 100644 --- a/src/client/activation/downloader.ts +++ b/src/client/activation/downloader.ts @@ -11,7 +11,7 @@ import { STANDARD_OUTPUT_CHANNEL } from '../common/constants'; import { IFileSystem } from '../common/platform/types'; import { IOutputChannel } from '../common/types'; import { createDeferred } from '../common/utils/async'; -import { LanguageService } from '../common/utils/localize'; +import { Common, LanguageService } from '../common/utils/localize'; import { StopWatch } from '../common/utils/stopWatch'; import { sendTelemetryEvent } from '../telemetry'; import { @@ -52,7 +52,7 @@ export class LanguageServerDownloader implements ILanguageServerDownloader { this.output.appendLine('download failed.'); this.output.appendLine(err); success = false; - this.appShell.showErrorMessage(LanguageService.lsFailedToDownload()); + this.showMessageAndOptionallyShowOutput(LanguageService.lsFailedToDownload()).ignoreErrors(); sendTelemetryEvent(PYTHON_LANGUAGE_SERVER_ERROR, undefined, { error: 'Failed to download (platform)' }, err); throw new Error(err); } finally { @@ -70,7 +70,7 @@ export class LanguageServerDownloader implements ILanguageServerDownloader { this.output.appendLine('extraction failed.'); this.output.appendLine(err); success = false; - this.appShell.showErrorMessage(LanguageService.lsFailedToExtract()); + this.showMessageAndOptionallyShowOutput(LanguageService.lsFailedToExtract()).ignoreErrors(); sendTelemetryEvent(PYTHON_LANGUAGE_SERVER_ERROR, undefined, { error: 'Failed to extract (platform)' }, err); throw new Error(err); } finally { @@ -83,6 +83,13 @@ export class LanguageServerDownloader implements ILanguageServerDownloader { } } + protected async showMessageAndOptionallyShowOutput(message: string) { + const selection = await this.appShell.showErrorMessage(message, Common.openOutputPanel()); + if (selection !== Common.openOutputPanel()) { + return; + } + this.output.show(true); + } protected async downloadFile(uri: string, title: string): Promise { this.output.append(`Downloading ${uri}... `); const tempFile = await this.fs.createTemporaryFile(downloadFileExtension); diff --git a/src/client/common/utils/localize.ts b/src/client/common/utils/localize.ts index c8d12bdf785f..47084664d234 100644 --- a/src/client/common/utils/localize.ts +++ b/src/client/common/utils/localize.ts @@ -19,15 +19,16 @@ export namespace Diagnostics { export namespace Common { export const canceled = localize('Common.canceled', 'Canceled'); export const loadingExtension = localize('Common.loadingPythonExtension', 'Python extension loading...'); + export const openOutputPanel = localize('Common.openOutputPanel', 'Show output'); } export namespace LanguageService { export const bannerMessage = localize('LanguageService.bannerMessage', 'Can you please take 2 minutes to tell us how the Python Language Server is working for you?'); export const bannerLabelYes = localize('LanguageService.bannerLabelYes', 'Yes, take survey now'); export const bannerLabelNo = localize('LanguageService.bannerLabelNo', 'No, thanks'); - export const lsFailedToStart = localize('LanguageService.lsFailedToStart', 'We encountered an issue starting the Language Server. Reverting to the alternative, Jedi. Check the Output panel for details.'); - export const lsFailedToDownload = localize('LanguageService.lsFailedToDownload', 'We encountered an issue downloading the Language Server. Reverting to the alternative, Jedi. Check the Output panel for details..'); - export const lsFailedToExtract = localize('LanguageService.lsFailedToExtract', 'We encountered an issue extracting the Language Server. Reverting to the alternative, Jedi. Check the Output panel for details.'); + export const lsFailedToStart = localize('LanguageService.lsFailedToStart', 'We encountered an issue starting the Language Server. Reverting to the alternative, Jedi. Check the Python output panel for details.'); + export const lsFailedToDownload = localize('LanguageService.lsFailedToDownload', 'We encountered an issue downloading the Language Server. Reverting to the alternative, Jedi. Check the Python output panel for details.'); + export const lsFailedToExtract = localize('LanguageService.lsFailedToExtract', 'We encountered an issue extracting the Language Server. Reverting to the alternative, Jedi. Check the Python output panel for details.'); } export namespace Interpreters { diff --git a/src/client/extension.ts b/src/client/extension.ts index 359e58f54da0..da2ffbc691ab 100644 --- a/src/client/extension.ts +++ b/src/client/extension.ts @@ -376,7 +376,7 @@ async function getActivationTelemetryProps(serviceContainer: IServiceContainer): // error handling function handleError(ex: Error) { - notifyUser('extension activation failed (see console log).'); + notifyUser('Extension activation failed, run the \'Developer: Toggle Developer Tools\' command for more information.'); traceError('extension activation failed', ex); sendErrorTelemetry(ex) .ignoreErrors(); diff --git a/src/test/activation/downloader.unit.test.ts b/src/test/activation/downloader.unit.test.ts index ca0bd168f3e8..5d08c6b6e142 100644 --- a/src/test/activation/downloader.unit.test.ts +++ b/src/test/activation/downloader.unit.test.ts @@ -13,7 +13,7 @@ import { ILanguageServerFolderService, IPlatformData } from '../../client/activa import { IApplicationShell } from '../../client/common/application/types'; import { IFileSystem } from '../../client/common/platform/types'; import { IOutputChannel } from '../../client/common/types'; -import { LanguageService } from '../../client/common/utils/localize'; +import { Common, LanguageService } from '../../client/common/utils/localize'; // tslint:disable-next-line:max-func-body-length suite('Activation - Downloader', () => { @@ -84,7 +84,7 @@ suite('Activation - Downloader', () => { .setup(f => f.getLatestLanguageServerVersion()) .returns(() => Promise.resolve(pkg)) .verifiable(TypeMoq.Times.once()); - appShell.setup(a => a.showErrorMessage(LanguageService.lsFailedToDownload())) + appShell.setup(a => a.showErrorMessage(LanguageService.lsFailedToDownload(), Common.openOutputPanel())) .returns(() => Promise.resolve(undefined)) .verifiable(TypeMoq.Times.once()); try { @@ -100,7 +100,7 @@ suite('Activation - Downloader', () => { .setup(f => f.getLatestLanguageServerVersion()) .returns(() => Promise.resolve(pkg)) .verifiable(TypeMoq.Times.once()); - appShell.setup(a => a.showErrorMessage(LanguageService.lsFailedToExtract())) + appShell.setup(a => a.showErrorMessage(LanguageService.lsFailedToExtract(), Common.openOutputPanel())) .returns(() => Promise.resolve(undefined)) .verifiable(TypeMoq.Times.once()); try { diff --git a/src/test/datascience/history.functional.test.tsx b/src/test/datascience/history.functional.test.tsx index 9473d97ad6ba..2dca689fc70b 100644 --- a/src/test/datascience/history.functional.test.tsx +++ b/src/test/datascience/history.functional.test.tsx @@ -11,7 +11,6 @@ import * as React from 'react'; import { SemVer } from 'semver'; import * as TypeMoq from 'typemoq'; import { CancellationToken, Disposable, TextDocument, TextEditor } from 'vscode'; - import { IApplicationShell, IDocumentManager, @@ -21,6 +20,7 @@ import { WebPanelMessage, } from '../../client/common/application/types'; import { EXTENSION_ROOT_DIR } from '../../client/common/constants'; +import { IDataScienceSettings } from '../../client/common/types'; import { createDeferred, Deferred } from '../../client/common/utils/async'; import { noop } from '../../client/common/utils/misc'; import { Architecture } from '../../client/common/utils/platform'; @@ -35,7 +35,6 @@ import { sleep } from '../core'; import { DataScienceIocContainer } from './dataScienceIocContainer'; import { SupportedCommands } from './mockJupyterManager'; import { waitForUpdate } from './reactHelpers'; -import { IDataScienceSettings } from '../../client/common/types'; enum cellInputState { Hidden,