You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 32529dc
Browse filesBrowse the repository at this point in the historyBrowse files
## Description
Editor completions previously opened only as a side effect of typing.
Applications could not request suggestions from a command, menu, or
their own shortcut without editing text.
Add the Editor-only `ShowCompletions` action and `show_completions` API.
There is no default shortcut: hosts choose bindings that fit their
platform and avoid input-method shortcuts such as Ctrl+Space. Hosts can
scope bindings to `Input && mode == editor`; existing `Input` bindings
remain valid.
```rust
window.dispatch_action(Box::new(ShowCompletions), cx);
editor.update(cx, |state, cx| state.show_completions(window, cx));
```
The action addresses the focused Editor; the method focuses the
specified Editor. Suggestions refine against the identifier prefix
before the caret, and an empty prefix still requests suggestions. Prefix
scanning walks backward through the rope instead of copying the whole
preceding document. Manual requests use LSP `INVOKED` with no trigger
character.
Disabled/readonly editors, missing providers, and IME preedit issue no
request. An already-open completion menu keeps its selected item. A new
request cancels the previous overlay request and inline suggestion,
closes code actions, and uses the existing completion lifecycle.
Responses are checked against the current document revision, caret,
focus, editability, and composition state before being applied.
English and Chinese Editor documentation describe the command, API,
host-owned shortcuts, and lifecycle rules.
## Public API
### gpui-base
- `input::ShowCompletions` — Editor action requesting suggestions
without typing; no default keybinding.
- `InputBaseState<EditorMode>::show_completions(&mut self, window: &mut
Window, cx: &mut Context<Self>)` — Request manual completions and focus
the Editor, respecting editability, IME, and an existing completion
menu.
### gpui-component
- `input::ShowCompletions` — Re-export the Base action for applications
using `gpui_kit::component::input`.
## Breaking Changes
None for existing consumers. The public API is additive and existing
`Input` bindings remain supported.
## Validation
- `cargo test -p gpui-kit --features 'test-support component' --test
input` — 179 passed. Covers explicit and empty-prefix requests,
host-configured Editor-only shortcuts, no Ctrl+Space default, menu
selection preservation, IME preedit/commit,
readonly/disabled/missing-provider guards, request replacement,
Escape/caret cancellation, inline suggestion/debounce cancellation,
code-action replacement, and API focus from an application command.
- `cargo clippy -p gpui-base -p gpui-kit --features
'gpui-kit/test-support gpui-kit/component' --all-targets -- --deny
warnings` — passed.
- `cargo fmt --all --check` and `git diff --check` — passed.
The implementation, tests, and documentation revision were generated
with AI assistance. IME coverage uses GPUI's simulated input-handler
protocol; it does not drive native candidate windows or verify OS
shortcut interception.
---------
Co-authored-by: Sola <sola-ryu@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Co-authored-by: Jason Lee <huacnlee@gmail.com>
0 commit comments