A professional-grade VS Code extension providing comprehensive SQL validation, IntelliSense, and schema enforcement for Baton SQL configuration files using the Language Server Protocol (LSP).
- 14 validation rules covering SELECT, INSERT, UPDATE statements
- Detects missing commas, typos, unclosed parentheses, invalid JOINs, and more
- Works across all SQL queries in your YAML (list, grants, provisioning, etc.)
- SQL keywords (SELECT, FROM, WHERE, JOIN, etc.)
- SQL functions (COUNT, SUM, AVG, CONCAT, etc.)
- Baton-specific parameters (?<parameter_name>)
- Context-aware suggestions
- Hover over SQL keywords for documentation
- Hover over Baton parameters for syntax help
- Rich markdown formatting
- Fix misspelled keywords (SELCT β SELECT)
- Add missing commas automatically
- Add closing parentheses
- Add missing FROM clauses
- Quick fix available via lightbulb π‘ or
Cmd+./Ctrl+.
- Jump to table definitions (F12 or Cmd+Click)
- Navigate to resource type definitions
- Understand query structure instantly
- Automatic schema application for
baton-sql-*.yamlfiles - Validates YAML structure, required fields, property types
- Supports account provisioning, credential rotation, and more
- Helpful tooltips on hover
- Download the latest
.vsixfile from releases - Open VS Code
- Go to Extensions panel (β§βX / Ctrl+Shift+X)
- Click "..." menu β "Install from VSIX..."
- Select the downloaded
.vsixfile
# Clone the repository
git clone https://github.com/yourusername/baton-sql-extension.git
cd baton-sql-extension
# Install dependencies
npm install
# Build and package
npm run build
npm run package
# Install the generated .vsix file- VS Code: 1.80.0 or higher
- Red Hat YAML Extension: Required for schema validation (installed automatically)
The extension activates automatically when you open files matching:
baton-sql-*.yamlbaton-sql-*.yml
All features work automaticallyβno configuration needed!
resource_types:
user:
list:
query: |
SELECT
id,
name
email β Error: Missing comma
FRO users β Error: Typo in FROMYou'll see:
- Red squiggles under errors
- Lightbulb π‘ with quick fixes
- Detailed error messages
Type SE and see suggestions for:
SELECTSET
Type ?< to trigger Baton parameter completion.
SELECT * FROM users JOIN orders ON users.id = orders.user_id
WHERE orders.status = 'active'
^^^^^^ Cmd+Click here to jump to JOIN definitionBuilt with the Language Server Protocol for maximum compatibility:
baton-sql-extension/
βββ src/
β βββ client/ # LSP client (VS Code integration)
β βββ server/ # LSP server (validation logic)
β β βββ features/ # Hover, completion, code actions, go-to-def
β β βββ index/ # Symbol indexing
β βββ validation/ # 14 SQL validation rules
β βββ utils/ # Shared utilities
βββ schemas/
β βββ baton-schema.json # JSON schema definition
βββ out/ # Compiled output
- Native VS Code support - Install directly from marketplace
- Other LSP editors - Server can be configured for Neovim, Emacs, Sublime Text, etc. (manual setup required)
- Runs in separate process for better performance
- Professional-grade features (hover, completion, quick fixes, navigation)
npm run build
code .Then press F5 to open a new Extension Development Host window.
npm run build # Compile TypeScript and bundle
npm run package # Create .vsix filenpm run build- Compile TypeScript + webpack bundlenpm run package- Package as VSIXnpm run watch- Watch mode for development
The extension includes 14 SQL validation rules:
- Missing Comma Rule - Detects missing commas in SELECT, INSERT, UPDATE
- Keyword Spelling Rule - Catches typos in SQL keywords
- Missing FROM Rule - Ensures SELECT has FROM clause
- Unclosed Parentheses Rule - Detects unbalanced parentheses
- Invalid JOIN Rule - Validates JOIN syntax and ON clauses (CROSS JOIN exempt)
- Ambiguous Columns Rule - Detects
SELECT *across multiple tables - Invalid GROUP BY Rule - Flags aggregates mixed with non-aggregates and no GROUP BY
- Invalid ORDER BY Rule - Flags positional
ORDER BY 1 - Duplicate Aliases Rule - Detects duplicate table aliases
- Property Name Typos Rule - Catches common YAML typos (e.g.,
static_entitlementβstatic_entitlements) - Baton Parameter Validation Rule - Validates
?<param>syntax - Trailing Comma Rule - Detects invalid trailing commas before
FROM/WHERE - Vars / Query Mismatch Rule - Flags
varsentries unused by the query and?<param>references missing fromvars - Unconventional SQL Syntax Rule - PostgreSQL-specific checks (ON CONFLICT, RETURNING, gen_salt, crypt, COALESCE, DATE literals)
app_name,app_description,connectresource_typeswith full validationstatic_entitlementswith provisioning supportentitlementsandgrantsaccount_provisioningwith schema, credentials, validate, createcredential_rotationfor password updates
no_password- SSO-only accountsrandom_password- Generate random passwordsencrypted_password- Pre-encrypted passwords
- Fork the repository
- Create a feature branch (
git checkout -b feature/YourFeature) - Commit your changes (
git commit -m 'Add YourFeature') - Push to the branch (
git push origin feature/YourFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If you encounter issues or have feature requests:
- Check existing issues on GitHub
- Create a new issue with detailed information
- Include your VS Code version and extension version
Made with β€οΈ for the Baton community