-
Install the Extension:
- Open VS Code
- Press
F5to launch the extension in development mode - Or package and install the
.vsixfile
-
Test the Extension:
- Open the included
test_example.lstfile - You should immediately see enhanced syntax highlighting
- Try typing GFA BASIC code to see auto-completion and snippets
- Open the included
- Create a new file with extension
.lst - Start typing GFA BASIC code
- Enjoy the enhanced features!
The extension recognizes and highlights:
name$ ' String variable (highlighted in string color)
count% ' 32-bit integer (highlighted in integer color)
addr& ' 16-bit integer (highlighted in integer color)
flag| ' 8-bit integer (highlighted in integer color)
active! ' Boolean variable (highlighted in boolean color)
value ' Float variable (default highlighting)
123 ' Decimal number
456.789 ' Float number
&H1A2B ' Hexadecimal number
&X1010 ' Binary number
' This is a line comment
PRINT "Hello" ! This is an inline comment
' All control keywords are highlighted
IF condition THEN
' code here
ENDIF
FOR i = 1 TO 10
' loop code
NEXT i
WHILE condition
' loop code
WEND
Type these prefixes and press Tab to expand:
| Prefix | Expands to | Description |
|---|---|---|
for |
FOR loop | Basic FOR loop structure |
forstep |
FOR loop with STEP | FOR loop with step increment |
while |
WHILE loop | WHILE...WEND structure |
repeat |
REPEAT loop | REPEAT...UNTIL structure |
if |
IF statement | Basic IF...ENDIF structure |
ifelse |
IF ELSE statement | IF...ELSE...ENDIF structure |
select |
SELECT CASE | SELECT...CASE...ENDSELECT structure |
procedure |
PROCEDURE | Procedure definition |
function |
FUNCTION | Function definition |
pset |
PSET command | Set pixel graphics command |
line |
LINE command | Draw line graphics command |
circle |
CIRCLE command | Draw circle graphics command |
xbios |
XBIOS call | System XBIOS call |
peek |
PEEK memory | Read byte from memory |
poke |
POKE memory | Write byte to memory |
The extension automatically indents code for:
FOR...NEXTloopsWHILE...WENDloopsREPEAT...UNTILloopsDO...LOOPconstructsIF...ELSE...ENDIFconditionalsSELECT...CASE...ENDSELECTstatementsPROCEDURE...RETURNblocksFUNCTION...ENDFUNCblocks
Hover over keywords to see documentation:
- Graphics Functions: PSET, LINE, BOX, CIRCLE, SETCOLOR, etc.
- System Functions: XBIOS, PEEK, POKE, VSYNC, etc.
- Control Structures: IF, FOR, WHILE, SELECT, etc.
- Math Functions: SHR, SHL, RAND, ABS, etc.
The extension provides symbol navigation for:
- Procedures: Defined with
PROCEDURE - Functions: Defined with
FUNCTION - Labels: Defined with
label_name:
Access via:
Ctrl+Shift+O- Go to Symbol in FileCtrl+T- Go to Symbol in Workspace- Outline view in Explorer panel
You can create custom snippets by:
- Open Command Palette (
Ctrl+Shift+P) - Type "Preferences: Configure User Snippets"
- Select "gfabasic"
- Add your custom snippets
Example custom snippet:
{
"Custom Graphics Loop": {
"prefix": "gfxloop",
"body": [
"FOR y& = 0 TO 199",
" FOR x& = 0 TO 319",
" color| = ${1:calculation}",
" PSET x&, y&, color|",
" NEXT x&",
"NEXT y&"
],
"description": "Graphics pixel loop"
}
}| Shortcut | Action |
|---|---|
Ctrl+Space |
Trigger auto-completion |
Ctrl+Shift+Space |
Trigger parameter hints |
Ctrl+K Ctrl+I |
Show hover information |
F12 |
Go to definition |
Alt+F12 |
Peek definition |
Shift+F12 |
Find all references |
Ctrl+Shift+O |
Go to symbol in file |
Ctrl+T |
Go to symbol in workspace |
Recommended file structure for GFA BASIC projects:
project/
├── main.lst # Main program file
├── graphics.lst # Graphics routines
├── sound.lst # Sound routines
├── data/
│ ├── sprites.dat # Sprite data
│ └── levels.dat # Level data
└── include/
├── constants.lst # Constant definitions
└── macros.lst # Macro definitions
-
Syntax highlighting not working:
- Ensure file has correct extension (
.lst) - Check VS Code language mode (bottom right corner)
- Reload window (
Ctrl+Shift+P→ "Developer: Reload Window")
- Ensure file has correct extension (
-
Auto-completion not appearing:
- Press
Ctrl+Spaceto manually trigger - Check if extension is activated
- Verify file is recognized as GFA BASIC
- Press
-
Indentation not working:
- Check VS Code indentation settings
- Ensure "Auto Indent" is enabled
- Verify language configuration is loaded
-
Snippets not expanding:
- Press
Tabafter typing prefix - Check if "Tab Completion" is enabled in settings
- Verify snippet syntax in configuration
- Press
-
Large Files:
- For files over 1000 lines, consider splitting into modules
- Use folding to collapse large procedures
- Disable unnecessary extensions for better performance
-
Memory Usage:
- Close unused files
- Restart VS Code periodically for large projects
- Monitor extension host performance
-
Variable Naming:
' Use descriptive names with proper suffixes player_name$ ' String for player name score% ' 32-bit integer for score lives| ' 8-bit integer for lives count game_over! ' Boolean for game state -
Comments:
' Use comments to explain complex logic ' Calculate screen address for pixel screen_addr% = &HFFFF8000 + (y& * 160) + (x& / 8) -
Indentation:
' Proper indentation for readability IF player_lives| > 0 IF enemy_collision! DEC player_lives| GOSUB player_hit_routine ENDIF ELSE GOSUB game_over_routine ENDIF
-
Modular Design:
- Separate graphics, sound, and game logic
- Use procedures and functions for reusable code
- Keep main program file clean and organized
-
Documentation:
- Comment all procedures and functions
- Document variable purposes
- Include usage examples for complex routines
-
Version Control:
- Use Git for version control
- Commit frequently with descriptive messages
- Tag stable versions
Happy coding with GFA BASIC 3.6! 🖥️