Skip to content

Commit

Permalink
only match filename not path
Browse files Browse the repository at this point in the history
  • Loading branch information
Feel-ix-343 committed Mar 3, 2024
1 parent 1a7d3c6 commit 730f2fb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions src/completion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ pub fn get_completions(
.unwrap_or("".to_string())
);


let all_links = MatchableReferenceable::from_vault(vault);

let matches = fuzzy_match(&inputted_refname, all_links);
Expand Down Expand Up @@ -373,8 +374,7 @@ pub fn get_completions(
},
referenceable
.get_refname(vault.root_dir())?
.path?
.to_string(),
.link_file_key()?,
match referenceable
.get_refname(vault.root_dir())?
.infile_ref
Expand All @@ -396,6 +396,10 @@ pub fn get_completions(
)
.and_then(|item| {
Some(CompletionItem {
label: format!("{}{}",
referenceable.get_refname(vault.root_dir())?.link_file_key()?,
referenceable.get_refname(vault.root_dir())?.infile_ref.map(|thing| format!("#{}", thing)).unwrap_or("".into())
),
sort_text: Some(rank.to_string()),
insert_text_format: Some(InsertTextFormat::SNIPPET),
filter_text: Some(format!(
Expand Down
2 changes: 1 addition & 1 deletion src/vault/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1153,7 +1153,7 @@ pub struct Refname {
}

impl Refname {
fn link_file_key(&self) -> Option<String> {
pub fn link_file_key(&self) -> Option<String> {

let path = &self.path.clone()?;

Expand Down

0 comments on commit 730f2fb

Please sign in to comment.