On 12-03-01 02:36 PM, Andy Bain wrote:
Hello, I'm new to the list but I'm more than willing to contribute.
I'm working with the new Raspberry Pi and I'm trying to make Geany more kid friendly (6 year old+).
Where does Geany get its code folding delimiters from? I'm trying to configure Geany so that it initially folds most of the code and not just functions or other pre-defined areas. In my scenario, I want almost all the code folded on start-up with a blank area where the students can write stuff (i.e. hide all the scary import and main loop stuff).
I'm targeting Python. I've looked at the filetypes and considered downloading and looking at the source, but I just get a feeling this is easily do-able for someone with more knowledge than me.
Hi,
I believe that the "fold points" come from the Scintilla lexers (in the scintilla/lexers/ directory, which is part of a separate project but happens to have its source embedded in Geany's source tree).
There's a feature available for C-style languages called "explicit fold points" where you can put a special comment in the file and it will allow folding of the area between the special comments (similar to #region/#endregion in C#/VS if you've ever used that).
If you were up for some hacking, you could look into making some similar feature for the LexPython.cxx lexer, which would allow you do what you want, albeit in a manual way (go to each computer and hide the scary stuff before the lesson).
Other than that maybe someone else has more insight.
P.S. In the Python lexer, you could use triple-quoted strings around the scary code to allow it to be folded, but of course it would be interpreted as such by Python when run.
Cheers, Matthew Brush