Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature] Option to disable cmd+click trigger for goToDefinition #23957

Open
nathanjd opened this issue Apr 5, 2017 · 39 comments · May be fixed by #130215
Open

[Feature] Option to disable cmd+click trigger for goToDefinition #23957

nathanjd opened this issue Apr 5, 2017 · 39 comments · May be fixed by #130215
Labels
editor-core Editor basic functionality feature-request Request for new features or functionality
Milestone

Comments

@nathanjd
Copy link

nathanjd commented Apr 5, 2017

Starting ~2 weeks ago, I have been plagued by this feature. Somehow I manage to trigger this feature about 60% of the time when I am trying to copy+paste. It is the same issue as reported here, but in the editor so am creating this ticket as suggested by @bpasero .

#7827 (comment)

  • VSCode Version: Version 1.10.2 (1.10.2)
  • OS Version: OS X 10.11.6 (15G31)

Steps to Reproduce:

  1. Cmd+click a followable definition.
  2. Unexpectedly arrive somewhere deep in node_modules.

Don't get me wrong, I love this feature but whatever changes were made recently seem to be incompatible with my muscle memory when copying text. So, I would like to change the keybinding, or at the very least turn it off altogether.

@rebornix rebornix added the feature-request Request for new features or functionality label Apr 5, 2017
@bpasero
Copy link
Member

bpasero commented Apr 6, 2017

Cmd+click a followable definition.
Unexpectedly arrive somewhere deep in node_modules.

@nathanjd I am not sure I understand, how is this related to copy?

@bpasero bpasero added the info-needed Issue requires more information from poster label Apr 6, 2017
@bpasero bpasero modified the milestone: Backlog Apr 6, 2017
@rebornix rebornix added the editor label Apr 6, 2017
@nathanjd
Copy link
Author

nathanjd commented Apr 6, 2017

Apologies, this seems to be how I have been selecting text for copy:

  1. Double (word) or triple-click (line) text to select the text to copy.
  2. Press cmd+c.

However, it seems that 60% of the time I end up hitting cmd before the click. This may be because, in my head, this is all one near-instantaneous operation.

It's clear to me that I should train myself not to hit control until after the text is selected but it is proving a hard habit to break. I think that if given the option, I would change the goToDefinition shortcut to be alt+click or ctrl+click to remove the chance of accidentally colliding with my cmd based shortcuts.

Keyboard shortcuts are super important in OS X and I have changed quite a few so I would love the ability to remap ALL key bindings. It seems that most are accounted for in the "Keyboard Shortcuts", but goToDefinition and goToDeclaration only show as bound to f12.

@bpasero bpasero removed the info-needed Issue requires more information from poster label Apr 7, 2017
@rhughesjr
Copy link

Yes, I too would love to have a way to disable this. It's something I always have to turn off in full Visual Studio for anything that does it (ReSharper, Pro Power Tools, etc).

VS allows ctrl-click to select a word. vscode does not, however, I still instinctively try to do this, and the jumping around it causes is quite annoying.

I'm rather surprised there was not an option for it initially, as you guys are generally really on top of having feature toggles available for any new features.

@clounie
Copy link

clounie commented Apr 17, 2017

I have the same thing happening as nathanjd, but trigger it in a different way. Doesn't happen often, but pretty annoying when it does.

How it happens for me:

  1. Select text (left mouse button still held down)
  2. Press Cmd (for Cmd+C) before letting go of the mouse button
  3. Let go of mouse button

Seems like VSCode shouldn't "Go to link/definition" unless you press cmd first. After all it's Cmd+click, not select text+cmd

@natsu12
Copy link

natsu12 commented May 17, 2017

Yes! I want to disable hyperlinks in vscode so badly because every time I copy a link, I use cursor and cmd + c, then vscode determines that I use cmd + click to follow a link and open in browser. That drives me crazy! And I find no clue to turn off hyperlinks in vscode.
c_e64f1wsaeeiyt

