Feature request: Code snippets

Hi @all,

i am pretty sure you already thought about it, but i could not find something related here (i hope i did not miss something). I thought it would be a nice addition to have some sort of customizable code snippets.
Where for example typing context! and hitting tab (or some other key) would expand into for example const canvas = DOM.context2d(width, height);.

1 Like

It would also be nice to have an option to automatically show the autocomplete dropdown.

I’ve said this before, but for me personally, it would be much more useful to have an API which allowed read/write access to a notebook, so people could use any text editor/IDE they want; adding fancier features to a web platform is never going to be able to match everyone’s existing expectations and preferences for how they should work. (But I definitely understand if this is not a priority. It’s not a trivial feature.)

We’ve discussed making autocompletion more discoverable in a previous thread. It’s potentially just home bias because Jeremy/Mike/I don’t use always-on autocompletion, and I personally find some of the completion behaviors to be… wonky, like Atom’s accept-completion-on-Enter, which conflicts with the ability to type a completable thing at the end of a line. But, yeah - as it stands, I fear that a lot of people don’t know that Tab works, and we need better onboarding to make that clear.

Per bring-your-own-editor… it’d be an awesome dream, but, yeah - it’s a massive undertaking, especially because editors nowadays have pretty deep language integration and we’d have to either create a “just JavaScript” dialect of Observable to play nice, or write an Observable mode for n editors. Plus, of course, the whole syncing/file-access/etc idea.

4 Likes

we’d have to either create a “just JavaScript” dialect of Observable to play nice, or write an Observable mode for n editors. Plus, of course, the whole syncing/file-access/etc idea.

No you wouldn’t. The community (either of Observable or of those editors) is more than capable of filling that in.

For instance, I would be happy to do the work to make a TextMate language bundle.

1 Like