cd packages/tools/vscode-objectql
code --install-extension vscode-objectql-0.1.0.vsixcd packages/tools/vscode-objectql
npm install
npm run compile
npm run package
code --install-extension vscode-objectql-0.1.0.vsixWhen editing .object.yml files, you get intelligent suggestions:
Field Types:
text,textarea,markdown,htmlnumber,currency,percentdate,datetime,timeselect,lookup,master_detailboolean,email,phone,urlfile,image,locationformula,summary,auto_numberobject,vector,grid
Validation Operators:
=,!=,>,>=,<,<=in,not_in,contains,not_containsstarts_with,ends_with
Type these prefixes and press Tab:
oql-object # Complete object definition
oql-field-text # Text field
oql-field-number # Number field
oql-field-select # Select with options
oql-field-lookup # Relationship field
oql-field-datetime # DateTime field
oql-field-email # Email field
oql-field-currency # Currency field
oql-field-file # File attachment
oql-field-image # Image field
oql-index # Database index
oql-ai-search # AI semantic searchoql-validation-cross-field # Cross-field validation
oql-validation-unique # Uniqueness validation
oql-validation-business # Business rule
oql-validation-state # State machineoql-hook-beforeCreate // Before create hook
oql-hook-afterCreate // After create hook
oql-hook-beforeUpdate // Before update hook
oql-hook-afterUpdate // After update hook
oql-hook-beforeDelete // Before delete hook
oql-hook-afterDelete // After delete hook
oql-action-record // Record-level action
oql-action-global // Global action
oql-query // Repository query
oql-create // Create record
oql-update // Update record
oql-error // ObjectQL errorPress Ctrl+Shift+P (or Cmd+Shift+P) and type "ObjectQL":
- ObjectQL: New Object Definition - Create new object with template
- ObjectQL: New Validation Rules - Create validation file
- ObjectQL: New Permission Rules - Create permission file
- ObjectQL: New Application Config - Create app config
- ObjectQL: Validate Current File - Validate against schema
The extension validates your YAML files in real-time:
✅ Valid Syntax:
name: product
label: Product
fields:
name:
type: text
required: true❌ Invalid Syntax:
name: product
fields:
name:
type: invalid_type # Error: Invalid field type
required: "yes" # Error: Should be booleanErrors appear:
- Underlined in red in the editor
- Listed in the Problems panel (
Ctrl+Shift+M) - With helpful error messages on hover
ObjectQL files get custom icons in the Explorer:
- 📊
.object.yml- Database table icon - ✅
.validation.yml- Checkmark icon - 🔒
.permission.yml- Lock icon - 📱
.app.yml- Application icon
- Press
Ctrl+Shift+P - Type "ObjectQL: New Object"
- Enter "product"
- Edit the generated template:
name: product
label: Product
description: "Product catalog item"
fields:
name:
type: text
label: Product Name
required: true
searchable: true
price:
type: currency
label: Price
required: true
min: 0
category:
type: select
label: Category
options:
- label: Electronics
value: electronics
- label: Clothing
value: clothing- In an
.object.ymlfile, typeoql-field-select - Press Tab
- Fill in the placeholders:
- Field name:
status - Label:
Status - Options:
Draft,Published,Archived
- Field name:
Result:
status:
type: select
label: Status
options:
- label: Draft
value: draft
- label: Published
value: published
defaultValue: draft- Type
oql-validation-cross-field - Press Tab
- Configure the rule:
validation:
rules:
- name: price_positive
type: cross_field
message: "Price must be greater than 0"
rule:
field: price
operator: ">"
value: 0
trigger: [create, update]
severity: error- Create
product.hook.ts - Type
oql-hook-beforeCreate - Press Tab
- Implement your logic:
import { HookContext, ObjectQLError } from '@objectql/types';
export async function beforeCreate(ctx: HookContext): Promise<void> {
const { doc } = ctx;
// Auto-generate SKU
if (!doc.sku) {
doc.sku = `PRD-${Date.now()}`;
}
// Set timestamps
doc.created_at = new Date();
}Add to your VS Code settings (.vscode/settings.json):
{
"objectql.validation.enabled": true,
"objectql.completion.enabled": true,
"objectql.diagnostics.enabled": true,
"yaml.schemas": {
"./packages/tools/vscode-objectql/schemas/object.schema.json": "*.object.yml",
"./packages/tools/vscode-objectql/schemas/app.schema.json": "*.app.yml"
}
}- Use Tab Navigation: After inserting a snippet, press Tab to jump between placeholders
- Check Problems Panel: Always check the Problems panel for validation errors
- Hover for Help: Hover over field names to see documentation
- Command Palette: Use
Ctrl+Shift+Pfor quick access to all commands - Auto-Save: Enable auto-save to see validation in real-time
Snippets not appearing?
- Make sure you're in a YAML or TypeScript file
- Check that
objectql.completion.enabledis true - Try reloading the window (
Developer: Reload Window)
Validation not working?
- Install the Red Hat YAML extension
- Check that the file extension is correct (
.object.yml, not.object.yaml) - Verify
objectql.validation.enabledis true
Extension not activating?
- Open a folder/workspace (not just a file)
- Create or open an ObjectQL file (
.object.yml) - Check the Output panel → Extension Host for errors
- Read the complete README for all features
- Check INSTALL.md for detailed installation
- See CONTRIBUTING.md to contribute
- Review IMPLEMENTATION-SUMMARY.md for technical details
Start creating ObjectQL metadata files with full IDE support:
- ✅ IntelliSense
- ✅ Validation
- ✅ Snippets
- ✅ Quick commands
- ✅ File icons
Happy coding! 🚀