Skip to content

fix: sub command names missing from tab completion and in random order - #212

Open
DragonL0508 wants to merge 1 commit into
FairyProject:v0.7from
DragonL0508:fix/command-completion-sub-command-names
Open

DragonL0508 wants to merge 1 commit into
FairyProject:v0.7from
DragonL0508:fix/command-completion-sub-command-names

Conversation

@DragonL0508

Copy link
Copy Markdown

completeArguments only added the sub command names when no command matched at all. Two common cases never suggested them:

  • with a no-arg command (@Command("#")), it is matched whenever no name is, so typing /shop se suggested nothing instead of sell and sellall;
  • when one name is a prefix of another, /shop sell matches sell, so sellall was never suggested.

The names are now always merged into the argument completions, without duplicates. getCommandsForCompletion only returns names that start with what has been typed, so nothing changes once a sub command's arguments are being typed. The names were also collected in a HashSet, so their order changed between calls; they are now sorted.

Tests: SubCommandCompletionTest. It adds the same CoreTestingHandle test helper as #211 (identical files, so the two PRs merge cleanly in either order).

🤖 Generated with Claude Code

completeArguments only added the sub command names when no command
matched at all. Two common cases therefore never suggested them:

- a no-arg command (@command("#")) exists: it is matched whenever no
  sub command name is, so typing "/shop se" suggested nothing instead of
  "sell" and "sellall";
- one name is a prefix of another: "/shop sell" matches "sell", so
  "sellall" was never suggested.

The names are now always merged into the argument completions
(getCommandsForCompletion only returns names that start with what has
been typed, so nothing changes once a sub command's arguments are being
typed), without duplicates. They were also collected in a HashSet, so
their order changed between calls; they are now sorted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant