Skip to content

fix: skip VS filesystem scan on macOS/Linux to prevent extension hang (#611)#615

Merged
rajbos merged 1 commit intomainfrom
rajbos/fix-vs-discovery-hang-macos-linux
Apr 17, 2026
Merged

fix: skip VS filesystem scan on macOS/Linux to prevent extension hang (#611)#615
rajbos merged 1 commit intomainfrom
rajbos/fix-vs-discovery-hang-macos-linux

Conversation

@rajbos
Copy link
Copy Markdown
Owner

@rajbos rajbos commented Apr 17, 2026

Problem

Fixes #611 (related: #493)

On macOS and Linux, the extension was hanging on startup from version 0.0.22 onwards. The last log entry before the hang was:

[1:19:57 PM] 📁 Crush: found 0 project(s) in projects.json

Root Cause

VisualStudioDataAccess._discoverFromFilesystem() performs a recursive filesystem scan of the user's home directory at depth 7, looking for .vs/copilot-chat/sessions/ paths (Visual Studio project directories).

On macOS and Linux, Visual Studio doesn't exist — .vs/ directories are never created. However, the scan still walked through all subdirectories of ~/ synchronously using readdirSync, which on a typical developer machine (with many workspaces and deeply nested project trees) caused the extension to appear completely frozen.

Fix

Add an early-exit guard at the top of _discoverFromFilesystem():

if (os.platform() !== 'win32') { return; }

Visual Studio is a Windows-only application (Visual Studio for Mac was discontinued). There are no .vs/ session directories to find on macOS or Linux, so the scan is skipped entirely on those platforms. The log-based discovery path (_discoverFromLogs) is unaffected — it already exits early when the %LOCALAPPDATA%\Temp\VSGitHubCopilotLogs directory doesn't exist.

Testing

  • TypeScript compiles cleanly (tsc --noEmit — 0 errors)
  • Extension bundles cleanly (node esbuild.js)
  • On Windows: behaviour unchanged — full filesystem scan still runs

The _discoverFromFilesystem() method in VisualStudioDataAccess recursively
scanned the user's home directory (depth 7) looking for .vs/ directories.
On macOS and Linux, Visual Studio does not exist and .vs/ directories are
never created, so this scan was traversing thousands of directories
synchronously -- causing the extension to hang on startup.

Fixes: #611 (related: #493)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@rajbos rajbos enabled auto-merge (squash) April 17, 2026 20:41
@rajbos rajbos merged commit 946a8f5 into main Apr 17, 2026
17 checks passed
@rajbos rajbos deleted the rajbos/fix-vs-discovery-hang-macos-linux branch April 17, 2026 20:43
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.

[BUG][vscode] Extension hangs during load

1 participant