How to open VS Code and pass commands to integrated termianal via CLI - visual-studio-code

I wonder how to use the code command to open the VS Code with the integrated terminal launching within with some commands running that I pass directly to the integrated terminal.
Right now I need to do a couple of actions to get it done:
open VS Code via code .
manually open the built-in terminal and run a command like npm run start
Maybe it's possible to open VS Code like this: code . --exec 'npm run start', and it may open the editor and also run another command in the integrated terminal just after VS Code is ready for work.
I look through the documentation and I couldn't find anything useful for this case. Maybe I need to look for something like plugin or tricky bash/zsh script?
Reminder: it’s important to run these “passed” commands via CLI directly in the integrated (built-in) terminal of the newly opened VS Code instance. I know that it's possible to open the editor and then run commands, like code . && npm run start, but it will be just another command in sequence after code, it's not the same as running commands in integrated terminal.
Thanks.

Related

Is there a way to programmatically open a NEW built-in terminal in VSCode from the terminal/bash?

Specifically I'd like to run a terminal command from vscode's built in terminal and have that command open another new vscode built-in terminal. Is this possible?
This is related to my question here - https://github.com/mklement0/ttab/issues/51#issuecomment-1372825316
Say I have the following command in my package.json scripts:
"sayHello": "ttab echo hello",
And I run npm run sayHello from the vscode integrated terminal. Is
there a way to have it so that the new terminal that is created is
created within the integrated terminal instead of from (in my case)
the default mac terminal application?

Is it possible to run the Javascript debug terminal outside of VSCode?

I want the Javascript debug terminal to be run outside of the vscode in the external linux terminal.
How can i do that?
Not found a single relevant answer in any platform.

Debugging new VS Code CLI flag in devcontainer

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 there a way to open a file in VS Code from the integrated terminal/codespace?

The integrated terminal in VS code means that you can run builds, scripts and other commands and see the results as is. Sometimes though they produce output files that you'd like to view in an editor, like a logfile or exception trace.
Is there a way of running a built-in command in the terminal to say 'please open this file in vscode', specifically in a codespace? On macOS, you might use 'open' or 'start' on Windows, but this only works if your codespace is hosted on the same machine that you're browsing to.
It would be great if there was a command that could be run that would open up the corresponding file in vscode, such that you could set the VIEW or EDITOR environment variables and have such operations edit in the file itself. Then (for example) running git in the integrated terminal would open a new vscode editor for writing the git message, instead of the default vi/emacs/notepad/edit.com/pico/nano.
Yes you can. Use the command:
code filename
Or, if you are running an early release (or GitHub codespaces):
code-insiders filename

Is it possible to open a C# solution in Rider via the command line?

It's possible with VS code via installing a shell command, as seen in this SO question: How to open Visual Studio Code from the command line on OSX?
Is the same thing possible with Jetbrain's Rider?
It is possible to open any file, folder, or solution and project in Rider for editing.
Here is a corresponding help page.
If you use a standalone Rider, you need to create a shell script. Call the action "Tools | Create Command-Line Launcher...". Then you will be able to call rider in a terminal as the shell script is by default created in /usr/local/bin.
In the case of using Toolbox installations, all scripts should be generated using Toolbox. Take a look at Create Command-line Launcher Intellij not found to find out how to set it in Toolbox.
Rider, in my case at least, and I installed it on Linux via snap, comes with a built-in rider command. It does open Rider, however, the issue is that the terminal becomes an output for logs from Rider. Additionally, as soon as I close the terminal, Rider gets closed as well. I guess the Rider process becomes a child process of the shell instance that I used to invoke it.