TcTidier is a formatter for TwinCAT Structured Text in VS Code.
It formats common TwinCAT PLC source files, plain Structured Text files, and TwinCAT-oriented virtual documents so you can keep TwinCAT code readable and consistent without hand-tuning spacing and indentation.
.TcPOU.TcGVL.TcDUT.TcIO.st.iecstTcViewvirtual Structured Text documents opened astwincat/iec-st
- Format the active TwinCAT / Structured Text document
- Format an entire workspace of supported TwinCAT files
- Use it from
Format Document, the command palette, the editor toolbar, or the status bar - Set it as the default formatter for TwinCAT Structured Text
- Configure formatting through a workspace
.tctidier.json - Respect ignore directives with
tctidier-ignore,tctidier-ignore-start, andtctidier-ignore-end
Install the extension, open a supported file, and either run Format Document or set TcTidier as the default formatter.
Recommended VS Code settings:
{
"[twincat-st]": {
"editor.defaultFormatter": "CodePiercerTechnologies.tctidier",
"editor.formatOnSave": true
}
}If another extension opens TwinCAT Structured Text as iec-st, TcTidier can still format it.
TcTidier: Format Current DocumentTcTidier: Format Workspace TwinCAT Files
Create a .tctidier.json file in your workspace root when you want to customize formatting behavior.
Example:
{
"indent": 4,
"useTabs": true,
"alignDeclarations": true,
"alignAssignments": true,
"alignNamedParameters": true,
"blankLineBetweenCaseBranches": true,
"normalizeOneLineIf": true,
"printWidth": 100
}For the fuller option set and behavior notes, see the formatter guide below.
- Workspace formatting skips dirty files so unsaved work is not overwritten.
- TcTidier is designed for deterministic formatting rather than style-by-style presets.
MIT. See LICENSE.