Using integrated terminal in a VS Code extension - visual-studio-code

There are multiple commands having to do with the Integrated Terminal that VS Code offers. In my extension, I am able to open it and focus it using workbench.action.terminal.focus, but running commands in it seems hacky to do through runSelectedText. Ideally I'd like to be able to run commands directly without having intermediate document to simulate selections in and to be able to read their results.
I have found the MainThreadTerminalService which seems to offer what I want, but I don't know how to and if I even can use that from an extension. Scanning node_modules/vscode/vscode.d.ts for terminal didn't yield any results, so I presume it is not possible yet.
Using TerminalPasteAction to run the commands seems as an option, but I would first have to get the command into the clipboard and there doesn't seem to be a good way to listen to the results anyway.
I know I can run a child process and listen to it's standard output and error, but since VS Code offers the integrated terminal window, it would be nice if the user could see the commands as they run in a separate integrated terminal tab exclusive to my extension. Is this possible? Will it be?

Check this thread
https://github.com/Microsoft/vscode/issues/9957
Apparently API is limited but you have
CreateTerminal(name?: string): Terminal
interface Terminal {
name:string;
runCommand(cmd:string)
show(preserveFocus: boolean): void
hide(): void;
dispose(): void;
}

Related

Is it possible to set up VS Code to run code in an external terminal Window instead of the integrated terminal/output windows?

I used to use the Atom code editor and one of the features I liked about this editor was that when I executed python code it would bring up an external CMD window where I would interact with the code, if input was required, and receive the results.
I have moved to VS Code as Atom is no longer supported and I have looked on here and with Google, but I do not seem to be able to get VS Code to behave in this fashion :(
I am wondering if any of the folks on here with more experience with VS code can advise if what I am looking to do is possible or do I just have to suck it up and use the integrated terminal/output panes at the bottom of the window?
Any advise would be very much appreciated.
I have tried in the "Configure Terminal Settings" to change from Integrated to External, but this has made no difference.

Recording terminal input and logs in VS Code extension

I want to create an extension that can access the command line input of a workspace terminal. I also want to record the various logs that occur within that console as well. I have looked at the extension API but haven't found anything useful. How would one go about doing this?

How to setup Julia in VS code?

I'm coming from a pure Windows Visual Studio programming background with little Linux experience. It seems possible to use VS Code to program in Julia, but I can't figure out how to get things set up correctly.
Does anybody have good example launch.json, tasks.json, or other files that can serve as an example to build from?
This would be a great thing to see in a detailed tutorial.
Here is how things work if you are using the Julia extension for VisualStudio Code.
The extension adds a bunch of new commands. They all start with "julia", so filtering by that string should show you everything you can do with the extension.
In terms of running Julia code, the extension offers only two options right now. First, you can execute a command to start a REPL. This will just show a default Julia prompt, and you can interact with it like you would with any other Julia REPL. The second is that there is also a command, triggered by Ctrl + Enter, to send either the current editor selection or the current editor line to this REPL.
There is currently no further integration offered by the Julia extension. We do plan to add debugger support in the future, at which point I would expect F5 to start the current file in the debugger, or something like that. But that functionality is probably a couple of months away.

Is there a way to force Protractor test results to display in command prompt window instead of within VS Code?

Currently, I am working on a project which has somehow started showing the test results within VS Code (instead of the separate cmd prompt window). Any way to toggle this within VS Code as part of launch.json or tasks.json? I'm clutching at straws here...
I'm beginning to think this is not configurable...
Just discovered this was part of a recent VS Code update (10.1). According to the docs, "Since the Debug Console does not support programs that need to read input from the console, the external console is still available and you can enable it by setting the attribute externalConsole to true in your launch configuration."
Add this attribute to your launch.json

Is it possible to have windows autocomplete custom commands?

I'm running Console2, which I believe is just an interface to windows cmd
I have a custom batch file that does most of my dirty work for me, but there are lot of commands in it now. Is there a way I can get a tap autocomplete working for it in the windows command prompt?
For example: my script is called rob.bat and it takes in a various number of arguments
It'd like to type rob set{Tab} and then have it cycle through
setup_envvars
setup_userprefs
setup_whateverothersetupscriptsIhave
Is there a way to do this?
Console2 has no special provisions for tab completion and instead relies on the program running within it to provide such features. Picture Console2 as little more than something that runs a console program hidden somewhere, regularly polls that hidden window for changes, and forwards all input to that window; this is, in essence, what's happening.
Note that Console2 does nothing special with cmd. You can run any shell within it. As for customizing tab completion, cmd offers nothing of that sort. You may be able to change this by installing clink, which has extension points for Lua code. Another option would be PowerShell, which has customizable tab completion out of the box, either by wrapping your program in a function that provides the necessary parameters, or by writing a custom TabExpansion or TabExpansion2 function.