Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>AX6 Rule File SyntaxNew to Visual Studio Code? Get it now.
AX6 Rule File Syntax

AX6 Rule File Syntax

Syahmi Zulkefli

|
9 installs
| (0) | Free
Comprehensive VS Code language extension for AX6 rule files (.rul) featuring syntax highlighting, intelligent validation, code snippets, and advanced formatting
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

AX6 Rule File Extension

A comprehensive VS Code extension providing advanced syntax highlighting, intelligent navigation, sophisticated language features, and multi-level syntax validation for AX6 rule files (.rul). Features include precision column alignment validation, comprehensive duplicate detection, and context-aware invalid syntax detection.

Features

🎨 Syntax Highlighting

  • Parameter headers (PRODUCT_ID?) - Highlighted in blue/cyan
  • Variable headers (LOT_ID:) - Highlighted in purple/magenta
  • Keywords, operators, numbers, booleans, strings
  • Comments (both # line comments and /* */ block comments)
  • Special values (NULL, NA, *)
  • List structures with proper bracket highlighting
  • Complex expressions (100*int(MULTIPLIER)) - Recognized as single values
  • Nested objects ({'config':[{0:0}]}) - Properly highlighted and structured

🧭 Navigation Features

  • Go to Definition (F12) - Jump between parameter and variable headers
  • Find All References (Shift+F12) - Find all usages of identifiers
  • Rename Symbol (F2) - Rename parameters/variables across the file
  • Hover tooltips - Show usage statistics and type information
  • Cross-file navigation - Find definitions and references across multiple rule files in workspace

🔗 Python Integration

Cross-Language "Go to Definition" - Navigate from Python files to .rul file definitions:

  • Smart Navigation: Ctrl+Click on rules.VARIABLE_NAME jumps to .rul file definition
  • Multi-Format Support: Finds variables in table headers, assignments, and requirements
  • Workspace-Wide: Searches all .rul files in your workspace

Usage Example:

# example.py
from rule_mgr.attributes import rules

def calculate_limits():
    temp = rules.TEMP_LIMIT        # Ctrl+Click → jumps to TEMP_LIMIT: in .rul file
    if rules.ENABLE_FEATURE:       # Ctrl+Click → jumps to ENABLE_FEATURE: definition
        return rules.MAX_VALUE     # Navigation works for all rule variables

Note: This feature provides additional .rul file definitions alongside VS Code's built-in Python navigation.

🔍 Advanced Syntax Validation

The extension provides three levels of intelligent syntax checking:

1. Column Alignment Validation

Super-sensitive alignment detection that catches even single-character misalignments:

  • ✅ Detects column shifts and spacing inconsistencies
  • ✅ Handles complex expressions as single values
  • ✅ Ignores formatting symbols in alignment calculations
  • ⚙️ Configurable: Adjust tolerance levels or disable entirely

2. Duplicate Detection

Comprehensive duplicate variable/header detection across all formats:

  • Parameter duplicates: Multiple VARIABLE? definitions
  • Assignment duplicates: Multiple VARIABLE: assignments
  • Assignment operator duplicates: Multiple VARIABLE = value statements
  • Cross-format duplicates: Mixed usage of ?, :, and = for same variable
  • ⚙️ Configurable: Enable/disable duplicate checking
# Duplicate detection examples
PRODUCT_ID?    LOT_ID?    UNIT_ID?
PRODUCT_ID?    BATCH_ID?  UNIT_ID?    # ❌ PRODUCT_ID and UNIT_ID duplicated

VOLTAGE:      3.3V
VOLTAGE:      5.0V                # ❌ VOLTAGE duplicated

TEMP_LIMIT = 85
TEMP_LIMIT = 90                   # ❌ TEMP_LIMIT duplicated with = operator

3. Invalid Syntax Detection

Context-aware detection of undefined identifiers with smart exclusions:

  • Standalone identifiers: Variables referenced but never defined
  • Table headers: Column headers without parameter definitions
  • Smart filtering: Excludes table cell values and assignment expressions
  • Table structure awareness: Understands table context to prevent false positives
  • ⚙️ Configurable: Enable/disable missing identifier checking
# Invalid syntax examples
UNDEFINED_VAR               # ❌ Standalone undefined identifier
MISSING_HEADER?   VALUE?   
ROW_DATA         42        # ❌ MISSING_HEADER defined but ROW_DATA not

# Smart exclusions (these are NOT flagged)
VOLTAGE: UNDEFINED_VALUE    # ✅ Part of assignment, not flagged
TABLE_DATA UNDEFINED_CELL   # ✅ Part of table data, not flagged

🎯 Column Alignment Features

  • Zero-tolerance alignment checking - Detects misalignments as small as one character
  • Smart value detection - Recognizes complex patterns:
    • Mathematical expressions: 40e-6, 100*int(FUNCTION)
    • Quoted arrays: ['OPTION_A'], ['MODE_A', 'MODE_B']
    • Nested objects: {'mapping':[{0:0}]}
    • Function calls: int(MULTIPLIER_VALUE)
  • Formatting symbol exclusion - Ignores standalone symbols like *, -, ], } when checking alignment
  • Error-level reporting - Column misalignments reported as errors for immediate attention

