Skip to content

Shorten wikilink block completion paths - #436

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1778363220-issue-421-block-completions
Open

Shorten wikilink block completion paths#436
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1778363220-issue-421-block-completions

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented May 9, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #421 by changing wikilink block completions to prefer filename-only block references when safe.

  • Adds a shorten_block_ref_paths hook to distinguish wikilink completions from markdown link completions.
  • Keeps markdown link block completions using the existing relative-path behavior.
  • For wikilink block completions, inserts Filename#^blockid|display instead of folder/path/Filename#^blockid|display unless the short reference would be ambiguous.
  • Falls back to the full vault-relative path when:
    • generating a new block ref for a file whose filename also appears elsewhere in the vault, or
    • completing an indexed block where another same-filename file has the same block id.
  • Adds focused unit tests for duplicate filename/stem detection.

Review & Testing Checklist for Human

  • Verify the ambiguity fallback matches expected Obsidian behavior for duplicate filenames and duplicate block IDs.
  • Test in Neovim with [[ <query> block completion: unique filenames should insert Filename#^id|text, while duplicate filenames should still use the full path.
  • Confirm markdown-link block completion behavior remains unchanged.

Notes

Local validation run:

  • cargo fmt --check
  • cargo clippy (passed with existing unrelated warnings)
  • cargo test (passed with existing unrelated warning)

Link to Devin session: https://app.devin.ai/sessions/ed2e0a94bfdb4138995a0b7228ef4095
Requested by: @Feel-ix-343


Open in Devin Review

Co-Authored-By: Felix Zeller <felixazeller@gmail.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

how to avoid full-path , block completion or enable wikilink style block completion

1 participant