Home > OS >  Visual Studio Code extension - mouse middle click go to definition
Visual Studio Code extension - mouse middle click go to definition

Time:04-01

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?

CodePudding user response:

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.

  • Related