I'm searching for an extension for VS Code something like this:
https://marketplace.visualstudio.com/items?itemName=norachuga.MiddleClickDefinition
It's natively supported in WebStorm, and I want to switch to VSC and it's really annoying.
I didn't find any results on google.
Is any good tutorial or code snipped on how to create one?
Author Credit: https://github.com/danielsamuels
For those of you who are looking for a short term fix for this, I've created an AutoHotkey script which provides middle-click Go To Definition behaviour:
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#IfWinActive ahk_exe Code.exe
~MButton::
MouseGetPos, xpos, ypos
if (ypos >= 87) {
SendInput,{Click}{F12}
}
return
Copy the above contents into a file named vscode-f12-go-to-definition.ahk and run it. You'll see a green H icon in your systray which shows it's running.
The AutoHotkey v2 translation of https://mcmap.net/q/1342421/-visual-studio-code-extension-mouse-middle-click-go-to-definition by Pedro Barreto is
If WinActive("ahk_exe Code.exe") {
~MButton::{
MouseGetPos &xpos, &ypos
if (ypos >= 87) {
SendInput "{Click}{F12}"
}
}
}
I have tested on my Visual Code in Windows 10 and it works.
By the way, this end (middle click to go to definition on Visual Studio Code) can be reached at different layers. For example, if your mouse happens to be a Logitech one, its Logitech Options(+) software allows you to do an application-specific mouse button remapping, so that you can simulate Ctrl / Alt + Left Click with your Middle Button when the context is Visual Studio Code. The good part of this approach is that it works across Windows and macOS, i.e. you don't need to write an equivalent script with Karabiner-Elements on mac.
^ The above screenshot shows simulating an Alt + Left Click with the Middle Button when the active application is Visual Studio Code.
© 2022 - 2025 β McMap. All rights reserved.