Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

testing: handle error when markdown preview is disabled #173083

Merged
merged 1 commit into from Feb 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -78,6 +78,7 @@ import { ITestService } from 'vs/workbench/contrib/testing/common/testService';
import { IRichLocation, ITestErrorMessage, ITestItem, ITestMessage, ITestRunTask, ITestTaskState, TestMessageType, TestResultItem, TestResultState, TestRunProfileBitset } from 'vs/workbench/contrib/testing/common/testTypes';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import 'vs/css!./testingOutputPeek';
import { INotificationService } from 'vs/platform/notification/common/notification';

class TestDto {
public readonly test: ITestItem;
Expand Down Expand Up @@ -433,6 +434,7 @@ export class TestingOutputPeekController extends Disposable implements IEditorCo
@IStorageService private readonly storageService: IStorageService,
@IContextKeyService contextKeyService: IContextKeyService,
@ICommandService private readonly commandService: ICommandService,
@INotificationService private readonly notificationService: INotificationService,
) {
super();
this.visible = TestingContextKeys.isPeekVisible.bindTo(contextKeyService);
Expand Down Expand Up @@ -470,7 +472,9 @@ export class TestingOutputPeekController extends Disposable implements IEditorCo
} else if (typeof message.message === 'string') {
this.editorService.openEditor({ resource: current.messageUri, options });
} else {
this.commandService.executeCommand('markdown.showPreview', current.messageUri);
this.commandService.executeCommand('markdown.showPreview', current.messageUri).catch(err => {
this.notificationService.error(localize('testing.markdownPeekError', 'Could not open markdown preview: {0}.\n\nPlease make sure the markdown extension is enabled.', err.message));
});
}
}

Expand Down