feat(console): CodeEditor completions prop for as-you-type suggestions#597
feat(console): CodeEditor completions prop for as-you-type suggestions#597rohitg00 wants to merge 1 commit into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 20 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe code editor now accepts optional completion terms, enables Monaco quick suggestions, and asynchronously registers a language-specific completion provider with cleanup handling. The public console UI declaration exposes the same prop. ChangesEditor completions
Estimated code review effort: 2 (Simple) | ~10 minutes Suggested reviewers: Sequence Diagram(s)sequenceDiagram
participant CodeEditor
participant MonacoLoader
participant MonacoProvider
CodeEditor->>CodeEditor: Enable quick suggestions
CodeEditor->>MonacoLoader: Import Monaco asynchronously
MonacoLoader->>MonacoProvider: Register language completion provider
MonacoProvider-->>CodeEditor: Return completion suggestions
CodeEditor->>MonacoProvider: Dispose provider during cleanup
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
skill-check — worker0 verified, 48 skipped (no docs/).
Four for four. Nicely done. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@console/web/src/components/ui/CodeEditor.tsx`:
- Around line 221-224: Update the completions cleanup logic around
editor.updateOptions to capture the editor’s original quickSuggestions and
wordBasedSuggestions values before applying completion-specific options, then
restore both values when completions becomes empty. Preserve the existing
behavior for active completions while ensuring cleanup returns the editor to its
prior completion settings.
- Around line 227-246: Update the completion provider created in CodeEditor’s
monaco.languages.registerCompletionItemProvider call to return no suggestions
unless the provideCompletionItems model is the owning editor model. Compare the
callback’s model against the editor’s current model, then preserve the existing
words mapping and range behavior for the owning model.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 6b40c2e4-2a9c-45c6-a2fd-31a347f41811
📒 Files selected for processing (2)
console/web/src/components/ui/CodeEditor.tsxpackages/console-ui/index.d.ts
Adds an opt-in `completions?: readonly string[]` to the shared CodeEditor (#579). Non-empty turns on the suggest popup (the default stays prose-quiet, so markdown/json/yaml behavior is byte-for-byte unchanged) and registers a Monaco completion provider for the editor's language offering those words, disposed on unmount. The database SQL panel is the first consumer, feeding it the live table names plus SQL keywords.
bbb1442 to
9a4a1ed
Compare
Adds an opt-in
completions?: readonly string[]prop to the shared CodeEditor (#579). Non-empty turns on the as-you-type suggest popup (the default stays prose-quiet, so markdown/json/yaml behaviour is byte-for-byte unchanged) and registers a Monaco completion provider for the editor's language offering those words, disposed on unmount.First consumer is the database worker's SQL panel, which feeds it the live table names plus SQL keywords for schema-aware autocomplete.
Test
tsc + biome clean. Verified live in the console SQL editor: typing a keyword or table prefix pops the suggest list, and Ctrl+Space triggers it explicitly. Prose editors (markdown/json) are unaffected since they pass no completions.
Summary by CodeRabbit