feat(applications): banner when editor IntelliSense degrades#1528
feat(applications): banner when editor IntelliSense degrades#1528dawsontoth wants to merge 3 commits into
Conversation
Closes #1504. Follow-up to #1500, which added the safety bound and a console-only breadcrumb; this surfaces the same degradation to the user. Two silent degradations now show a dismissible notice above the editor: - Type-acquisition budget exhausted: once the session-wide @types budget seals (ExtraLibBudget.isSpent), further packages report a spurious "cannot find module". A new isTypeAcquisitionBudgetSpent() surfaces the signal, and useApplicationTypeIntelligence now returns it as status. - Oversized file: a file over MAX_WORKER_MODEL_CHARS renders as plaintext (the existing `oversized` flag). The notice is a thin bar (role="status", aria-live="polite") sitting flush below the toolbar so it never covers the first line of code; dismissal is keyed per file+mode so it re-shows for a different file/degradation. Wrapping the editor in a flex column needs a definite-height column (h-full) and a flex-1/min-h-0 box, or Monaco's height:100% fails to resolve and the editor collapses to a few px. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Coverage Report
File Coverage
|
||||||||||||||||||||||||||||||||||||||
"Reopening the tab resets this" is misleading: the app references more packages than the type budget can hold, so it would just re-throttle. Explain the cause instead of promising a fix that won't hold. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
There was a problem hiding this comment.
Code Review
This pull request introduces a 'DegradedIntelliSenseBanner' component to notify users when the editor's language features are limited due to session-wide type-acquisition budget exhaustion or oversized files. The changes include updating the 'useApplicationTypeIntelligence' hook to track and expose the budget status, and integrating the banner into the 'TextEditorView' component. I have kept the review comment regarding the extraction of inline prop types into a dedicated interface as it improves code maintainability and readability.
Address PR #1528 review: extract the inline prop type into an exported DegradedIntelliSenseBannerProps interface. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
||
| const MESSAGES: Record<IntelliSenseDegradation, string> = { | ||
| budget: | ||
| 'Type information is limited to keep the editor responsive — this application references more packages than the editor can load, so some imports may show “cannot find module.”', |
There was a problem hiding this comment.
Low: budget copy attributes a session-wide limit to "this application"
The @types budget is session-wide and monotonic across every project opened in the tab (see ExtraLibBudget / the isTypeAcquisitionBudgetSpent JSDoc). If a large app exhausts it, then opening a small app — which references few packages — still shows this banner claiming "this application references more packages than the editor can load." That's inaccurate for the small app; the budget was spent elsewhere. The linked issue's suggested copy is session-scoped for this reason ("limited in this session… Reopening the tab resets this").
Suggested fix:
| 'Type information is limited to keep the editor responsive — this application references more packages than the editor can load, so some imports may show “cannot find module.”', | |
| 'Type information is limited in this editor session to keep it responsive, so some imports may show “cannot find module.” Reopening the tab resets this.', |
—
Generated by Barber AI
There was a problem hiding this comment.
Most people have one app, so the suggested text is more likely to be a bad experience for them.
Summary
Closes #1504. When the Applications code editor silently degrades its language features to stay responsive, it now tells the user with a dismissible in-editor banner instead of only logging to the console. Follow-up to #1499/#1500 — that work added the safety bound and a developer-facing
console.warn/console.debug; this is the user-facing half raised in review.Two degradation modes are surfaced:
@typesreachMAX_EXTRA_LIB_CHARS_TOTALandExtraLibBudgetseals, further packages aren't acquired and their imports report a spurious "cannot find module".MAX_WORKER_MODEL_CHARS(512 KB) renders asplaintextwith no highlighting or language features.What changed
typeAcquisition.ts: newisTypeAcquisitionBudgetSpent()surfaces the sealed-budget signal (previously console-only).useApplicationTypeIntelligence.ts: now returns{ typeAcquisitionBudgetExhausted }— seeded from the module-level budget (so a session that already exhausted it shows the notice immediately) and refreshed after each acquisition pass.DegradedIntelliSenseBanner.tsx(new): a thin, dismissible notice withrole="status"/aria-live="polite".TextEditorView/index.tsx: computes the active degradation (oversized wins; budget notice only on editable JS/TS files) and renders the banner above the editor. Dismissal is keyed perpath:variant, so it re-shows for a different file or degradation but stays dismissed for the current one.Design notes (matches the issue)
mt-9= the 36pxContentActionsoverlay) so it never covers the first line of code.role="status"/aria-live="polite".Wrapping the editor in a flex column required giving that column a definite height (
h-full, notmin-h-full) plus aflex-1 min-h-0box — otherwise@monaco-editor/react'sheight:100%can't resolve and Monaco collapses to a few pixels.Testing
DegradedIntelliSenseBanner.test.tsx(copy,aria-live="polite", dismiss callback);workerLimitstests still green.tsc -b,oxlint,dprintall clean.stagedata (Applications editor, real Monaco): with the banner forced on, it renders flush below the toolbar, the editor fills the pane (1043px), and the first line of code sits below the banner; dismissing removes it and the editor reflows to full height (1136px,padding.toprestored to 48). With the trigger removed, no banner appears for a normal file — no regression.🤖 Generated with Claude Code