Conversation
This PR adds path mapping functionality to enable seamless integration between JetBrains IDEs and VS Code when projects are located in different environments (e.g., Windows host vs. Docker container). ### Added - Path mapping configuration with three new settings: - vscode-jetbrains-sync.pathMapping.enabled: Enable/disable the feature - vscode-jetbrains-sync.pathMapping.sourcePattern: Regex pattern to match source paths - vscode-jetbrains-sync.pathMapping.targetPath: Target path for replacement ### Improved - Error messages now show transformed paths instead of original paths - Better configuration UI with examples and descriptions - Robust error handling for invalid regex patterns ### Use Case When the same project is open in: - JetBrains IDE on Windows: I:/_SendAPI/sendapi-projects-root-v01/ - VS Code in Docker container: /workspace/ The extension now transforms incoming file paths automatically: I:/_SendAPI/sendapi-projects-root-v01/service/app.js → /workspace/service/app.js ### Testing - Path transformation works correctly with regex patterns - Error handling for invalid patterns - Configuration UI displays properly - Backwards compatibility maintained when feature is disabled
There was a problem hiding this comment.
Pull Request Overview
This PR adds path mapping functionality to enable seamless integration between JetBrains IDEs and VS Code when projects are located in different environments, such as Windows host vs Docker container. The feature allows automatic transformation of incoming file paths using regex patterns.
- Adds configurable path mapping with source pattern matching and target path replacement
- Transforms file paths in error messages to show mapped paths instead of original paths
- Includes comprehensive configuration settings with examples and validation
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| vscode-extension/src/extension.ts | Implements path transformation logic and applies it to incoming file operations |
| vscode-extension/package.json | Adds three new configuration settings for path mapping functionality |
| vscode-extension/CHANGELOG.md | Minor formatting change with empty line addition |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
- Optimize path transformation by calling transformIncomingFilePath only once per method - Improve error message specificity by indicating which configuration values are missing - Move path transformation to beginning of handleIncomingState method to avoid redundant computation
There was a problem hiding this comment.
Pull Request Overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| } | ||
|
|
||
| try { | ||
| const regex = new RegExp(sourcePattern, 'g'); |
There was a problem hiding this comment.
Using the global flag 'g' with replace() can cause unexpected behavior when the same RegExp object is reused, as it maintains state between calls. Consider removing the 'g' flag since replace() will replace all occurrences by default when using a string replacement.
| const regex = new RegExp(sourcePattern, 'g'); | |
| const regex = new RegExp(sourcePattern); |
| "type": "string", | ||
| "default": "", | ||
| "description": "Target path to replace the matched source pattern", | ||
| "scope": "window", |
There was a problem hiding this comment.
There's trailing whitespace after the comma on this line. Remove the extra space for consistency.
| "scope": "window", | |
| "scope": "window", |
This PR adds path mapping functionality to enable seamless integration between JetBrains IDEs and VS Code when projects are located in different environments (e.g., Windows host vs. Docker container).
Added
Improved
Use Case
When the same project is open in:
The extension now transforms incoming file paths automatically:
I:/_SendAPI/sendapi-projects-root-v01/service/app.js → /workspace/service/app.js
Testing