Add slash commands for adding context into the assistant (#12102)
Tasks * [x] remove old flaps and output when editing a slash command * [x] the completing a command name that takes args, insert a space to prepare for typing an arg * [x] always trigger completions when typing in a slash command * [x] don't show line numbers * [x] implement `prompt` command * [x] `current-file` command * [x] state gets corrupted on `duplicate line up` on a slash command * [x] exclude slash command source from completion request Next steps: * show output token count in flap trailer * add `/project` command that matches project ambient context * delete ambient context Release Notes: - N/A --------- Co-authored-by: Marshall <marshall@zed.dev> Co-authored-by: Antonio Scandurra <me@as-cii.com>
This commit is contained in:
parent
d6e59bfae1
commit
a73a3ef243
18 changed files with 1649 additions and 147 deletions
|
@ -2166,6 +2166,31 @@ impl BufferSnapshot {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn has_edits_since_in_range(&self, since: &clock::Global, range: Range<Anchor>) -> bool {
|
||||
if *since != self.version {
|
||||
let start_fragment_id = self.fragment_id_for_anchor(&range.start);
|
||||
let end_fragment_id = self.fragment_id_for_anchor(&range.end);
|
||||
let mut cursor = self
|
||||
.fragments
|
||||
.filter::<_, usize>(move |summary| !since.observed_all(&summary.max_version));
|
||||
cursor.next(&None);
|
||||
while let Some(fragment) = cursor.item() {
|
||||
if fragment.id > *end_fragment_id {
|
||||
break;
|
||||
}
|
||||
if fragment.id > *start_fragment_id {
|
||||
let was_visible = fragment.was_visible(since, &self.undo_map);
|
||||
let is_visible = fragment.visible;
|
||||
if was_visible != is_visible {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
cursor.next(&None);
|
||||
}
|
||||
}
|
||||
false
|
||||
}
|
||||
|
||||
pub fn has_edits_since(&self, since: &clock::Global) -> bool {
|
||||
if *since != self.version {
|
||||
let mut cursor = self
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue