vscode-fson gives .fson files full syntax highlighting, editing support, and a formatter that matches what the fson library itself produces.
Install
Marketplace (publisher Fedem): search FSON in the Extensions view, or
code --install-extension Fedem.vscode-fson
From a .vsix (on the Downloads page): see Installing a .vsix.
Highlighting
A TextMate grammar (scope source.fson) covering every FSON token:
//line and nested/* … */block comments- bare and quoted keys
- single-, double-, and
|-block strings, with escape sequences - numbers — hex (
0xFF),Infinity/NaN, leading/trailing-dot forms true/false/null%include … asdirectives--disabled members, scoped asmarkup.disabled.fsonso they can be dimmed. The extension ships a default rule (#acdea9, italic); override it in your owneditor.tokenColorCustomizationsif you prefer.
Run Developer: Inspect Editor Tokens and Scopes to see the scope under the cursor.
Editing support
- line/block comment toggling
- bracket matching and auto-closing for
{},[],"",'' - a
wordPatternthat matches FSON's narrow bare-key grammar
Formatter
The extension registers a document formatter for .fson — use Format Document or format-on-save. It is a faithful JavaScript port of the fson library's canonical writer, so its output matches Fson::save's: 2-space indent, one member per line, comments (all positions, nested blocks), -- members, %include directives and |-blocks all preserved, number lexemes exact, output a fixed point.
If the document has parse errors the formatter declines to run (so a half-typed file is never mangled) and shows a warning.
Setting — fson.format.preferBareKeys (default false): when on, quoted keys are rewritten bare wherever the name grammar allows. Matches the library's preferBareKeys / fson-check --bare.
Notes
- A
|-block is highlighted as one string; Markdown embedded inside it is intentionally not separately highlighted. - The bare-key grammar follows FSON's
nameproduction, not JSON5'sIdentifierName—$foo,_x,name_,a__bmust be quoted.

