mcneel / ghpython

A Grasshopper component for Rhino.Python
http://www.food4rhino.com/project/ghpython
117 stars 34 forks source link

folding code blocks in code editor #36

Open bengolder opened 12 years ago

bengolder commented 12 years ago

In the C# and VB.NET scripting components, it is possible to include functions below the main script, in the editor, and to collapse these code blocks.

It would be really nice to have the ability to collapse blocks of code, so that one could include a large amount of additional functions or classes in a script without compromising readability. This offers an alternative to importing packages.

piac commented 12 years ago

Newer versions of Rhino 5 have an improved code folding strategy. Just making a function should make the inner scope properly foldable. Does it help?

bengolder commented 12 years ago

Thanks Giulio, this does help. My only other concern is that fold persistence: if I give someone a ghpython component with folded functions and they open it, will those functions remain folded? I'll test and let you know.

piac commented 12 years ago

Hello Ben

it will not remain folded. Folding is usually just an editor help (.py files are simple text). And it does not stick in the _EditPythonScript editor, so it won't stick in the GhPython editor either, sorry. What should the next reader understand from the folding strategy?