Can I configure VS Code to disable Breakpoint by middle click? - visual-studio-code

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.

Related

Ctrl+D equivalent in DBeaver

I checked the DBeaver shortcuts docs page and Googled a lot but couldn't find any info on this...
Does DBeaver have a Ctrl+D equivalent (I am referring to Ctrl+D in VS Code, where it multi-selects by adding the current selection)?
Background
I work with BigQuery a lot, and in BigQuery Console and VS Code they both have the Ctrl+D functionality but not in DBeaver (at least not by default with the same hotkey)
DBeaver does not come with this functionality working by default, but you can very easily add this shortcut yourself with the following 4 steps:
On the top context menu, click Window -> Preferences. Then select User Interface -> Keys.
The command you want to add a binding to is the Multi selection down relative to anchor selection. So, on the filter text box, write multi. Select it, then on the bottom pane select the Binding text box, and press the shortcut keys down (In this case, press Ctrl+D).
Make sure that the When column changes to Editing Text. Otherwise, change this yourself. It will look like the iamge below
The Ctrl+D shortcut is already taken by the "Delete Line" command, so you need to unbind them. On the filter textbox, write ctrl+d. Then click on row that shows Delete Line, and click the Unbind Command button.
Click Apply and Close and have fun.
I believe it is Ctrl+Alt+Down (from https://dbeaver.com/docs/wiki/Shortcuts/)

VSCode: Disable mouse+ctrl interaction

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/

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 navigate up/down using keyboard home keys in Eclipse's suggestions pop up window?

When Eclipse shows a popup for code completion, how do you change the highlighted option using the keyboard home keys? Currently, if the thing I want is third or fourth on the list of suggestions, I have to use the mouse to select it, or use the arrow keys. Is there a way to use the keyboard home keys/ shortcuts with ctrl/alt to do this?
Arrow keys always work for me. Can you be little more specific as to what perspective, editor, etc?
I get a code completion popup when I press Ctrl + 1 in the Java editor. From then on, I can use the arrow keys to navigate.
I'm assuming you want to select from the code completion menu by X for up and Y for down. Go to Preferences > Keys and bind the commands Line Up and Line Down to X and Y, respectively. Make sure that in the When drop-down you select In Windows.
Note that after the settings are applied, X (Y) also makes the cursor go one line up (down) in the source editor. Personally, I use X = Ctrl+P and Y = Ctrl+N which means I can navigate lines and select entries from the code completion menu without lifting my hands off the keyboard.
Unfortunately, these bindings don't work with other pop-up lists in Eclipse, e.g. quick outline (Ctrl+O) or quick access (Ctrl+3). I'd love to find out how to bind these too.

How can I go to the next Eclipse marker (e.g. build error) using the keyboard?

Suppose I make a method signature change that breaks several callers, and I want to review the call sites manually to update them.
Once I change the signature, my "Problems" view shows, say, a dozen errors.
What keys can I hit to navigate through them while leaving the keyboard focus in the editor for fast fixups?
(It's been a while, but I think the Visual Studio equivalent is F8.)
Note that this question does not duplicate Eclipse: How to go to a error using only the keyboard (keyboard-shortcut)?, as that one seeks to navigate only between markers in the current file. In this case, I want to go to the next error regardless of which file it's in.
("Marker" is the general Eclipse term for errors, warnings, etc.)
The best I've come up with so far is Ctrl + F7 to flip to the Problems view, then ↓ to pick the topmost error, then Enter to go to it (which returns focus to the editor).
Here's a way to move to the next error, regardless of editor, in one keystroke. It's not perfect, but it works until it's fixed in Eclipse.
Open a "Markers" view. Click the down arrow at the top right, and choose "Configure Contents". Uncheck the show all box, and create the view to show only the problems you want to see. You'll probably want to deselect "warnings" and "errors" as well. Save it.
Click the same "Markers" down arrow, and choose "Group By". Select "None". This is important because you don't want the parent tree level nodes to show, otherwise some of your "next" actions will take you to those, which don't represent an error.
In Eclipse -> preferences -> keys, search for "Markers". If there is not a keystroke bound to the Markers view, create one. I use Ctrl + Shift + M
Get a keyboard hotkey tool like AutoHotKey (for PC's) or iKey for the Mac. I'm using iKey, but there are plenty of other Mac tools you can use. In your hotkey tool, define an action for the keystroke you want to use for "next error". I chose the standard CMD + .
For that keystroke/action in your hotkey tool, generate 3 keystrokes in the following order:
Ctrl + Shift + M
Down arrow
Enter
Of course, you'll want to change the first one to whatever you picked for yours. You'll probably want to restrict that action to be executed only when Eclipse is the current application.
Save that, create some compile errors, and test it.
Try Ctrl + 3 for Quick access popup window.
If the "Markers view" is not already visible, then type in "markers", in the searchbox on the popup window. Once you have selected it, it should stay available, when you press Ctrl + 3 the next time around.
I just had the same problem, after refactoring some parts of code. I had a lot of errors in different files and i had to go through all of those.
I used the following solution:
Mark all (relevant) entries in the Problems view.
To do this switch to the Problems view using Ctrl+F7 and select the entries with Shift+↓/↑
You can also select all entries using Ctrl+A
Open the marked errors by pressing ↵.
Every file containing at least one marked error will be opened.
The cursor will automatically select one error/file, as if you open only this specific entry
Fix the errors in the opened file.
Here you can use Ctrl+. to navigate to next error inside this file
Close the file using Ctrl+W when your done.
Eclipse will automatically focus the next file and you can go back to step 3
In my case this solution was much faster then switching to the Problems view each time.
There's an Eclipse bug entered for this that has an attachment that looks like it does what you want.
You could use AutoHotkey:
save the mouse position, send a mouse event to click on the arrow in CDT console and then return the mouse back to it's original location. Record the mouse coords with window spy or use autohotkey's search by image function (first capture the images of two arrows with printscreen into bitmaps).