Introduce a new /delta command (#17903)

Release Notes:

- Added a new `/delta` command to re-insert changed files that were
previously included in a context.

---------

Co-authored-by: Roy <roy@anthropic.com>
This commit is contained in:
Antonio Scandurra 2024-09-17 08:47:08 -06:00 committed by GitHub
parent a20c0eb626
commit 54b8232be2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 408 additions and 366 deletions

View file

@ -1906,7 +1906,22 @@ impl ContextEditor {
cx: &mut ViewContext<Self>,
) {
if let Some(command) = SlashCommandRegistry::global(cx).command(name) {
let output = command.run(arguments, workspace, self.lsp_adapter_delegate.clone(), cx);
let context = self.context.read(cx);
let sections = context
.slash_command_output_sections()
.into_iter()
.filter(|section| section.is_valid(context.buffer().read(cx)))
.cloned()
.collect::<Vec<_>>();
let snapshot = context.buffer().read(cx).snapshot();
let output = command.run(
arguments,
&sections,
snapshot,
workspace,
self.lsp_adapter_delegate.clone(),
cx,
);
self.context.update(cx, |context, cx| {
context.insert_command_output(
command_range,