Adds the ; you forgot the moment you leave a line of C. Written for embedded C (Renesas RL78 /
CC-RL), where a missing semicolon is the most common compile error.
Features
Semicolon on the line you leave — pressing Enter, inserting a line above or below, or
moving off the line with ↑/↓ parses the line you left with tree-sitter and appends ; only if
it is a statement that must end in one, so int a = 1 becomes int a = 1; while if (x),
#define, comments and unfinished expressions are left alone.
Completion acceptance finishes the statement — accepting a suggestion with Tab or Enter
turns counter = coun into counter = counter; and puts the cursor after the semicolon. Nothing
is added when the accepted item leaves the cursor mid-line (a snippet placeholder such as f(|))
or when the statement is still incomplete.
No doubled semicolons — for three seconds after an automatic ;, typing ; yourself leaves
one, not ;;, the same way auto-closing brackets behave. It works by removing the duplicate
rather than claiming the ; key, so a keymap extension that binds ; keeps working.
Missing : on switch labels — case 0 or default left on its own line gets its colon
instead of a semicolon.
Conservative where the parse is unclear — unparseable regions such as RL78 SFR bit access
(P1.0 = 1) fall back to a line-level rule that prefers adding nothing. Undo/redo, paste,
Enter in the middle of a line, mouse clicks and multiple cursors never trigger it, and one
Ctrl+Z removes the new line and the added character together.
Usage
Works automatically. A file is handled when its language is c, or when its name ends in .c or
.h in any letter case — the name rule matters when a setting such as
"files.associations": { "*.C": "cpp" } makes Windows report C files as C++. Real C++ files
(.cpp, .hpp, .cc) are left alone.
The Tab / Enter acceptance path is the command Clang Auto Semicolon: Accept Suggestion and
Append Semicolon (clangAutoSemicolon.acceptSuggestion), bound to those keys only while the
suggestion widget has a focused item in a handled file. Rebind it if your keymap needs different
keys.
Settings
Setting
Default
Purpose
clangAutoSemicolon.enabled
true
Turn the extension on or off.
clangAutoSemicolon.completionSemicolon
true
Append the ; when a completion is accepted, and swallow a ; typed right after it.
clangAutoSemicolon.debugLog
false
Write to the Clang Auto Semicolon output channel why an edit was skipped or what was inserted.