Skip to content

[Bug]: Wiki link autocomplete menu disappears immediately when typing after [[ #418

@corkang

Description

@corkang

What happened?

When typing [[ to create a wiki link, the autocomplete menu appears correctly. However, as soon as I type any character (e.g., [[a), the autocomplete menu immediately disappears instead of filtering the suggestions.

Expected behavior: The autocomplete menu should stay open and filter suggestions based on the typed query, showing notes that match the input.

Actual behavior: The menu closes instantly when any character is typed after [[.

Version

0.1.0 (latest)

Operating System

macOS

Steps to reproduce

  1. Open any note in Lokus
  2. Type [[ to trigger the wiki link autocomplete
  3. Observe that the autocomplete menu appears with file suggestions
  4. Type any character (e.g., a)
  5. The autocomplete menu immediately disappears

Relevant log output

Additional context

Root cause: In src/editor/lib/WikiLinkSuggest.js, the allow() function only checks the 2 characters immediately before the cursor. When typing [[a, the check textBefore.endsWith('[[') fails because textBefore is [a, not [[.

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions