🏠 back to Observable

code folding in the editor

When working with a large snippet of code in a cell or even a small one but having too many short lines such as with vegalite spec or defining some css stylesheets, the cells get pretty long, is there any way to have a code folding functionality? I feel its somehow wrong to ask this functionality as we can ideally break code into multiple cells and unpin them, but I do not want to create new named cells for most of these use cases.

Note: I had to turn off auto code formatting so I can handle large json objects in a single line to make the code shorter. Having a shortcut to format the current cell is also very welcome compared to having it default for all cells in all notebooks.

2 Likes

Thanks for the feedback! I submitted this as a feature request.

1 Like

A little late here but you can put the comment // prettier-ignore on the line before the JSON object to prevent it from being reformatted.

4 Likes