Skip to content
| Marketplace
Sign in
Visual Studio Code>Visualization>Code Stats — codebase statisticsNew to Visual Studio Code? Get it now.
Code Stats — codebase statistics

Code Stats — codebase statistics

clodeagents

|
1 install
| (0) | Free
See your codebase at a glance: lines and files per language, language share, and the largest files in the project. Runs fully offline, no setup required.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Code Stats

Codebase statistics right in the VS Code sidebar. How many lines, in which languages, and which files have grown out of hand. Open a folder and the numbers are already there.

What it shows

  • Project summary — total lines, files, and number of languages.
  • Per-language breakdown with each language's share, so you can see what the project is actually made of.
  • Largest files — clickable, they open straight in the editor. Handy for finding what needs splitting up.

Recognises over 30 extensions: TypeScript, JavaScript, Python, Rust, Go, Java, C#, C/C++, Ruby, PHP, Swift, Kotlin, Lua, Shell, SQL, HTML/CSS/SCSS, Vue, Svelte, Markdown and more.

Usage

Open a project folder and click the Code Stats icon in the activity bar. The scan starts on its own.

The Rescan button at the bottom refreshes the numbers. The same action is available from the command palette as Code Stats: Rescan.

Settings

Setting Default What it does
codeStats.exclude **/{node_modules,.git,out,dist,build,vendor,__pycache__}/** What to leave out of the count
codeStats.maxFiles 5000 Upper bound on files scanned — guards against hanging on huge repositories

If that limit is hit, the panel says so rather than quietly showing partial numbers.

What is not counted

Binary files (detected by a null byte), files over 2 MB, and anything matched by codeStats.exclude. Blank lines and comments are counted — this is a line counter, not a "logical lines of code" metric.

Privacy

The extension runs entirely locally. No network requests, no telemetry — your file contents never leave your machine.


Development

npm install
npm run watch

Press F5 to launch a second VS Code window with the extension loaded.

Layout

File Role
src/extension.ts Activation, webview panel, commands
src/scan.ts File walking and line counting
media/main.js Panel rendering
media/main.css Styling built on VS Code theme variables

An extension lives in two runtimes: the extension host (extension.ts) is Node.js with the vscode API but no DOM, while the webview (main.js) is a browser sandbox with a DOM but no Node. They talk only through postMessage.

Tests

npm run test:mock

Stubs the vscode module and runs the scanner over the project's real files, asserting that per-language totals add up, the sort order holds, and paths come back relative.

There is also scandir.js, which runs the scanner over any folder and prints JSON:

node scandir.js ../some-other-project

Packaging

npx @vscode/vsce package

vscode:prepublish runs the compiler, so broken code cannot end up in the package.

License

MIT

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2026 Microsoft