Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Autocomplete suggestions in Default theme #1853

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

StayBlue
Copy link
Contributor

@StayBlue StayBlue commented Mar 4, 2025

This PR is the first step in addressing #1353. This attempts to mirror the original functionality while addressing issues with how the default theme handles autocomplete suggestions. Primarily:

  • Simplified/refactored the existing code
  • Fixed an issue where the Frame would not be sized to accommodate the autocomplete suggestions
  • Factored out autocomplete to a separate function inside of UI so that plugins can directly manipulate the resulting suggestions
  • Fixed an issue where autocomplete suggestions for player names would be provided despite the first argument of a command always expecting a command and not a player
  • Fixed an issue where autocomplete would attempt to concatenate the text with the table of command prefixes, resulting in an error

Why only the default theme? Simply put, I'm lazy at the moment. If there are criticisms about how I handled the new autocomplete suggestions in the default theme, I would have to change it in every single theme whenever a problem is brought up in review. This is fine since it doesn't adversely affect other themes that don't support this new functionality (yet).

Proof of functionality:

2025-03-03.15-56-41.mp4

@StayBlue StayBlue marked this pull request as draft March 4, 2025 00:20
@StayBlue StayBlue force-pushed the autocomplete-refactor branch from 9555ac8 to 11f19f0 Compare March 4, 2025 00:58
@StayBlue StayBlue marked this pull request as ready for review March 4, 2025 01:00
@StayBlue
Copy link
Contributor Author

StayBlue commented Mar 4, 2025

I converted this to a draft while trying to track down an error I got during testing. The autocomplete would attempt to concatenate the current text with the list of command prefixes when no possible entries were found, resulting in an error (since you can't concatenate a string with a table). This issue existed in the existing code but likely never occurred because there would always be at least one possible suggestion to choose from (i.e., a player in the game).

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