Clang Func Completion
Clang Func Completion fills in the half of a C function you have not written yet: it suggests
only functions whose declaration or definition is missing, and inserts the missing one for you.
Features
- Completes the missing counterpart. Where a definition belongs, you are offered the
functions that are declared but never defined, inserted as a full signature with a
{ } body
and the cursor placed inside. Where a declaration belongs — a header, or the prototype block
at the top of a .c file — you are offered the functions that are defined but never declared,
inserted as a signature ending in ;.
- Never suggests what already exists. A function that has both a declaration and a
definition is filtered out, so the list stays short instead of duplicating ordinary
token-match completion.
- A lower-priority tier for functions you called before writing them. A name that is called
somewhere in the workspace but declared and defined nowhere is offered too. Only the bare name
is inserted: a call site shows argument expressions, never their types, so any signature built
from one would be a guess.
- Replaces the type tokens you already typed. Typing
static void fun and accepting a
candidate produces static void fun(...), not a duplicated return type. extern is dropped
when inserting a definition, since it only means something on a declaration.
- Whole-workspace scan kept warm in the background. The scan runs at startup, re-runs when
you save a supported file, and is cleared when files are deleted or renamed.
- Respects
static linkage. A static definition is offered as a declaration candidate
only inside the file that defines it.
Usage
Works automatically in c and cpp files (.c .C .cpp .cxx .h .hpp .hxx). Start
typing a function name where a declaration or a definition would go and the candidates appear in
the normal completion list. Inside a function body, where neither can be written, nothing is
offered.
If the workspace scan has to stop early — more than 5000 files, a file over 4 MB, directories
nested deeper than 12 levels, or an unreadable file — a warning is shown once per scan. A file
that was skipped makes an already-defined function look undefined, so check the signature before
accepting an insertion.
Requirements
VS Code 1.104.0 or later. No compiler or language server is required; signatures are extracted
by text analysis. Because that analysis is regex-based rather than a real C parser, unusual
declaration forms (a pointer return type written as char *get_buf(void), CC-RL __far /
__near / __callt qualifiers, or a function returning a function pointer) may go unrecognized,
which again shows up as an offer to insert a duplicate definition.