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

Wrapping command elements with empty usage at the end of seq generates extra whitespace in usage #2254

Open
thibaulthenry opened this issue Nov 10, 2020 · 2 comments
Labels

Comments

@thibaulthenry
Copy link
Contributor

SpongeVanilla version: 1.12.2-7.3.0
Java version: 8
Operating System: Windows 10
Plugins: only my plugin in development (cosmos)

Hey,

Again a small ticket to inform that wrapping command elements with empty usage at the end of CommandElement#seq generates extra whitespace in command usage.

The problem occurs with GenericArguments#markTrue or GenericArguments#none and all elements with Text.EMPTY usage.

For example:

GenericArguments.seq(
    GenericArguments.string(Text.of("arg1")),
    GenericArguments.markTrue(Text.of("argTrue"))
 ),
GenericArguments.string(Text.of("arg2"))

will generates

Capture3

It's limited to one extra whitespace per seq element, but with (ok.. kind of strange) arguments wrapping, it accumulates :

GenericArguments.seq(
    GenericArguments.string(Text.of("arg1")),
    GenericArguments.seq(
        GenericArguments.string(Text.of("sub1")),
        GenericArguments.seq(
            GenericArguments.string(Text.of("subsub1")),
            GenericArguments.none()
        ),
        GenericArguments.none()
    ),
    GenericArguments.none()
),
GenericArguments.string(Text.of("arg2"))

will generates

Capture4

Thank you for reading this issue.

@thibaulthenry thibaulthenry changed the title Wrapping command elements with empty usage at the end of #seq generates extra whitespace in usage Wrapping command elements with empty usage at the end of seq generates extra whitespace in usage Nov 10, 2020
@dualspiral dualspiral added the api: 7 (u) version: 1.12 label Nov 14, 2020
@dualspiral
Copy link
Contributor

Given how minor this issue is, the focus we have on getting our 1.15.2 builds completed and that the commands system has been completely rewritten for API 8 to support the client side completion, I will admit that it is very unlikely that I will look at this. However, I would welcome a PR to fix this if you have the inclination to do it.

@thibaulthenry
Copy link
Contributor Author

Totally agree, just wanted to write it down to not forget.
I'll try to fix it on free time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants