Skip to content
| Marketplace
Sign in
Visual Studio Code>Linters>Live Cognitive ComplexityNew to Visual Studio Code? Get it now.
Live Cognitive Complexity

Live Cognitive Complexity

yousuf360

| (0) | Free
Real-time Sonar-style cognitive complexity CodeLens for methods and classes — color-coded low / medium / high with ratio and absolute scores. Java today; more languages planned.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Live Cognitive Complexity

Real-time Sonar-style cognitive complexity in VS Code and Cursor.

See complexity as you type, above every method and class — with color-coded low / medium / high bands, ratio %, and absolute scores.

Language support today: Java
Planned: TypeScript, JavaScript, Python, Go, and more

Features

  • Method CodeLens — e.g. medium complexity (93%) · CC: 14
  • Class CodeLens — e.g. class complexity · sum 16 · max 14 · high 0
  • Status bar — complexity for the method under your cursor
  • Color bands (absolute + ratio of Sonar threshold; worst wins)
    • Green — low
    • Orange — medium
    • Red — high
  • Tooltip breakdown — every increment with line, nesting, and reason
  • Works on large files (hundreds of KB)

CodeLens on sample Java methods

Status bar complexity

Install

From the VS Code Marketplace (after publish)

  1. Open Extensions (Cmd+Shift+X / Ctrl+Shift+X)
  2. Search Live Cognitive Complexity (or live-cognitive-complexity)
  3. Click Install

Same steps work in Cursor (it uses the VS Code extension ecosystem).

From a VSIX (local / pre-release)

git clone https://github.com/CHANGE_ME/live-cognitive-complexity.git
cd live-cognitive-complexity
npm install
npm run compile
npx @vscode/vsce package

Then in VS Code / Cursor:

Cmd+Shift+P → Extensions: Install from VSIX... → pick live-cognitive-complexity-0.2.0.vsix

Cursor tip: Do not use the Agent CLI cursor --install-extension — that binary is not the IDE. Use Install from VSIX in the Command Palette.

Development host (F5)

  1. Open this folder in VS Code / Cursor
  2. Press F5 (Run Extension)
  3. Open samples/OrderService.java

What it measures

Live Cognitive Complexity (Sonar) estimates how hard control flow is to understand:

  • if / else / else if, loops, switch, catch, ternary
  • Nesting penalties
  • && / || operator sequences
  • Lambdas increase nesting for nested code

Unlike cyclomatic complexity, it ignores “readable shorthand” and focuses on mental load.

Defaults match Sonar rule S3776 (errorThreshold = 15).

Sample results (samples/OrderService.java)

Symbol Metric
OrderService (class) sum 16, max 14, high 0
add CC 0 (low)
validate CC 2 (low)
fulfill CC 14 (medium)

Configuration

Setting Default Description
liveCognitiveComplexity.enabled true Master switch
liveCognitiveComplexity.showCodeLens true Method CodeLens
liveCognitiveComplexity.showClassCodeLens true Class sum / max / high
liveCognitiveComplexity.showStatusBar true Cursor method in status bar
liveCognitiveComplexity.errorThreshold 15 High band + ratio denominator
liveCognitiveComplexity.warningThreshold 10 Medium absolute lower bound
liveCognitiveComplexity.mediumRatioPercent 67 Medium ratio lower bound
liveCognitiveComplexity.excludeAnonymousClassMethods true Skip anonymous class methods
liveCognitiveComplexity.excludeEqualsHashCode true Skip equals / hashCode
liveCognitiveComplexity.excludePatterns target, build, … Exclude globs

Also ensure editor CodeLens is on: "editor.codeLens": true.

Requirements

  • VS Code / Cursor ^1.85.0
  • Native tree-sitter bindings (bundled in the VSIX). If load fails after a platform change: npm rebuild tree-sitter tree-sitter-java

Privacy

Analysis runs entirely on your machine. Source is not uploaded. No telemetry.

Roadmap

  • [ ] TypeScript / JavaScript
  • [ ] Python
  • [ ] Go
  • [ ] Optional Problems panel diagnostics for high methods

Develop

npm install
npm test
npm run compile

See PUBLISH.md for GitHub + Marketplace release steps.

License

MIT

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