Today we’re soft-launching some fun stuff (try the new notebook toggle UI!)). Second one on the list is: code completion!
Completion is on by default for everyone - just hit tab!
Quick rundown of the completion at this point!
Tab while typing to autocomplete. Then arrow keys navigate the list, clicking selects a completion, hitting Tab accepts a completion, Escape closes the autocompletion.
We currently support autocompleting the following:
- Cell names
- Variable names defined in the same cell
- Everything in the Standard Library
- Globals, like
Math, and their properties. If you type
Math. and hit tab, it’ll give you all the sweet trigonometry functions
- RegExp and String prototype methods, if you’re on one of those
In the near future, we’d love to add more sources of completion, so it can help auto-complete functions in modules and properties of other cells, but we’re starting small and already using this has reduced my typo count significantly.
Try it out and let us know what you think!
Thanks for doing this. I like the way it works. Because I’m bad at reading, I tried this without reading the rundown of how it worked first. Because my most used IDE does it, I expected the autocomplete to be triggered when I paused typing in the middle of a word (after typing at least one character). It is what I saw in the video too . I appreciate all the hard work and thought going into this project. I’m wondering if others might expect the autocomplete to be triggered by a pause as well? Thanks for updating the help modal also!!!
Works well for me. Thanks for adding this.
We decided to go all-in for autocompletion, so I’ve just deployed an update that:
- Completes properties of imported modules and of other cells
- Supports completing even if the path includes
- bracket notation, with strings or numbers, and newlines
- ‘Wild mode’ completion when you’re completing properties of a variable that’s local to a cell - completes against all properties declared on objects in that cell.
Basically now you can:
- Use autocompletion to quickly explore datasets - pull out the first item with
 and see its properties
- Rely on autocompletion (almost) always being available, for (almost) everything
Try it out! It’s still behind the feature flag in the OP: set this in your developer console
localStorage.FEATURE_CODE_COMPLETION = true
I’m really excited about this feature, but it’s unfortunately not working for me. Here’s what happens in my browser every time I try code completion:
Let me know if I can provide more info. (Technical user-agenty stuff: Chrome/63.0.3239.132, Intel Mac OS X 10_12_5)
EDIT: Addition debugging info. This is what is printed on my console:
bundle.3027ac135d7b78d3b26865f3c485b6b1191458450fb1447e6c219aa951e5ffed.js:2 Uncaught (in promise) TypeError: Class constructors may only return object or undefined
at Object.finishUpdate (bundle.3027ac135d7b78d3b26865f3c485b6b1191458450fb1447e6c219aa951e5ffed.js:2)
at Object.update (bundle.3027ac135d7b78d3b26865f3c485b6b1191458450fb1447e6c219aa951e5ffed.js:2)
And this is the location of the error:
Huh - surprising that I’ve been debugging in Chrome 63 etc, and never happened upon that TypeError - irregardless, I’ve pushed an update that should fix the issue!
Works now! Thanks for the quick fix on this awesome feature!
Code completion is now shipped - no flag necessary to use it, just edit an hit Tab to complete, and you’ll get magic suggestions whenever possible.