Update 0.4.4
More Autocomplete Power!!
Arguments themselves can now have autocomplete, and you too can add this to your own quicks!
How? Add autocompleteArgs to your quick, and return an array of Response’s (Scroll down a bit to see the type) OR if you just want to return the basic autocomplete use the function that you can pass in as many strings as you want and it will convert it into the correct format. Simply return Utils.createBasicAutocompletes(…) just as seen below.
This also allows for more powerful completions with access to the whole document object, and the index of the argument that is currently being edited(Starting at 1) This lets you have different suggestions for the first and second argument and so on.
Also dont worry about narrowing the autocompletes down, this will automatically be done internally.
editingArgIndex
- The index of the arg that is being currently edited
arguments
- an array of all arguments given so far. arguments[editingArgIndex]
returns the current argument thats being edited
Being edited means the text cursor is there.
An example would be >TEST(aa,bb|);
If | is where the cursor is at then editingArgIndex
is 2, and arguments[editingArgIndex]
is bb
A fancier autocomplete
Lots more is going on here
More info below where each new util is explained. Feel free to comment if something doesn’t make sense.
I may show some more complex examples of this in this thread some time.
Not every built in command has or needs argument autocomplete.
What else changed?
-
Some Bug Fixes
-
A big internal code rework since this project is getting big, and needs to stay maintainable.
-
Fixed some issues where autocompletes would have \n in them
-
Added some Utils
- FindCharInString(str, charPattern) - returns a table containing { index, line, lineIndex }
- GetCharacterAtPosition(str, lineNum, charNum) - Returns a character in a string. Think of charNum as X, and lineNum as Y. Gets the character at a certain line number with
charNum
characters in - CombineKeyTables(table1, table2) - Combines any 2 key-based tables
- CombineKeyTables(…) - pass any amount of strings in and it will return an array of Responses
- createBasicAutocompletesWithDefaultValues({}, …) - Just like
createBasicAutocompletes
, but instead but the first argument is a “Response template” that will be applied to every other Response on the list. See example above
-
A few other minor tweaks
The autocomplete can also be used as a live preview of what its going to turn into as demoed in the new >GS()
Please give me feedback, suggestions, and even share with me what you use this for as it helps me figure out what people like, what people need, as well as motivation.