SMAPI icon indicating copy to clipboard operation
SMAPI copied to clipboard

Auto-complete support for the console

Open spacechase0 opened this issue 3 years ago • 3 comments

(And a bunch of other stuff, included in the ReadLine library. See GitHub page. Only tab completion and history was tested.)

Uses the ReadLine library, with some tweaks I had to do for SMAPI: https://www.nuget.org/packages/spacechase0.ReadLine.SMAPI/2.2.0 Fork: https://github.com/spacechase0/ReadLine (and relevant commit: https://github.com/spacechase0/ReadLine/commit/e5eaa386f55bcd153c36d796150daf96ff6b7973 )

Includes support for commands names themselves (handled by SMAPI) and the help built-in command, + API for mods to handle auto-completion for their commands.

Mods can pass a new parameter, a function taking a string representing the current input and returning string[] representing the list of potential completions. For an example, see SMAPI's help command (since they function the same).

(I'd normally include a GIF here, but the GIF has some unreleased stuff of mine in it.)

spacechase0 avatar Aug 17 '21 05:08 spacechase0

Made the API more consistent, and fixed some things.

spacechase0 avatar Aug 17 '21 15:08 spacechase0

Oh yeah. This doesn't include copying the ReadLine assembly into smapi-internal/. I don't know how to do that.

spacechase0 avatar Aug 20 '21 05:08 spacechase0

There seems to be a bug where you can move the cursor to the left, and it will crash the game if it goes left of the left edge. Probably a bug in usage of the library, judging from the stack trace. Will look into it.

spacechase0 avatar Aug 20 '21 20:08 spacechase0

I'll close this since it still has some unresolved issues, and we're discussing a different library to tackle this on Discord. Thanks for the PR though!

Pathoschild avatar Oct 09 '22 16:10 Pathoschild