feat: add T-SQL formatter extension with profile management and forma…#1
feat: add T-SQL formatter extension with profile management and forma…#1JoelMiller74 merged 22 commits intomainfrom
Conversation
…tting features - Implemented core formatting logic for T-SQL in `src/formatter/engine.ts`. - Added extension activation and command registration in `src/extension.ts`. - Created profile management functions for saving, loading, exporting, and importing profiles in `src/profiles/profileManager.ts`. - Added SQL sample query for testing in `samples/sample.sql`. - Developed unit tests for formatter functionality in `src/test/formatter.test.ts` and `src/test/formatter.vitest.ts`. - Configured TypeScript settings in `tsconfig.json` and Vitest configuration in `vitest.config.ts`. - Updated extension documentation in `vsc-extension-quickstart.md`.
There was a problem hiding this comment.
Pull request overview
This PR adds a T-SQL formatter extension for VS Code with comprehensive formatting options and profile management capabilities. The extension provides a document formatter for SQL files with extensive configuration options for keyword casing, indentation, line breaks, and SQL-specific formatting rules like JOIN alignment and CTE formatting.
Key changes:
- Implements core T-SQL formatting engine with 30+ configuration options for keyword casing, indentation, operator spacing, parenthesis handling, and SQL clause formatting
- Adds profile management system allowing users to save, load, export, and import formatting profiles as JSON files
- Includes comprehensive test coverage using both Mocha (for VS Code integration tests) and Vitest (for unit tests)
Reviewed changes
Copilot reviewed 29 out of 32 changed files in this pull request and generated 18 comments.
Show a summary per file
| File | Description |
|---|---|
| src/extension.ts | Extension activation with document formatter registration and profile management commands |
| src/formatter/engine.ts | Core T-SQL formatting logic implementing keyword casing, indentation, and SQL-specific formatting rules |
| src/profiles/profileManager.ts | Profile management functions for saving, loading, exporting, and importing formatter profiles |
| src/test/extension.test.ts | Basic extension test suite with placeholder tests (contains critical syntax error) |
| src/test/formatter.test.ts | Mocha-based unit tests for formatter functionality covering various formatting options |
| src/test/formatter.vitest.ts | Vitest-based unit tests mirroring the Mocha tests for dual test framework support |
| package.json | Extension manifest with configuration schema, commands, and build/test scripts |
| .github/workflows/ci.yml | CI/CD workflow for linting, building, and testing (contains YAML structure error) |
| tsconfig.json | TypeScript compiler configuration with strict mode enabled |
| vitest.config.ts | Vitest configuration for unit tests |
| README.md | Extension documentation with feature descriptions and usage examples (contains documentation inconsistencies) |
| PROFILES.md | Profile management documentation and example configurations (contains command name inconsistencies) |
| CONFIG.md | Comprehensive configuration reference for all available settings |
| samples/sample.sql | Sample SQL file for testing formatter functionality |
| vsc-extension-quickstart.md | Quick start guide for extension development (contains typo) |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
src/test/extension.test.ts
Outdated
| assert.strictEqual(-1, [1, 2, 3].indexOf(5)); | ||
| assert.strictEqual(-1, [1, 2, 3].indexOf(0)); | ||
| }); | ||
| const cfg = vscode.workspace.getConfiguration('tsqlformatter'); |
There was a problem hiding this comment.
This line is incomplete and will cause a syntax error. It appears to be leftover code that should either be removed or completed as part of a test case. The variable cfg is declared but never used.
| const cfg = vscode.workspace.getConfiguration('tsqlformatter'); |
…e formatting options
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
@JoelMiller74 I've opened a new pull request, #2, to work on those changes. Once the pull request is ready, I'll request review from you. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
test(ci): add vitest v8 coverage provider and use npm coverage script
Welcome to Codecov 🎉Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests. ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment Thanks for integrating Codecov - We've got you covered ☂️ |
…tting features
src/formatter/engine.ts.src/extension.ts.src/profiles/profileManager.ts.samples/sample.sql.src/test/formatter.test.tsandsrc/test/formatter.vitest.ts.tsconfig.jsonand Vitest configuration invitest.config.ts.vsc-extension-quickstart.md.