Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>LOC Monitor ProNew to Visual Studio Code? Get it now.
LOC Monitor Pro

LOC Monitor Pro

Hoàng Tuân

|
1 install
| (0) | Free
Count code across VS Code languages and installed language extensions
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

LOC Monitor Pro

See how much source code is in your VS Code workspace, understand which languages and folders contribute to it, and inspect the files behind the numbers. LOC Monitor Pro counts the working copy, including unsaved changes in open workspace files, while filtering common generated and build output.

Get started

  1. Open a project folder or workspace in VS Code. The extension starts scanning after VS Code starts.
  2. Look for the LOC item in the status bar at the bottom of VS Code. Click it to open the dashboard, or run LOC Monitor: Open Dashboard from the Command Palette.
  3. Use the dashboard to explore the totals, find a file, and inspect exclusions or files that need attention. Use Refresh to rescan when needed.

Status bar

When the active editor contains a counted source file, the status bar shows its LOC followed by the workspace total, for example 184 / 8.4K LOC. If the active file is outside the counted scope, or there is no active editor, it shows the workspace total alone.

  • Large numbers are rounded for a compact display. Hover over the item for the unrounded counts, the current file's percentage of workspace LOC, the number of generated files excluded, and the number of skipped files.
  • ~ marks a count that includes an estimate. A warning icon and number indicate skipped files; open the dashboard for their reasons.
  • During the initial scan the item shows a scanning indicator. If a workspace scan fails, it shows an error and marks the previous results as stale. Run LOC Monitor: Refresh to retry; details are in Output → LOC Monitor Pro.

Dashboard

The dashboard follows your VS Code theme and shows the time of the latest working-copy update. Its overview contains four cards:

Card What it shows
Source LOC Total counted source lines. A leading ~ means one or more files have estimated counts.
Source files Number of counted files and the number of languages represented.
Generated excluded Number of discovered files excluded as generated or build output.
Needs attention Combined number of estimated and skipped files, with a breakdown of each.

The Languages and Source by folder panels show the largest eight contributors in each group, with their LOC and share of the workspace total. The Largest source files table lists counted files, their language, LOC, and whether the count used a grammar or is estimated. Filter the table by file path or language, sort by largest file, path, or language, and select a file path to open it.

Expandable sections show discovered generated files, non-source documents, workspace-excluded files, and estimates or skipped files when present. Each entry includes a reason; detail sections show up to 200 entries. The Refresh button invalidates cached counts and rediscovers workspace files.

What gets counted

  • Recognized source files include programming, markup, stylesheet, query, and source-configuration languages. Test source files are included.
  • With a usable TextMate grammar, nonblank lines containing code count once; comment-only and blank lines are excluded. A line containing both code and a comment counts once. Results depend on the installed grammar.
  • Language definitions are discovered from VS Code and installed language extensions rather than a fixed list. Examples include TypeScript, JavaScript, JSX/TSX, Python, Java, C#, C/C++, Go, Rust, Vue, Svelte, PHP, and Kotlin. Install the corresponding language extension when VS Code does not provide it. Use LOC Monitor: Language Coverage to see registered language IDs and their configured grammars.
  • Open workspace documents use their current editor contents and language mode. Untitled files and files outside the workspace are outside the workspace scan. VS Code file associations can map custom filenames to a registered language.

Exclusions and skipped files

Common build, dependency and cache directories, lockfiles, source maps, minified or bundled files, generated filename patterns, and generated markers in leading comments are excluded independently of programming language. Examples include node_modules, dist, build, out, bin, obj, target, .next, .nuxt, and vendor. These are heuristic rules, so review the dashboard if a file is unexpectedly excluded. Files already hidden from workspace discovery by VS Code may not appear in the exclusion details.

Documentation, plain text, data tables, diffs, logs, and Git editor buffers are excluded from source totals. You can add your own workspace-relative exclusion glob with locMonitor.exclude.

Unrecognized files, binary files, files that cannot be read, and files exceeding the configured size limit are reported as skipped rather than silently counted as zero. UTF-8 and BOM-marked UTF-16 LE/BE are supported.

Estimates and accuracy

If a language has no usable TextMate grammar, the extension estimates LOC from nonblank lines, so comments may be included. Missing grammar dependencies, tokenization failures or limits, and detected grammar inconsistencies can also cause a file to be marked as estimated. The dashboard lists the affected files and reasons. A ~ on the workspace total means at least one included file is estimated.

Grammar-based counting is not compiler analysis and may be imperfect for complex or embedded-language syntax. The Language Coverage command lists registered language IDs even when a grammar is unavailable; document-only editor modes remain outside the source total.

Commands

Command Action
LOC Monitor: Open Dashboard Open or reveal the source overview.
LOC Monitor: Language Coverage List registered language IDs and grammar availability.
LOC Monitor: Refresh Clear cached counts and rediscover workspace files.

File edits are debounced and only invalidated files are recounted. File creation/deletion, workspace, extension, and relevant configuration changes trigger rediscovery. If a newly installed language extension requires a reload, run Developer: Reload Window.

Settings

Setting Default Purpose
locMonitor.exclude **/{node_modules,.git,dist,build,out,coverage,.venv,venv,vendor,.next,.nuxt}/** Workspace-relative exclusion glob. Built-in generated-output filters also apply.
locMonitor.maxFileSizeMB 10 Maximum file size in MB; larger files are reported as skipped. Allowed range: 0.1–100.

Development

npm ci
npm test

The optional real-grammar integration suite accepts LOC_LANGUAGE_EXTENSION_ROOTS, a JSON array containing directories for VS Code's built-in language extensions and/or installed language extensions:

node --test test/installedGrammars.test.cjs

Packaging runs vscode:prepublish to compile the extension. The VSIX includes production dependencies and vscode-oniguruma/release/onig.wasm; development tests and source maps are excluded.

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