DanTup · GitHub

@DanTup

If you did `pub get` on Linux and get that package_config into Windows, this would throw and stop the extension from starting up.
Fixes #5909

@DanTup

gemini-code-assist[bot]

chatgpt-codex-connector[bot]

Pull request overview

Prevents the extension from failing to start when a workspace contains a package_config.json generated on a different OS (for example Linux paths opened on Windows), by making package-map URI parsing more resilient and adding coverage for these scenarios.

Changes:

  • Catch invalid file: URI conversions in the package map loader and return undefined instead of throwing.
  • Make extractFlutterSdkPathFromPackagesFile() return undefined when the derived SDK path does not exist.
  • Expand FS/unit tests to cover cross-OS file: URI cases for both flutterRoot and the Flutter package entry.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
src/test/dart/utils/fs.test.ts Adds tests for cross-OS file: URIs and updates setup to create a fake Flutter root/bin.
src/shared/utils/fs.ts Ensures extracted Flutter SDK path is only returned if it exists on disk.
src/shared/pub/package_map.ts Wraps URI→path conversion in try/catch to avoid crashes on invalid cross-OS URIs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov

Codecov Report

❌ Patch coverage is 58.33333% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 67.61%. Comparing base (d3e3938) to head (bbdaafe).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/shared/pub/package_map.ts 54.54% 3 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #5910      +/-   ##
==========================================
- Coverage   67.65%   67.61%   -0.04%     
==========================================
  Files         169      169
  Lines       12976    12979       +3
  Branches     2564     2566       +2
==========================================
- Hits         8779     8776       -3     
- Misses       3743     3748       +5     
- Partials      454      455       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@DanTup

@DanTup

@DanTup

@DanTup

@DanTup

DanTup deleted the handle-bad-package-map branch

February 18, 2026 12:04

Read the original on github.com ↗