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

add autocomplete/suggestions for arguments in Console.hx #1032

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ZwodahS
Copy link
Contributor

@ZwodahS ZwodahS commented Dec 16, 2021

There is an existing solution at #832 which does it differently from this implementation.

This implementation uses a function that return the best match instead of a list of suggestions.
Open to suggestions on how to improve this further.

@ZwodahS ZwodahS force-pushed the feat-console branch 2 times, most recently from 28d4d42 to 6f03a01 Compare January 19, 2022 17:42
@ZwodahS ZwodahS changed the title add suggestions for args in Console add autocomplete/suggestions for argument in Console.hx Mar 7, 2022
@ZwodahS ZwodahS changed the title add autocomplete/suggestions for argument in Console.hx add autocomplete/suggestions for arguments in Console.hx Mar 7, 2022
@ZwodahS
Copy link
Contributor Author

ZwodahS commented Mar 7, 2022

I guess I should also show an example on how I use this

final testNames = [....];
console.addCommand("runtest", "run a specific test", [
	{
		"name": "testName",
		"t": h2d.Console.ConsoleArg.AString,
		"argSuggestions": function(tokenized: Array<String>, arg: String) {
			return utils.findClosestMatch(testNames, arg);
		}
	}
], .... 
`findClosestMatch` essentially is the same way that commands are matched `Console.hx`

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

Successfully merging this pull request may close these issues.

1 participant