Missing link to keybindings.json in the Keyboard Shortcuts editor - visual-studio-code

The VS Code documentation refers to a link to keybindings.json. This link is not present in my editor (see image). How can it be restored?
Where is keybindings.json located in Windows 10?
VS Code version: 1.29.0-insider (user setup)

I've tested this both on 1.28.0 and 1.29.0-insider. It seems that the link in question doesn't exist on the insider version. On my 1.28.0 installation, I can click the link and it will go to keybindings.json, which is found in C:\Users\<username>\AppData\Roaming\Code\User\keybindings.json. This link exists even if the file itself is deleted, and will create a new file at that location if you click it.
In the insider's version however, the link is gone, and the insider keybindings.json is installed for me by default in C:\Users\<username>\AppData\Roaming\Code - Insiders\User\keybindings.json.
If you want to open it up, you can open up the control palette with CTRL +SHIFT + P and select Preferences: Open Keyboard Shortcuts File. This does the same thing as clicking on that link in the non-insiders version, including creating the file if it doesn't exist.

Related

Updating vscode doesn't show user code snippets

Updating vscode doesn't show user code snippets.
If I move the cursor after entering the prefix, it appear only then.
This issue can be resolved by following these steps:
Close Visual Studio Code.
Go to your user snippets folder, usually located at ~/.config/Code/User/snippets (for Linux), %APPDATA%\Code\User\snippets (for Windows) or ~/Library/Application Support/Code/User/snippets (for Mac).
Backup your user snippets folder by renaming it to something like snippets_backup.
Reopen Visual Studio Code.
Check if your user snippets are appearing now.
If the above steps don't solve the problem, you can try clearing the Visual Studio Code's cache:
Go to the Command Palette (Ctrl + Shift + P on Windows, or Cmd + Shift + P on Mac).
Type in "Developer: Delete Settings File".
Select the option "Developer: Delete Settings File" from the dropdown.
Confirm the deletion of the settings file by clicking on the "Yes" button.
Reopen Visual Studio Code.
These steps should resolve the issue with your user code snippets not appearing after updating Visual Studio Code.

How to change folder that opened by default in VSCode?

I have small problem with VSCode folder, that opened by default.
Problem description: I start new instance of VSCode (trough File->New Window), and then if I choose File->Open Folder it opens dialog with my Windows user folder as starting point (C:\Users\MyUser)
Question: How can I change that folder in settings (if it possible)? So by default it will show as start point for example D:\development\ ?
At the time I write this answer, this is not possible. There are two problems on Windows, and one problem on Mac and Linux:
VS Code does not provide a default path to the file dialog 1. It does remember the last folder that you opened a file in, but that path cannot be used as a default because it is overwritten constantly.
On Windows only, Electron ignores the default path when creating a file dialog if the default path is a directory 2.
An extension also cannot solve this, because extensions are not allowed to modify the File menu 3.
I think the best option at this point is to pin a folder to the Quick Access area in Windows Explorer, as suggested in a comment, or to put an actual shortcut in the user profile folder.
Workspaces and File > Open Recent may also be helpful if you often open the same folders.
Your main problem is that you are unable to open your specific folder in VScode.
To solve that you can simply open the terminal/cmd in that specific window by just typing cmd in your search bar or just by pressing shift+right-click in that folder.
Now your cmd is open and you just have to type "code ." in the cmd and press enter to open the current folder in your VSCode.
In case that code . doesn't work for you then you have to add the Vscode in the environment variables of your windows.
Visual Studio doesn't provide a specific feature to open a specific path. But there is a solution to your problem. You are saying that you want D:\develpment as a default when you open VS Code. You can go to that specific directory or create shortcut to desktop then click right click on that folder and then click on open with code. If you didnot see open with code then reinstall your VS code and check on open with code when you are reinstalling VS Code.
make a shortcut on the desktop for vscode and then modify it and add the folder after the .exe command. This will default open that folder when you double click on it.
Visual Studio Code can be installed in two ways - User setup and System setup. I strongly believe you have User setup installed in your PC. Try re-installing it System-wide. That should probably fix your problem.
For more information: https://code.visualstudio.com/docs/setup/windows#_user-setup-versus-system-setup
PS: A lot more information is needed, you can share a screenshot of the window and elaborate more on it.

How do I factory reset Visual Studio Code or Delete Folders

