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

Fix #177405. Treat error as plain text. #180960

Merged
merged 1 commit into from
Apr 26, 2023
Merged
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
7 changes: 4 additions & 3 deletions extensions/notebook-renderers/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,8 @@ type DisposableStore = ReturnType<typeof createDisposableStore>;
function renderError(
outputInfo: OutputItem,
outputElement: HTMLElement,
ctx: IRichRenderContext
ctx: IRichRenderContext,
trustHTML: boolean
): IDisposable {
const disposableStore = createDisposableStore();

Expand All @@ -146,7 +147,7 @@ function renderError(
outputElement.classList.add('traceback');

const outputScrolling = scrollingEnabled(outputInfo, ctx.settings);
const content = createOutputContent(outputInfo.id, [err.stack ?? ''], ctx.settings.lineLimit, outputScrolling, true);
const content = createOutputContent(outputInfo.id, [err.stack ?? ''], ctx.settings.lineLimit, outputScrolling, trustHTML);
const contentParent = document.createElement('div');
contentParent.classList.toggle('word-wrap', ctx.settings.outputWordWrap);
disposableStore.push(ctx.onDidChangeSettings(e => {
Expand Down Expand Up @@ -413,7 +414,7 @@ export const activate: ActivationFunction<void> = (ctx) => {
case 'application/vnd.code.notebook.error':
{
disposables.get(outputInfo.id)?.dispose();
const disposable = renderError(outputInfo, element, latestContext);
const disposable = renderError(outputInfo, element, latestContext, ctx.workspace.isTrusted);
disposables.set(outputInfo.id, disposable);
}
break;
Expand Down