Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>ST XML ExporterNew to Visual Studio Code? Get it now.
ST XML Exporter

ST XML Exporter

Juexro

|
1 install
| (0) | Free
A VSCode extension for exporting Structured Text (ST) files to PLC Open XML format
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

JS PLC Extension

A VSCode extension for PLC (Programmable Logic Controller) development, providing syntax highlighting for Structured Text (.st) files and XML export functionality.

Features

1. Syntax Highlighting for .st Files

  • Keywords: Control keywords (IF, THEN, ELSE, FOR, WHILE, etc.)
  • Data Types: Basic data types (BOOL, INT, REAL, STRING, etc.)
  • Constants: Numbers, boolean values (TRUE, FALSE)
  • Strings: Double-quoted and single-quoted strings
  • Comments: Single-line comments (//) and block comments (* *)
  • Operators: Arithmetic, comparison, and logical operators

2. XML Export Functionality

  • Right-click Menu: Export PLC Open XML from .st files
  • Customizable Output Directory: Configure where XML files are generated
  • Automatic Directory Creation: Creates output directory if it doesn't exist

3. Configuration Options

  • js-plc.xmlOutputDirectory: Directory where XML files will be generated (default: "build")

Installation

  1. Open VSCode
  2. Go to Extensions view (Ctrl+Shift+X)
  3. Search for "JS PLC"
  4. Click Install
  5. Reload VSCode to activate the extension

Usage

Syntax Highlighting

Simply open any .st file and the syntax highlighting will be automatically applied.

Exporting XML

  1. Open a .st file
  2. Right-click in the editor
  3. Select "Export PLC Open XML" from the context menu
  4. The XML file will be generated in the configured output directory

Configuring Output Directory

  1. Open VSCode Settings (File > Preferences > Settings)
  2. Search for "JS PLC"
  3. Modify the "Xml Output Directory" setting
  4. Or use the command palette (Ctrl+Shift+P) and run "Set XML Output Directory"

Supported File Types

  • .st - Structured Text files

Example

Structured Text File Example

TYPE
  DUT_ENUM : 
  (
    GREEN,
    BLUE
  ) := DUT_ENUM#GREEN;
  DUT_ALIAS : BOOL := FALSE;
  DUT_SUB : INT (0..5) := 2;
  DUT_ARR : ARRAY [1..2, 1..2] OF BOOL := 1;
  DUT_STRUCT : STRUCT
    A : BOOL;
    B : DUT_ALIAS;
  END_STRUCT;
  DUT_UNION : UNION
    C : BOOL;
    D : BOOL;
  END_UNION;
END_TYPE

PROGRAM TEST
  VAR
    LocalVar0 : INT;
    LocalVar1 : BOOL;
    LocalVar2 : BOOL;
    LocalVar3 : DUT_ALIAS;
    LocalVar4 : DUT_SUB;
    LocalVar5 : DUT_ENUM;
    LocalVar6 : DUT_ARR;
    LocalVar7 : DUT_STRUCT;
    LocalVar8 : DUT_UNION;
  END_VAR

  FOR LocalVar0 := 1 TO 128 BY 1 DO

  END_FOR ;

  LocalVar0 := 11;

END_PROGRAM


CONFIGURATION config
  VAR_GLOBAL CONSTANT GVL
    GlobalVar0 : BOOL;
  END_VAR
  VAR_GLOBAL GVL
    GlobalVar1 : BOOL;
  END_VAR

  RESOURCE resource1 ON PLC
    TASK NewTask2(SINGLE :=   GlobalVar0, PRIORITY := 1);
    TASK NewTask3(FREEWHEELING := TRUE, PRIORITY := 1);
    TASK NewTask(SINGLE := GlobalVar0, PRIORITY := 1);
    TASK MainTask(INTERVAL := T#20ms, PRIORITY := 1);
    PROGRAM NewTask2_25044_TEST_1 WITH NewTask2 : TEST;
    PROGRAM NewTask3_25045_TEST_1 WITH NewTask3 : TEST;
    PROGRAM NewTask_25043_TEST_1 WITH NewTask : TEST;
    PROGRAM MainTask_23417_TEST_1 WITH MainTask : TEST;
  END_RESOURCE
END_CONFIGURATION

Generated XML

The extension will generate XML files compatible with PLC Open standards.

Requirements

  • VSCode version 1.74.0 or higher

Community

Wechat:

Official Website: https://www.jishan-tech.com

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft