Thoughts on collapsible code snippets?

Emerald_Knight
2018-06-16T11:59:48Z

One thing I ended up realizing is that for e.g. code challenges in ~comp, there could be threads with a lot of code blocks that could easily take up a ton of screen real-estate. Something like the following isn't so bad:

/*
    This is a short multi-line example that doesn't
    take up much screen real-estate at all.
*/

But, what if the average comment for a particular topic has several of these with 100 lines or more? This could make navigating the comments really cumbersome as the number of comments grows. In the case of code challenges, lengthy code snippets could be very common, and collapsing the comment threads may not be the desirable course of action--in collapsing the thread for navigational convenience, you lose the ability to view and contribute to discussions. Hosting the code elsewhere risks links expiring or becoming lost or broken, and it feels like a clunky workaround to try to avoid inconveniencing other users.

With that in mind, what are your thoughts on having these code blocks display in a collapsed state by default with only a preview of the code block showing? Is there any support for this idea? If so, should this be implemented as part of Tildes itself or as a client-side extension of some sort? Are there any concerns about this?

(If there's general support for the idea, but opposition toward adding it to the Tildes code base, I may get off my lazy ass and try to hack something together.)

Comments URL: https://tildes.net/~tildes/2cm/thoughts_on_collapsible_code_snippets

Votes: 13

Comments: 4