Wire up completion keyboard navigation and add AGENTS.md
- Tab/Enter confirms the selected completion item - Up/Down arrows navigate the completion menu - Escape dismisses the menu (via existing dismiss_lsp_overlays) - Editor intercepts keys via completion_intercept_keys flag when menu is showing - Add AGENTS.md with LLM-powered predictive autocomplete idea Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.6
parent
a75bc99852
commit
d421b9583f
@@ -141,6 +141,14 @@ impl LocalCodeEditorView {
|
||||
FeatureFlag::LspCompletion.is_enabled()
|
||||
}
|
||||
|
||||
/// Sync the editor's key interception flag with the completion state.
|
||||
pub(super) fn sync_completion_intercept(&self, ctx: &mut ViewContext<Self>) {
|
||||
let should_intercept = self.completion_state.is_showing();
|
||||
self.editor.update(ctx, |editor, _ctx| {
|
||||
editor.completion_intercept_keys = should_intercept;
|
||||
});
|
||||
}
|
||||
|
||||
/// Handle a user typing event — potentially trigger completion.
|
||||
pub(super) fn on_content_changed_for_completion(&mut self, ctx: &mut ViewContext<Self>) {
|
||||
if !Self::is_completion_enabled() {
|
||||
@@ -270,6 +278,7 @@ impl LocalCodeEditorView {
|
||||
Ok(Some(result)) if !result.items.is_empty() => result,
|
||||
_ => {
|
||||
self.completion_state = CompletionState::Idle;
|
||||
self.sync_completion_intercept(ctx);
|
||||
ctx.notify();
|
||||
return;
|
||||
}
|
||||
@@ -288,6 +297,7 @@ impl LocalCodeEditorView {
|
||||
let query = self.get_completion_filter_query(trigger_offset, ctx);
|
||||
self.completion_state.filter(&query);
|
||||
|
||||
self.sync_completion_intercept(ctx);
|
||||
ctx.notify();
|
||||
}
|
||||
|
||||
@@ -332,6 +342,7 @@ impl LocalCodeEditorView {
|
||||
};
|
||||
|
||||
self.completion_state = CompletionState::Idle;
|
||||
self.sync_completion_intercept(ctx);
|
||||
|
||||
self.editor.update(ctx, |editor, ctx| {
|
||||
let edit_range = if let Some(range) = text_edit_range {
|
||||
|
||||
Reference in New Issue
Block a user