VS Code Go to Matching Pair Command - visual-studio-code

This command won't work for me. I had installed the Visual Studio Keymap, but when I uninstalled that it made no difference. If I open Keyboard Shortcuts and try customizing it to some other keybinding, still nothing. I open the simplest javascript folder/file (folder with a single .js file) to test, simply putting the cursor on either side of the parens in console.log('hi');
Version is 1.28.2 (latest). The only other extensions I have installed are Debugger for Chrome & ESLint.

editor.action.jumpToBracket is what you want for .js files, Ctrl-Shift-\.
The "Go to matching pair" command: editor.emmet.action.matchTag is for html files.

Related

Why does code not recognize paths in a system shortcut?

I want to use a shortcut to open up a specific folder in Visual Studio Code in a new window. I am on Fedora with Gnome Shell and have tried the integrated shortcut manager that can be found in the settings. When I define a shortcut with the command code -n ~/path/to/folder, Visual Studio opens a new file with the name folder. When I run the same command in the terminal it works as expected, i.e. a new window is opened in the specified folder.
Turns out ~ cannot be used in this context, so providing an absolute path fixed the issue.

How to run a Visual Studio Code extension?

I just installed the Visual Studio Code (v1.52.1) extension "Spelling Checker."
Now how do I use the thing?
I searched all the menus for a command to run this extension, or any extension. I asked Google "how to run a VSC extension" and only got matches that tell me how to install an extension. Apparently extensions are just supposed to run themselves.
There's a whole class of extensions for which that makes sense, such as extensions that add enhancements to editor windows. But there's another whole class of extensions, like this one, for which it makes no sense at all.
How do you run an extension?
This is confusing as the answer is spelled out in five-minute videos or is skirted around.
On your keyboard: Cmd+Shift+P (macOS) Ctrl+Shift+P (Windows, Linux, etc.) or under "View" and "Command Palette" opens the Command Palette so you can execute an extension's command such as "Browse Lite" for say https://github.com/antfu/vscode-browse-lite - hopefully, the developers say what the command is.
Note: Cmd+P (macOS) or Ctrl+P will search files by name. The shift is what's needed to launch the extension magic.
Open Visual studio code.
Go to extension option.
Then click on any extension.
After that disconnect your internet.
Then it will prompt for install extension manually.
Then it will ask to locate that .vsc file.
Select that and file and install it.

Issue with VSC build (CMD-Shift-B) command on mac

I am working through the instructions on building VSC for developers (https://github.com/Microsoft/vscode/wiki/How-to-Contribute#build-and-run) currently. Right under "Build" it instructs me to go "Go into vscode and start the build task with CMD+Shift+B) since I have a mac. I have gone into the folder in my finder and have pressed this combination of buttons but nothing happens at all. Am I supposed to do this in the terminal or am I missing anything?
It looks like the vscode directory must be opened in Visual Studio Code and a build is performed with ⌘ Command+Shift+B.
Here is an older version of the instructions where it is clearer:
https://github.com/microsoft/vscode-wiki/blob/2e2d6b0/How-to-Contribute.md#build
It appears that the directory vscode got mixed up with the full application name in a subsequent edit.

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"

File path autocomplete in VS Code

Has VS Code an autocomplete function for file paths?
For e.g. if I want to write the full path to js: "assets/libs/jquery.min.js"
Editors like Brackets.ie does this by default.
Visual code by itself has no Path intellisense, but you can use this plugin.
press f1 and copy this in it: ext install path-intellisense
Its a plug-in made by Christian Kohler, all props to him.
Plus, as Searene mentions in the comments, you may also want to set "path-intellisense.absolutePathToWorkspace": false in User Settings to make the auto-completion of absolute paths work.
Path Intellisense does not work for me, but Path Autocomplete works for me.
Installation:
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
ext install ionutvmi.path-autocomplete
You can also install it in the extensions tab(Ctrl+Shift+X).