If you are a Visual Studio Code (VSCode) user, you may have noticed in 2025 that using the "Go to Definition" command or its shortcut (such as F12, Ctrl+Click, or Cmd+Click) often opens the target file in Preview Mode by default. This behavior can be inconvenient if you work with multiple files, as the preview tab is easily replaced by other files, interrupting your workflow and causing confusion when switching between definitions and files.
As of the 2025 release, there remains high community demand for a dedicated setting to disable preview mode specifically for Go to Definition, but the core workflow remains similar. Here is how you can manage the preview behavior and take advantage of improvements in VSCode:
How to Change Go to Definition Preview Behavior in VSCode (2025):
Open VSCode settings by pressing Ctrl + , (Windows/Linux) or Cmd + , (Mac).
Search for "workbench.editor.enablePreview" in the settings search bar.
Set Enable Preview to false (uncheck the box for "Enable Preview"). This will force editors (including those opened via Go to Definition) to open as permanent tabs rather than preview tabs. Preview tabs are highlighted with italic titles and are replaced by other files if not pinned.
Optionally, you can also search for "workbench.editor.enablePreviewFromQuickOpen" and set it to false, which affects files opened from Quick Open (Ctrl+P).
To make this change directly in your settings.json, add or update the following lines:
{ "workbench.editor.enablePreview": false, "workbench.editor.enablePreviewFromQuickOpen": false }
After these changes, using Go to Definition (via F12, Ctrl+Click, or Cmd+Click) will open files in a regular non-preview tab, and they won't be replaced by subsequent navigation actions. This helps maintain a stable, clutter-free workspace while navigating through code [source] [source].
Tip: If you'd still like to see a quick definition preview without opening a full tab, use Peek Definition by selecting a symbol and pressing Alt+F12. This opens an inline window without switching files.
This approach works for all language extensions supporting Go to Definition. Some extensions may have additional configuration options, so check their documentation if needed.
Did you know?
VSCode’s 2025 releases come with several innovative features to further enhance your coding experience:
Unified Chat and AI Agent Flows: The new Unified Chat view integrates AI-powered code chat and agentic code-editing sessions, allowing for fast code modifications and autonomous workflow support directly in the editor [source].
Remote Development: Seamlessly develop in containers, on remote machines, or via Windows Subsystem for Linux (WSL) for a consistent environment everywhere.
GitHub Codespaces Integration: Launch and manage consistent, cloud-based development environments directly from GitHub, improving collaboration and onboarding.
AI-Powered Code Suggestions: Leverage advanced AI suggestions that learn from your coding style, boosting productivity and reducing errors.
Enhanced Debugging Tools: Improved support for inline breakpoints, call stack navigation, and real-time debugging insights.
Improved Live Share: Better collaborative coding with shared debugging, audio, and video features for smoother pair programming sessions.
With these updates and fine-tuned settings like disabling preview mode for Go to Definition, VSCode in 2025 continues to be a top choice for modern developers seeking efficiency and minimal distraction.