Truncate line when accepting inline suggestions for Supermaven (#13884)
Configures inline completions to delete the remaining text on the given line. This doesn't affect the github copilot inline completion provider since it seems to only generate suggestions if the cursor is at the end of the line but fixes the usability issues related to Supermaven. https://github.com/user-attachments/assets/1b8bc9a3-4666-4665-a436-96e4beee01bb Release Notes: - Fixed https://github.com/zed-industries/zed/issues/13039 --------- Co-authored-by: Antonio Scandurra <me@as-cii.com> Co-authored-by: Conrad Irwin <conrad.irwin@gmail.com>
This commit is contained in:
parent
c703e20a06
commit
a20e92a8c1
6 changed files with 51 additions and 19 deletions
|
@ -8,7 +8,7 @@ use language::{
|
|||
Buffer, OffsetRangeExt, ToOffset,
|
||||
};
|
||||
use settings::Settings;
|
||||
use std::{path::Path, sync::Arc, time::Duration};
|
||||
use std::{ops::Range, path::Path, sync::Arc, time::Duration};
|
||||
|
||||
pub const COPILOT_DEBOUNCE_TIMEOUT: Duration = Duration::from_millis(75);
|
||||
|
||||
|
@ -239,7 +239,7 @@ impl InlineCompletionProvider for CopilotCompletionProvider {
|
|||
buffer: &Model<Buffer>,
|
||||
cursor_position: language::Anchor,
|
||||
cx: &'a AppContext,
|
||||
) -> Option<&'a str> {
|
||||
) -> Option<(&'a str, Option<Range<language::Anchor>>)> {
|
||||
let buffer_id = buffer.entity_id();
|
||||
let buffer = buffer.read(cx);
|
||||
let completion = self.active_completion()?;
|
||||
|
@ -269,7 +269,7 @@ impl InlineCompletionProvider for CopilotCompletionProvider {
|
|||
if completion_text.trim().is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(completion_text)
|
||||
Some((completion_text, None))
|
||||
}
|
||||
} else {
|
||||
None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue