Static dead code detectors only flag unused exports. They don't show how recently code was touched or whether it's actively maintained. A visual freshness heatmap helps devs prioritize refactoring and cleanup.
Objective
Create line-level editor decorations that color-code code based on last modification date via git blame/git log.
Scope & Implementation Details
1. Git Integration
- Execute:
git log --format="%H %ai" -- <file>
- Parse timestamps per line using
git blame --line-porcelain or diff-based mapping
- Cache results per file path + HEAD commit hash
2. Heat Mapping Logic
- Calculate age per line:
now - lastModified
- Color thresholds:
- $(green)
< 7 days → #4caf50
- $(yellow)
7–30 days → #ff9800
- $(red)
> 30 days → #f44336
- Gracefully fallback to gray for untracked files
3. Editor Decorations
- Use
vscode.window.createTextEditorDecorationType
- Apply line ranges via
setDecorations
- Tooltip on hover:
"Last modified: 42 days ago by @user"
4. Performance Safeguards
- Skip files > 10,000 lines or outside workspace
- Debounce decoration updates on save/scroll
- Cache git output in
workspaceState or memory map
Acceptance Criteria
Technical Notes
- Use
child_process.exec with maxBuffer: 10 * 1024 * 1024
- Run git commands off the main thread or via
execAsync
- Invalidate cache on
workspace.onDidChangeTextDocument + save
- Consider
git log -L for range-specific history if blame is slow
(use codicons not emojis)
Static dead code detectors only flag unused exports. They don't show how recently code was touched or whether it's actively maintained. A visual freshness heatmap helps devs prioritize refactoring and cleanup.
Objective
Create line-level editor decorations that color-code code based on last modification date via
git blame/git log.Scope & Implementation Details
1. Git Integration
git log --format="%H %ai" -- <file>git blame --line-porcelainor diff-based mapping2. Heat Mapping Logic
now - lastModified< 7 days→#4caf507–30 days→#ff9800> 30 days→#f443363. Editor Decorations
vscode.window.createTextEditorDecorationTypesetDecorations"Last modified: 42 days ago by @user"4. Performance Safeguards
workspaceStateor memory mapAcceptance Criteria
Technical Notes
child_process.execwithmaxBuffer: 10 * 1024 * 1024execAsyncworkspace.onDidChangeTextDocument+ savegit log -Lfor range-specific history if blame is slow(use codicons not emojis)