I'd like to watch vscode builtin terminal output or at least be able to read whole output. This output will be searched against some pattern.
I looked at this question, but mentioned method
window.onDidWriteTerminalData
appears to be not available at current api.
How to read terminal output from vscode extension?
It cannot do in stable version of VSCode. Try window.onDidWriteTerminalData API only in Insider version.
For your information, there are several options, not official supported by VSCode.
Use node-pty to create and manage the process and then hook it up using ExtensionTerminalOptions.
Create a process/script that wraps the terminal shell.
reference:
https://github.com/microsoft/vscode/issues/83224
https://github.com/microsoft/vscode/commit/dc6b475be75999e78233f9f6951ef66f18f768ea#r53974957
Related
I've forked VSCode on Github to try to add a tiny little feature I think would be useful, which adds a new CLI flag to code, to be used inside the VSCode terminal (like code - for stdin). I added the code, wrote tests, and now I want to try out the feature.
I'm developing inside the built-in devcontainer, so I just launched an instance of VSCode from within VSCode, connected to the devcontainer via VNC and tried to use my flag inside the VSCode-OSS terminal. However, I get an error saying "Command is only available in WSL or inside a Visual Studio Code terminal"
According to server.cli.ts, this means that the env variables VSCODE_IPC_HOOK_CLI and VSCODE_CLIENT_COMMAND aren't set, but I don't know who should be setting them, or if I need to launch VSCode in a different way for debugging.
Has anyone using the VSCode DevContainer to write additional CLI flags and knows how to debug them?
Is it possible to configure vs code to support the ZMODEM protocol? I could use xshell to download files with sz command, but when I try to use sz in vs code, here it returns some random number.
(base) [alpha#hpc03 newfile]$ sz INCAR
�*B00000000000000
I use Remote-SSH extension in vs code to connect to the Linux system.
My question is:
Is there any extension or configuration method that would allow me to use sz in vs code?
As far as I know (I looked, didn't find anything) there's no existing extension or method to use the ZModem protocol with VSCode. However, there's a pull request from 2017 that adds support for it to Xterm, which is the terminal display VSCode uses. As indicated in this mentioning issue the VSCode developers would need more information.
As far as an extension goes, if you or anyone reading this wanted to make an extension for this purpose, you could use this ZModem.js implementation of the protocol in Javascript, and write the extension yourself, or do something similar.
From the Remote-SSH docs
VS Code will look for the ssh command in the PATH. Failing that, on Windows it will attempt to find ssh.exe in the default Git for Windows install path. You can also specifically tell VS Code where to find the SSH client by adding the remote.SSH.path property to settings.json.
Maybe you can include Xshell somehow this way. Or find a windows version of zssh (not this from the Ziti project) and it could work. Another candidate is SecureCRT. (via). Probably these rich GUI apps are not embeddable as simple CLI programs, though. Which would be a useful feature in this case.
Is it possible to run Visual Studio Code commands from Markdown? I noticed that, for example [cpptools](vscode:extension/ms-vscode.cpptools) shows the extension's page. I wondered if executing a command from the command palette would also work, and if it is something of an URI.
It proved difficult to track down the documentation but in fact this is possible, see: https://github.com/microsoft/vscode/issues/140733
Say your command is referenced as pkg.command, then this URL in Markdown can be clicked to execute it:
[Run It](command:pkg.command)
This works out of the box in modern VSCode.
Link processing using protocol vscode for example [cpptools](vscode:extension/ms-vscode.cpptools) is performed only by Visual Studio Code. For now, it handles links if they point to extensions, but does not support link to commands. But the Visual Studio Code development team can add this if they see fit for the developers.
But, in my opinion, this functionality is not necessary.
I'm working on a VS code extension which needs to access console.log() output, written into the user's active terminal.
I'm aware of the vscode.window.activeTerminal API which returns a Terminal. However, according to the docs I can only sendText() to the terminal.
Is it possible to read the terminal's content from within my extension?
It cannot do in stable version of VSCode. Try window.onDidWriteTerminalData API only in Insider version.
For your information, there are several options, not official supported by VSCode.
Use node-pty to create and manage the process and then hook it up using ExtensionTerminalOptions.
Create a process/script that wraps the terminal shell.
reference:
https://github.com/microsoft/vscode/issues/83224
https://github.com/microsoft/vscode/commit/dc6b475be75999e78233f9f6951ef66f18f768ea#r53974957
How can I open the command prompt in vs code? But as a window separate from vs code?
I tried shortcuts and other questions on StackOverflow but they all are on vs code and not opening it on a separate window.
You cannot do exactly what you are asking for. However, it sounds like you might be interested in installing Microsoft Terminal, available for free in the Microsoft Store. I use Microsoft Terminal Preview, it works extremely well.