Allow configuring completion matcher algorithm

See #872.
This commit is contained in:
Patrick Förster 2023-04-16 15:19:58 +02:00
parent 617c799dcd
commit dae46eff80
6 changed files with 129 additions and 23 deletions

View file

@ -12,6 +12,7 @@ pub struct Config {
pub synctex: Option<SynctexConfig>,
pub symbols: SymbolConfig,
pub syntax: SyntaxConfig,
pub completion: CompletionConfig,
}
#[derive(Debug)]
@ -71,6 +72,19 @@ pub struct SymbolConfig {
pub ignored_patterns: Vec<Regex>,
}
#[derive(Debug)]
pub struct CompletionConfig {
pub matcher: MatchingAlgo,
}
#[derive(Debug)]
pub enum MatchingAlgo {
Skim,
SkimIgnoreCase,
Prefix,
PrefixIgnoreCase,
}
impl Default for Config {
fn default() -> Self {
Self {
@ -81,6 +95,7 @@ impl Default for Config {
synctex: None,
symbols: SymbolConfig::default(),
syntax: SyntaxConfig::default(),
completion: CompletionConfig::default(),
}
}
}
@ -149,3 +164,11 @@ impl Default for SymbolConfig {
}
}
}
impl Default for CompletionConfig {
fn default() -> Self {
Self {
matcher: MatchingAlgo::SkimIgnoreCase,
}
}
}