mirror of
https://github.com/lotabout/skim.git
synced 2026-09-10 07:16:23 -04:00
fix: disable compact_matcher feature
This commit is contained in:
parent
93ffbcea88
commit
8ae57f6d01
|
|
@ -67,4 +67,3 @@ ron = "0.12.0"
|
|||
[features]
|
||||
default = ["cli"]
|
||||
cli = ["dep:clap", "dep:clap_complete", "dep:shlex", "dep:env_logger", "dep:clap_mangen"]
|
||||
compact_matcher = []
|
||||
|
|
|
|||
2
justfile
2
justfile
|
|
@ -11,7 +11,7 @@ generate-files:
|
|||
changelog version:
|
||||
git cliff -o CHANGELOG.md -t 'v{{ version }}'
|
||||
|
||||
release version: (bump-version version) generate-files (changelog version)
|
||||
release version: (bump-version version) generate-files (changelog version) test
|
||||
cargo generate-lockfile
|
||||
git add CHANGELOG.md Cargo.lock Cargo.toml man/ shell/
|
||||
git commit -m 'release: v{{ version }}'
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@ use std::cmp::min;
|
|||
use std::fmt::{Display, Error, Formatter};
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::fuzzy_matcher::FuzzyMatcher;
|
||||
use crate::fuzzy_matcher::clangd::ClangdMatcher;
|
||||
use crate::fuzzy_matcher::skim::SkimMatcherV2;
|
||||
use crate::fuzzy_matcher::{FuzzyMatcher, IndexType, ScoreType, clangd::ClangdMatcher, skim::SkimMatcherV2};
|
||||
|
||||
use crate::item::RankBuilder;
|
||||
use crate::{CaseMatching, MatchEngine};
|
||||
|
|
@ -109,7 +107,7 @@ impl FuzzyEngine {
|
|||
FuzzyEngineBuilder::default()
|
||||
}
|
||||
|
||||
fn fuzzy_match(&self, choice: &str, pattern: &str) -> Option<(i64, Vec<usize>)> {
|
||||
fn fuzzy_match(&self, choice: &str, pattern: &str) -> Option<(ScoreType, Vec<IndexType>)> {
|
||||
if pattern.is_empty() {
|
||||
return Some((0, Vec::new()));
|
||||
} else if choice.is_empty() {
|
||||
|
|
|
|||
|
|
@ -9,23 +9,16 @@ pub mod clangd;
|
|||
pub mod skim;
|
||||
mod util;
|
||||
|
||||
#[cfg(not(feature = "compact_matcher"))]
|
||||
type IndexType = usize;
|
||||
#[cfg(not(feature = "compact_matcher"))]
|
||||
type ScoreType = i64;
|
||||
|
||||
#[cfg(feature = "compact_matcher")]
|
||||
type IndexType = u32;
|
||||
#[cfg(feature = "compact_matcher")]
|
||||
type ScoreType = i32;
|
||||
pub(crate) type IndexType = usize;
|
||||
pub(crate) type ScoreType = i64;
|
||||
|
||||
/// Trait for fuzzy matching text patterns against choices
|
||||
pub trait FuzzyMatcher: Send + Sync {
|
||||
/// fuzzy match choice with pattern, and return the score & matched indices of characters
|
||||
fn fuzzy_indices(&self, choice: &str, pattern: &str) -> Option<(ScoreType, Vec<IndexType>)>;
|
||||
fn fuzzy_indices(&self, choice: &str, pattern: &str) -> Option<(i64, Vec<usize>)>;
|
||||
|
||||
/// fuzzy match choice with pattern, and return the score of matching
|
||||
fn fuzzy_match(&self, choice: &str, pattern: &str) -> Option<ScoreType> {
|
||||
fn fuzzy_match(&self, choice: &str, pattern: &str) -> Option<i64> {
|
||||
self.fuzzy_indices(choice, pattern).map(|(score, _)| score)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue