Fix #209158. Add Copy Output and Open Output in Text Editor to Scrollable text output context menu. (#216920)

* Fix #209158. Add Copy Output and Open Output in Text Editor to Scrollable text output context menu.

* Context menu should be triggered on container

* fix naming
This commit is contained in:
Peng Lyu
2024-06-24 10:31:17 -07:00
committed by GitHub
parent 36a5701192
commit 1b883b238e
4 changed files with 72 additions and 1 deletions

View File

@@ -71,6 +71,11 @@ function generateNestedViewAllElement(outputId: string) {
function truncatedArrayOfString(id: string, buffer: string[], linesLimit: number, linkOptions: LinkOptions) {
const container = document.createElement('div');
container.setAttribute('data-vscode-context', JSON.stringify({
webviewSection: 'text',
outputId: id,
'preventDefaultContextMenuItems': true
}));
const lineCount = buffer.length;
if (lineCount <= linesLimit) {
@@ -95,6 +100,11 @@ function truncatedArrayOfString(id: string, buffer: string[], linesLimit: number
function scrollableArrayOfString(id: string, buffer: string[], linkOptions: LinkOptions) {
const element = document.createElement('div');
element.setAttribute('data-vscode-context', JSON.stringify({
webviewSection: 'text',
outputId: id,
'preventDefaultContextMenuItems': true
}));
if (buffer.length > softScrollableLineLimit) {
element.appendChild(generateNestedViewAllElement(id));
}