#947 Medium folding

Won't_Implement
open
Neil Hodgson
Scintilla (356)
5
2012-07-20
2012-07-20
human-man
No

I'm coding in Python with Eric, which uses Scintilla (eric-ide.python-projects.org).

I have a python module with classes at the top level, and defs inside of them. Currently I can only fold the classes OR classes, defs, if statements and so on.

I want to be able to fold only classes and defs OR only defs in the class the cursor is in OR both (depending on what's best to implement and doesn't confuse the user).

Discussion

  • Neil Hodgson
    Neil Hodgson
    2012-07-20

    This is application-level functionality as it requires a higher level understanding of the language structure than the lexical level understood by Scintilla.

    To do this, some application code will need to identify each relevant fold header type and then show or hide them as commanded.

     
  • Neil Hodgson
    Neil Hodgson
    2012-07-20

    • assigned_to: nobody --> nyamatongwe
    • milestone: --> Won't_Implement
     
  • human-man
    human-man
    2012-07-22

    Maybe you misunderstood. In Eric at the moment it is only possible to fold the top-level or fold as deep as possible. I suggested as an option to fold 2 levels, i.e. the top-level and the level under it (that refers to my case, maybe there could be an option for the number of levels to fold).

    The author of Eric said it's not what Eric is doing but rather "lexers/LexPython.cxx" from the Scintilla source files. Read his comment there: http://die-offenbachs.homelinux.org:48888/issues/issue71 .

     
  • No, Neil is (of course, he's the guy) right: the Python lexer defines the fold *POINTS* (e.g. where the code can be folded), not what should be folded which way. What the application should do is decide which fold points to expand or collapse following whatever rules you want, instead of folding/unfolding everything.

    OK, to implement what you want the application will need to know what does a fold point apply to (class, def, statement, etc), but Scintilla doesn't have a way to "tag" fold points, and the application code should be able to determine the "type" of the fold point quite easily by checking the style(s) and/or text on the corresponding line.