在 VS Code 中单击鼠标中键滚动

Middle-click scrolling in VS Code

我一直在使用 VS Code 构建我的投资组合网站,实际上我发现它比 Visual Studio 更有效.但我需要中间点击滚动功能,最近似乎每个人都从我们这里拿走了。

我读到另一个 SO 回答说他们对他们的插件不满意 api 所以他们还没有发布它,但是有没有任何快捷方式、选项或隐藏的 东西 可以让我启用鼠标中键滚动吗?或者是否有启用插件支持的秘密方法,以便我可以编写自己的插件或下载插件?

实际上没有办法启用中间点击滚动。 扩展程序 API 即将开放供 public 使用。给他们一点时间来整理所有内容。

据原作者this open GitHub issue thread in vscode repo, as of September 2021 this feature is not implemented bug is not fixed. However, there is this AutoHotKey workaround.. For the sake of completeness of the answer, here is source code, which is licensed under GNU General Public License v3.0称:

; autohotkey script to enable middle mouse button scrolling in VS Code
; with the cursor in a text area, hold down the middle mouse button to scroll
; outside of text areas, middle mouse is unaffected

#IfWinActive ahk_exe Code.exe ; script is only active in VS Code
    MButton:: ; on middle mouse button click, do the following
        ; check if the cursor is in a text area
        ; if no, send a regular middle click
        ; if yes, scroll
        if (A_Cursor != "IBeam") {
            send {MButton}
        } else {
            scroll := true ; activate scroll
            noScrollZone := 10 ; no scrolling until the mouse moves at least this far
            MouseGetPos, xinit , yinit ; initial position of cursor when middle mouse button is clicked
            while scroll { ; loop until middle mouse button is released
                ToolTip, SCROLLING ; visual indication that scroll is active
                MouseGetPos, x , y ; current position of cursor
                ; check the four cases
                if (y < yinit - noScrollZone) ; up
                    send, {WheelUp 1}
                if (y > yinit + noScrollZone) ; down
                    send, {WheelDown 1}
                if (x < xinit - noScrollZone) ; left
                    send, {WheelLeft 1}
                if (x > xinit + noScrollZone) ; right
                    send, {WheelRight 1}
                ; make speed of scroll react to cursor position
                dist := Round( Sqrt( ( x - xinit )**2 + ( y - yinit )**2 ) ) ; cursor's distance from initial position
                sleepTime := Max( 300 - dist, 0 ) ; a lower sleeptime gives a faster scroll
                ; sleepTime:= 100 ; uncomment this line to get a constant scroll speed
                sleep sleepTime ; loop pauses for this length of time
            }
        }
    return
#IfWinActive

#IfWinActive ahk_exe Code.exe ; script is only active in VS Code
    MButton Up:: ; on middle mouse button release, do the following
        scroll := false ; cancel scroll
        ToolTip ; cancel tooltip
    return
#IfWinActive

但是,这没有流畅的滚动。滚动的那种......跳跃。但这是我们目前拥有的最好的。