Visual Code wont open from explorer or command prompt - visual-studio-code

I had to re-install Visual Code and now found i cant open visual code from explorer window or from command prompt
I cant get the shell command to appear in the palette command to run
Install 'code' command in PATH
any ideas on whats gone wrong
thanks

Related

VS Code Not Running Anything - No such file or directory

My VS Code
My VSCode for Mac won't run even simple Python commands. For more context my Python Terminal execute in file dir setting is turned on. I don't know what the problem is, the play button or right clicking and selecting run code also doesn't do anything.
I've already ensured I have the proper VSCode installed for Mac. Please help :(
try to edit your settings.json file like this :
"terminal.explorerKind": "external",
"terminal.integrated.defaultProfile.windows": "Command Prompt"
learn more about using python in VS Code

Whenever I open terminal in visual studio code the terminal is blank and cant type a single word in it

Whenever I try to open terminal of visual studio code my terminal remains blank and I am not able to type anything in the terminal I have switched power shell to command prompt but the same issue persist I have included the screenshot
Try opening VSC as an administrator

how to stop VSCode terminal to open a new cmd window in each command?

On window 10 with vscode -v 1.51.1 terminal with cmd.
After writing the command and hitting the enter key... a new window is open and close...
so, if I'm trying to check --version the window is already close and i can't see results..
or if i having an error - i cant see it if the window is close... so for now: i use print screen..
how can i get the process output run on the same window... on the VSCode terminal?
If am understanding your question you can try
code -v
OMG
Turn off ConPTY integration in the
File->Preferences->Settings->conPTY->Uncheck it
Integrated terminal in visual studio code is opening externally and not internally

How to open a file from terminal in a tmux session in Visual Studio Code

One can open a file from the integrated terminal in Visual Studio Code via:
code -r something.dat
Unfortunately, this does not work for me when I work in the terminal within a tmux-session. The error I get is:
-bash: code: command not found
I googled the error and it seems I have to include vscode on my Path variable (example: similar problem).
I'm now confused on what to do as it works from the normal integrated terminal but doesn't work in the tmux "environment".
Do you have any ideas?
Probably you first started the tmux server from a terminal without this in PATH and you are not adding it in any of the shell startup files that the shell uses when started from tmux (remember tmux starts login shells by default).

How to open a file from the integrated terminal in Visual Studio Code?

Is there a way of opening a file from the terminal in Visual Studio Code that opens in the same vscode instance that runs the terminal? Similar to c9 tool in Cloud9.
I'm aware of the code tool, but when you run code something.php from the integrated terminal it opens a new vscode instance, which is not what I want...
You can use -r or --reuse-window command line option.
code -r something.php
just
code file_name
I tried it on Win10 and on Linux (Ubuntu)
I don't know what operating system you're using, but on MacOS you can just say open filename.ext in the integrated terminal, and it will open a new tab in the same VSCode instance, ready for you to edit.
If you are having command not found: code in macOS, use a full path to it.
/Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code -r [filename]
Open Visual Studio Code
Press CMD + SHIFT + P (this opens "Command Palette")
Type shell command
Select “Install code command in path”
Navigate to any project from the terminal, and type code .
If it didn't work, select “Uninstall code command from path” first, then reinstall it again.
I use code -r . to open the current directory in the main window.
You can use the code command from the CLI to open a file, but if you want it to open in the existing window, either use code -r <file> as mentioned in other answers (which does work for me on Ubuntu Linux), or, if -r does not work (under WSL?), make sure window.openFilesInNewWindow is either off or default in settings.json or the in VS Code settings UI, then use code <file>.
Many things can be found in open --help
A work around that worked for me on MacOS is:
open -a 'Visual Studio Code.app' something.php
in the version 1.31.0 that I have installed, on Windows 7, the only way I found to do this is to e.g. change the file associations in system so that .cproj and .cs files are opened by Visual Studio Code by default, and type "filename.cs" in Terminal to open file by that name in the same window... -r option is not working for the first call (opens a new window), but with each subsequent call that same window is correctly reused. ok can't get to open whole directories this way - it's a bit shoddy anyway. probably it would be more convenient to use an outside shell and work with "-r" option
VSCode 1.64 (Jan. 2022) comes with a new command:
Keyboard Navigable Links
Previously, link navigation in the terminal required the use of a mouse.
Now, links can be opened using only the keyboard via the following commands:
Terminal: Open Detected Link... to view all links (web, file, word)
Terminal: Open Last Web Link... ex: https://github.com/microsoft/vscode
Terminal: Open Last File Link... ex: /Users/user/repo/file.txt
Check if the last command Terminal: Open Last File Link... would help in your case.
See also "Terminal shell integration"