Skip to content

feat(console): CodeEditor completions prop for as-you-type suggestions#597

Open
rohitg00 wants to merge 1 commit into
mainfrom
feat/codeeditor-completions
Open

feat(console): CodeEditor completions prop for as-you-type suggestions#597
rohitg00 wants to merge 1 commit into
mainfrom
feat/codeeditor-completions

Conversation

@rohitg00

@rohitg00 rohitg00 commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

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

  • New Features
    • Added optional autocomplete suggestions to the code editor.
    • Suggestions appear as users type and support the editor’s active language.
    • Added public configuration for supplying a list of completion terms.

@vercel

vercel Bot commented Jul 24, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
workers Ready Ready Preview, Comment Jul 24, 2026 6:41pm
workers-tech-spec Ready Ready Preview, Comment Jul 24, 2026 6:41pm

Request Review

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@rohitg00, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 20 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 8045d088-e9cc-47b8-aa3a-4d7a9d97ba9c

📥 Commits

Reviewing files that changed from the base of the PR and between bbb1442 and 9a4a1ed.

📒 Files selected for processing (2)
  • console/web/src/components/ui/CodeEditor.tsx
  • packages/console-ui/index.d.ts
📝 Walkthrough

Walkthrough

The 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.

Changes

Editor completions

Layer / File(s) Summary
Completion API and Monaco provider
console/web/src/components/ui/CodeEditor.tsx, packages/console-ui/index.d.ts
CodeEditorProps exposes readonly completion strings; CodeEditor registers suggestions for the current language, computes replacement ranges, stabilizes effect updates, and disposes the provider during cleanup.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: sergiofilhowz

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
Loading

Poem

A bunny taps words in a glowing display,
Monaco offers suggestions along the way.
Quick hints bloom softly as keystrokes appear,
Then providers tidy when cleanup is near.
Hop, type, and autocomplete bright!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding a CodeEditor completions prop for as-you-type suggestions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/codeeditor-completions

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

skill-check — worker

0 verified, 48 skipped (no docs/).

Layer Result
structure
vale
ai
render

Four for four. Nicely done.

@rohitg00
rohitg00 requested a review from sergiofilhowz July 24, 2026 18:01
@rohitg00
rohitg00 marked this pull request as ready for review July 24, 2026 18:01
@rohitg00 rohitg00 added the no-ticket PR deliberately has no Linear ticket (bump/typo/CI-only) label Jul 24, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6452708 and bbb1442.

📒 Files selected for processing (2)
  • console/web/src/components/ui/CodeEditor.tsx
  • packages/console-ui/index.d.ts

Comment thread console/web/src/components/ui/CodeEditor.tsx
Comment thread console/web/src/components/ui/CodeEditor.tsx
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-ticket PR deliberately has no Linear ticket (bump/typo/CI-only)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant