Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Autocomplete interface #18
One of the reasons that method names are so long (
(@janpaul123, you followed the vision--how did that end up working for beginner jsdares players?)
So how will we do it? There are two parts:
For finding completions, our secret weapon will be Aether, since it should know not only which properties are available on
For autocomplete UI, I hadn't thought too much about it beyond starting with something simple and trying to evolve it toward the screenshots above while iterating through some UX tests. Developing the interface is what this issue (in the main CodeCombat project) is about.
I found a couple potentially useful links for doing autocomplete within ACE:
I'm guessing we'll probably want something weird enough that we won't really go through ACE for it, though.
I think the autocomplete box in jsdares worked pretty well, I have seen most novice learners use it without any problems. Most people start typing "robot." by example, and then see the autocomplete box. Some people copy/paste lines from the example, but eventually they discover the autocomplete box too.
It's a flexible interface for discovering new methods (not just the ones in an example). It also scales nicely to real-world programming, although there autocomplete boxes are often not as nice (no preview, or no context-awareness) ;-)
If you're going to do this, I would like to suggest doing it a bit better than jsdares and show some more information, e.g. little icons (like Bret Victor proposes), or named arguments instead of just numbers, or small method descriptions.
Yeah many people expect this, including me. A lot of people already get frustrated when nothing happens after pressing CTRL+Space ( a code assist combination in many IDE's ). so maybe show a message box (maybe just when you do CTRL+SPACE) that tells that the auto complete function is not yet implemented but will be done soon.
Yeah, it's largely done. I see a few issues remaining with it:
1. Autocomplete often inserts invalid code
I should be able to select the autocompletion even after typing this and have it work. It should also do the semicolon for me.
2. Autocomplete requires semi-advanced keypresses
I have to press either tab-tab, down-tab, or down-enter to trigger the first autocomplete snippet. I would prefer it if we can let them also just press tab to do the first one (or even enter if what they have typed couldn't be a valid end of line). Glen mentioned Ctrl+Space–I'm not sure how common that is, but if it's really standard, we might try to support it. I think it will conflict with keyboard input method selection shortcuts a lot of the time, though.
3. Autocomplete z-layering goes above spell palette
Should be easy to fix.
4. Autocomplete tries to complete when typing in a comment or string
5. Autocomplete maybe shouldn't autocomplete numbers
While it's cool that it can do that, this seems like it would be useful less of the time than it would be confusing.
At some point soon I think we're going to need to make the snippet insertion much smarter to take advantage of the available methods and only insert valid code (especially on iPad), but we can do that one in a separate issue.