JAI Block Editor - DSL Commands
Working with AI assistants like Claude or ChatGPT? Tired of manually copying code changes?
This is a bridge between AI code generation and your IDE. Execute AI-suggested changes with simple DSL commands (REPLACE, DELETE, INSERT) across multiple files.
- Before: Copy-paste each change from AI chat → Find location in files → Replace manually
- After: Copy DSL commands → Press Ctrl/Cmd+Enter → All changes applied instantly
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/Cmd+Shift+P)
- Run
JAI: Block Editor (DSL)
- Enter your DSL commands
- Press
Ctrl/Cmd+Enter to apply changes
In this README, Ctrl/Cmd means Ctrl on Windows/Linux and Cmd on macOS.
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
DSL notes
- Full-line
// comments outside ---BEGIN---/---END--- blocks are ignored
- Comments inside blocks are preserved as literal content
Examples
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 Block
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---
Multiple Operations
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.
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
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)
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
Questions or feedback: JeenyJAI@gmail.com
License
This extension is proprietary software. You may use and distribute it freely
in its unmodified form, but modifications are not permitted.
See LICENSE file for details.
🚀 Created with Claude