PLC
Documentation

Version Latest

Structured Text

The PLC module's Structured Text language service for .st files and TwinCAT object files: colouring, outline, completion, hover, navigation, rename and structure checks.

State: modelled. The module's own language service for IEC 61131-3 Structured Text with the TwinCAT and CODESYS extensions, checked on every Structured Text region of the real TwinCAT fixtures and fuzzed, Linux only. It never claims a program compiles: that is the vendor compiler's call (see Build with the vendor compiler).

In .st and .iecst files

These files open in the language Structured Text (id iecst):

  • Colouring from the theme, multi-line comments included.
  • Outline of POUs, types, variable sections and members.
  • Completion of variables in scope, POUs, types, keywords, members after a dot (following EXTENDS, THIS^, SUPER^) and named parameters in a call. qualified_only enumerations and global lists are offered only qualified.
  • Hover with the declaration line and its comment.
  • Go to Definition and Find All References across the open files and the workspace's .st files.
  • Rename across them. It refuses collisions, shadowing and names it cannot resolve.
  • Structure checks in Problems as you type (below).

In TwinCAT object files

.TcPOU, .TcGVL, .TcDUT and .TcIO files open as XML with:

  • an outline of the object, its methods, properties with their Get and Set bodies, and variables, at their positions in the file;
  • the same structure checks on each declaration and body, reported at their exact place in the XML;
  • an XML problem when the file is not well-formed.

Structure checks

Problems lists, as you type:

  • unclosed comments, strings and pragmas;
  • an END_ that matches nothing or the wrong opener;
  • blocks never closed;
  • malformed literals and undefined escapes;
  • characters that are not Structured Text.

The checks are lexical and structural only. Types, undeclared names and semantics are the vendor compiler's call. The lexer follows IEC 61131-3 third edition plus nested comments, {...} pragmas and ?=.

Not verified

  • Anything the vendor compiler checks.
  • Customer projects of realistic size; Windows.

Last reviewed 17 October 2026View as Markdown

Structured Text · Docs · Neural Inverse