Skip to content

Array autocompletion does not respect flag-yielding #459

@Pablete1234

Description

@Pablete1234

https://github.com/Incendo/cloud/blob/master/cloud-core/src/main/java/cloud/commandframework/CommandTree.java#L617

        } else if (GenericTypeReflector.erase(child.getValue().getValueType().getType()).isArray()) {
            while (commandQueue.size() > 1) {
                commandQueue.remove();
            }
        }

This removes all remaining arguments except for the very last one, which prevents autocompletion for tags like:
/command arr1 arr2 arr3 --flag valu, because the moment it reaches arr1 the whole queue is obliterated and you're left with a standalone valu but without any context for the flag to be able to tab-complete it.

This should probably call the parser and see what it consumes. If it consumes everything, suggest with the last word previously available in the queue. If it does not consume everything, move on to the next argument.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions