refactor: remove redundant configure_options and default_options methods
Co-authored-by: aider (openai/andrew/openrouter/deepseek/deepseek-chat-v3.1) <aider@aider.chat>
This commit is contained in:
@@ -521,44 +521,4 @@ impl MetaPlugin for TextMetaPlugin {
|
||||
self.base.options_mut()
|
||||
}
|
||||
|
||||
fn configure_options(&mut self, options: &std::collections::HashMap<String, serde_yaml::Value>) -> anyhow::Result<()> {
|
||||
log::debug!("TEXT: Configuring options: {:?}", options);
|
||||
if let Some(text_detect_size) = options.get("text_detect_size") {
|
||||
if let Some(size) = text_detect_size.as_u64() {
|
||||
self.max_buffer_size = size as usize;
|
||||
}
|
||||
}
|
||||
// Handle the old option name for backward compatibility
|
||||
else if let Some(max_buffer_size) = options.get("max_buffer_size") {
|
||||
if let Some(size) = max_buffer_size.as_u64() {
|
||||
self.max_buffer_size = size as usize;
|
||||
}
|
||||
}
|
||||
|
||||
// Update tracking options - use default values if not present in options
|
||||
self.track_word_count = options.get("text_word_count")
|
||||
.and_then(|v| v.as_bool())
|
||||
.unwrap_or(true);
|
||||
self.track_line_count = options.get("text_line_count")
|
||||
.and_then(|v| v.as_bool())
|
||||
.unwrap_or(true);
|
||||
|
||||
// For line length tracking, check if any of the line length options are enabled
|
||||
let track_line_max = options.get("text_line_max_len")
|
||||
.and_then(|v| v.as_bool())
|
||||
.unwrap_or(true);
|
||||
let track_line_mean = options.get("text_line_mean_len")
|
||||
.and_then(|v| v.as_bool())
|
||||
.unwrap_or(true);
|
||||
let track_line_median = options.get("text_line_median_len")
|
||||
.and_then(|v| v.as_bool())
|
||||
.unwrap_or(true);
|
||||
|
||||
self.track_line_lengths = track_line_max || track_line_mean || track_line_median;
|
||||
if self.track_line_lengths && self.line_lengths.is_none() {
|
||||
self.line_lengths = Some(Vec::new());
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user