Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .claude/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"allow": [
"WebFetch(domain:prettier.io)",
"WebFetch(domain:code.visualstudio.com)",
"Bash(pnpm prettier:*)",
"Bash(pnpm lint:*)",
"Bash(npm run prettier:*)",
"Bash(npm run lint:*)",
"mcp__ide__getDiagnostics"
],
"deny": [],
Expand Down
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},

// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "pnpm install",
"postCreateCommand": "npm install",

// Run as the node user for better security.
"remoteUser": "node"
Expand Down
6 changes: 3 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
## Checklist

- [ ] I have read the [CONTRIBUTING](https://github.com/prettier/prettier-vscode/blob/main/CONTRIBUTING.md) guidelines
- [ ] My code follows the code style of this project (`pnpm lint` passes)
- [ ] I have run `pnpm prettier` to format my code
- [ ] My code follows the code style of this project (`npm run lint` passes)
- [ ] I have run `npm run prettier` to format my code
- [ ] I have added/updated tests that prove my fix or feature works
- [ ] All new and existing tests pass (`pnpm test`)
- [ ] All new and existing tests pass (`npm test`)
- [ ] I have updated the [CHANGELOG.md](https://github.com/prettier/prettier-vscode/blob/main/CHANGELOG.md) with a summary of my changes
12 changes: 6 additions & 6 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ This is the official Prettier VS Code extension (`prettier.prettier-vscode`). It

## Development

- Use `pnpm` as the package manager
- Run `pnpm install` to install dependencies
- Run `pnpm compile` to build for development
- Run `pnpm test` to run tests (no VS Code instance can be running)
- Run `pnpm lint` to check linting
- Run `pnpm prettier` to format code
- Use `npm` as the package manager
- Run `npm install` to install dependencies
- Run `npm run compile` to build for development
- Run `npm run test` to run tests (no VS Code instance can be running)
- Run `npm run lint` to check linting
- Run `npm run prettier` to format code

## Architecture

Expand Down
9 changes: 4 additions & 5 deletions .github/instructions/workflows.instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ applyTo: ".github/workflows/*.yaml"

## Package Manager

- Use `pnpm` as the package manager
- Include `pnpm/action-setup@v4` before running pnpm commands
- Use `npm` as the package manager
- Use `actions/setup-node@v6` with `node-version-file: ".nvmrc"`

## Checkout and Setup Pattern
Expand All @@ -17,15 +16,15 @@ applyTo: ".github/workflows/*.yaml"
- uses: actions/setup-node@v6
with:
node-version-file: ".nvmrc"
- uses: pnpm/action-setup@v4
- run: pnpm install
- run: npm ci
```

## Testing

- Linux tests require Xvfb for display: `/usr/bin/Xvfb :99 -screen 0 1024x768x24`
- Set `DISPLAY: ":99.0"` environment variable for tests on Linux
- Tests run via `pnpm test`
- Tests run via `npm test`
- Include `pnpm/action-setup@v4` in test jobs - some test fixtures use `packageManager: pnpm` to verify pnpm compatibility

## Permissions

Expand Down
35 changes: 17 additions & 18 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@ jobs:
- uses: actions/setup-node@v6
with:
node-version-file: ".nvmrc"
- uses: pnpm/action-setup@v4
- run: pnpm install
- run: pnpm lint
- run: pnpm prettier --check
- run: npm ci
- run: npm run lint
- run: npm run prettier -- --check

test:
runs-on: ${{ matrix.os }}
Expand All @@ -29,16 +28,17 @@ jobs:
- uses: actions/setup-node@v6
with:
node-version-file: ".nvmrc"
# pnpm is needed for test fixtures that use packageManager: pnpm
- uses: pnpm/action-setup@v4
- run: corepack enable
shell: bash
with:
version: 10

- run: /usr/bin/Xvfb :99 -screen 0 1024x768x24 > /dev/null 2>&1 & echo "Started xvfb"
shell: bash
if: ${{ success() && matrix.os == 'ubuntu-latest' }}

- run: pnpm install
- run: pnpm test
- run: npm ci
- run: npm test
env:
DISPLAY: ":99.0"

Expand All @@ -50,10 +50,10 @@ jobs:
- uses: actions/setup-node@v6
with:
node-version-file: ".nvmrc"
- uses: pnpm/action-setup@v4
- run: pnpm install
- run: pnpm exec playwright install --with-deps chromium
- run: pnpm test:web
- run: npm ci
- run: npx playwright install --with-deps chromium
- run: npm run test:web

package:
runs-on: ubuntu-latest
needs: [lint, test, test-web]
Expand All @@ -63,16 +63,16 @@ jobs:
- uses: actions/setup-node@v6
with:
node-version-file: ".nvmrc"
- uses: pnpm/action-setup@v4
- run: pnpm install
- run: pnpm compile
- run: npm ci
- run: npm run compile
- run: npx @vscode/vsce package --no-dependencies
- run: echo "VSIX_PATH=$(find . -maxdepth 1 -type f -iname "*.vsix" | head -1)" >> $GITHUB_ENV
- run: echo "VSIX_NAME=$(basename $(find . -maxdepth 1 -type f -iname "*.vsix" | head -1))" >> $GITHUB_ENV
- uses: actions/upload-artifact@v5
with:
path: ${{ env.VSIX_PATH }}
name: ${{ env.VSIX_NAME }}

release:
runs-on: ubuntu-latest
needs: package
Expand All @@ -83,7 +83,6 @@ jobs:
- uses: actions/setup-node@v6
with:
node-version-file: ".nvmrc"
- uses: pnpm/action-setup@v4
- name: Check if prerelease
id: check_prerelease
run: |
Expand All @@ -92,8 +91,8 @@ jobs:
else
echo "is_prerelease=false" >> $GITHUB_OUTPUT
fi
- run: pnpm install
- run: pnpm compile
- run: npm ci
- run: npm run compile
- run: npx @vscode/vsce package --no-dependencies ${{ steps.check_prerelease.outputs.is_prerelease == 'true' && '--pre-release' || '' }}
- run: echo "VSIX_PATH=$(find . -maxdepth 1 -type f -iname "*.vsix" | head -1)" >> $GITHUB_ENV
- run: echo "VSIX_NAME=$(basename $(find . -maxdepth 1 -type f -iname "*.vsix" | head -1))" >> $GITHUB_ENV
Expand Down
6 changes: 4 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ node_modules
*.log
test-results.xml

# Generated pnpm lockfiles in test fixtures (npm lockfiles are tracked)
test-fixtures/**/pnpm-lock.yaml
# Generated lockfiles in test fixtures
test-fixtures/**/package-lock.json
test-fixtures/**/pnpm-lock.yaml
test-fixtures/**/yarn.lock
2 changes: 1 addition & 1 deletion .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ out/
dist/
test-fixtures/
node_modules/
pnpm-lock.yaml
package-lock.json
2 changes: 1 addition & 1 deletion .vscodeignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ tsconfig.scripts.json
eslint.config.mjs
lefthook.yml
esbuild.mjs
pnpm-lock.yaml
package-lock.json
dist/*.map

node_modules/
Expand Down
26 changes: 13 additions & 13 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,31 +10,31 @@ This is the official Prettier VS Code extension (`prettier.prettier-vscode`). It

```bash
# Install dependencies
pnpm install
npm install

# Build for development
pnpm compile
npm run compile

# Build for production
pnpm package
npm run package

# Watch mode (esbuild + TypeScript type checking)
pnpm watch
npm run watch

# Run linting
pnpm lint
npm run lint

# Format code with Prettier
pnpm prettier
npm run prettier

# Run tests (requires no VS Code instance running)
pnpm test
npm test

# Run web extension tests (headless browser)
pnpm test:web
npm run test:web

# Compile tests only
pnpm compile:test
npm run compile:test
```

## Running Tests
Expand All @@ -44,16 +44,16 @@ pnpm compile:test
Tests require the `test-fixtures/` workspace and run inside a VS Code instance:

1. **Via VS Code Debug**: Open Debug sidebar → "Launch Tests"
2. **Via CLI**: `pnpm test` (no VS Code instance can be running)
2. **Via CLI**: `npm test` (no VS Code instance can be running)

Before running tests, `pnpm pretest` installs dependencies in various test fixture directories.
Before running tests, `npm run pretest` installs dependencies in various test fixture directories.

### Web Extension Tests

Web tests run in a headless Chromium browser to verify the web extension works correctly:

```bash
pnpm test:web
npm run test:web
```

Web tests are located in `src/test/web/suite/` and test the extension's browser functionality.
Expand Down Expand Up @@ -102,7 +102,7 @@ esbuild produces two bundles:

The browser build uses path aliasing to swap `ModuleResolver` → `BrowserModuleResolver`.

Build configuration is in `esbuild.js`.
Build configuration is in `esbuild.mjs`.

## Test Fixtures

Expand Down
33 changes: 16 additions & 17 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ Thank you for your interest in contributing to the Prettier VS Code extension! F
## Prerequisites

- [Node.js](https://nodejs.org/) (see `.nvmrc` for version)
- [pnpm](https://pnpm.io/) (v10.24.0 or later)
- [Visual Studio Code](https://code.visualstudio.com/)

## Getting Started
Expand All @@ -20,32 +19,32 @@ Thank you for your interest in contributing to the Prettier VS Code extension! F
2. Install dependencies:

```bash
pnpm install
npm install
```

3. Build the extension:
```bash
pnpm compile
npm run compile
```

## Development

### Common Commands

```bash
pnpm install # Install dependencies
pnpm compile # Build for development (esbuild + type checking)
pnpm compile:test # Compile tests only
pnpm watch # Build and watch for changes
pnpm lint # Run ESLint
pnpm prettier # Format code with Prettier
pnpm test # Run tests
npm install # Install dependencies
npm run compile # Build for development (esbuild + type checking)
npm run compile:test # Compile tests only
npm run watch # Build and watch for changes
npm run lint # Run ESLint
npm run prettier # Format code with Prettier
npm test # Run tests
```

### Running the Extension

1. Open this repository in VS Code
2. Run `pnpm compile` to build
2. Run `npm run compile` to build
3. Press `F5` or go to Debug sidebar → "Run Extension"
4. A new VS Code window will open with the extension loaded

Expand All @@ -61,23 +60,23 @@ Tests run inside a VS Code instance and use the `test-fixtures/` workspace.
**Desktop Tests (Via CLI):**

```bash
pnpm test
npm test
```

> **Note:** No VS Code instance can be running when using the CLI, or tests won't start.

**Web Extension Tests:**

```bash
pnpm test:web
npm run test:web
```

This runs the extension in a headless Chromium browser to verify the web extension works correctly.

## Code Style

- Code is formatted with Prettier (run `pnpm prettier` before committing)
- Linting is enforced with ESLint (run `pnpm lint` to check)
- Code is formatted with Prettier (run `npm run prettier` before committing)
- Linting is enforced with ESLint (run `npm run lint` to check)
- Pre-commit hooks automatically format and lint staged files

## Architecture Overview
Expand All @@ -96,8 +95,8 @@ Key components:
## Submitting Changes

1. Fork the repository and create a branch for your changes
2. Make your changes and ensure tests pass (`pnpm test`)
3. Run `pnpm lint` and `pnpm prettier` to ensure code style compliance
2. Make your changes and ensure tests pass (`npm test`)
3. Run `npm run lint` and `npm run prettier` to ensure code style compliance
4. Submit a pull request with a clear description of your changes

For bug fixes, please include a test case that demonstrates the fix when possible.
Loading
Loading