Real-time error detection and code validation as you type.
The Clarion Extension provides real-time diagnostics:
- Immediate feedback - Errors highlighted as you type
- Squiggly underlines - Visual indicators in code
- Problems panel - List of all issues
- Hover for details - Error descriptions on hover
- Quick fixes - Suggested solutions (where applicable)
Detects missing END statements:
IF x = 1 THEN
DoSomething()
! ❌ Error: Missing ENDStructures checked:
IF/THEN→ requiresENDLOOP→ requiresENDCASE/OF→ requiresENDEXECUTE→ requiresENDBEGIN→ requiresENDCLASS→ requiresENDGROUP→ requiresENDMAP→ requiresENDMODULE→ requiresEND
Error message:
Unterminated IF structure
Expected END statement
Detects wrong termination keywords:
IF x = 1 THEN
DoSomething()
UNTIL ! ❌ Error: Expected END, got UNTILDetects procedures without RETURN:
MyProc PROCEDURE
CODE
x = 10
! ❌ Warning: Missing RETURN statementNote: Not required for ROUTINE blocks.
Validates all code paths have RETURN:
MyProc PROCEDURE
CODE
IF condition
RETURN ! ✅ OK
ELSE
x = 10
! ❌ Warning: Missing RETURN in ELSE branch
ENDFILE declarations must have DRIVER:
MyFile FILE
Record RECORD
END
END ! ❌ Error: FILE missing DRIVER attributeShould be:
MyFile FILE,DRIVER('TOPSPEED'),CREATE
Record RECORD
END
END ! ✅ OKFILE declarations must have RECORD:
MyFile FILE,DRIVER('TOPSPEED')
END ! ❌ Error: FILE missing RECORD definitionShould be:
MyFile FILE,DRIVER('TOPSPEED')
Record RECORD
Field LONG
END
END ! ✅ OKOnly OF/OROF allowed in CASE:
CASE x
OF 1
DoSomething()
ELSE ! ❌ Error: ELSE not allowed in CASE (use OROF)
DoOther()
ENDShould be:
CASE x
OF 1
DoSomething()
OROF 2 TO 10 ! ✅ OK
DoOther()
ENDOnly BEGIN allowed in EXECUTE:
EXECUTE choice
OF 1
DoSomething() ! ❌ Error: Use BEGIN instead of OF in EXECUTE
ENDShould be:
EXECUTE choice
BEGIN
DoSomething() ! ✅ OK
END
ENDDetects missing OMIT terminator:
OMIT('DEBUG')
DebugCode()
! ❌ Error: Missing OMIT terminatorShould be:
OMIT('DEBUG')
DebugCode()
! ! ✅ OKDetects missing COMPILE terminator:
COMPILE('DEBUG')
DebugCode()
! ❌ Error: Missing COMPILE terminatorDetects user-defined labels that clash with Clarion reserved keywords:
LOOP LONG ! ❌ Error: 'LOOP' is a reserved keyword and cannot be used as a labelWarns when a procedure with a return type is called but the result is discarded:
MAP
GetCount(), LONG
END
CODE
GetCount() ! ⚠️ Warning: Return value of GetCount() is discarded
x = GetCount() ! ✅ OKNote: Only applies to plain MAP/MODULE procedures, not class methods.
Detects control flow statements used in invalid context:
MyProc PROCEDURE
CODE
BREAK ! ❌ Error: BREAK must be inside a LOOP or ACCEPT block
CYCLE ! ❌ Error: CYCLE must be inside a LOOP or ACCEPT blockDetects variables whose class type is defined in an .inc file that isn't included:
st StringTheory ! ⚠️ Warning: 'StringTheory' is defined in 'StringTheory.inc' which is not included.
af &FileManager ! ⚠️ Warning: 'FileManager' is defined in 'ABFile.inc' which is not included.How it works:
- Checks global-scope variable declarations (column 0) whose type is a known
CLASSorINTERFACE - Walks the full transitive include chain (any depth, cycle-safe) — a type included via
A.inc → B.incis correctly resolved - Also checks the
MEMBERparent file's includes if the current file has aMEMBER('parent.clw')statement
Quick fix (Ctrl+.):
- Add INCLUDE to this file — inserts
INCLUDE('type.inc'),ONCEat module scope - Add INCLUDE to MEMBER parent — inserts into the parent
.clwfile instead - Add INCLUDE + constants — inserts the include and any missing
DefineConstantsentries in one step
Detects class types whose .inc is present but required Link()/DLL() constants are missing from the project:
st StringTheory ! ℹ️ Info: 'StringTheory' requires project constants that are not defined: ST_LinkMode, ST_DllModeThis fires as Information severity (blue squiggle) — the code compiles but will link or run incorrectly without the constants.
Quick fix (Ctrl+.):
- Add Link constants — QuickPick prompts: Static link (
LinkMode=>1, DllMode=>0) or DLL mode (LinkMode=>0, DllMode=>1). Adds the chosen constants toDefineConstantsin the.cwproj.
The diagnostic clears immediately once the constants are added (the extension watches the .cwproj file for changes).
Squiggly underlines:
- Red squiggles - Errors
- Yellow squiggles - Warnings
- Blue squiggles - Information
Hover for details:
- Place mouse over squiggle
- Tooltip shows error message
- May include suggested fix
View all issues:
- Press
Ctrl+Shift+M - Or: View → Problems
Shows:
- File name and path
- Line and column number
- Error severity (Error/Warning/Info)
- Error message
Click to navigate:
- Click any problem in list
- Editor jumps to that line
- Squiggle highlighted
Bottom-left shows issue count:
❌ 2 ⚠️ 3 ℹ️ 1
- ❌ - Errors
⚠️ - Warnings- ℹ️ - Information
Click count to open Problems panel
Critical issues that prevent compilation:
- Unterminated structures
- Missing required attributes (DRIVER, RECORD)
- Invalid syntax
Must be fixed before application can be built.
Issues that may cause problems:
- Missing RETURN statements
- Unreachable code
- Questionable patterns
Should be reviewed but won't prevent compilation.
Suggestions and hints:
- Code style recommendations
- Optimization opportunities
- Best practice hints
Optional to fix.
Turn all diagnostics off:
{
"clarion.diagnostics.enabled": false
}Structure validation:
{
"clarion.diagnostics.validateStructures": false
}FILE validation:
{
"clarion.diagnostics.validateFiles": false
}RETURN validation:
{
"clarion.diagnostics.validateReturns": false
}Make warnings errors:
{
"clarion.diagnostics.missingReturn": "error" // Default: "warning"
}Suppress warnings:
{
"clarion.diagnostics.missingReturn": "information"
}Visually dims code that cannot be executed:
MyProc PROCEDURE
CODE
IF condition
RETURN
END
x = 10 ! ← Dimmed (unreachable after RETURN)
RETURNDetected patterns:
- Code after unconditional RETURN
- Code after unconditional EXIT
- Code after unconditional HALT
Scope-aware detection:
- Only dims code at top execution level
- ROUTINE blocks always considered reachable
- Respects Clarion semantics (STOP is not a terminator)
Visual effect:
- 40% opacity dimming
- Non-intrusive
- Zero false positives
Disable unreachable code detection:
{
"clarion.unreachableCode.enabled": false
}- Address red squiggles (errors) before warnings
- Errors prevent compilation, warnings don't
- Use Problems panel to see all errors at once
- Warnings indicate potential issues
- May cause runtime problems
- Consider fixing before production
- Don't wait until end to check errors
- Fix issues as they appear
- Faster than debugging later
If diagnostic is incorrect:
- Check code syntax is valid
- Verify structure termination
- Report issue on GitHub if bug confirmed
Workaround: Disable specific validation temporarily
If errors not detected:
- Check
clarion.diagnostics.enabledistrue - Verify file extension is
.clw,.inc, or.equ - Reload window:
Ctrl+Shift+P→ "Developer: Reload Window"
If diagnostics slow down editor:
- Disable validations you don't need
- Larger files take longer to validate
- Consider disabling for very large files (10K+ lines)
{
"clarion.diagnostics.validateOnChange": false // Validate on save only
}- Code Editing - Tools to fix issues quickly
- Common Tasks - Handling errors
- Settings Reference - All diagnostic settings