Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
26 changes: 14 additions & 12 deletions .github/REVIEW_GUIDELINES.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,22 @@
Please keep these principles in mind while reviewing or submitting a PR:

### Author Responsibilities
- **Be descriptive.** Include relevant context, especially for UX-affecting or feature-level changes.
- **Keep it focused.** Don’t combine unrelated features, refactors, or style changes in a single PR.
- **Add tests.** Include or update unit/integration tests where possible.
- **Tag reviewers.** Assign reviewers familiar with the code area or issue.
- **Surface important diffs.** Use comments to draw attention to anything non-obvious or potentially controversial.
- **Ensure stability.** Double-check that this change doesn’t break core features like connection flow, query execution, or the editor UI.

- **Be descriptive.** Include relevant context, especially for UX-affecting or feature-level changes.
- **Keep it focused.** Don’t combine unrelated features, refactors, or style changes in a single PR.
- **Add tests.** Include or update unit/integration tests where possible.
- **Tag reviewers.** Assign reviewers familiar with the code area or issue.
- **Surface important diffs.** Use comments to draw attention to anything non-obvious or potentially controversial.
- **Ensure stability.** Double-check that this change doesn’t break core features like connection flow, query execution, or the editor UI.

### Reviewer Responsibilities
- **Understand the context.** Read the PR description before reviewing code.
- **Don't rubber-stamp.** Approve only after reviewing the actual code changes.
- **Request missing tests.** If there’s logic but no tests, ask why.
- **Call out breaking behavior.** Note anything that might affect extensions, users, or existing workflows.
- **Follow up.** Don’t complete PRs with unresolved threads unless explicitly delegated.

- **Understand the context.** Read the PR description before reviewing code.
- **Don't rubber-stamp.** Approve only after reviewing the actual code changes.
- **Request missing tests.** If there’s logic but no tests, ask why.
- **Call out breaking behavior.** Note anything that might affect extensions, users, or existing workflows.
- **Follow up.** Don’t complete PRs with unresolved threads unless explicitly delegated.

## Additional Notes

*Add anything extra reviewers should be aware of – links to specs, design docs, screenshots, test logs, telemetry updates, or any TODOs still in scope.*
_Add anything extra reviewers should be aware of – links to specs, design docs, screenshots, test logs, telemetry updates, or any TODOs still in scope._
13 changes: 6 additions & 7 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,14 @@

## Description

*Provide a clear, concise summary of the changes in this PR. What problem does it solve? Why is it needed? Link any related issues using [issue closing keywords](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue).*
_Provide a clear, concise summary of the changes in this PR. What problem does it solve? Why is it needed? Link any related issues using [issue closing keywords](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue)._

## Code Changes Checklist

- [ ] New or updated **unit tests** added
- [ ] All existing tests pass (`npm run test`)
- [ ] Code follows [contributing guidelines](https://github.com/microsoft/vscode-mssql/blob/main/CONTRIBUTING.md)
- [ ] Telemetry/logging updated if relevant
- [ ] No regressions or UX breakage
- [ ] New or updated **unit tests** added
- [ ] All existing tests pass (`npm run test`)
- [ ] Code follows [contributing guidelines](https://github.com/microsoft/vscode-mssql/blob/main/CONTRIBUTING.md)
- [ ] Telemetry/logging updated if relevant
- [ ] No regressions or UX breakage

## Reviewers: [Please read our reviewer guidelines](https://github.com/microsoft/vscode-mssql/blob/main/.github/REVIEW_GUIDELINES.md)

129 changes: 75 additions & 54 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,18 @@ The MSSQL Extension for Visual Studio Code is a TypeScript-based VS Code extensi
**NEVER CANCEL** any build or test commands. These operations can take significant time and should be allowed to complete.

#### Initial Setup (Required once)

```bash
# Ensure correct Node.js version (v20+)
node --version # Should be v20.19.4 or higher
yarn --version # Should be v1.22+
yarn --version # Should be v1.22+

# Install dependencies - takes ~60 seconds initial, ~11 seconds subsequent. NEVER CANCEL. Set timeout to 120+ seconds.
yarn install
```

#### Build Commands

```bash
# Full build - takes ~19 seconds. NEVER CANCEL. Set timeout to 60+ seconds.
yarn build
Expand All @@ -32,11 +34,12 @@ yarn watch
```

#### Individual Build Steps (if needed)

```bash
# Prepare assets and localization (~2 seconds)
yarn build:prepare

# Compile extension TypeScript (~5 seconds)
# Compile extension TypeScript (~5 seconds)
yarn build:extension

# Bundle extension (~1 second)
Expand All @@ -50,6 +53,7 @@ yarn build:webviews-bundle
```

### Linting and Code Quality

```bash
# Lint source files only - takes ~1.5 seconds
yarn lint src/ test/
Expand All @@ -60,6 +64,7 @@ yarn lint src/ test/
### Testing

#### Unit Tests

```bash
# Unit tests require VS Code download and cannot run in sandboxed environments
# This is expected behavior - tests work in CI with proper VS Code setup
Expand All @@ -73,13 +78,15 @@ yarn test --testPattern "QueryRunner" # Alternative syntax for test filt
```

#### E2E Tests (Smoke Tests)

```bash
# E2E tests also require VS Code and SQL Server setup
yarn smoketest
yarn smoketest
# Requires: SQL Server running, connection credentials, VS Code installation
```

### Packaging

```bash
# Install vsce globally (if not already installed)
npm install -g vsce
Expand All @@ -94,19 +101,22 @@ yarn package --offline # Creates platform-specific packages with embedded servi
**Always test the following scenarios after making changes:**

### Complete Build Validation

1. Clean install: `rm -rf node_modules && yarn install`
2. Full build: `yarn build`
2. Full build: `yarn build`
3. Lint check: `yarn lint src/ test/`
4. Package creation: `yarn package --online`
5. Verify VSIX file is created (~12-15MB is normal)

### Development Workflow Validation

1. Start watch mode: `yarn watch`
2. Make a small change to a TypeScript file in `src/`
3. Verify automatic recompilation occurs
4. Stop watch mode with Ctrl+C

### Pre-Commit Validation Workflow

```bash
# Always run these commands before committing changes:
yarn build # Ensure code compiles
Expand All @@ -115,87 +125,98 @@ yarn package --online # Ensure extension can be packaged
```

### Code Quality Validation
- Always run `yarn lint src/ test/` before committing
- Check for TypeScript compilation errors: `yarn build:extension` and `yarn build:webviews`
- Verify no new warnings are introduced during build

- Always run `yarn lint src/ test/` before committing
- Check for TypeScript compilation errors: `yarn build:extension` and `yarn build:webviews`
- Verify no new warnings are introduced during build

## Project Structure

### Key Directories
- `src/` - Main extension source code (TypeScript)
- `copilot/` - GitHub Copilot integration features
- `controllers/` - Extension controllers and logic
- `reactviews/` - React components for webviews
- `services/` - Core business logic services
- `test/` - Unit and E2E tests
- `scripts/` - Build and utility scripts
- `dist/` - Build output (not in repository)
- `localization/` - Multi-language support files

- `src/` - Main extension source code (TypeScript)
- `copilot/` - GitHub Copilot integration features
- `controllers/` - Extension controllers and logic
- `reactviews/` - React components for webviews
- `services/` - Core business logic services
- `test/` - Unit and E2E tests
- `scripts/` - Build and utility scripts
- `dist/` - Build output (not in repository)
- `localization/` - Multi-language support files

### Important Files
- `package.json` - Extension manifest and build scripts
- `tsconfig.extension.json` - TypeScript config for extension code
- `tsconfig.react.json` - TypeScript config for React webviews
- `eslint.config.mjs` - Linting configuration
- `prettier.config.mjs` - Code formatting rules

- `package.json` - Extension manifest and build scripts
- `tsconfig.extension.json` - TypeScript config for extension code
- `tsconfig.react.json` - TypeScript config for React webviews
- `eslint.config.mjs` - Linting configuration
- `prettier.config.mjs` - Code formatting rules

## Common Commands and Expected Times

| Command | Expected Time | Timeout Setting | Description |
|---------|---------------|-----------------|-------------|
| `yarn install` | ~60s initial, ~11s subsequent | 120+ seconds | NEVER CANCEL: Installs all dependencies |
| `yarn build` | ~19 seconds | 60+ seconds | NEVER CANCEL: Complete build process |
| `yarn build:extension` | ~5 seconds | 30+ seconds | Compile extension TypeScript |
| `yarn build:webviews` | ~8 seconds | 30+ seconds | Compile React webviews |
| `yarn lint src/ test/` | ~1.5 seconds | 30+ seconds | Lint source files only |
| `yarn package --online` | ~4.5 seconds | 60+ seconds | NEVER CANCEL: Create VSIX package |
| `yarn watch` | Continuous | N/A | Development watch mode |
| Command | Expected Time | Timeout Setting | Description |
| ----------------------- | ----------------------------- | --------------- | --------------------------------------- |
| `yarn install` | ~60s initial, ~11s subsequent | 120+ seconds | NEVER CANCEL: Installs all dependencies |
| `yarn build` | ~19 seconds | 60+ seconds | NEVER CANCEL: Complete build process |
| `yarn build:extension` | ~5 seconds | 30+ seconds | Compile extension TypeScript |
| `yarn build:webviews` | ~8 seconds | 30+ seconds | Compile React webviews |
| `yarn lint src/ test/` | ~1.5 seconds | 30+ seconds | Lint source files only |
| `yarn package --online` | ~4.5 seconds | 60+ seconds | NEVER CANCEL: Create VSIX package |
| `yarn watch` | Continuous | N/A | Development watch mode |

## Build Troubleshooting

### Common Issues and Solutions

#### Lint Failures
- **Issue**: `yarn lint` fails with "Definition for rule not found"
- **Solution**: Use `yarn lint src/ test/` to lint source files only, not build output

- **Issue**: `yarn lint` fails with "Definition for rule not found"
- **Solution**: Use `yarn lint src/ test/` to lint source files only, not build output

#### VS Code Tests Failing
- **Issue**: Tests fail with "ENOTFOUND update.code.visualstudio.com"
- **Solution**: Expected in sandboxed environments. Tests require internet access to download VS Code.

- **Issue**: Tests fail with "ENOTFOUND update.code.visualstudio.com"
- **Solution**: Expected in sandboxed environments. Tests require internet access to download VS Code.

#### Build Warnings
- **Issue**: Engine warnings: "The engine 'vscode' appears to be invalid"
- **Solution**: These are harmless warnings and can be ignored.

#### Watch Mode Issues
- **Issue**: Watch mode not detecting changes
- **Solution**: Stop watch mode (Ctrl+C) and restart: `yarn watch`
- **Issue**: Engine warnings: "The engine 'vscode' appears to be invalid"
- **Solution**: These are harmless warnings and can be ignored.

#### Watch Mode Issues

- **Issue**: Watch mode not detecting changes
- **Solution**: Stop watch mode (Ctrl+C) and restart: `yarn watch`

### CI/CD Expectations
- The GitHub Actions workflow expects all these commands to work
- Build must complete in under 60 seconds
- Linting must pass with zero errors
- VSIX package size should be under 25MB
- No localization updates should be required unless strings changed

- The GitHub Actions workflow expects all these commands to work
- Build must complete in under 60 seconds
- Linting must pass with zero errors
- VSIX package size should be under 25MB
- No localization updates should be required unless strings changed

## Architecture Notes

### Extension Components
- **Main Extension**: Entry point in `src/extension.ts`
- **Webview Controllers**: React-based UI components for database management
- **Services**: SQL Tools Service integration, connection management, query execution
- **AI Integration**: GitHub Copilot features for SQL assistance and agent mode

### Build Pipeline
- **Main Extension**: Entry point in `src/extension.ts`
- **Webview Controllers**: React-based UI components for database management
- **Services**: SQL Tools Service integration, connection management, query execution
- **AI Integration**: GitHub Copilot features for SQL assistance and agent mode

### Build Pipeline

1. **Asset Preparation**: Copies test resources and generates localized strings
2. **TypeScript Compilation**: Compiles both extension and webview code separately
2. **TypeScript Compilation**: Compiles both extension and webview code separately
3. **Bundling**: Uses esbuild to create optimized bundles for production
4. **Packaging**: Creates VSIX file with all assets and dependencies

### Development Patterns
- Use `yarn watch` during development for live compilation
- Always run linting before committing changes
- Build and package extension to test full integration
- Extension can be debugged by installing VSIX in VS Code

- Use `yarn watch` during development for live compilation
- Always run linting before committing changes
- Build and package extension to test full integration
- Extension can be debugged by installing VSIX in VS Code

**Remember**: NEVER CANCEL long-running build or test commands. Always set appropriate timeouts and wait for completion.
Loading