Antoine
Antoine

Reputation: 777

Is there an API to clear the terminal?

I am creating a VSCode extension. I don't see any API to clear the terminal. Am I missing something or does it need to be implemented?

I tried looking through the VSCode reference docs, but was not able to find anything helpful.

Upvotes: 0

Views: 515

Answers (1)

Matt Bierner
Matt Bierner

Reputation: 65623

Philipp Kief is correct that there is no official API. As noted, https://github.com/Microsoft/vscode/issues/17895 tracks adding this

If you absolutely need this functionality, try using the workbench.action.terminal.clear command to clear the active terminal:

import { commands } from 'vscode';
commands.executeCommand('workbench.action.terminal.clear');

Upvotes: 2

Related Questions