Unbind ZoomIn in Visual Studio Code - visual-studio-code

I'm using a Mac and would like to use cmd+= to switch between open windows in VSCode (1.6.1).
By default that key is bound to workbench.action.zoomIn.
I tried following these instructions to unbind that key, but so far have not had success.
In keybindings.json, I have:
{ "key": "cmd+=", "command": "-workbench.action.zoomIn" },
This doesn't seem to have any impact, however, as I still am able to zoom in with cmd+=.
What am I doing wrong here?

Unbinding seems to be broken. You should consider filing a bug here: https://github.com/Microsoft/vscode/issues
would like to use cmd+= to switch between open windows in VSCode
Then you don't need to unbind the current shortcut for workbench.action.zoomIn first. Just create a new keybinding like this one to overwrite the existing one:
{
"key": "cmd+=",
"command": "workbench.action.switchWindow"
}

Related

Visual Studio Code Keybinding for navigation in Quick Fix contextual menu

After vsCode v1.74 update, I'm having trouble defining custom shortcuts for the Quick Fix contextual menu.
Quickfix Menu
Before, I was able to solve it by following this thread https://github.com/microsoft/vscode/issues/55111
Is anyone experiencing the same problem?
This is what I used for months with no problem.
{
"key": "shift+j",
"when": "codeActionMenuVisible",
"command": "selectPrevCodeAction"
},
{
"key": "shift+k",
"when": "codeActionMenuVisible",
"command": "selectNextCodeAction"
},
To be able to use custom shortcuts for the Quick Fix contextual Menu
I don't know if you filed the github issue selectNextCodeAction custom keybinding not working and revert to old context key ID for code action widget , but it has been resolved by reverting to the previous context key codeActionMenuVisible from the new actionWidgetVisible - which I assume was introduced because there are now code actions/quick fixes in the terminal (but should have at least been called out in the Release Notes).
The fix is due to be released as part of the Recovery Build v.1.74.1 which may be out soon.
[As a side note, this key started life as CodeActionMenuVisible (note the capitalization) before being switched to the typical camel case version later.]

Trying to add a custom context menu item in VSCode that runs commands from an installed extension. Not sure what package.json to edit

I installed an extension called Faker, and the only way to access its commands are through the Command Palette. So I want to add a new entry to the editor's context menu using editor/context and contributes.menus as described here - and place all the Faker commands inside the new menu for easy access.
The format goes something like this (non-submenu):
{
"contributes": {
"menus": {
"editor/context": [
{
"command": "faker.address",
"group": "faker"
}
]
}
}
}
My question is, should I edit the extension's (Faker) package.json? Or is there is a global package.json that I can edit so I don't have to touch the extension's files?
What's the proper way to go about this?
Thanks much for any help.

Automatic scoll down on document refresh (VS Code)

Since VS Code can auto-refresh a document when it is changed from outside, I would like to scroll down to the last line automatically.
I'm sure this feature worked on previous versions but now I found no entry in settings to enable it.
It is helpful in order to monitor a log file while been write.
Is there any way to enable this feature?
So I created a VS Code extension for this, it's called autoscrolldown.
Building the world's most expensive tail -f!
Auto Scroll extension does this.
You could use the keybinding to scroll to the bottom of the file:
{
"command": "workbench.action.terminal.scrollToBottom",
"key": "ctrl+end",
"when": "terminalFocus"
}
CTRL-End
I don't see any other way to have the scrolling be automatic when a file refreshes.

VSCode. How to reload theme after editing its style

