When you open a folder in VS Code and see a banner saying "Do you trust the authors of the files in this folder?" or notice that features like debugging, terminal, and certain extensions are disabled, you're encountering Workspace Trust. This security feature protects you from automatically executing potentially dangerous code in untrusted projects, but it can be confusing when it blocks legitimate work.

Understanding Workspace Trust

VS Code introduced Workspace Trust to protect against malicious code execution. When you open a folder, VS Code asks whether you trust it. If you answer "No" or "Continue in Restricted Mode," VS Code disables:

  • Debugging
  • Task execution
  • Terminal (in workspace folder)
  • Extension activation (for untrusted extensions)
  • Workspace settings
  • Certain editor features

This is important for security, but it can block your workflow when working with your own projects.

Solution 1: Trust the Workspace

The simplest solution is to trust the workspace.

Step 1: When you open a folder, you'll see the trust dialog. Click "Yes, I trust the authors" to enable all features.

Step 2: If you dismissed the dialog, reopen it: - Open Command Palette (Ctrl+Shift+P or Cmd+Shift+P) - Type "Workspace: Manage Workspace Trust" - Select the option

Step 3: In the trust management window, check the box for your workspace and click OK.

Step 4: If you're in Restricted Mode, you'll see an indicator in the status bar. Click it to open the trust management.

Solution 2: Configure Trust for Parent Folders

If you keep opening subfolders within a trusted parent, configure the trust hierarchy.

Step 1: Open Command Palette and run "Workspace: Manage Workspace Trust".

Step 2: In the trust editor, you'll see your current folder and its parent hierarchy.

Step 3: Trust a parent folder to automatically trust all subfolders: - Check the box for C:\Users\YourName\Projects (Windows) - Or /Users/yourname/projects (macOS/Linux) - All subfolders will inherit trust

Step 4: This is especially useful for: - Your main development folder - A git repositories folder - A work projects directory

Solution 3: Disable Workspace Trust Globally

If you find the feature intrusive for your workflow, you can disable it entirely.

Warning: This reduces security. Only do this if you understand the risks and control what you open in VS Code.

Step 1: Open Settings (Ctrl+, or Cmd+,).

Step 2: Search for "workspace trust".

Step 3: Find "Security > Workspace: Trust" and uncheck "Enabled":

json
"security.workspace.trust.enabled": false

Step 4: Or edit settings.json directly:

json
{
  "security.workspace.trust.enabled": false
}

Step 5: Reload VS Code. The trust dialog will no longer appear.

Solution 4: Configure Automatic Trust for Specific Scenarios

You can configure VS Code to automatically trust certain types of workspaces.

Step 1: Open Settings and search for "workspace trust".

Step 2: Find "Start Prompt" setting:

```json // Never show the prompt, always trust "security.workspace.trust.startupPrompt": "never"

// Always show the prompt (default) "security.workspace.trust.startupPrompt": "always" ```

Step 3: Configure what happens when opening empty workspaces:

```json // Trust empty workspaces automatically "security.workspace.trust.emptyWindow": true

// Don't trust empty windows "security.workspace.trust.emptyWindow": false ```

Solution 5: Fix Extension Trust Issues

Some extensions don't work in untrusted workspaces by design.

Step 1: Check if an extension is blocked: - Open Extensions panel (Ctrl+Shift+X) - Look for a warning icon on extensions - The extension description may say "Disabled in Restricted Mode"

Step 2: Check extension settings for workspace trust requirements:

json
// In the extension's package.json, extensions declare:
"capabilities": {
  "untrustedWorkspaces": {
    "supported": false  // Extension won't run in untrusted workspaces
  }
}

Step 3: To use the extension, you must trust the workspace (see Solution 1).

Step 4: Some extensions have partial support:

json
// Extensions can define limited functionality for untrusted workspaces
"capabilities": {
  "untrustedWorkspaces": {
    "supported": "limited",
    "restrictedConfigurations": [
      "extension.someSetting"
    ]
  }
}

Solution 6: Handle Remote Development Trust Issues

Remote development (SSH, Containers, WSL) has additional trust considerations.

For Remote SSH: - Trust is managed per remote machine - Each remote folder must be trusted independently - Trust state is stored on the remote machine

Step 1: When connecting to a remote, you'll see a trust prompt for the remote folder.

Step 2: Trust the remote workspace: - Command Palette > "Workspace: Manage Workspace Trust" - Trust the remote folder

For Dev Containers: - Trust applies to the container workspace - Rebuilding the container may reset trust - Trust the container's workspace folder

For WSL: - Trust is managed within the WSL filesystem - Trust /home/username/projects or similar folders

Solution 7: Manage Trust Across Multiple Machines

If you sync settings, trust decisions may not sync correctly.

Step 1: Trust decisions are stored in: - Windows: %APPDATA%\Code\User\globalStorage\ms-vscode.workspace-trust\... - macOS: ~/Library/Application Support/Code/User/globalStorage/ms-vscode.workspace-trust/... - Linux: ~/.config/Code/User/globalStorage/ms-vscode.workspace-trust/...

Step 2: These trust decisions don't sync via Settings Sync.

Step 3: On each machine, re-trust your commonly used folders.

Step 4: For consistent behavior, consider: - Disabling workspace trust on all machines - Using a consistent folder structure across machines - Storing trust configuration in a script:

bash
# Trust a folder via command line
code --trust <folder-path>

Solution 8: Troubleshoot Stuck Restricted Mode

Sometimes VS Code gets stuck in Restricted Mode even after trusting the workspace.

Step 1: Check the status bar for the shield icon indicating Restricted Mode.

Step 2: Click the shield icon and verify trust status.

Step 3: If it shows as trusted but still behaves as restricted: - Reload the window: Command Palette > "Developer: Reload Window" - If that fails, restart VS Code completely

Step 4: Clear trust storage and re-trust:

Close VS Code, then delete: `` Windows: %APPDATA%\Code\User\globalStorage\ms-vscode.workspace-trust macOS: ~/Library/Application Support/Code/User/globalStorage/ms-vscode.workspace-trust Linux: ~/.config/Code/User/globalStorage/ms-vscode.workspace-trust

Restart VS Code and re-trust your workspaces.

Solution 9: Understand What's Disabled in Restricted Mode

Knowing what's disabled helps you understand why features aren't working.

Features disabled in Restricted Mode: - Debugging (all configurations) - Tasks (npm scripts, build tasks, etc.) - Terminal restricted to outside the workspace folder - Extensions that require trust - Workspace settings modifications - Certain settings that affect code execution

Features still available: - File editing - Extension browsing and installation - Source control (Git operations) - Settings (user-level only) - Keyboard shortcuts - Theme changes

To check if a feature is blocked: - Hover over disabled UI elements - Check the status bar for the Restricted Mode indicator - Look at the Debug panel—it shows "Debugging is disabled in Restricted Mode"

After understanding and configuring Workspace Trust, you can work productively while maintaining appropriate security. For personal projects in controlled environments, disabling or globally trusting your development folders is reasonable. For untrusted code (code reviews, open-source contributions, client projects), keeping Restricted Mode provides important protection.