fix(completion): stop callout completions recurring over block-quote prose - #3
Open
Feel-ix-343 wants to merge 1 commit into
Open
fix(completion): stop callout completions recurring over block-quote prose#3Feel-ix-343 wants to merge 1 commit into
Feel-ix-343 wants to merge 1 commit into
Conversation
…prose The callout completer matched any line starting with the (> *)+ prefix against the whole line, ignoring the cursor. Since " " and ">" are completion trigger characters, every space typed inside a block quote re-popped all callout completions over prose. Slice the line to the cursor and only fire when the text after the block-quote prefix is empty or a partial callout opener ([?!?[\w-]*), mirroring link_completer's cursor-aware matching. Add unit tests. Co-Authored-By: Felix Zeller <felixazeller@gmail.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Callout (admonition) completions kept popping up over ordinary prose inside a block quote — e.g. typing
> We're going to have to decidere-showed the full[!note]/[!warning]/… list on every keystroke. They should only appear where an Obsidian callout could actually be typed (right after the>marker), not after a word is written.Root cause in
CalloutCompleter::construct: it matched the whole line against^(> *)+, ignoring the cursor and anything after the prefix. Since the server registers" "and">"as completion trigger characters (main.rs), every space inside a block quote re-fired the completer and it unconditionally returned all 27 callouts.Fix: slice the line to the cursor (mirroring
link_completer'sline_to_cursor) and only fire when the text after the(> *)+prefix is empty or a partial callout opener:So completions still fire at
>,> [,> [!,> [!no, and bare> no, but are suppressed once a space, apostrophe, or finished word appears (> note,> We're …). Nested block quotes (>>) and the existingnested_level/preceding_textbehavior are unchanged. The trigger test is extracted into a purecallout_trigger(line_to_cursor)helper with unit tests.Test plan
cargo test— 78 passing, incl. 4 newcallout_completertests (marker fires; opener-typing fires; prose/space/apostrophe suppressed; non-blockquote rejected).cargo fmt --all -- --checkclean;cargo build --lockedsucceeds.Link to Devin session: https://app.devin.ai/sessions/cd5d29cf010f4708bdf1a5146f8f3665
Requested by: @Feel-ix-343