SkriptLang / Skript

Skript is a Spigot plugin which allows server admins to customize their server easily, but without the hassle of programming a plugin or asking/paying someone to program a plugin for them.
https://docs.skriptlang.org
GNU General Public License v3.0
1.05k stars 362 forks source link

Tab Completions #3894

Open MrScopes opened 3 years ago

MrScopes commented 3 years ago

I couldn't find a good open issue to leave this comment on, but I think with a tab completion event, there could also be an option in commands:

command /hello <text> <text>:
    tab complete:
        set completions to "hello" and "hi" # this sets both position 1 and 2
        # set completions to ("hello" and "hi") and "epic" - this could also work to set position 1 and 2
        set completions for tab arg 2 to "sup" if tab arg 1 is "hello" # so, if the user puts "hello", the next completion will be "sup"
    trigger:
        doStuff

tab arg 1 acting as the user input, completions for tab arg 1 acting as what you set\ event-player and etc would work in tab complete:\ I'd like to hear what people think about this

FranKusmiruk commented 3 years ago

duplicate of #1600 but going to leave both open since this is more of a clear feature request and the other one has a bounty so it'd be a waste.

We've thought about this many times already, the main issue with this is the syntax. A new section to the command node was discouraged since we already have too many, this would be a full command with every scope:

command /test:
    description: This is a test command.
    usage: /test
    executable by: players
    permission: test.perm
    permission message: <light red>You don't have the permissions to use this command.
    aliases: testing, stuff
    cooldown: 15 seconds
    cooldown message: <yellow>Wait %remaining time% to use this command.
    cooldown bypass: test.cooldown.bypass
    cooldown storage: {cooldown::%player's uuid%}
    trigger:

There's really no place for the tab complete section there, it'd make the code hard to read. Though, you may argue not everyone will use all of the command section features in a single command, which is in fact true, it may be better if the section goes after the trigger section and not before, to make it a bit more readable.

TPGamesNL commented 3 years ago

Another suggested way to do this is to make it a seperate event, this way the command section wouldn't get more poluted

Mwexim commented 3 years ago

There's really no place for the tab complete section there, it'd make the code hard to read. Though, you may argue not everyone will use all of the command section features in a single command, which is in fact true, it may be better if the section goes after the trigger section and not before, to make it a bit more readable.

If I’m being honest, I find this a pretty weak argument in order to cancel this feature request.

This mentality has stopped important and handy feature requests while there is literally no need to.

Also, isn’t it possible to choose where you put each subsection, or are their places predetermined? If the latter is true, maybe we should consider adding support for this?

FranKusmiruk commented 3 years ago

If I’m being honest, I find this a pretty weak argument in order to cancel this feature request.

I am not cancelling it, I'd have closed it otherwise. I am just pointing out one of the reasons why there was a hesitance when it comes to implementing this feature, among many others like implementation (using TabCompleter to support older versions vs (Async)TabCompleteEvent and support for 1.13+ only) or the overall hassle that is implementing new sections considering how Skript handles commands. That being said, we do know this is a long-requested feature and it'll be definitely be implemented sooner or later, but it isn't on my priority list right now at least and I don't know about the rest of the team.