intersystems-community / vscode-objectscript

InterSystems ObjectScript extension for Visual Studio Code
https://docs.intersystems.com/components/csp/docbook/DocBook.UI.Page.cls?KEY=GVSCO
Other
108 stars 49 forks source link

Add OS command execution to webSocketTerminal #1282

Closed EnricoParisi closed 10 months ago

EnricoParisi commented 11 months ago

TerminalAgent.cls.txt As you may have noticed I'm testing and using the new webSocketTerminal and I think it's a great improvement to vscode ObjecScript. I think that one useful functionality is missing, the the ability to run Operating System (Linux or Windows) commands. Having the ability do run simple OS commands directly from webSocketTerminal would be a big advantage. Using "normal" IRIS terminal, be it Windows IRIS console, Windows Telnet or within "iris session" in linux, running OS commands is simple, from the IRIS terminal prompt just precede the OS command with "$" or "!".

Running OS commands from IRIS code is not difficult, so I had a look to the backend code (%Atelier.v7.TerminalAgent.cls) and realized that could be easily implemented (hacked?) there without any change in the vscode extension.

I attach a modified version (from 2023.3 Build 254) of %Atelier.v7.TerminalAgent.cls that implement OS command execution. If anyone what to test it, after loading the modified class to the backend IRIS system, from the webSocketTerminal OS commands can be run just typing "!" or "$" before the command, like "!dir" or "!ls -la".

Again this is just an hack, nevertheless it works for simple OS commands.

P.S.: I know that the backend classes, while being tightly related, are not part of this project, but I think that this is the right place to ask for this enhancement.

isc-bsaviano commented 11 months ago

@EnricoParisi Thanks for the suggestion! I'm not sure that this is worth adding. VS Code's UI for having multiple terminals open is great, so I'd rather users lean on that.

@isc-rsingh What do you think?

isc-rsingh commented 11 months ago

Unless there's a really strong use case for running OS commands in the terminal I much prefer the cleaner separation of having multiple terminals open. Then you know you have a fully functional command line.