Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
liuchengxu committed Aug 9, 2023
1 parent 22b3c36 commit af2de04
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 4 additions & 5 deletions crates/maple_core/src/stdio_server/input.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@ impl PluginEvent {
/// Returns `true` if the event can be potentially too frequent and should be debounced.
pub fn should_debounce(&self) -> bool {
match self {
Self::Autocmd((autocmd_event_type, _)) => match autocmd_event_type {
AutocmdEventType::CursorMoved => true,
_ => false,
},
Self::Autocmd((autocmd_event_type, _)) => {
matches!(autocmd_event_type, AutocmdEventType::CursorMoved)
}
}
}
}
Expand Down Expand Up @@ -259,7 +258,7 @@ impl InputRecorder {
self.current_index = self
.current_index
.checked_sub(1)
.unwrap_or_else(|| self.inputs.len() - 1);
.unwrap_or(self.inputs.len() - 1);
self.inputs.get(self.current_index).map(AsRef::as_ref)
}
}
4 changes: 2 additions & 2 deletions crates/maple_core/src/stdio_server/plugin/ctags.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,9 @@ impl ClapPlugin for CtagsPlugin {
if !Path::new(&file_path).exists() {
return Ok(());
}
if !self.buf_tags.contains_key(&bufnr) {
if let std::collections::hash_map::Entry::Vacant(e) = self.buf_tags.entry(bufnr) {
let buffer_tags = crate::tools::ctags::fetch_buffer_tags(file_path)?;
self.buf_tags.insert(bufnr, buffer_tags);
e.insert(buffer_tags);
self.on_cursor_moved(bufnr).await?;
}
}
Expand Down

0 comments on commit af2de04

Please sign in to comment.