Hello I'm trying to make custom theme for VS Code and want to see style changes right after editing, currently i need to restart editor to see changes which is not very productive.
Is there is any way to enable something like "hot reload" for theme/extension development?
"hot reload" for theme/extension,
not specifically, but there is a Reload Window command, which is quite fast.
It is a suggested solution by VSCode.
You can Press Ctrl+Shift+P for Command Palette and type Reload Window,
or define a key binding: Open Keyboard Shortcuts from menu or Ctrl+K,Ctrl+S,
find Reload Window command using Search, add your desired key combination
As already suggested by Alex and also VSCode's themes article,
a flexible way to edit a theme, is to transfer lines with values you want to tweak into the Settings. Or create new ones, it's easier there, as you can take advantage of IntelliSense and "live" update, which is not really live, but upon Settings file Save (not all settings are live, e.g. editor.foreground will not auto update)
Once you are satisfied with the changes, or with your new entries, transfer lines containing them from Setting to the Theme file and reload.
Settings in Setting file have priority, will override values from Theme file, if they exist there.
There are usually two sections in a Theme file, one defining Workbench colors,
in Theme file, these settings are under colors Key. e.g.:
"colors": {
"editor.background": "#000000",
"editor.something": "#ffffff"
}
but to tweak them in the User Settings, they must go in workbench.colorCustomizations Key. e.g.:
"workbench.colorCustomizations": {
"editor.background": "#000000",
}
then there are Syntax highlighting colors,
these might be in Theme file in an Array under tokenColors Key, or referenced to external file.
To tweak e.g. String color and style:
{
"name": "String",
"scope": "string",
"settings": {
"fontStyle": "",
"foreground": "#E6DB74"
}
},
place it in User Setting under editor.tokenColorCustomizations inside textMateRules:
"editor.tokenColorCustomizations": {
"textMateRules": [
{
"name": "String",
"scope": "string",
"settings": {
"fontStyle": "",
"foreground": "#E6DB74"
}
},
]
},
(*) Trailing commas
Watch out for the trailing commas. They can be a nuisance. The last entry must not have it and when you are copying items up and down, it's easy to miss one.
As a little help you can take advantage of the fact that Settings will forgive you if you'll leave it there. From some point of view, considering that the setting will reside in Settings only temporarily, it might be less error prone to not remove the comma from Settings, if it was already there in Theme file and you're going to put the line/block back to Theme file after tweaking. This is why I included the comma, against JSON rules in examples above.
(*) Error in JSON
If you make an error in JSON and then save and reload VSCode still with the error in JSON, the modifications will not show and theme will look the same as from before the reload. It looks like the VSCode is still using a cached version of the Theme file from before the error was made.
This is quite confusing. Expected behavior would be to fall back to default Theme.
If you then open the Theme selector, your theme will still be listed as selected, but if you select another one and then try to select yours again (one with the error), VSCode will ignore this action, keeping the another theme. This behavior might confuse further, expected would be to show error, or not allow to make the selection.
Edit: from vscode 1.31.0 hot-reload is working for theme in [Extension Development Host (when launching F5 extensionHost].
Hot reload works in settings.json Ctrl+,. After theme is ready simply move the content.
"workbench.colorCustomizations": {},
"editor.tokenColorCustomizations": {
"textMateRules": []
},
The best I came up with, was to make a shortcut to:
code -n c:\projectdir
and give it a keyboard shortcut like Ctrl + F1.
Then, after editing, save your file, hit Ctrl + F1 and a new VS Code will open up with the theme freshly loaded. If you open up files with several different languages, you get a good preview. Then you can just close that window again, and continue editing your theme. Rinse, repeat.

How to disable Ctrl-Click in VS Code

I want to know if it's possible to remove the key bind on Ctrl-Click for the goToDefinition (F12) editor action.
This is so annoying, every time i try to Ctrl+C/V it trigger and go to the definition cause I'm holding Ctrl while I'm highlighting the code with my mouse.
I have search for it on google but all y can change is the F12 key bind for goToDefinition which is not what I want.
--- Update
This is the feature I want to disable
I need to remove the ctrl+click key bind.
Even if I replace it, it doesn't work.
-- Update 2
I finally found something on the subject Here
But for me it doesn't work at all.
-- Update 3
Created a new issue on GitHub (#7827)
Look at it if you wanna see the update on the request.
At the time of writing (2022) you can turn off this with workaround by setting following setting to 'ctrlCmd'.
How to open setting page in vs code?
Ctrl+Shift+P and enter open setting (UI)
Note that if you are also looking for Ctrl+Click for word selection, it is still not possible. See my another answer.
And yea, the dreaded (and famous) issue #3310 is never really happened, even after 6 years.
There is a VS Code feature request for this on GitHub, under the more general heading Allow customization of mouse shortcuts.
Anyone interested in this VS Code feature should comment/vote there. (The Ctrl-click-specific GitHub posts have been closed off and linked to this one. Ex. #16974)
Add the following lines in keybingings.json to disable (actually override default behaviour) mouse+ click
[
{ "key": "ctrl+[mouse button]", "command": "cursorWordLeft",
"when": "editorTextFocus" }
]
To open key bindings file, traverse
File > Preferences > Keyboard Shortcuts