如何在VSCode中隐藏默认菜单项?解决HiDPI屏幕菜单显示不全问题
Hey Igor, sorry to hear you're dealing with this messy, truncated View menu on your 13-inch HiDPI laptop—high-res displays can be finicky with app menus, but we’ve got a straightforward fix for hiding those zoom options you don’t need in the menu.
Since you’re already comfortable with the command panel, this solution won’t take away your ability to access zoom functions when you need them—it just cleans up the View menu so it fits properly and looks neat. Here’s how to do it:
Open your user settings JSON file
- Bring up the command panel (press
Ctrl+Shift+Pon Windows/Linux, orCmd+Shift+Pon Mac) - Type
Preferences: Open User Settings (JSON)and select that option
- Bring up the command panel (press
Add the menu customization config
Paste this snippet into your settings JSON file (make sure it’s within the curly braces{}of your existing settings):"menus": { "view/zoom": [ { "command": "workbench.action.zoomIn", "when": "false" }, { "command": "workbench.action.zoomOut", "when": "false" }, { "command": "workbench.action.zoomReset", "when": "false" } ] }Save and refresh VSCode
Save the settings file, and you’ll see the Zoom In, Zoom Out, and Reset Zoom options disappear from the View menu right away. If changes don’t show up immediately, a quick restart of VSCode will do the trick.
A quick note: You can still access all zoom functions via the command panel whenever you want—just search for "Zoom In", "Zoom Out", or "Reset Zoom" like you normally would. And if you ever want those menu items back, just delete the snippet above or change "when": "false" to "when": "true".
内容的提问来源于stack exchange,提问作者Igor

