feat(chart): persist period selection and compact period picker UI#595
Merged
feat(chart): persist period selection and compact period picker UI#595
Conversation
…ction header - Add lastChartPeriod field to extension; defaults to 'day' - Handle 'setPeriodPreference' message in showChart() to store chosen period - Pass initialPeriod in getChartHtml() so chart reopens on the last-used period - In bootstrap(), set currentPeriod from initialData.initialPeriod before render - In switchPeriod(), post setPeriodPreference message to extension - Move period toggle buttons from separate row into chart section header (right-aligned) - Period pills are smaller (11px font, 4px/9px padding) and sit alongside the heading - Saves one full row of vertical space; compact pills save screen real estate - Add .chart-section-header flex layout and .period-controls compact overrides Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
With ~1100 session files, the old 1000-entry limit caused constant evictions on every analysis cycle, keeping cache hit rates around 50-60%. 3000 entries gives comfortable headroom (3x current file count). Memory cost is ~1-2 MB which is well within VS Code extension and globalState limits. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
… repo view By Model chart: - Rank all models by total tokens for the active period - Show top 5 models individually (largest usage first) - Collapse remaining models into a single 'Other models' dataset (gray) - Eliminates the wall of 20+ legend entries visible in the screenshot By Repository chart: - Exclude 'Unknown' entries from repository datasets and summary cards - 'Unknown' represents sessions with no repo context (empty window chats, global CLI sessions, etc.) which add noise to a per-repo breakdown - Same filter applied to repositoryTotalsMap used for the detail panel Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…orktrees Two bugs that caused CLI sessions in worktrees to show as 'Unknown' in the By Repository chart: 1. CLI JSONL path extraction was dead code: allContentReferences was defined but never populated for non-delta (Copilot CLI) JSONL files. The loop only read rename_session calls. Now also reads tool.execution_start argument values that look like file paths and pushes them into allContentReferences, which is then fed to extractRepositoryFromContentReferences as before. 2. Git worktree detection missing in workspaceHelpers.ts: extractRepositoryFromContentReferences only checked for .git/config (standard git repo). Worktrees have .git as a FILE containing 'gitdir: <path>/.git/worktrees/<name>'. This file was unreadable as a directory, silently caught, and the walk continued upward past the repo root without finding the remote URL. Now also reads .git as a file, follows the gitdir pointer, resolves the main .git dir (2 levels up from the worktree-specific dir), and reads the remote URL from its config. Bump CACHE_VERSION 37 → 38 to invalidate stale 'no repo' cache entries so all existing CLI sessions are re-scanned on next reload. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Previously showUsageAnalysis() awaited calculateUsageAnalysisStats() before creating the panel, causing a ~20s blank delay when the cache was cold (e.g. while the chart was computing its 365-day background load). Apply the same two-phase pattern used by the chart view: - Create the webview panel immediately - If lastUsageAnalysisStats is cached, render it instantly - Otherwise show a loading spinner; fire calculateUsageAnalysisStats() in the background and push 'updateStats' to the webview when it completes - getUsageAnalysisHtml() now accepts UsageAnalysisStats | null - bootstrap() shows a loading message instead of 'No data available.' when null, since the updateStats message handler already calls renderLayout() Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two quality-of-life improvements to the chart view's period selector.
Period persistence
The chart now remembers the last period you selected (Day / Week / Month) and reopens on it the next time you open the chart.
lastChartPeriodfield in the extension (defaults to'day')setPeriodPreferencemessage whenever the user switches periodsgetChartHtml()injectsinitialPeriodinto the page databootstrap()readsinitialPeriodand setscurrentPeriodbefore first renderCompact/inline period picker
The period toggle buttons (📅 Day / 🗓️ Week / 📆 Month) have been moved from their own row above the chart into the "📊 Charts" section heading row, right-aligned. This saves roughly one full row of vertical space.
chart-section-headerflex wrapper: heading on the left, pills on the rightborder-bottomseparator that the period row used to carryChanges
vscode-extension/src/extension.ts—lastChartPeriodfield,setPeriodPreferencehandler,initialPeriodin HTML datavscode-extension/src/webview/chart/main.ts—InitialChartData.initialPeriod,bootstrap()init,switchPeriod()message, moved period toggles into section headervscode-extension/src/webview/chart/styles.css—.chart-section-header,.period-controlscompact overrides