我正在寻找 VS Code 的扩展,如下所示:
https://marketplace.visualstudio.com/items?itemName=norachuga.MiddleClickDefinition
WebStorm 原生支持它,我想切换到 VSC,真是烦人。
我在谷歌上没有找到任何结果。
有没有关于如何创建一个好的教程或代码?
作者信用:https://github.com/danielsamuels
对于那些正在寻找短期解决方案的人,我创建了一个 AutoHotkey 脚本,它提供了中键单击“转到定义”行为:
#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
将上述内容复制到名为 vscode-f12-go-to-definition.ahk 的文件中并运行。您将在系统托盘中看到一个绿色的 H 图标,表明它正在运行。
Pedro Barreto 的 https://stackoverflow.com/a/71694023/9373509 的 AutoHotkey v2 翻译是
If WinActive("ahk_exe Code.exe") {
~MButton::{
MouseGetPos &xpos, &ypos
if (ypos >= 87) {
SendInput "{Click}{F12}"
}
}
}
我已经在 Windows 10 中测试了我的可视化代码,它可以工作。