JAI Block Editor - DSL Commands
100% AI Code · Human Reviewed

Bridge between AI code generation and your IDE. Execute AI-suggested changes with simple DSL commands (REPLACE, DELETE, INSERT) across multiple files.
Features
- Smart Replace - Replace code blocks across multiple files simultaneously
- Bulk Delete - Remove unwanted code patterns everywhere at once
- Precision Insert - Add code at exact positions (before/after blocks, start/end of files)
- Boundary Blocks - Define complex replacements with start/end boundaries using
---TO---
- Multi-file Operations - Use glob patterns to target specific file groups
- Pre-execution Analysis - independent analysis of each command (not a preview of cascading changes)
- Format Preservation - Maintains original file encoding and line endings
Quick Start
- Open Command Palette (
Ctrl+Shift+P
/ Cmd+Shift+P
)
- Run
JAI: Block Editor (DSL)
- Enter your DSL commands
- Press
Ctrl+Enter
to apply changes
DSL Commands
Replace Block
replace block
---BEGIN---
DEBUG = True
---END---
with
---BEGIN---
DEBUG = False
---END---
in files ["config.py", "settings/*.py"]
Delete Block
delete block
---BEGIN---
# TODO: Remove after migration
def legacy_function():
pass
---END---
in files ["src/**/*.py"]
Insert Code
insert after
---BEGIN---
class User:
---END---
with
---BEGIN---
def __init__(self, name, email):
self.name = name
self.email = email
---END---
in files ["models.py"]
Boundary Blocks (with ---TO---)
replace block
---BEGIN---
def process_data(data):
# Start of function
---TO---
return result
# End of function
---END---
with
---BEGIN---
def process_data(data):
# Optimized implementation
if not data:
return None
result = optimize(data)
log_performance(result)
return result
# End of function
---END---
File Patterns
in files ["config.py"] # single file
in files ["config.py", "settings.py"] # multiple files
in files ["src/"] # all files in directory (recursive)
in files ["*.py"] # pattern in current directory
in files ["src/*.py"] # pattern in specific directory
in files ["**/test_*.py"] # recursive pattern
in files ["config.py", "src/", "tests/*.py"] # combination
Pattern Rules:
- Paths ending with
/
- directories (recursive search)
*
- any characters within single level
**
- recursive search in all subdirectories
- All patterns are processed as glob patterns
- If no files specified - uses current active file
Multiple Commands
Use ---NEXT_BLOCK---
to execute multiple operations at once:
replace block
---BEGIN---
VERSION = "1.0.0"
---END---
with
---BEGIN---
VERSION = "2.0.0"
---END---
in files ["version.py"]
---NEXT_BLOCK---
insert after
---BEGIN---
VERSION = "2.0.0"
---END---
with
---BEGIN---
RELEASE_DATE = "2024-01-01"
---END---
in files ["version.py"]
Pre-execution Analysis
Before applying changes, the extension performs analysis and shows:
PRE-EXECUTION ANALYSIS
──────────────────────────────
Total commands: 34
Matches found: 30
No matches for: 4 commands
Parse errors: 0
Details:
- Commands 0003, 0004, 0005, 0006 will be skipped (blocks not found)
Continue with applying changes?
[Apply] [Cancel]
Important: Preview analyzes each command independently. When applied sequentially, commands may affect each other, so final result may differ from pre-analysis.
Supported Operations
replace block
- replace all block occurrences
delete block
- delete all block occurrences
insert before
- insert before each block occurrence
insert after
- insert after each block occurrence
insert at start
- insert at file start
insert at end
- insert at file end
Advanced Examples
Complex Function Replacement
replace block
---BEGIN---
def validate_email(email):
if not email:
return False
return '@' in email
---END---
with
---BEGIN---
def validate_email(email):
if not email or '@' not in email:
return False
if email.count('@') != 1:
return False
local, domain = email.split('@')
return len(local) > 0 and len(domain) > 3 and '.' in domain
---END---
in files ["validators.py", "utils/validation.py"]
Mass Debug Cleanup
delete block
---BEGIN---
console.log('DEBUG:
---TO---
');
---END---
in files ["src/**/*.js"]
insert at start
with
---BEGIN---
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Copyright (c) 2024 Your Company
Licensed under MIT License
"""
---END---
in files ["src/**/*.py"]
Configuration
This extension contributes the following settings:
blockEditor.validatePaths
: Enable path validation for security (default: true
)
blockEditor.mixedEolPolicy
: How to handle mixed line endings (warn
, ignore
, skip
, normalize
)
blockEditor.enableVerboseLogging
: Enable verbose logging for debugging (default: false
)
blockEditor.files.respectSearchExclude
: Respect VS Code's exclude settings when resolving files (default: true
)
blockEditor.files.includeDotfiles
: Control dotfile handling - inherit
/always
/never
(default: inherit
)
Requirements
Behavior Notes
- Binary files are automatically skipped for safety
- Mixed line endings in files will trigger a warning (configurable via
blockEditor.mixedEolPolicy
)
Release Notes
See CHANGELOG.md for release history.
Security
Block Editor operates only within your workspace boundaries:
- Automatic validation that files are within workspace
- Protection against path traversal attacks
- No access to files outside the project
Contributing
Found a bug or have a feature request? Please open an issue on GitHub.
License
This extension is licensed under the MIT License.
🚀 Created by Claude Opus 4.1 · Reviewed by Gemini 2.5 Pro, ChatGPT 5, DeepSeek V3