Compare commits

...

1 Commits

Author SHA1 Message Date
Nathan Sobo
fff6a06226 WIP 2024-09-13 10:51:25 -04:00
16 changed files with 24 additions and 3 deletions

View File

@@ -162,6 +162,7 @@ impl ContextOperation {
)?,
icon: section.icon_name.parse()?,
label: section.label.into(),
path: section.path.map(Into::into),
})
})
.collect::<Result<Vec<_>>>()?,
@@ -242,6 +243,10 @@ impl ContextOperation {
)),
icon_name: icon_name.to_string(),
label: section.label.to_string(),
path: section
.path
.as_ref()
.map(|p| p.to_string_lossy().to_string()),
}
})
.collect(),
@@ -641,6 +646,7 @@ impl Context {
range,
icon: section.icon,
label: section.label.clone(),
path: section.path.clone(),
})
} else {
None
@@ -1825,6 +1831,7 @@ impl Context {
..buffer.anchor_before(start + section.range.end),
icon: section.icon,
label: section.label,
path: section.path,
})
.collect::<Vec<_>>();
sections.sort_by(|a, b| a.range.cmp(&b.range, buffer));
@@ -2977,6 +2984,7 @@ impl SavedContext {
..buffer.anchor_before(section.range.end),
icon: section.icon,
label: section.label,
path: section.path,
}
})
.collect(),

View File

@@ -1089,6 +1089,7 @@ async fn test_random_context_collaboration(cx: &mut TestAppContext, mut rng: Std
range: section_start..section_end,
icon: ui::IconName::Ai,
label: "section".into(),
path: None,
});
}

View File

@@ -141,6 +141,7 @@ impl SlashCommand for ContextServerSlashCommand {
.description
.unwrap_or(format!("Result from {}", prompt_name)),
),
path: None,
}],
text: prompt,
run_commands_in_text: false,

View File

@@ -70,6 +70,7 @@ impl SlashCommand for DefaultSlashCommand {
range: 0..text.len(),
icon: IconName::Library,
label: "Default".into(),
path: None,
}],
text,
run_commands_in_text: true,

View File

@@ -182,6 +182,7 @@ impl SlashCommand for DiagnosticsSlashCommand {
range: 0..1,
icon: IconName::Library,
label: "No Diagnostics".into(),
path: None,
}],
text: "\n".to_string(),
run_commands_in_text: true,
@@ -228,6 +229,7 @@ impl SlashCommand for DiagnosticsSlashCommand {
PlaceholderType::File(file_path) => file_path.into(),
PlaceholderType::Diagnostic(_, message) => message.into(),
},
path: None,
})
.collect();

View File

@@ -349,6 +349,7 @@ impl SlashCommand for DocsSlashCommand {
range,
icon: IconName::FileDoc,
label: format!("docs ({provider}): {key}",).into(),
path: None,
})
.collect(),
run_commands_in_text: false,

View File

@@ -161,6 +161,7 @@ impl SlashCommand for FetchSlashCommand {
range,
icon: IconName::AtSign,
label: format!("fetch {}", url).into(),
path: None,
}],
run_commands_in_text: false,
})

View File

@@ -171,7 +171,6 @@ impl SlashCommand for FileSlashCommand {
.collect())
})
}
fn run(
self: Arc<Self>,
arguments: &[String],
@@ -428,7 +427,6 @@ pub fn codeblock_fence_for_path(path: Option<&Path>, row_range: Option<Range<u32
text.push('\n');
text
}
pub fn build_entry_output_section(
range: Range<usize>,
path: Option<&Path>,
@@ -454,6 +452,7 @@ pub fn build_entry_output_section(
range,
icon,
label: label.into(),
path: path.map(|p| p.to_path_buf()),
}
}

View File

@@ -57,6 +57,7 @@ impl SlashCommand for NowSlashCommand {
range,
icon: IconName::CountdownTimer,
label: now.to_rfc2822().into(),
path: None,
}],
run_commands_in_text: false,
}))

View File

@@ -140,6 +140,7 @@ impl SlashCommand for ProjectSlashCommand {
range,
icon: IconName::FileTree,
label: "Project".into(),
path: None,
}],
run_commands_in_text: false,
})

View File

@@ -95,6 +95,7 @@ impl SlashCommand for PromptSlashCommand {
range,
icon: IconName::Library,
label: title,
path: None,
}],
run_commands_in_text: true,
})

View File

@@ -165,6 +165,7 @@ impl SlashCommand for SearchSlashCommand {
range: 0..text.len(),
icon: IconName::MagnifyingGlass,
label: query,
path: None,
});
SlashCommandOutput {

View File

@@ -77,6 +77,7 @@ impl SlashCommand for OutlineSlashCommand {
range: 0..outline_text.len(),
icon: IconName::ListTree,
label: path.to_string_lossy().to_string().into(),
path: None,
}],
text: outline_text,
run_commands_in_text: false,

View File

@@ -91,6 +91,7 @@ impl SlashCommand for TerminalSlashCommand {
range,
icon: IconName::Terminal,
label: "Terminal".into(),
path: None,
}],
run_commands_in_text: false,
}))

View File

@@ -100,10 +100,10 @@ pub struct SlashCommandOutput {
pub sections: Vec<SlashCommandOutputSection<usize>>,
pub run_commands_in_text: bool,
}
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct SlashCommandOutputSection<T> {
pub range: Range<T>,
pub icon: IconName,
pub label: SharedString,
pub path: Option<std::path::PathBuf>,
}

View File

@@ -2388,6 +2388,7 @@ message SlashCommandOutputSection {
AnchorRange range = 1;
string icon_name = 2;
string label = 3;
optional string path = 4;
}
message ContextOperation {