Terminal getText not working correctly
degrammer opened this issue · comments
Ruben Restrepo commented
The getText
method from TerminalView
is not working correctly.
It selects the Terminal output executing the wrong copy command: terminal copy selection
There is no such command.
One alternative could be to modify the command to use copy
Reproduction example:
const workbench = await browser.getWorkbench()
const bottomBar = workbench.getBottomBar()
const terminalView = await bottomBar.openTerminalView()
const text = await terminalView.getText() // returns empty value
A temporary workaround:
import clipboard from 'clipboardy'
const workbench = await browser.getWorkbench()
await workbench.executeCommand('Terminal select all')
await workbench.executeCommand('Copy')
// Use the clipboard to get the copied text.
const text = await clipboard.read()
await clipboard.write('')
Christian Bromann commented
Hey @degrammer
thanks for raising the issue.
I added a test for this in 3050417. It seems that the way getText
was implemented wasn't working anymore since the command for copying the text from the terminal was removed in VS Code. This is now fixed.