Skip to content

fix(vscode): vscode state database path detection to support shared storage#894

Open
BrainlessDip wants to merge 1 commit intoamnweb:mainfrom
BrainlessDip:fix/vscode
Open

fix(vscode): vscode state database path detection to support shared storage#894
BrainlessDip wants to merge 1 commit intoamnweb:mainfrom
BrainlessDip:fix/vscode

Conversation

@BrainlessDip
Copy link
Copy Markdown
Contributor

Fixes issues caused by VS Code 1.118+ moving history.recentlyOpenedPathsList from global storage to shared storage.

This change introduces a new utility to dynamically resolve the correct state.vscdb path instead of relying on a hardcoded location.

What was done

  • Added get_state_db_path() helper to determine the correct database path at runtime

  • Implemented detection of shared storage by:

    • Locating product.json from the latest VS Code installation
    • Reading sharedDataFolderName to resolve the shared storage directory
    • Constructing the shared DB path:
      ~/<sharedDataFolderName>/sharedStorage/state.vscdb
  • Added existence checks to ensure the shared DB is actually available before using it

  • Implemented fallback to legacy global storage:
    %APPDATA%\Code\User\globalStorage\state.vscdb

  • Added find_vscode_product_json() to safely locate the correct product.json from installed versions

Refactors

  • Replaced all hardcoded global storage paths with get_state_db_path() in:

    • VSCodeProvider
    • YASB VSCode widget

This approach avoids hardcoding .vscode-shared and instead adapts based on the user’s actual environment, making it future-proof and more reliable.

…torage

Extract VSCode state database path resolution into a dedicated utility function to support both standard and shared storage configurations. Add automatic detection of VSCode installation via product.json to determine the correct sharedDataFolderName, falling back to the default APPDATA location when shared storage is not configured or detection fails.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant