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

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;
}