✨ Code Snippets

Type these prefixes and press Tab to expand:

  • param → Parameter header template
  • var → Variable header template
  • section → Header section with parameter and variable
  • bool → Boolean assignment
  • row → Table row with tab-separated values
  • comment → Comment block
  • region → Collapsible region markers

User Configuration

Customize the extension behavior through VS Code settings (Ctrl+, → Extensions → AX6 Rule File):

Alignment Validation Settings

{
  "rulefile.validation.enableColumnAlignment": true,
  "rulefile.validation.alignmentTolerance": 0
}
  • enableColumnAlignment: Enable/disable column alignment checking
  • alignmentTolerance: Number of characters tolerance for alignment (0 = zero tolerance)

Duplicate Detection Settings

{
  "rulefile.validation.enableDuplicateDetection": true
}
  • enableDuplicateDetection: Enable/disable detection of duplicate variable/parameter definitions

Invalid Syntax Detection Settings

{
  "rulefile.validation.enableInvalidSyntaxDetection": true
}
  • enableInvalidSyntaxDetection: Enable/disable detection of undefined identifiers and missing indicators (standalone variables not defined as parameters)

Note: All validation features are enabled by default except duplicate detection. To disable any feature, set the corresponding setting to false in your VS Code settings.

Usage Examples

Parameter and Variable Headers

# Parameter definition (highlighted in blue)
PRODUCT_ID?    LOT_ID?    UNIT_ID?

# Variable assignments (highlighted in purple)  
PRODUCT_ID:    TEST_MODE:         PROGRAM_VERSION:
X1A2          ['MODE_A']         ['1.0','1.1']
X2B3          ['MODE_B']         ['1.2'...'1.5']

Complex Value Recognition

# Mathematical expressions recognized as single values
MAX_LIMIT    100*int(MULTIPLIER_VALUE)    0

# Nested objects and arrays
CONFIG_MAP:    {'mapping':[{0:0}]}    ['OPTION_A']

# Function calls and scientific notation
VOLTAGE_LIMIT:      40e-6    int(CALC_VALUE)

Navigation

  • Click on PRODUCT_ID? and press F12 to jump to all PRODUCT_ID: assignments
  • Right-click any identifier and select "Find All References" to see all usages
  • Press F2 on any header to rename it across the entire file

Hover Information

Hover over any identifier to see:

  • Number of parameter usages
  • Number of variable assignments
  • Number of standalone references

Installation

  1. Download the .vsix file
  2. In VS Code, press Ctrl+Shift+P and run "Extensions: Install from VSIX..."
  3. Select the downloaded file
  4. Reload VS Code

File Association

The extension automatically activates for files with these extensions:

  • .rul

Language Configuration

The extension provides:

  • Auto-indentation with 2-space tabs
  • Bracket matching for [], {}, (), <>
  • Comment toggling with Ctrl+/
  • Region folding with #region / #endregion

Contributing

Found a bug or have a feature request? Please open an issue on the GitHub repository.

License

This extension is licensed under the MIT License.


Enjoy enhanced AX6 rule file editing with intelligent language support!

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