Repository navigation
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes a Windows startup crash in pyright-scip by removing the platform-derived RegExp(path.sep) (which is invalid on Windows) and replacing it with a safe separator-matching regex that works across both Windows (\) and POSIX (/) path styles.
Changes:
- Replace
new RegExp(path.sep, 'g')with a safe cross-platform separator regex (/[\\/]/g). - Add a regression test ensuring module resolution works with both Windows-style and POSIX-style separators in package file paths.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/pyright-scip/src/virtualenv/PythonEnvironment.ts | Uses a safe, cross-platform separator regex to avoid Windows RegExp initialization crashes and handle mixed path styles. |
| packages/pyright-scip/src/virtualenv/PythonEnvironment.test.ts | Adds coverage to confirm module resolution works for both \ and / separators. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
I can confirm the startup crash on Windows (SyntaxError: Invalid regular expression: //g: \ at end of pattern). It happens with every 0.6.x release (0.6.6–0.6.8) on Windows 11 with Node 26, so scip-python can’t be used on Windows at all right now. Happy to help test. Thanks! |
|
Tested this change on Windows, in case it helps the review. Setup: Windows 11, Node.js 26.13.1,
One more Windows issue, separate from this PR: the emitted |
What changed
\and/Why
On Windows,
path.sepis\. Passing it directly tonew RegExp()creates an invalid regular expression and crashesscip-pythonduring module initialization. This addresses #210.Accepting both separators also keeps package resolution robust when Python metadata contains mixed path styles.
Validation
npm test -- --runInBand— 2 suites, 8 tests passednpm run check:prettier— passednpm run build-agent— passed