Siemens PLC development in VS Code
Diagnostics, a graphical LAD and FBD editor, PLC unit tests and TIA Portal sync for SCL / Structured Text and TIA Portal exports. Use it next to TIA Portal: export the PLC, edit and test in VS Code, and import the changes back.
How it fits with TIA Portal
- ExportExport the PLC from TIA Portal, or link the folder to the project.
- EditEdit SCL, LAD, FBD, interfaces and tag tables with diagnostics as you type.
- TestRun .scltest unit tests and check coverage. Memory resets in milliseconds.
- ReviewCompare graphically against Git or the TIA project before importing.
- ImportImport the changes into TIA Portal and download as usual.
Graphical block editor
Open any .s7dcl block export as a diagram. LAD, FBD and SCL networks share one editor, and every change is a normal edit to the text file.
Edit LAD and FBD networks
Insert, replace and delete contacts, coils, boxes and calls, add parallel branches, and wire call pins. Each edit goes through the parser before it is applied, so the file stays importable.
Double-click an operand to type, with the same completion as the text editor. Long rungs are drawn as one continuous circuit.
Monitor a running PLC
Connect the PLC Monitoring view to a Siemens CPU over S7CommPlus, or to a generated runtime. Values appear on the diagram, and Boolean wires turn green or red.
Pick the FB instance to see its locals, including multi-instances and array elements. Monitoring is read-only.
Interface table
The block interface is an editable table with type suggestions, validation as you type, and paste from a spreadsheet. Sections, structures and networks can be collapsed.
Graphical comparisons
Compare a block with Git HEAD, any text diff, or the version in TIA Portal. Networks are lined up side by side with added, removed, modified and moved changes marked on the diagram.
Find and replace
Ctrl+F and Ctrl+H search the whole block, including the interface and collapsed networks, with case, whole word and regex options.
TIA Portal sync
Link an exported PLC folder to its TIA Portal V21 project. Changes on either side show up in the Source Control view.
Compare, import and export
Compare checks a fresh export against your local files and the last sync, and sorts the results into local changes, changes in TIA Portal and conflicts. Import only takes files that are safe to import, and asks about the rest.
Compile, download, go online and snapshot retained values from the status bar. TIA compile errors show up in the Problems panel.
Tests and debugging
PLC code runs in a generated runtime on your machine, so tests and debugging do not need a PLC or PLCSIM.
Unit tests with coverage
Write .scltest files that set inputs, wait cycles and assert outputs, for a single FC or FB or the whole program. Run them from the Test Explorer or npx plccheck test in CI.
Memory is reset between tests in milliseconds, where TIA unit tests take about two seconds. Coverage is shown per file in the Explorer.
Debugging
Set breakpoints and step through SCL and S7DCL in the generated runtime. The PLC Debug Dashboard shows cycle time and runtime health, and Live Watch reads and writes tags while the program runs.
Language support
The Go language server checks a whole PLC in one pass, around 300k lines per second on an M3 Pro, and reports Siemens-specific errors before you import.
- Files
.scl,.st,.s7dcl,.s7res,.udt,.db,.awl,.scltestand PLC tag table XML- Editor
- Diagnostics, hover, completion, go to definition, references, call hierarchy, outline and folding
- Scopes
- A
.plc.jsonfile marks a PLC root, so several PLCs in one workspace keep their own symbols. Project libraries in a siblingTypesfolder are found automatically. - Diagnostics
- Type checking, call pins, array bounds, FBD and LAD wiring that TIA Portal would reject, and more. See the diagnostic codes.
plccheck CLI
The same checks and tests run from a terminal or CI without VS Code.
npx plccheck check ./my-plc-project
npx plccheck test ./my-plc-project --coverage-lcov lcov.info
npx plccheck transpile --to scl ./Program.s7dcl
npx plccheck tia export software Demo.ap21 --out exported --plc PLC_1