Why do VS Code extensions run globally instead of per workspace?

Published 2026-05-23 · Updated 2026-05-23

The Ghost in the Machine: Why Your VS Code Extensions Are Everywhere

Ever noticed that extension you painstakingly configured – the one that automatically formats your JavaScript or highlights your Python syntax – seems to be *everywhere* in VS Code? It’s working in your React project, your Vue app, and even your simple HTML file, regardless of which workspace you're currently using. It’s a frustrating quirk that’s puzzled countless developers, and understanding *why* VS Code handles extensions this way is key to optimizing your workflow and avoiding unexpected behavior. It’s not a bug, exactly, but a deliberate design choice rooted in the way VS Code manages its core functionality and its commitment to a consistent experience. Let's unpack it.

The Global Extension Host: A Foundation of Stability

At the heart of VS Code lies the Extension Host. This is a separate process running alongside your main VS Code application. Think of it as a dedicated sandbox where extensions execute their code. The Extension Host’s primary job is to provide a stable and isolated environment for extensions to operate, preventing them from directly interfering with the core VS Code application or with each other. This isolation is crucial for security and stability. If an extension crashes, it doesn't bring down the entire editor.

The design philosophy here is straightforward: create a robust and predictable environment for extensions. This necessitates a global approach. Each extension, regardless of the workspace, is loaded and executed within this host. The VS Code application then communicates with the Extension Host to display the results, handle user input, and manage the overall editor interface. This means that if a formatting extension is loaded, it's running inside the Extension Host, and VS Code is simply displaying the formatted code.

Workspace Context vs. Extension Scope

Now, let's address the question of workspaces. VS Code’s workspace feature allows you to group related files and folders together, providing a context for your development. However, the Extension Host operates on a different principle: it doesn’t inherently understand or respect workspace boundaries. When you open a workspace, VS Code simply presents a collection of files. It doesn’t automatically tell the Extension Host to only load extensions relevant to that particular workspace.

This is where the perceived “global” behavior comes from. The Extension Host is always running, always ready to execute extensions. It’s like a central server for all extension processing, regardless of which folder you're currently working in.

Extension Configuration and the `context` API

The `context` API within VS Code provides a way for extensions to react to specific events and actions within the editor. This API allows extensions to listen for things like key presses, file changes, and even commands. However, the Extension Host doesn't automatically filter these events based on the workspace. An extension configured to respond to a particular key binding will respond to that key binding *everywhere* in VS Code, not just within the current workspace.

For example, a linter extension might be configured to highlight syntax errors when you press Ctrl+Shift+P. This extension will trigger regardless of the project you're working on. This isn’t a limitation of the extension itself, but a consequence of how the Extension Host operates.

Managing Extension Behavior: The `settings.json` File

While the global nature of extensions can be frustrating, you *do* have some control. The `settings.json` file allows you to customize the behavior of extensions, including disabling them entirely. You can also use workspace settings to override global settings, creating a more targeted environment for specific projects.

For example, you could disable a formatting extension in your React project by adding `"editor.formatOnSave": false` to the `settings.json` file within the workspace. This tells VS Code to not automatically format the file when you save it, preventing the extension from interfering with your workflow. You could also use the `extensions.ignoreDiscover` setting to prevent certain extensions from being automatically discovered within a workspace. This is particularly useful for extensions that you don’t want to be automatically suggested or enabled.

Takeaway: Understanding the Architecture

The global behavior of VS Code extensions is a deliberate design choice driven by the Extension Host’s architecture. It prioritizes stability, security, and a consistent experience across all projects. While it can sometimes lead to unexpected behavior, understanding this fundamental principle allows you to manage extension behavior effectively through workspace settings and the `settings.json` file. Don't fight the system; learn to work with it. By recognizing that extensions are running in a separate process, you can avoid frustration and optimize your VS Code workflow for maximum productivity.


Frequently Asked Questions

What is the most important thing to know about Why do VS Code extensions run globally instead of per workspace??

The core takeaway about Why do VS Code extensions run globally instead of per workspace? is to focus on practical, time-tested approaches over hype-driven advice.

Where can I learn more about Why do VS Code extensions run globally instead of per workspace??

Authoritative coverage of Why do VS Code extensions run globally instead of per workspace? can be found through primary sources and reputable publications. Verify claims before acting.

How does Why do VS Code extensions run globally instead of per workspace? apply right now?

Use Why do VS Code extensions run globally instead of per workspace? as a lens to evaluate decisions in your situation today, then revisit periodically as the topic evolves.