Skip to content

Conversation

@Traqueur-dev
Copy link
Owner

✨ Fix: Tab-Completion Suggestions for Hierarchical Commands

🐞 Problem

Tab-completion behavior was inconsistent for hierarchical commands registered via CommandTree.
In particular:

  • Suggestions did not account for cases where the cursor was positioned directly after a valid argument (/command arg<CURSOR> vs /command arg <CURSOR>).
  • Commands with aliases and nested subcommands could fail to provide accurate suggestions when partially typed.

πŸ”§ Solution

  • Improved handling of suggestion context:

    • Distinguish between cursor positions:

      • When the cursor is attached to the last argument (e.g., /test sub<CURSOR>), suggest sibling or matching commands.
      • When the cursor is after a space (e.g., /test sub <CURSOR>), suggest subcommands of sub.
  • Ensure correct traversal of CommandTree:

    • Adjusted fallback traversal logic when findNode(...) returns no match but a partial path still exists.
    • Handles aliases transparently, allowing consistent suggestions even when alias paths are used.

πŸ“ Notes

  • No breaking changes to API.
  • Fully compatible with the hierarchical CommandTree introduced previously.
  • Tab-completion behavior now aligns closely with user expectations in hierarchical command structures.

βœ… Why this fix

  • Improves UX when using nested and alias-based commands.
  • Ensures tab-completion suggests valid next tokens based on exact cursor position and command context.
  • Provides reliable behavior across deeply nested command hierarchies.

@Traqueur-dev Traqueur-dev merged commit 9e40384 into master Jul 15, 2025
2 checks passed
@Traqueur-dev Traqueur-dev deleted the develop branch August 26, 2025 11:48
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.

1 participant