This extension provides practical FreeBASIC support for Visual Studio Code.
It is focused on making .bas and .bi files feel like first-class editor content instead of plain text with a few colored keywords.
- FreeBASIC language registration for
.basand.bi - syntax highlighting for core language forms, runtime APIs, graphics routines, TCP forms, and sfxlib commands
- editor language configuration for comments, word selection, and indentation
- snippets based on real FreeBASIC example patterns
- lightweight IntelliSense for built-ins and traced declarations
The grammar and snippets were expanded against the FreeBASIC fbc-fbxl tree, with coverage taken from the parts of the source that define or parse the language:
src/compiler/symb-keyword.bassrc/compiler/rtl-*.bassrc/compiler/parser-quirk-file.bassrc/compiler/parser-quirk-console.bassrc/compiler/parser-quirk-gfx.bassrc/compiler/parser-quirk-thread.bassrc/compiler/parser-quirk-sfx.bassrc/gfxlib2examples/network/opentcpexamples/sfxlibexamples/manual
That means the extension covers:
- core declaration, control-flow, OOP, and type-system keywords
- built-in and runtime functions across console, file, math, string, system, thread, and graphics areas
- graphics statements and helpers such as
DRAW STRING,VIEW SCREEN,SCREEN,GET,PUT, and palette forms - TCP and device
OPENforms such asOPEN TCP,OPEN TCP SERVER, andTCP ACCEPT - newer
MUSIC,SFX,AUDIO,STREAM,MIDI,DEVICE, andCAPTUREcommand families
The current IntelliSense layer is intentionally lightweight.
It provides:
- completions for compiler keywords, built-ins, runtime names, graphics names, and selected symbolic constants
- completions for declarations traced from the current document
- hover information for traced declarations and built-in symbols
- document symbols and workspace symbols
- go-to-definition for traced declarations across
.basand.bifiles in the workspace
This is not a full language server yet, so it does not attempt compiler-grade parsing, diagnostics, or type checking.
The repository does not require vsce.
The main project commands are:
powershell -ExecutionPolicy Bypass -File .\tools\build-freebasic-grammar.ps1powershell -ExecutionPolicy Bypass -File .\tests\test-smoke.ps1powershell -ExecutionPolicy Bypass -File .\tests\test-unit.ps1powershell -ExecutionPolicy Bypass -File .\tools\build-vsix.ps1
The smoke test rebuilds the generated grammar, validates the JSON assets, and runs the grammar coverage audit. The unit test covers the reusable parser helpers and the generated string-token rule used for common empty-string cases such as Input "" and Inkey$ <> "".
If VS Code is already using an older copy of the extension, close all VS Code windows before reinstalling the generated .vsix.
If you want to isolate packaging from your normal profile while testing, this command installs into a temporary extension directory:
code --transient --extensions-dir .\.tmp-code-extensions --install-extension .\dist\fb-vscode-language-1.20.1.vsix --forceThe extension already aims to be more than a syntax highlighter, but there is still room to grow.
The main next steps are:
- more editor-side validation against the upstream example corpus
- continued refinement of edge cases where TextMate highlighting can only approximate parser context
- richer semantic tooling over time