Thank you for your interest in contributing to pnpm Workspace! This document provides guidelines and information for contributors.
This extension supports all VS Code environments:
- Local
- Remote (SSH/WSL/Dev Containers)
- Web (github.dev, vscode.dev)
This extension is built with:
- TypeScript
- VS Code Extension API
- ESBuild for bundling
- pnpm for package management
- Node.js >= 22.15.0
- pnpm 10.13.1+
- VS Code
Install these recommended VS Code extensions for the best development experience:
amodio.tsl-problem-matcher- TypeScript problem matcherms-vscode.extension-test-runner- Extension Test Runnerdbaeumer.vscode-eslint- ESLint integration
# Clone the repository
git clone https://github.com/reekystive/vscode-pnpm-workspace.git
cd vscode-pnpm-workspace
# Install dependencies
pnpm install
# Compile the extension
pnpm run compile
# Package the extension
pnpm run package| Command | Description |
|---|---|
pnpm run compile |
Compile the extension with type checking and linting |
pnpm run watch |
Watch for changes and recompile automatically |
pnpm run watch:esbuild |
Watch for changes and rebuild with ESBuild |
pnpm run watch:tsc |
Watch for TypeScript changes |
pnpm run check-types |
Run TypeScript type checking |
pnpm run lint |
Run ESLint |
pnpm run test |
Run tests |
pnpm run package |
Create production build |
# Run all tests
pnpm run test
# Compile tests only
pnpm run compile-tests
# Watch tests
pnpm run watch-tests- Fork and Clone: Fork the repository and clone your fork
- Install Dependencies: Run
pnpm install - Create Branch: Create a feature branch from
main - Develop: Make your changes
- Test: Run
pnpm run testto ensure tests pass - Lint: Run
pnpm run lintto check code style - Build: Run
pnpm run packageto create production build - Commit: Make descriptive commits
- Push: Push to your fork
- PR: Create a Pull Request
- Press
F5in VS Code to launch a new Extension Development Host window - In the new window, open a project with package.json files
- Test the extension commands through the Command Palette (
Ctrl+Shift+PorCmd+Shift+Pon Mac) - Set breakpoints in your code inside
src/extension.tsto debug your extension - Find output from your extension in the debug console
- You can relaunch the extension from the debug toolbar after changing code
- You can also reload (
Ctrl+RorCmd+Ron Mac) the VS Code window to load your changes
- Install the Extension Test Runner
- Run the "watch" task via the Tasks: Run Task command. Make sure this is running, or tests might not be discovered
- Open the Testing view from the activity bar and click the "Run Test" button, or use the hotkey
Ctrl/Cmd + ; A - See the output of the test result in the Test Results view
- Make changes to
src/test/extension.test.tsor create new test files inside thetestfolder - The provided test runner will only consider files matching the name pattern
**.test.ts - You can create folders inside the
testfolder to structure your tests any way you want
- Follow TypeScript best practices
- Use ESLint and Prettier for code formatting
- Write descriptive commit messages
- Include tests for new features
- Update documentation as needed
├── src/
│ ├── extension.ts # Main extension entry point
│ ├── logger.ts # Logging functionality
│ ├── commands.ts # Command implementations
│ ├── pnpm-workspace.ts # pnpm workspace functionality
│ ├── package-scanner.ts # Package discovery logic
│ ├── workspace-discovery.ts # Workspace file discovery
│ ├── virtual-workspace-workaround.ts # Virtual workspace compatibility layer
│ └── test/ # Test files
│ └── fixtures/ # Test fixture workspaces
│ └── simple-workspace/ # Basic pnpm workspace for testing
├── dist/ # Compiled extension bundles
├── out/ # TypeScript output
├── package.json # Extension manifest
├── tsconfig.json # TypeScript configuration
├── esbuild.mjs # ESBuild configuration (dual build)
└── eslint.config.mjs # ESLint configuration
The extension is designed with modularity and cross-platform compatibility in mind:
- Modular Architecture: Code is split into focused modules for maintainability
- VS Code API Only: Uses only VS Code APIs, no Node.js dependencies for file operations
- Virtual Workspace Support: Compatible with virtual file systems and remote workspaces
- Dual Build System: Generates both Node.js and Web bundles from the same source
- URI-based Operations: All file operations use VS Code URIs for cross-platform compatibility
Virtual Workspace File Discovery Issue
Due to VSCode issue #249197, vscode.workspace.findFiles doesn't work properly in virtual workspaces (vscode-test-web, GitHub Codespaces, etc.).
Impact: Complex glob patterns like {packages/*/package.json,scripts/*/package.json} return 0 results even when files exist.
Our Solution:
- The extension implements a dual-strategy approach:
- Primary: Use
findFilesAPI for regular file system workspaces (fast and efficient) - Fallback: Use manual directory traversal with
fs.readDirectoryandfs.statAPIs for virtual workspaces
- Primary: Use
- Detection is automatic based on URI scheme (
file://vs others) - See
src/package-scanner.tsandsrc/workspace-discovery.tsfor implementation details
Testing Virtual Workspaces:
# Test in browser environment
npm run open-in-browser
# Or use vscode-test-web directly
npx vscode-test-web --extensionDevelopmentPath=.scanWorkspacePackages()inpnpm-workspace.ts: Discovers all packages in pnpm workspacegetWorkspaceDependencies()inpnpm-workspace.ts: Extracts workspace dependencies for a packagegetWorkspacePackages()inpnpm-workspace.ts: Gets cached workspace packagesregisterCommands()incommands.ts: Registers all extension commands
This project uses a specific versioning strategy aligned with VS Code extension conventions:
- Stable Releases: Use even minor versions (e.g., 0.4.0, 0.6.0, 1.0.0)
- Pre-releases: Use odd minor versions (e.g., 0.5.123)
The CI/CD pipeline automatically handles versioning:
-
Development Builds (non-tag pushes):
- Validates that
package.jsonminor version is even - Generates version:
{major}.{minor+1}.{ci_run_number} - Example:
0.4.0→0.5.123 - Published as pre-release
- Validates that
-
Release Builds (tag pushes):
- Uses exact version from
package.json - Must be even minor version
- Published as stable release
- Uses exact version from
- Development: Keep
package.jsonat even minor version (e.g.,0.4.0) - Release: Update
package.jsonto next even minor version (e.g.,0.6.0) and create git tag → triggers release with version frompackage.json
This ensures clear separation between development previews and stable releases while adhering to VS Code's versioning constraints.
- Ensure all tests pass
- Update documentation if needed
- Follow the existing code style
- Write clear commit messages
- Submit a Pull Request with a detailed description
When reporting issues, please include:
- VS Code version
- Extension version
- Steps to reproduce
- Expected vs actual behavior
- Any error messages
- Check existing issues and discussions
- Review the VS Code Extension API documentation
- Open the full set of VS Code API by viewing
node_modules/@types/vscode/index.d.ts - Ask questions in the issue tracker
- Bundle your extension to reduce size and improve startup time
- Publish your extension on the VS Code marketplace
- Set up Continuous Integration for automated builds
Thank you for contributing! 🎉