Format Batch is a Visual Studio Code extension designed for AdvPL/TLPP/PRG ecosystems. It allows formatting and compiling large numbers of source files automatically in batch mode using the capabilities provided by the TOTVS Developer Studio extension installed in VSCode.
The extension is ideal for mass processing, refactoring tasks, and applying continuous integration standards across thousands of files simultaneously.
🌟 New Feature: Batch Dashboard UI!
We have introduced a rich, interactive Webview Dashboard that serves as your central command center for all batch operations!
Press Ctrl+Shift+P and type:
Format Batch: Open Dashboard
Dashboard Features:
- 📋 GENERATE LIST: Automatically scan your workspace and build a file list based on your
.vscode/batchformatter.json extensions.
- ✨ FORMAT BATCH: Format all sources in parallel. The dashboard tracks the progress and displays real-time statistics (Success vs Errors) in interactive cards.
- 🚀 COMPILE BATCH: Connects natively to your active TOTVS environment and compiles all sources in the list.
- Server Validation: Automatically checks if you have a valid token/connection to a Protheus environment before attempting to compile, preventing silent failures.
- Detailed Logs: If a compilation fails with warnings or errors, a
.log file is generated locally. The Dashboard provides a handy View Log button next to the failed file to open the exact error trace immediately.
Features
- Format files in batch mode with Parallel processing for high performance.
- Compile files in batch mode, leveraging the official TOTVS Language Server.
- Generates individual
.log files for files with compile Warnings/Errors in a dedicated batch_compile_logs/ folder.
- Automatically detect file extensions in workspace.
- Generate file lists automatically or Import pre-generated
.txt file lists.
- Configuration file automatically generated (
.vscode/batchformatter.json).
Supported Languages (Validated)
This extension is specifically designed and validated for the following TOTVS languages:
⚠️ Requirement: To correctly format or compile these files, you MUST install and be authenticated in the official TOTVS Developer Studio extension for Visual Studio Code. Without it, VSCode cannot apply formatting, and the batch compiler cannot reach the AppServer.
Commands
You can access all tools via the Command Palette (Ctrl+Shift+P):
Format Batch: Open Dashboard (Recommended)
Opens the interactive Webview panel.
Config: Format Batch Sources
Triggers the legacy quick-pick menu to format files from a list or workspace scan.
Config: Compile Batch Sources
Triggers the legacy quick-pick menu to compile files from a list or workspace scan.
Format Batch: Generate List of Sources
Quickly detects extensions and saves a .txt file list of your sources for later use.
Configuration
Configuration file: .vscode/batchformatter.json
(The extension automatically creates this file if it does not exist).
{
"parallel": 10,
"exclude": [
".git",
"node_modules",
"dist",
"build",
"batch_compile_logs"
]
}
Options
parallel: Number of files processed simultaneously during formatting.
exclude: Directories ignored during file search and list generation.
Batch Formatter uses the native VSCode file search API and hooks directly into the LSP (Language Server Protocol), bypassing manual Editor openings.
Typical performance improvements:
- 10x faster than manual file formatting/compilation.
- Scales easily to thousands of files without crashing VSCode.
License
MIT