@jvielrco
Copy link

Any update on this feature?
I used Cmd+Click all the time with VS2017 to select the whole word instead of double clicks because it's sooo much more faster and convenient. Am I the only one who actually used it?

@DoCode
Copy link

DoCode commented Oct 26, 2017

Here the same situation. I don't know why anyone else thinks about it... :-( Very annoying...

@foolmoron
Copy link

I can't imagine why this isn't an option or rebindable. Near-unusably annoying.

@trevordaniels
Copy link

Related: #3130, #34354, #27905

@jkildedal
Copy link

I also use Ctrl+Click to select whole word all the time in Visual Studio and it is very annoying that this behaviour cannot be customized in VS Code.

Is there any reason why this has been stalled so long?

Thanks.

@stephenmartindale
Copy link

Just wanted to add that, as @jkildedal mentioned, the gesture ctrl+click is generally and more conventionally used to select a word or token in Windows applications, full-fat Visual Studio included. I use it all the time in Visual Studio and the fact that it does something else in VS Code is extremely annoying. The fact that I can't disable the something else and have the conventional behaviour is doubly aggravating.

Please, please give us options.

@clounie
Copy link

clounie commented Mar 23, 2018

It might be conventional to Windows and Visual Studio, but it's far from the standard..neither Eclipse, IntelliJ IDEA, nor Sublime Text use Ctrl+Click to select a word.

Agreed though, options/configuration will be nice to have.

@rebornix rebornix added editor-core Editor basic functionality and removed editor labels Sep 18, 2018
@thany
Copy link

thany commented Oct 18, 2018

Bump

Need this feature as well. I do Ctrl+Alt+click all the time by accident to use multiple cursors. Since it's Ctrl+Alt+up/down on the keyboard to add more cursors above/below, it makes total sense in my head that Ctrl+Alt+click also adds an extra cursor. But it doesn't.

It not only flies the editor to a place where I'm not working on atm, it also does so in a secondary (split screen) editor. Both are annoying, and both casue me to get ripped out of my flow.

@url00
Copy link

url00 commented Jan 23, 2019

Has this been fixed? It's crazy to me that a feature like this can't be disabled in an otherwise fantastically configurable editor.

@darrenhollick
Copy link

dear vscode team,

PLEASE PLEASE PLEASE... allow us to disable the default behavior of ctrl + leftMouseButton (go to definition)

AND... PLEASE PLEASE PLEASE allow us to enable ctrl + leftMouseButton to do WORD selection exactly as it behaves in Visual Studio 2019/2017/2015.......

Thanks for your consideration!

@thany
Copy link

thany commented Feb 25, 2019

AND... PLEASE PLEASE PLEASE allow us to enable ctrl + leftMouseButton to do WORD selection exactly as it behaves in Visual Studio 2019/2017/2015.......

But please only take the GOOD bits of VS20xx. It is mostly a shit editor, but it does have some good traits. I'm glad and disappointed at the same time, that two essentially identical editors (as in, the component where letters appear, not the whole program!) from the same vendor, can be so different. It's almost like Microsoft is becoming Adobe.

@rpstreef
Copy link

whenever I copy paste something I can get anywhere from 1 to 3 tabs opened with function definitions in my browser, it is really annoying to work with.
Any rebinding would be very much appreciated

@brenwebber
Copy link

Same problem here. I use Ctrl+Click to select words for copy and paste. More than happy to use the F12 key based shortcuts when I want to see definitions. It's the first thing I change in full VS when I do a new install.
Doing quite a bit in VS Code now and not being able to change this is very frustrating.

@Jav3k
Copy link

Jav3k commented Sep 11, 2019

I changed the "editor.multiCursorModifier value to "ctrlCmd"

settings.json:

 "editor.multiCursorModifier": "ctrlCmd",

The "Ctrl+Click" then became a multiCursor trigger and "Alt+Click" became a goToDefinition

@nonsensation
Copy link

I changed the "editor.multiCursorModifier value to "ctrlCmd"

settings.json:

 "editor.multiCursorModifier": "ctrlCmd",

The "Ctrl+Click" then became a multiCursor trigger and "Alt+Click" became a goToDefinition

This triggers the Multi-Cursor on click and unfortunately is equally annoying..

Almost 3 years later in 2020 this is still an issue with no fix ... (4 years for crtl + click for select #3130)

@AntonyJBlackett
Copy link

AntonyJBlackett commented Feb 26, 2020

This problem was enough to drive me away from VS Code. Let me know when it's fixed and I might use it again.

As an aside note, I also find go to definition hyperlink mode seems to get stuck on sometimes and you have to hit ctrl again to get it unstuck.

@wgebczyk
Copy link

wgebczyk commented Apr 4, 2020

Hey!

I would also second ANY HACK/OPTION/WORKAROUND to disable Ctrl+Click to navigate. I would like just simple selection of text to work. I would even more appreciate that with Ctrl selection would select whole word under cursor. But I can live with simply disabling those links after Ctrl.

@AntonyJBlackett
Copy link

AntonyJBlackett commented Apr 4, 2020 via email

@purduemike
Copy link

@Jav3k Thanks this works for me! @wgebczyk You should try @Jav3k solution above.

@sergilazaro
Copy link

@Jav3k @purduemike That doesn't work when you want to hold ctrl and then "click word > C > click word > V", which is a fast way to select a word, copy it, select a different one, replace it. I can do this in traditional Visual Studio, and I do this really often, but it's pretty annoying that there's zero ways to configure VSCode to do this. I don't want to make this the default behavior, I don't mind configuring my editor to suit my needs, but this seems to be literally impossible right now...

@wadawe
Copy link

wadawe commented Sep 3, 2020

Not 100% sure if this is relevant; but I was able to move the "go to definition" behaviour to requiring a different keypress (such as option instead of command)) by: VSCode Window > Selection Menu > Switch to Cmd+Click for Multi-cursor.

It does seem as though this button is not 100% accurate with its description. It is a toggle button that switches between the state Switch to Cmd+Click for Multi-cursor and Switch to Alt+Click for Multi-cursor. I have found that when the button displays Switch to Alt+Click for Multi-cursor, it requires you to click the option key instead of command - thus eliminating the odd accidental command+click "go to definition" behaviour before wanting to copy+paste text :)

@AdjutantML
Copy link

Thanks @WillDawe , you are a champion

@bvandenbon
Copy link

bvandenbon commented Dec 4, 2020

Just a reminder, there are also users that actually do want the "ctrl-click to navigate" behavior.

As @Jav3k mentions above, fiddling with the "editor.multiCursorModifier": "ctrlCmd", does indeed influence the behavior of the ctrl-click. And that's exactly why I created the following bug ticket:

#111888

@manuelxmarquez manuelxmarquez linked a pull request Aug 5, 2021 that will close this issue
@manuelxmarquez
Copy link

It's been over 4 years! I guess we're all waiting for someone else to do it. Well, the wait is over! I don't use VS Code very often, but I would always come back and check the status of this when I needed to use it so I decided to spend a day and try to get this fixed. I managed to get a configuration property to replace the click link to gesture with word selection instead.

If you want both, it is going to require more work since a lot of the key modifiers with selection are hard coded and the properties that do exist only support single enum values, not combinations. You could make a quick hard coded change to fix it. Looking at my commit should give you an idea of what to change.

I am assuming that most people here are coming from full Visual Studio to program in a language not well supported by it and are looking for a similar experience.

If you want to make more changes or it doesn't make it into in the build, you can follow this guide to build from my commit. If you build your own version you will need to modify product.json in the main folder to get the extension gallery to work as described here. You can also install the extension Visual Studio Keymap to get similar key bindings.

Once in Visual Studio Code you can enable the feature or add the JSON property:

"editor.wordSelection": true

image

@crazydef
Copy link

Come on guys, ctrl+click to select a word should have been the default functionality in the first release. People use Visual Studio Code because it has the words Visual and Studio in its name. There are plenty of other editors out there that don't work like Visual Studio.

@rebornix rebornix removed their assignment Oct 21, 2021
@tbcarver
Copy link

I don't understand why so many people love to double click. ctrl+click is one of the most efficient features of Visual Studio. Please add this to the release.

@clounie
Copy link

clounie commented Dec 17, 2021

Come on guys, ctrl+click to select a word should have been the default functionality in the first release. People use Visual Studio Code because it has the words Visual and Studio in its name. There are plenty of other editors out there that don't work like Visual Studio.

This may have been true initially, but is certainly not true now. People use it because it's a standard editor for web development, and most of them likely have never used VS in their life...

As a config option, great. As a default that goes against industry standards (ctrl+click = "find references / usages")...no.

@nathanjd
Copy link
Author

@clounie That may be industry standard for Windows software but it certainly is not for Mac OS X.

@tbcarver
Copy link

The pull request isn't for a default option its to add the feature. If the contributed feature would be rolled in I think all parties would be very happy.

@dougbenham
Copy link

dear vscode team,

PLEASE PLEASE PLEASE... allow us to disable the default behavior of ctrl + leftMouseButton (go to definition)

AND... PLEASE PLEASE PLEASE allow us to enable ctrl + leftMouseButton to do WORD selection exactly as it behaves in Visual Studio 2019/2017/2015.......

Thanks for your consideration!

https://github.com/dougbenham/CtrlClick

@bpasero bpasero added this to the Backlog milestone Aug 9, 2022
@manuelxmarquez
Copy link

It appears my code change will not be merged. I have seen more people request this feature and link to my pull request but it was too old to compile.

For anyone that still wants this feature, you can find my updated change here.

I also uploaded the compiled binaries for Windows which you can find in the Release tab. Follow the instructions on the README to enable the feature.

@tbcarver
Copy link

tbcarver commented Nov 8, 2022

@manuelxmarquez I doubt your feature could be totally done in an extension, correct, because there needs to be some base functionality to VSCode to allow access to mouse events? Would it be possible to break your VSCode PR into something more basic like exposing the mouse events and then extensions could be used to add in the settings to change the ctrl click behavior? (or is this exactly what you have? And if so, could the VSCode piece be made even more generic?)

I would be willing to help you with a project of this nature. A feature that makes VSCode more configurable I think would have a better chance at a merged PR. I've also seen open tickets for just the mouse click configurability ability.

Also, great work! And also, WTF, why would VSCode have so much control over the key board short cuts and no control over mouse short cuts?! 😡

@manuelxmarquez
Copy link

@tbcarver I'm not sure how practical it is to allow that much configurability to mouse buttons. A lot of mouse behaviours are "standard" and hard coded. Allowing too much configurability would lead to conflicts.

I'm not sure how much software allows that level of configurability, the only one that I can think of is Blender which allows you swap the Left and Right mouse buttons. I do remember a time when there were some issues if you did switch the default and some actions did not work properly.

I'm not sure how many special cases like Go To Definition exist. I wanted at least to disable Ctrl+Click Go To Definition and wanted an experience close to Visual Studio since I use that most. I'm not sure about other editors and standards that people are used to and would expect.

I don't have time to work on VS Code features and I don't use it often. It seems possible to do what you are after but might be a lot of work. I think one of the more challenging parts is deciding what actions are configurable and how to allow the user to configure it.

For reference, this is the Visual Studio option.
image

All I did was add the reverse option to VS Code. I added a checkbox to perform word selection when Ctrl is pressed.

@pmoura
Copy link

pmoura commented Jun 19, 2024

Related: #212444

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor-core Editor basic functionality feature-request Request for new features or functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.