I started to learn one language and moved to a different one. I want to start with that language with a fresh code editor. But I don't know how to reset visual studio code and delete all my data. Can someone help me? I'm quite new to vs code. (Sorry if this is a stupid question)
You can delete VSCode related data comletely by deleting both of these or if you just want to reset your editor just delete the .vscode folder in your user profile.
To Delete user data directory Code:
Windows %APPDATA%\Code
macOS $HOME/Library/Application Support/Code
Linux $HOME/.config/Code
To Delete the extensions and other related data, delete the folder named .vscode:
Windows %USERPROFILE%\.vscode
macOS ~/.vscode/
Linux ~/.vscode/
Press CTRL + SHIFT + P
Type "settings json"
Click "Preferences: Open Settings (JSON)"
Edit file and leave only braces { }

How to transfer VSCode key mapping on windows to ubuntu

I use vs-code as my go-to editor on Windows. Recently I've installed on Ubuntu and now the default key mapping is different.
Is there any way I can set the key mapping on Ubuntu similar to what they were for Windows, or at least a subset of it?
I have created an extension that provides the default Windows keybindings. It is on the VSCode extension marketplace and called Windows Default Keybindngs.
I have tested it on Linux with VSCode 1.38.0 and 1.36.1.
The new bindings take precedence where there is a conflict, but existing, non-conflicting bindings are still available.
Basically all I did was use HolyBlackCat's suggestion to run "Preferences: Open Default Keyboard Shortcuts (JSON)" and stuff the result into the appropriate place in package.json. (Plus document it and figure out how to publish it!)
Update 2020-06-05: In response to a question in a comment, I did a search and found LinuxKeybindings, an extension that provides the default Linux bindings. I have not tried it myself but this could be useful for those wanting the Linux bindings instead of Windows bindings.
A quick way to transfer the default keymap without an extension:
VS Code Windows (source)
open "Show All Commands" / Ctrl+Shift+P
select Open Default Keyboard Shortcuts (JSON) (docs)
Note: #Ville Venäläinen's answer did not work for me for default key bindings.
copy everthing to clipboard or a temporary file (like you need it)
VS Code Linux (target)
open user keybindings / CTRL + K CTRL + S → click Open Keyboard Shortcuts (JSON) button
paste all previously copied settings to this file. If you already have custom user settings, make sure to don't overwrite them. Also preserve the file JSON structure [{}, {}, ...].
Additional notes
You can make a backup of the keymaps before. Default file locations analogue to settings.json:
Linux: $HOME/.config/Code/User/keybindings.json
Windows: %APPDATA%\Code\User\keybindings.json
If needed, also copy custom user keyboard shortcuts in source and append them in the target keybindings.json file (as explained above).
This worked well for me with a Debian target distro. If you should happen to get a key conflict, just delete or change the relevant key binding for this case.
At least with the latest VSCode, you can go to File -> Preferences -> Keyboard Shortcuts. On that page, there is a text under the search field: For advanced customizations open and edit keybindings.json. That will open you a view showing the default keybindings on the left and an empty file on the right for your own bindings. You can try to copy those bindings from Windows and save the to your Ubuntu one.
If you're not customizing your keymap, look through VSCode Keymaps for keymaps and install on both Windows and Ubuntu.
I personally use the code-settings-sync extension.
Synchronize Settings, Snippets, Themes, File Icons, Launch, Keybindings, Workspaces and Extensions Across Multiple Machines Using GitHub Gist.

Can't get "View in Browser" or tool tip to work in Visual Studio Code editor

I can't get two features in Microsoft's Visual Studio Code to work.
1) I can't activate the "View in Browser" extension.
2) The tool tip feature isn't displayed in the editor.
Thanks in advance.
I would suggest you re-install the latest version from vscode
Open vscode, press F1, then type 'ext install[space]', [space] = space key;
Select "Extensions: Install Extension", then type 'view in browser'; Click bottom right 'tree' like logo to install extension; then Restart Now.
Open vscode, create an html file, then press Ctrl + F1 to view the html in your default browser.
Reference:
https://marketplace.visualstudio.com/items?itemName=qinjia.view-in-browser
Instead of using View in browser extension, I suggest you to use View in Default Application Extension.
Press F1 and narrow down the list commands by typing extension
Select the Extensions: Install Extension command.
Search for this extension by typing in the text view in default application
Once installed, you will be prompted to restart your instance of Visual Studio Code to use the extension
After saving your HTML file, press first ctrl+k and then ctrl+b.Your HTML file will be open in your default browser
Go To File - > Settings.
It will open a new window to the right.
Add your proxy settings there as:
"http.proxy" : "value".
Restart the Visual Studio Code.
It should work.