Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>clang unused dimNew to Visual Studio Code? Get it now.
clang unused dim

clang unused dim

noname

|
6 installs
| (0) | Free
Dim unused variables, parameters, functions, declarations and includes in C/C++ without clangd
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

clang unused dim

Fades out unused C/C++ symbols directly in the editor. Detection is pure text analysis over the open file plus a workspace-wide token index — no clangd, no compiler, no compile_commands.json — so it works on vendor embedded trees (Renesas CC-RL / e2 studio / CS+, IAR, Keil) where a language server cannot realistically be configured.

Features

  • Single-file checks that work immediately, with no index and no setup: local variables declared but never used, parameters that never appear in the body, static functions and file-scope static variables nothing in their own file references, and an extern declaration a .c file never mentions again.
  • Workspace-proven checks for what one file cannot decide — non-static functions and prototypes that no file in the workspace calls, and a header's extern declarations. These appear only once the background index is ready and its evidence is complete.
  • Silence instead of a guess. Dimming code that is actually in use is the failure that matters, so wherever the evidence is incomplete — a ## token paste, inline assembly, an unreadable file, unsaved edits, a rebuilding index — the affected verdicts are dropped rather than shown. The tool deliberately under-reports.
  • Reads the toolchain files a C parser would miss. Assembler, linker scripts and CC-RL subcommand files are swept for identifiers, so an interrupt handler referenced only from startup.s or an ENTRY() in a linker script does not look dead. Leading underscores match both ways.
  • Non-UTF-8 sources are handled, using the encoding VS Code resolves for each file, so Shift-JIS CC-RL sources are analysed rather than turned into mojibake.
  • A status bar item that says why nothing is dimmed, distinguishing "no unused symbols here" from "this file cannot be judged", and naming the file that caused the refusal.
  • An optional #include hint (off by default) for recognised standard headers whose symbols never appear in the file. It is advisory only — confirm with a build before deleting an include.

Usage

Works automatically on C and C++ files. Dimming appears as you edit for the single-file checks, and once the workspace scan finishes for the cross-file ones. Press ctrl+alt+u (or run the toggle command, listed in the palette as "Toggle dimming of unused symbols") to turn dimming on and off, and click the status bar item (or run "Show unused-symbol verdict status") to see why a file or a kind is not being judged.

Settings

Setting Default Purpose
clangUnusedDim.enabled true Master switch for all dimming.
clangUnusedDim.opacity 0.45 Opacity of dimmed identifiers (0 invisible, 1 normal).
clangUnusedDim.localVariables true Dim locals declared but never used in their function body.
clangUnusedDim.parameters true Dim parameters that never appear in the body.
clangUnusedDim.staticFunctions true Dim static functions unreferenced in their own file.
clangUnusedDim.staticVariables true Dim file-scope static variables unreferenced in their own file.
clangUnusedDim.includeNonStaticFunctions true Dim non-static functions no file in the workspace calls.
clangUnusedDim.functionDeclarations true Dim prototypes no file in the workspace calls.
clangUnusedDim.externVariables true Dim unused extern declarations and workspace-proven-unused globals.
clangUnusedDim.includes false Advisory #include hint for standard headers (off by default).

Limitations

Worth knowing before trusting a verdict on unfamiliar code: the index only proves absence of use within the opened workspace, so a header consumed from an SDK or a sibling repository looks unused; the preprocessor is not evaluated; macro-assembled names, K&R definitions, __attribute__ carriers, inline functions and files containing asm blocks are never analysed; and a name is counted as used whenever the identifier reappears, so a same-named field or macro suppresses the report.

Requirements

VS Code 1.100.0 or later — the floor comes from vscode.workspace.decode, which resolves files.encoding so Shift-JIS sources are read correctly. Nothing else: no compiler, no toolchain, no index configuration. Virtual workspaces are supported in limited form.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft