SuggestionsBuilder for basic string suggestions and RichSuggestionsBuilder for advanced completions with tooltips and metadata.
Overview
Suggestion builders are used in thesuggest() and suggestRich() methods of argument providers to provide tab completion suggestions to users.
SuggestionsBuilder
The basic suggestion builder for string-based tab completions.Class Definition
me.vaperion.blade.util.command
Methods
Adds a suggestion to the list.If the suggestion already exists, it will not be added again. Only suggestions that pass the current filter will be included.
The suggestion text to add
Sets a filter for suggestions. Only suggestions that pass the filter will be included in the final list.
The filter predicate, or
null to accept all suggestionsTests whether a suggestion passes the current filter.Returns:
The suggestion to test
true if the suggestion passes the filter, false otherwiseClears all current suggestions.
Returns the number of suggestions currently stored.
Builds and returns an unmodifiable list of all suggestions.
Basic Usage Example
RichSuggestionsBuilder
An advanced interface for building suggestions with rich metadata like tooltips and numeric completions. This is particularly useful for Brigadier-based platforms.Interface Definition
me.vaperion.blade.util.command
Methods
Returns the full input string used for suggestion generation.
Returns the start offset where suggestions should replace text.
Returns the remaining input segment from the start position.
Returns the lowercase remaining input segment.Useful for case-insensitive filtering.
Adds all suggestions from another builder instance.
The builder to merge from
Creates a new builder view with the given replacement offset.
The replacement start offset
Creates a new builder view that restarts at this builder’s start offset.
Returns the legacy string-only builder view.
Tests whether a suggestion passes the current filter.
The suggestion to test
Sets the suggestion filter.
The filter predicate, or
null to accept all suggestionsSuggestionTooltip
Creates tooltip metadata for rich suggestions.Static Factory Methods
Instance Methods
Returns the tooltip text representation, or
null if not provided.Returns a typed native tooltip handle.Returns: The native handle, or
The requested native type
null if unavailableUsage Examples
Basic String Suggestions
Rich Suggestions with Tooltips
Numeric Suggestions with Range
Context-Aware Suggestions
Conditional Suggestions Based on Previous Arguments
See Also
- ArgumentProvider - Interface for creating custom argument types
- Context - Command execution context
- InputArgument - Command argument representation