Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why is VS Code making me use "option + click" to open editor links instead of "cmd + click" on macOS? [duplicate]

My VS Code recently started to invert the system shortcuts from command to option.
As you can see here, the option to open a link is now option+click when it was cmd+click. enter image description here

And the keybindings for open link is set as system enter image description here

This made me think that the mac shortcuts (the system) should have changed.. but all the mac shortcuts are still using command, as shown in this setting: enter image description here

I'm very confused, as I don't know what caused this and how to revert it back. I tried working with this, but it's really annoying!

How can I revert this?

like image 785
Lughino Avatar asked Sep 08 '25 17:09

Lughino


1 Answers

What modifier is used for opening links is defined to not conflict with whatever modifier you have chosen for working with multiple cursors. When you have set editor.multiCursorModifier to "alt", you get cmd + click for clicking links, and if you set editor.multiCursorModifier to "ctrlCmd", then you get option + click.

The docs for the multi-cursor modifier support this:

The Go to Definition and Open Link gestures will also respect this setting and adapt such that they do not conflict.

The description text for the editor.multiCursorModifier setting also says something to that effect.

The default value of editor.multiCursorModifier is "alt", so I'm guessing you changed it to "ctrlCmd".

You can cross-check with the source code too: The relevant code is in src/vs/editor/contrib/links/browser/links.ts. The string constants you see ("Follow link" and "option + click") are in the getHoverMessage function, where you can see that the choice of whether option or cmd depends on a parameter named useMetaKey. The only caller of getHoverMessage is _getOptions- a private static function property of the LinkOccurrence class. _getOptions is used in its public, static decoration function property, and activate and deactivate instance function properties, which all just pass along useMetaKey parameters of their own. If you look for usages of the LinkOccurrence class, you'll see those functions used in the following places: updateDecorations, _onEditorMouseMove, and cleanUpActiveLinkDecoration, in each of which where useMetaKey = (this.editor.getOption(EditorOption.multiCursorModifier) === 'altKey');.

like image 171
starball Avatar answered Sep 10 '25 07:09

starball