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