Productivity features to write Clarion code faster.
The Clarion Extension provides powerful code editing tools:
- 50+ code snippets - Quick insertion of common structures
- Paste as Clarion String - Convert text to Clarion string format
- Add Method Implementation - Generate method stubs automatically
- Create New Class - Interactive class creation wizard
- Code folding - Collapse/expand code blocks
Shortcuts that expand into full code structures:
- Type the trigger word (e.g.,
IF) - Press Tab
- Full structure inserted with placeholders
- Tab again to jump to next placeholder
Trigger: IF
IF THEN
ENDTrigger: IFE (IF with ELSE)
IF THEN
ELSE
ENDTrigger: LOOP
LOOP
ENDTrigger: LOOPFT (LOOP with FROM/TO)
LOOP var = from TO to
ENDTrigger: LOOPFILE (File LOOP)
LOOP UNTIL ACCESS:FileName.Next()
ENDTrigger: CASE
CASE variable
OF value
ENDMAP→ MAP/ENDMODULE→ MODULE/ENDCLASS→ CLASS/ENDGROUP→ GROUP/ENDQUEUE→ QUEUE/ENDFILE→ FILE/END
Pattern: V{type} (V = Variable)
VS→Bar STRING(10)VL→Bar LONGVR→Bar REALVD→Bar DECIMAL(10,2)VDT→Bar DATEVTI→Bar TIME
Pattern: RV{type} (RV = Reference Variable)
RVS→Bar &STRINGRVL→Bar &LONGRVR→Bar &REAL
Pattern: PV{type} (PV = Procedure Variable)
PVS→(STRING Foo)PVL→(LONG Foo)
Pattern: PVR{type} (PVR = Procedure Reference)
PVRS→(*STRING Foo)PVRL→(*LONG Foo)
| Shortcut | Type |
|---|---|
s |
STRING |
l |
LONG |
r |
REAL |
d |
DECIMAL |
dt |
DATE |
ti |
TIME |
b |
BYTE |
sh |
SHORT |
ul |
ULONG |
us |
USHORT |
cs |
CSTRING |
ps |
PSTRING |
Converts clipboard text to Clarion string format:
- Automatically escapes quotes
- Converts unicode quotes to ASCII (for Clarion compatibility)
- Adds line continuation (
& |) - Handles multi-line text
- Perfect for SQL, error messages, multi-line strings
Note: Unicode "smart quotes" (', ', ", ") from Word, web browsers, etc. are automatically converted to ASCII quotes (' and ") to ensure Clarion compiler compatibility.
- Copy text to clipboard (any source)
- In VS Code, position cursor where you want string
- Press
Ctrl+Shift+Alt+V - Text pasted as Clarion string
Or:
Ctrl+Shift+P→ "Clarion: Paste as Clarion String"
Clipboard:
Hello World
Pasted:
'Hello World'Clipboard:
This is line 1
This is line 2
This is line 3
Pasted (default):
'This is line 1' & |
'This is line 2' & |
'This is line 3'Clipboard:
He said "Hello"
Pasted:
'He said "Hello"'Clipboard (with "smart quotes"):
SELECT * FROM Customers WHERE Name = 'John's Store'
Pasted (automatically converted to ASCII):
'SELECT * FROM Customers WHERE Name = ''John''s Store'''Note: Unicode quotes (', ', ", ") are converted to ASCII (' and ") before escaping. This ensures Clarion compiler compatibility.
Clipboard:
SELECT *
FROM Customers
WHERE Country = 'USA'
ORDER BY CustomerNamePasted:
'SELECT *' & |
'FROM Customers' & |
'WHERE Country = ''USA''' & |
'ORDER BY CustomerName'Note: Single quotes automatically doubled for SQL escaping!
Choose how lines are joined:
{
"clarion.pasteAsClarionString.lineTerminator": "space" // Default
}Options:
"space" - Join with space (default)
'Line 1' & |
'Line 2'"crlf" - Include CRLF characters
'Line 1' & |
'<13,10>' & |
'Line 2'"none" - No line breaks
'Line 1Line 2'Remove indentation from pasted text:
{
"clarion.pasteAsClarionString.trimLeading": true // Default
}Example with trim enabled:
Clipboard:
Indented line 1
Indented line 2
Pasted:
'Indented line 1' & |
'Indented line 2'Automatically generates method implementations from CLASS declarations:
- Finds the method declaration in CLASS
- Locates the MODULE file
- Checks for existing implementation
- Generates new implementation or jumps to existing
- Place cursor on method name in CLASS declaration
- Press
Ctrl+Shift+I - Implementation generated in MODULE file
- Cursor moves to new implementation
Or:
Ctrl+Shift+P→ "Clarion: Add Method Implementation"
In MyClass.inc:
MyClass CLASS,MODULE('MyClass.clw')
Init PROCEDURE() ← Cursor here, press Ctrl+Shift+I
ENDGenerates in MyClass.clw:
MyClass.Init PROCEDURE
CODE
! Your code hereHandles overloaded methods:
MyClass CLASS,MODULE('MyClass.clw')
Process PROCEDURE(STRING value)
Process PROCEDURE(*STRING reference) ← Generates correct signature
ENDGenerates:
MyClass.Process PROCEDURE(*STRING reference)
CODE
Uses parameter types to match correct overload!
If implementation already exists:
- Jumps to existing implementation
- Does NOT create duplicate
- Cursor positioned at implementation
Interactive wizard creates both .inc and .clw files:
- Prompts for class name
- Asks for folder location
- Creates
.incfile with CLASS declaration - Creates
.clwfile with MODULE stub - Opens both files
- Press
Ctrl+Shift+P - Type "Clarion: Create New Class"
- Enter class name (e.g.,
MyClass) - Select destination folder
- Files created and opened
MyClass.inc:
MyClass CLASS,MODULE('MyClass.clw'),TYPE,THREAD
Init PROCEDURE()
Kill PROCEDURE()
ENDMyClass.clw:
MEMBER('MyClass')
MAP
END
INCLUDE('MyClass.inc'),ONCE
MyClass.Init PROCEDURE
CODE
MyClass.Kill PROCEDURE
CODE
Collapse/expand code blocks:
- Hides implementation details
- Focus on structure
- Navigate large files easier
All major Clarion structures:
- PROCEDURE/END
- CLASS/END
- IF/END
- LOOP/END
- CASE/END
- MAP/END
- GROUP/END
- ROUTINE/END
Fold/unfold block:
- Click ▼ icon in left gutter
- Or press
Ctrl+Shift+[(fold) - Or press
Ctrl+Shift+](unfold)
Fold all:
Ctrl+K Ctrl+0- Fold allCtrl+K Ctrl+J- Unfold all
Fold level:
Ctrl+K Ctrl+1- Fold level 1Ctrl+K Ctrl+2- Fold level 2- etc.
Automatically closes:
(→()[→[]'→''"→""
Cursor positioned inside:
MyProc(|) ← Cursor here after typing (Matching brackets highlighted:
- Place cursor next to bracket
- Matching bracket highlighted
- Makes nested structures easier to read
- Type trigger
- Tab to expand
- Type placeholder value
- Tab to next placeholder
- Repeat until done
- Keep Paste as String shortcut handy
- Use for any multi-line text
- SQL queries, error messages, help text
- Use wizard for consistent structure
- Generates Init/Kill methods automatically
- Proper MODULE reference
- Fold completed procedures
- Focus on current work
- Unfold when needed
- Signature Help - Parameter hints for functions
- Snippets Reference - All available snippets
- Common Tasks - Usage examples