VSCode: Disable mouse+ctrl interaction - visual-studio-code

I often double-click to select followed by ctrl+c to copy. I am finding in vscode that ctrl press with the mouse over a word can perform an action. In some cases it selects the whole line, and in others it jumps to the definition of what is underneath. Is there a way to turn this off?
Note that if you move the mouse cursor off the word then it appears the action is not performed.

You could click on Visual Studio code->Preferences->KeyBoard Shortcuts. Keyboard Shortcuts page opens up. You could change any of the keyboard short cuts, by click on edit icon on the left as shown below

You can change the behavior of these features or disable them altogether by going to Tools > Options > Text Editor.
https://devblogs.microsoft.com/cppblog/productivity-structure-visualizer-ctrl-click-to-go-to-definition/

Related

Can I configure VS Code to disable Breakpoint by middle click?

I am switching from PyCharm to VS Codium. I want to be able to disable breakpoints by middle mouse click, like in pycharm.
Currently, I can disable a breakpoint by right click at breakpoint and select Disable Breakpoint:
Another way is to disable it in list in Breakpoints view.
But I want to be able to quickly enable/disable it by just clicking with mouse wheel (middle button). Is it possible to configure VS Code this way? Currently, when I middle click on breakpoint, this is ignored, and instead a text from selection clipboard is pasted (it is the default behavior in linux). Visual Studio Code version is 1.66.1.
There is no way at the moment to customize mouse click events. There are a few hardcoded options you can change in the settings, but it is extremely limited like pressing ctrl and the mouse wheel for zoom. As far as I am aware, disabling breakpoints is not among those options.
Check out: https://github.com/microsoft/vscode/issues/3130
I currently use the following workaround.
Remap the middle click to some button.
For wayland several utilities can be used for that. Let's take kbct.
Add such config (edit for your needs)
/etc/kbct/config.yml:
- keyboards: [ "Logitech MX Master" ]
keymap:
btn_middle: f15
Then start kbct.service.
Create the ruler script
Make the file choose_press.sh:
#!/bin/bash
class=$(xdotool getactivewindow getwindowclassname)
if [ "x$class" == "xVSCodium" ]; then
ydotool click 0xC1 # right click
sleep 0.2
ydotool key 107:1 107:0 28:1 28:0 # End, Enter
else
ydotool click 0xC2 # middle click
fi
Do not forget to add executable permissions.
Bind shortcut to the script
To assign a command to shortcut in KDE, go to System Settings -> Shortcuts -> Custom Shortcuts, right click, choose New -> Global Shortcut -> Command/URL. Go to Action tab and fill in the command. In this case it will be the path to choose_press.sh. Note: do not use ~ there.
And in Trigger tab assign the shortcut. In this case we use f15 (use some way to simulate it, if it is not presented on the keyboard).
Start VS Codium
Use vs codium in X11 mode. This is because I currently do not know how to get active window class in wayland.
Result
Now if you middle click in vscodium window, it will receive the sequence of input that leads to enabling/disabling breakpoint. In any other window, the middle click will behave as normal.
There is debug.enableOrDisableBreakpoint in codium, but toggling that with shortcut only works when the cursor is on the line with breakpoint. I did not found a way to move cursor to the line where you pressed (method to get the mouse over line?). So I made that complex thing with ydotool choose_press.sh.
I also tried to start stop kbct by window activation, but that is unfortunately broken in kde wayland currently.

Access mouse over hover in VSCode

Is there a way to access the mouse over popup in VSCode via Keyboard and navigate in it?
I often use the mouse over to get the namespace of function or variable ...
So I want to place the cursor on "bar", popup the hover (Show Hover Ctrl+k Ctrl+i), focus it, mark some text (eg. namespace::functioname), copy and close the hover.
namespace foo{
void bar();
}
First problem, the hover doesn't get the focus and I don't know how to focus it. But there is another feature "Show defintion preview hover", which actually gets focused. So far so good. But I still cannot mark or copy text inside the hover via keyboard.
Show hover (not focused):
Show definition preview hover (focused):
But I still cannot mark or copy text inside the hover via keyboard.
That should change with VSCode 1.68 (May 2022):
Lock hovers to more easily mouse over them
Some custom hovers cannot be moused over and others are tricky to mouse over without hiding it because of other things in the way (eg. like a scroll bar).
Holding alt while a hover is active will now "lock" it, giving it a wider border and preventing moving the mouse outside of the hover widget or whatever triggered it from hiding it.
This is primarily an accessibility feature to make hovers play nice with screen magnifiers but it is also useful for copying text from certain hovers.
Note that this feature only applies outside of the editor because editor hovers can always be moused over unless specified otherwise via a setting.
This will be helpful for other views (debug, terminal, ...) where variables with their popup can appear as well.
In the editor, see microsoft/vscode issue 63296
ctrl+K ctrl+I to show the hover and focus it
ctrl+A to select all the hover content
ctrl+C to copy to clipboard
It does indeed work for me (on windows) for the first two steps, however ctrl+C does not copy the text selected with ctrl+A.
It seems like there are two different selections possible in the hover:
ctrl+Aselects everything with a dark blue.
When selecting some text in the hover with the mouse (i.e. press the left mouse button while near/over a char, move mouse, release left mouse button) the selected text is shown in a lighter and brighter blue.
The two selections can coexist.
ctrl+C always copies the text selected with the mouse, or nothing if there's no such selection, no matter whether a ctrl+A selection also has been done.
If there's only a ctrl+A selection, ctrl+C doesn't copy anything.
The two selections can be selected in any order. The order doesn't change the behavior.
Think I found out what you were after.
The shortcut is: Ctrl+K Ctrl+I
See: Trigger advanced hover information with keyboard
please try control + mouse click
it may be help you

