refactor: remove use_xml_format (#1535)

This commit is contained in:
yetone
2025-03-09 14:58:30 +08:00
committed by GitHub
parent 510bf2ff35
commit 868c136574
17 changed files with 75 additions and 102 deletions

View File

@@ -15,6 +15,13 @@ impl State<'_> {
}
}
#[derive(Debug, Serialize, Deserialize)]
struct SelectedCode {
path: String,
content: Option<String>,
file_type: String,
}
#[derive(Debug, Serialize, Deserialize)]
struct SelectedFile {
path: String,
@@ -24,11 +31,12 @@ struct SelectedFile {
#[derive(Debug, Serialize, Deserialize)]
struct TemplateContext {
use_xml_format: bool,
ask: bool,
code_lang: String,
selected_files: Option<Vec<SelectedFile>>,
selected_code: Option<String>,
selected_code: Option<SelectedCode>,
recently_viewed_files: Option<Vec<String>>,
relevant_files: Option<Vec<String>>,
project_context: Option<String>,
diagnostics: Option<String>,
system_info: Option<String>,
@@ -50,11 +58,12 @@ fn render(state: &State, template: &str, context: TemplateContext) -> LuaResult<
Ok(jinja_template
.render(context! {
use_xml_format => context.use_xml_format,
ask => context.ask,
code_lang => context.code_lang,
selected_files => context.selected_files,
selected_code => context.selected_code,
recently_viewed_files => context.recently_viewed_files,
relevant_files => context.relevant_files,
project_context => context.project_context,
diagnostics => context.diagnostics,
system_info => context.system_info,