Windows 10虚拟桌面下VS Code多实例文件打开跳转问题咨询
Hey there! I totally get how annoying it is when you try to open a file in your current virtual desktop, only for VS Code to yank you over to another desktop where your last instance was running. Let's get this sorted using the exact configuration you spotted (and a couple more reliable tweaks).
Step 1: Open VS Code Settings
First, pull up your VS Code settings:
- Use the keyboard shortcut
Ctrl+,(comma), or - Click the gear icon in the bottom-left corner and select Settings.
Step 2: Tweak the Key Configuration
You mentioned the "window.openFilesInNe..." setting—this is almost certainly "window.openFilesInNewInstance", which controls whether VS Code reuses an existing instance or spins up a new one when opening files.
Here's what to do:
- In the settings search bar, type
window.openFilesInNewInstanceto locate the setting. - Set its value to
"on". This tells VS Code to always open files in a new instance on your current virtual desktop, instead of jumping to the last-used instance elsewhere.
If you'd prefer to reuse instances but keep them tied to your current desktop (instead of triggering a switch), you can add this extra tweak:
- Search for
"window.restoreWindows"and set it to"none". This prevents VS Code from restoring previous window states across desktops, pairing nicely with the first setting for a seamless fix.
Test the Fix
After adjusting these settings, try opening a file from your current virtual desktop—it should either open in a new VS Code window right there, or in an existing instance on the same desktop, no unwanted virtual desktop switches required.
内容的提问来源于stack exchange,提问作者Gailius

