As you already mentioned in your question, this question is about Code Snippet. However, code snippet is not enabled for MSE.
The feature what we have available right now is Code Blocks for which SE uses Google Code Prettify internally. So the expand/collapse-able feature would be possible only if the Code Prettify has such facility, which I don't think exist now.
Code Snippet != Code Blocks
I am not sure when and how we will get the code snippet feature here. I think this code snippet feature is only available in the site StackOverflow. So the chance to get this feature for MSE is very rare (since there exists pretty old SE sites such as SuperUser which do not have code snippet feature yet.)
Refer this answer: https://meta.stackoverflow.com/a/354002/2869218