Clang Biome
A linter and formatter for C written against Renesas RL78 / CC-RL conventions. It parses with
tree-sitter, so its rules act on a syntax tree rather than on regular expressions, and it leaves
non-standard embedded constructs byte for byte as you wrote them.
Features
- Ten lint rules in the Problems panel — naming (
constant-upper-snake,
func-name-uppercase-start, global-var-uppercase-start, var-prefix) and defensive-style rules
(if-else-requires-else, switch-requires-default, switch-sequence-break,
no-assign-in-condition, no-magic-number, require-comment-empty-block), each set to off,
warning or error on its own. Analysis runs 500 ms after you stop typing, on editor switches,
on setting changes and at activation.
- Twenty formatter rules on whole-document formatting — indentation, brace style, operator and
keyword spacing, pointer asterisk placement, hex literal case, comment alignment, trailing
whitespace and final newline, each individually switchable. Reached from
Shift+Alt+F and from
format-on-save; range formatting is deliberately not offered.
- RL78 guard — SFR bit access such as
P1.0 = 1, #pragma interrupt/sfr/address/inline_asm
lines, CC-RL keywords (__interrupt, __near, __far, __saddr, __fsmx, sreg) and anything
tree-sitter cannot parse are never rewritten and never produce a diagnostic.
- Workspace-wide lint on demand — one command lints every C file in the workspace, so files you
have not opened still report.
- Conservative defaults — indentation is tabs, brace style is
linux, and the three rules that
rewrite already-correct code (align-declarations, align-array-elements,
collapse-blank-lines) are off, so existing hand-made alignment survives. iodefine.h is
excluded from both surfaces by default. An invalid setting value falls back on its own and the
reason is written to the Clang Biome output channel, rather than resetting the rest.
Usage
Lint runs automatically in files VS Code treats as c or cpp. Format with Shift+Alt+F, or
select this extension as your C formatter and enable format-on-save.
| Command |
Keybinding |
What it does |
clangBiome.lintWorkspace — Lint All C Files in the Workspace |
— |
Lints every file matching clangBiome.lint.extensions. |
clangBiome.toggle — Toggle Linting |
Ctrl+Alt+B |
Flips clangBiome.lint.enabled and clears the Problems panel when turning it off. |
Settings
Forty-three keys live under clangBiome.*. The ones you are likely to touch:
| Setting |
Default |
Purpose |
clangBiome.lint.enabled |
true |
Report lint diagnostics. |
clangBiome.lint.excludeFiles |
["iodefine.h"] |
Files that produce no diagnostics; base name or workspace-relative path. |
clangBiome.lint.extensions |
[".c", ".h", ".C", ".H"] |
Extensions collected by a workspace lint run. |
clangBiome.lint.rules.<rule> |
warning (var-prefix: off) |
Severity of one lint rule: off, warning, error. |
clangBiome.format.enabled |
true |
Offer this extension as the C/C++ document formatter. |
clangBiome.format.excludeFiles |
["iodefine.h"] |
Files the formatter refuses to touch. |
clangBiome.format.indent.style |
tab |
tab or space; format.indent.width (default 4) applies only to space. |
clangBiome.format.braceStyle |
linux |
Opening-brace placement: kr, allman or linux. |
clangBiome.format.alignComment.column |
100 |
Target column for trailing end-of-line comments. |
clangBiome.format.breakIfConditions.minConditions |
2 |
Condition count at which a long if is split across lines. |
clangBiome.format.rules.<rule> |
true (three off, see above) |
Enable or disable one formatter rule. |
Limitations
The formatter skips documents over 200 KB and the linter documents over 500 KB, writing the reason
to the output channel. clangBiome.lint.sfrExclusion.enabled and
clangBiome.lint.sfrExclusion.iodefinePath have no effect in this version — the SFR-name exclusion
set is a stub, and keeping iodefine.h in the exclude lists is the working alternative.
var-prefix has no built-in prefix scheme, so turning it on reports that the rule is unconfigured.
Requirements
Visual Studio Code 1.100.0 or later.
| |