VSCode:如何将MDN参考链接设置为双击触发
Got it, I totally get the frustration of accidentally clicking those MDN links when you just meant to hover over content for a quick reference! Here's how you can switch the trigger to double-click without ditching the feature entirely:
Step-by-Step Solution
1. Turn off single-click opening for hover links
First, we’ll disable the default behavior that opens links on a single click:
- Open VS Code Settings (press
Ctrl+,on Windows/Linux,Cmd+,on Mac) - Search for the setting
editor.hover.openOnClick - Toggle the switch to false — this stops accidental single-clicks from launching the MDN link
2. Bind double-click to open hover links
Next, we’ll set up a double-click shortcut to intentionally open the link when you want to:
- Open the Keyboard Shortcuts editor (press
Ctrl+K Ctrl+Son Windows/Linux,Cmd+K Cmd+Son Mac) - Click the small file icon in the top-right corner of the shortcuts editor to open your
keybindings.jsonfile - Paste the following configuration into the file:
{ "key": "doubleclick", "command": "editor.action.openHoverLink", "when": "hoverVisible && editorTextFocus" }
- Save the file, and you’re all set!
From now on, hovering over content will still bring up the MDN reference popup, but single-clicks won’t do anything. A double-click will open the link exactly when you intend it to.
内容的提问来源于stack exchange,提问作者T S
相关产品推荐
相关产品推荐

