ST3 has a little arrow besides the line number that hides a certain section of code from view. Is it possible via the ST3 API to implement a drop down in a view that hides a certain section of text below it ?
Getting a drop down icon in a view
You could use the gutter for that (see add_regions() and example of it in Packages/Default/mark.py).
Check this post to know how to detect click in the gutter.
Another way would be to use phantoms: where you would place an arrow directly in the text area.
To hide section of code check the fold/unfold functions.
I believe by default Phantoms don’t allow their content to be editable. Is there a way to make the content editable ?
No, they are read-only for the user, but why would you need it to be editable, if it is just supposed to be an arrow to fold/unfold text ?
If you mean changing the arrow icon when the user click it, then it is not a problem, since your plugin controls the phantom content and can change it.
You can not add icons to the gutter and an event handler for when that icon is clicked, so You can, add a hover popup to the gutter for the lines you have a region in and within the popup provide a link that the user can click to fold a custom region.add_regions
isn’t going to help you here aside from visualization.
This is similar to phantoms, except phantoms are rendered inline and not on-hover.
The purpose of asking the original question was to assess whether I can create something like a ‘cheat sheet’ in a separate output view on a key stroke containing code snippets which I can hide or show based on the drop down.
Yes, that’s totally possible using phantoms. https://packagecontrol.io/packages/Debugger, for example, does something like that.