O2VEND Liquid VS Code Extension
The O2VEND Liquid extension provides comprehensive language support for O2VEND Liquid templates in VS Code and Cursor. It includes syntax highlighting, IntelliSense, code snippets, and JSON schema validation.
Installation
From VS Code Marketplace
- Open VS Code or Cursor
- Go to Extensions (Ctrl+Shift+X / Cmd+Shift+X)
- Search for "O2VEND Liquid"
- Click Install
Manual Installation
If you have a .vsix file:
code --install-extension o2vend-liquid-1.0.0.vsix
Or in VS Code:
- Go to Extensions
- Click the "..." menu
- Select "Install from VSIX..."
- Choose the
.vsixfile
Features
Syntax Highlighting
Full syntax highlighting for:
- Liquid template tags (
{% %}) - Liquid output tags (
{{ }}) - O2VEND-specific tags (
{% section %},{% widget %}) - HTML, CSS, and JavaScript within Liquid files
- Liquid filters and variables
IntelliSense and Auto-completion
Intelligent code completion for:
- Liquid Tags:
assign,capture,case,comment,cycle,for,if,include,unless, etc. - O2VEND Tags:
section,widget,schema,render_widget - Liquid Filters:
abs,capitalize,date,default,money,product_url, etc. - O2VEND Filters:
money,money_with_currency,product_url,collection_url,img_url,asset_url,render_widget, etc.
Code Snippets
Pre-built snippets for common patterns:
Liquid Snippets:
if- Conditional blockfor- Loop blockassign- Variable assignmentinclude- Include snippetcase- Switch statement
O2VEND Snippets:
section- Include sectionwidget- Render widgetschema- Section schemarender_widget- Widget rendering
JSON Schema Validation
Automatic validation for:
config/settings_schema.json- Theme settings schemaconfig/settings_data.json- Theme settings dataconfig/theme.json- Theme manifest
The extension provides:
- Real-time validation
- Error highlighting
- Auto-completion for schema properties
- Hover documentation
Hover Documentation
Hover over Liquid tags and filters to see:
- Description of the tag/filter
- Usage examples
- Parameter information
- O2VEND-specific documentation
Language Configuration
Optimized editor settings for Liquid files:
- Auto-closing tags
- Bracket matching
- Indentation rules
- Comment toggling
Usage
Opening Liquid Files
The extension automatically activates when you open .liquid files. You'll see:
- Syntax highlighting applied
- IntelliSense available
- Snippets accessible via Tab completion
Using IntelliSense
- Type
{%to see available Liquid tags - Type
{{to see available variables and filters - Type
|after a variable to see available filters - Press
Ctrl+Space(orCmd+Spaceon Mac) to trigger completions
Using Snippets
- Type the snippet prefix (e.g.,
if,for,section) - Press
Tabto expand the snippet - Fill in the placeholders
- Press
Tabto move to the next placeholder
Example: Creating a Section
- Type
sectionand pressTab - The snippet expands to:
{% section 'section-name' %} - Replace
section-namewith your section name
Example: Using Filters
- Type
{{ product.price |and pressCtrl+Space - See available filters including:
money- Format as currencymoney_with_currency- Format with currency symboldefault- Provide default value
- Select a filter and continue typing
Configuration
Extension Settings
Configure the extension in VS Code settings:
{
"o2vend-liquid.format.enable": true,
"o2vend-liquid.lint.enable": true,
"o2vend-liquid.autoCloseTags": true
}
Settings:
o2vend-liquid.format.enable- Enable formatting for Liquid files (default:true)o2vend-liquid.lint.enable- Enable linting for Liquid files (default:true)o2vend-liquid.autoCloseTags- Automatically close Liquid tags (default:true)
File Associations
The extension automatically associates with .liquid files. If needed, you can manually configure:
{
"files.associations": {
"*.liquid": "liquid"
}
}
Supported Language Features
Liquid Tags
All standard Liquid tags are supported:
- Control flow:
if,unless,case,for,tablerow - Variables:
assign,capture,increment,decrement - Includes:
include,render - Comments:
comment,raw - Other:
cycle,liquid
O2VEND-Specific Tags
{% section 'name' %}- Include a section template{% widget widget_data %}- Render a widget{% schema %}- Define section schema{{ widget | render_widget }}- Render widget filter
Liquid Filters
Standard Liquid filters:
- String:
capitalize,downcase,upcase,strip,lstrip,rstrip - Array:
first,last,join,sort,reverse,map,where - Math:
abs,ceil,floor,round,plus,minus,times,divided_by - Date:
date - Other:
default,size,escape,url_encode,url_decode
O2VEND-Specific Filters
money- Format price with currencymoney_with_currency- Format price with currency symbolmoney_with_settings- Format price with custom settingsproduct_url- Generate product URLcollection_url- Generate collection URLpage_url- Generate page URLimg_url- Generate image URL with size optionsasset_url- Generate asset URLhandleize- Convert to URL-friendly handlepluralize- Pluralize wordshighlight- Highlight search termsrender_widget- Render widget from data
JSON Schema Support
Settings Schema
The extension validates config/settings_schema.json:
{
"sections": [
{
"name": "Colors",
"settings": [
{
"type": "color",
"id": "primary_color",
"label": "Primary Color",
"default": "#000000"
}
]
}
]
}
Settings Data
The extension validates config/settings_data.json:
{
"current": {
"primary_color": "#FF0000"
}
}
Theme Manifest
The extension validates config/theme.json:
{
"id": "my-theme",
"name": "My Theme",
"version": "1.0.0",
"author": "Your Name",
"description": "Theme description"
}
Best Practices
1. Use IntelliSense
Let the extension help you:
- Use
Ctrl+Spaceto see available options - Read hover documentation for tags and filters
- Use snippets for common patterns
2. Validate JSON Files
The extension automatically validates JSON configuration files:
- Fix errors before saving
- Use auto-completion for schema properties
- Check hover hints for required fields
3. Use Snippets
Speed up development with snippets:
- Learn snippet prefixes
- Customize snippets if needed
- Use Tab to expand and navigate
4. Enable Formatting
Keep code clean:
- Enable format on save
- Use the formatter for consistent style
- Configure formatting rules
Troubleshooting
Extension Not Activating
- Check that
.liquidfiles are recognized - Verify extension is installed and enabled
- Reload VS Code window (
Ctrl+Shift+P> "Reload Window")
IntelliSense Not Working
- Check that file is recognized as Liquid (see status bar)
- Try
Ctrl+Spaceto manually trigger completions - Verify extension is enabled in workspace settings
Snippets Not Appearing
- Type the snippet prefix and press
Tab - Check that snippets are enabled in settings
- Verify file is recognized as Liquid
JSON Validation Not Working
- Ensure JSON files are in
config/directory - Check file names match expected patterns
- Verify JSON syntax is valid
Related Tools
- O2VEND Theme CLI - Command-line tool for theme development
- O2VEND Theme Starter - Ready-to-use starter template
Support
- Extension Repository: GitHub
- Issues: Report issues on GitHub
- Documentation: O2VEND Developer Docs
License
MIT License