javalent / admonitions

Adds admonition block-styled content to Obsidian.md
MIT License
1.04k stars 67 forks source link

🐞 Strange Behavior of Callout Type Autocompletion #339

Open RyzenFromFire opened 1 month ago

RyzenFromFire commented 1 month ago

Check for existing bug reports before submitting.

Expected Behavior

I type >[! and a dropdown list of admonition types appears. I can type more characters to search/narrow down the list of types. When I press Enter (or alternatively Tab, doesn't matter to me), the currently selected one is autocompleted and my cursor is placed at the end.

Current behaviour

I type >[! and a dropdown list of admonition types appears. I can type more characters to search as desired, but the first character I type is always kept, and then the autocompleted type is concatenated. For example, if I type >[!n and then select the note type, the result is >[!nnote] (with my cursor one space after the bracket - that part is fine).

image image

Furthermore, in this case, pressing Enter (or left-clicking) to confirm the autocompletion doesn't work in a clean vault for some reason. That is, I can't actually autocomplete.


If I only type >[! with no additional characters, then select a type, a newline is inserted. Like before, in a clean vault, pressing Enter or clicking to confirm doesn't do anything.

image image


If I type a space >[!, then select a type, the selection menu remains open, which can cause "chaining" of the part of the admonition declaration after the part already typed (ex. note]):

image image image image ...ad nauseum

Unlike the previous two cases, pressing Enter to confirm the autocompletion works in a clean vault, exhibiting the same behavior described here.

Reproduction

  1. Open any vault and file.
  2. If the Admonition plugin is not already installed, do so.
  3. Using live preview or source view mode, type >[! followed by: 1. some other character that is part of a valid admonition type, 2. nothing, or 3. a space.
  4. The admonition autocomplete selection menu appears. Select one by pressing Enter or clicking on it.
  5. Depending on what you did in Step 3, the behavior corresponding to the case described above occurs.

Which Operating Systems are you using?

Obsidian Version Check

v1.5.12 and v1.4.16

Plugin Version

10.2.0

Confirmation

Possible solution

No response

valentine195 commented 1 month ago

I unfortunately can't recreate this at all. I will keep investigating.