Disable multi cursor functionality

I do not like the Visual Studio multi cursor options, and I never use them.
Inevitably, I phantom-pressing some key combination that brings up a multi cursor option, then I write some code, and then the code is destroyed afterward. Please tell me how to completely disable all such functionality in Visual Studio Code. I am running on Ubuntu, but also interested in how to accomplish this on Windows (if there is any difference).
I should mention, that this happens literally once every 5 minutes to me on Ubuntu, but in Windows it happens much less frequently (like once an hour).
Un-check Selection->Column Selection Mode
You can remove the keyboard shortcut(s) that trigger this functionality.
Click on the gear on the bottom-left corner of the window and choose "Keyboard Shortcuts" from the menu. Type "Add Cursor" into the "Search" box and it shows only the commands that contain "Add Cursor" in their name.
Right-click on each command that add a cursor and has a keyboard shortcut associated and select "Remove Keybinding".
Also search for "Multi-Cursor". It could return the command "Toggle Multi-Cursor Modifier" that is associated to a combination of modifier keys (one or more of Ctrl, Alt, Shift). If such a combination of keys is pressed when you click in the editor window it adds a new text cursor at the click position. You should also removed these key bindings.
Set this settings in editor settings :
"editor.columnSelection": false,
In Android Studio :
Un-check Selection->Column Selection Mode

How to close the search toggle for vscode?

This is an extremely stupid question... but how do I close/toggle the search box in vscode?
I hit [ cmd + shift + f ] to do a global search, but then I need to reach for my mouse to actually close the box to allow for more screen space.
I've searched through their issues, and there seems to be another user in the past who also experienced something similar --> https://github.com/Microsoft/vscode/issues/32613 , but the solution provided of cmd - b only works for closing the sidebar.
My developer speed has drastically dropped since this issue, and I'm certain there's been a fix.
Please help. :(
**added in picture here -->
Press CTRL + SHIFT + E. It will switch to and focus the explorer.
Your search results are appearing in the panel, not the sidebar.
To toggle the panel:
pc/mac: ctrl + ` (backtick)
mac: ⌘ + J
However, if you want your search results to appear in the sidebar (which I think is the default behavior), then add this line to your settings:
"search.location": "sidebar"
Similar to what Vijey has mentioned, you can use the Toggle Panel keyboard shortcut which will do the job for me. On A mac the shortcut is
⌘ Command+J
I'm coming from sublime where the search results appear in a new tab - making it much easier to close the results (just like closing an other tab)
The best way to get rid of the search panel is by doing the following: -
On a windows computer, press and hold CTRL + Q
A window will then pop up, you can then release Q when the window pops up but you still have to hold down the CTRL key to keep the pop up open
3.Now use your mouse to click on the option called explorer and the search menu is now gone
There is no keyboard shortcut to close the search panel. However, you can create a shortcut yourself as shown in the attached image.
1) Go to File > Preferences > Keyboard Shortcuts.
2) Search for the command 'Close Panel' and set it to your convenient keyboard shortcut.
In the image below, I set it to Ctrl+F8.
If the search box displays in the sidebar (see Amr Noman's answer on how to set that up if it isn't already), How do you close the search box and go back to your project folders? In this case, there is no tab you can close with a click of the mouse. One way is to set up a keymap shortcut, e.g.
{
"key": "cmd+'",
"command": "workbench.files.action.showActiveFileInExplorer"
},
You can figure this out by going to Preferences -> Keyboard Shortcuts and searching for sidebar. One of the hits is described as "File: Reveal Active File in Side Bar"
More generally, any action that hides your project folder view in the sidebar can be cancelled by this shortcut.

Key binding for changing eclipse tab traversal

When using eclipse, I often use the find/replace tool without touching the mouse. I'll press Ctrl+F, type the text I want to find, press tab, type the replacement text, then press Shift+Tab 3 times, to bring focus to the "replace all" button, then I press Space to perform the action and ESC to close the window.
Today, I tried this and tab will only switch between the "find" text box and the "replace with" text box, meaning I have to go to my mouse to perform the "replace all" action, which takes forever (comparatively). I have had this problem before, and thought I recalled a key binding that changes the focus traversal policy for eclipse, but I cant seem to find it now. Googling has turned up nothing, but I don’t think I am searching for the right terms. I don’t think this is OS related, but I am on a Mac.
Thanks in advance!
I finally found this. It was OS related- Mac has a setting to allow tab navigation through buttons.
System Preferences-> keyboard, at the bottom select "all controls"