adjust output truncation message

This commit is contained in:
aamunger
2023-04-04 16:03:10 -07:00
parent 8d55402690
commit b7a495cdb8
3 changed files with 29 additions and 26 deletions
+25 -23
View File
@@ -8,36 +8,37 @@ import { handleANSIOutput } from './ansi';
export const scrollableClass = 'scrollable';
function generateViewMoreElement(outputId: string) {
// Output is Truncated. View as a [scrollable element] or open in a [text editor]. Output layout settings
const container = document.createElement('div');
const first = document.createElement('span');
first.textContent = 'Output exceeds the ';
const second = document.createElement('a');
second.textContent = 'size limit';
second.href = `command:workbench.action.openSettings?%5B%22notebook.output.textLineLimit%22%5D`;
first.textContent = 'Output is Truncated. View as a ';
container.appendChild(first);
const viewAsScrollableLink = document.createElement('a');
viewAsScrollableLink.textContent = 'scrollable element';
viewAsScrollableLink.href = `command:cellOutput.enableScrolling?${outputId}`;
viewAsScrollableLink.ariaLabel = 'enable scrollable output';
container.appendChild(viewAsScrollableLink);
const second = document.createElement('span');
second.textContent = ' or open in a ';
container.appendChild(second);
const openInTextEditorLink = document.createElement('a');
openInTextEditorLink.textContent = 'text editor';
openInTextEditorLink.href = `command:workbench.action.openLargeOutput?${outputId}`;
openInTextEditorLink.ariaLabel = 'open output in text editor';
container.appendChild(openInTextEditorLink);
const third = document.createElement('span');
third.textContent = '. Open the full output data ';
const forth = document.createElement('a');
forth.textContent = 'in a text editor';
forth.href = `command:workbench.action.openLargeOutput?${outputId}`;
third.textContent = '. Adjust ';
container.appendChild(third);
container.appendChild(forth);
const refreshSpan = document.createElement('span');
refreshSpan.classList.add('scroll-refresh');
const fifth = document.createElement('span');
fifth.textContent = ', or view in a ';
const sixth = document.createElement('a');
sixth.textContent = 'scrollable element';
sixth.href = `command:cellOutput.enableScrolling?${outputId}`;
refreshSpan.appendChild(fifth);
refreshSpan.appendChild(sixth);
container.appendChild(refreshSpan);
const layoutSettingsLink = document.createElement('a');
layoutSettingsLink.textContent = 'settings...';
layoutSettingsLink.href = `command:workbench.action.openSettings?%5B%22%40tag%3AnotebookOutputLayout%22%5D`;
layoutSettingsLink.ariaLabel = 'notebook output settings';
container.appendChild(layoutSettingsLink);
return container;
}
@@ -66,7 +67,6 @@ function truncatedArrayOfString(id: string, buffer: string[], linesLimit: number
return container;
}
container.appendChild(generateViewMoreElement(id));
container.appendChild(handleANSIOutput(buffer.slice(0, linesLimit - 5).join('\n'), trustHtml));
// truncated piece
@@ -76,6 +76,8 @@ function truncatedArrayOfString(id: string, buffer: string[], linesLimit: number
container.appendChild(handleANSIOutput(buffer.slice(lineCount - 5).join('\n'), trustHtml));
container.appendChild(generateViewMoreElement(id));
return container;
}
@@ -862,7 +862,7 @@ configurationRegistry.registerConfiguration({
markdownDescription: nls.localize('notebook.textOutputLineLimit', "Controls how many lines of text are displayed in a text output. If {0} is enabled, this setting is used to determine the scroll height of the output.", '`#notebook.output.scrolling#`'),
type: 'number',
default: 30,
tags: ['notebookLayout']
tags: ['notebookLayout', 'notebookOutputLayout']
},
[NotebookSetting.markupFontSize]: {
markdownDescription: nls.localize('notebook.markup.fontSize', "Controls the font size in pixels of rendered markup in notebooks. When set to {0}, 120% of {1} is used.", '`0`', '`#editor.fontSize#`'),
@@ -897,13 +897,13 @@ configurationRegistry.registerConfiguration({
[NotebookSetting.outputScrolling]: {
markdownDescription: nls.localize('notebook.outputScrolling', "Use a scrollable region for notebook output when longer than the limit"),
type: 'boolean',
tags: ['notebookLayout'],
tags: ['notebookLayout', 'notebookOutputLayout'],
default: typeof product.quality === 'string' && product.quality !== 'stable' // only enable as default in insiders
},
[NotebookSetting.outputWordWrap]: {
markdownDescription: nls.localize('notebook.outputWordWrap', "Controls whether the lines in output should wrap."),
type: 'boolean',
tags: ['notebookLayout'],
tags: ['notebookLayout', 'notebookOutputLayout'],
default: false
},
[NotebookSetting.formatOnSave]: {
@@ -109,6 +109,7 @@ export class SettingsEditor2 extends EditorPane {
private static SUGGESTIONS: string[] = [
`@${MODIFIED_SETTING_TAG}`,
'@tag:notebookLayout',
'@tag:notebookOutputLayout',
`@tag:${REQUIRE_TRUSTED_WORKSPACE_SETTING_TAG}`,
`@tag:${WORKSPACE_TRUST_SETTING_TAG}`,
'@tag:sync',