rifen.rifen-timescope) from the VS Code Marketplace or via the Command Palette (Ctrl+P / Cmd+P):ext install rifen.rifen-timescope
timeout = 900 or 3000 in setTimeout(fn, 3000)). The human-readable duration displays instantly in a hover tooltip.Requirements: Neovim ≥ 0.7 and Node.js ≥ 18.
{
'rifen/timescope',
tag = 'nvim-v0.2.30', -- latest nvim-v* tag; or branch = 'nvim' for rolling
opts = {
format = 'compact',
},
}
use {
'rifen/timescope',
tag = 'nvim-v0.2.30',
config = function()
require('timescope').setup({
format = 'compact',
})
end,
}
The nvim-v* tags are published by CI on every release and ship the prebuilt
Node.js bridge — no clone or build required. See the Releases page for the
latest tag. To run from a source checkout instead, see
packages/nvim/README.md.
Move the cursor over any numeric duration to view the formatted duration rendered as inline virtual text.
Run TimeScope directly from your terminal using npx:
# Parse a numeric duration or math expression
npx @rifen/timescope-core parse "60 * 60 * 24"
# Scan a source file or directory for durations
npx @rifen/timescope-core scan ./src
timeout, interval, delay, ttl, retention).setTimeout → ms in JS/TS, time.sleep → seconds in Python, time.Sleep → nanoseconds in Go).60 * 60 * 24 → 1d.15m), verbose (15 minutes), or combined (both).keyword: "timeout" (javascript)).# Python
timeout = 900 # → "15m"
retry_delay = 5000 # → "5s"
cache_ttl = 60 * 60 * 24 # → "1d"
time.sleep(30) # → "30s" (language-aware)
// JavaScript / TypeScript
setTimeout(fn, 3000); // → "3s" (language-aware)
setInterval(fn, 5000); // → "5s" (language-aware)
const timeout = 30000; // → "30s" (context clues)
// Go
timeout := 15 * time.Second // → "15s"
time.Sleep(2 * time.Second) // → "2s" (language-aware)
# YAML
timeout: 300 # → "5m"
interval: 3600000 # → "1h"
ttl: 86400 # → "1d"
TimeScope detects the active language and adapts its unit inference to standard library conventions:
| Language | Recognized Patterns | Inferred Unit |
|---|---|---|
| JavaScript / TypeScript | setTimeout, setInterval, setImmediate, requestAnimationFrame |
Milliseconds |
| Python | time.sleep |
Seconds |
| Go | time.Sleep, time.After, time.Tick |
Nanoseconds |
| Rust | std::thread::sleep, tokio::time::sleep |
Milliseconds |
| Java | Thread.sleep |
Milliseconds |
| Other Languages | Common keywords: timeout, interval, delay, duration, ttl, sleep, wait, cache, etc. |
Context Heuristics |
TimeScope requires zero configuration by default, but provides granular options to customize behavior.
Configure in the VS Code Settings UI or add directly to settings.json:
{
"timescope.enabled": true,
"timescope.format": "compact", // "compact" | "verbose" | "both"
"timescope.defaultUnit": "seconds", // "seconds" | "milliseconds" | "microseconds" | "nanoseconds" | "minutes" | "hours" | "days" | "weeks" | "months" | "years" | "auto"
"timescope.minValue": 1,
"timescope.maxValue": 31557600000, // Ignore values above ~1000 years in ms
"timescope.contextClues": true, // Use variable names and comments to infer units
"timescope.fileTypes": ["*"] // Glob patterns for active file types
}
Configure through require('timescope').setup({...}) or the opts table in lazy.nvim:
require('timescope').setup({
enabled = true,
format = 'compact', -- 'compact' | 'verbose' | 'both'
defaultUnit = 'seconds', -- 'seconds' | 'milliseconds' | 'microseconds' | 'nanoseconds' | 'hours' | 'days' | 'weeks' | 'months' | 'years' | 'auto'
minValue = 1,
maxValue = 31557600000,
contextClues = true,
debounceMs = 150, -- Cursor move debounce delay in ms
})
Access these from the Command Palette (Ctrl+Shift+P / Cmd+Shift+P):
| Command | Action |
|---|---|
TimeScope: Toggle Enabled |
Toggle the hover provider on or off |
TimeScope: Dump Settings to Output |
Print active configuration to the TimeScope output channel |
TimeScope: Log Hover Target |
Inspect token and AST context under the active cursor |
| Command | Description |
|---|---|
:TimeScopeEnable |
Enable the hover provider |
:TimeScopeDisable |
Disable the hover provider and clear virtual text |
:TimeScopeToggle |
Toggle the hover provider on or off |
:TimeScopeSettings |
Display active configuration in the command window |
:TimeScopeReload |
Clear virtual text and force refresh |
We welcome contributions!
This project is licensed under the MIT License.