Code folding

Code folding

236
MasterMaster
236

    Feb 08, 2005#1

    Hi,

    I can't get code folding (in UE 11.00) to work properly. When I open a PHP file, functions, loops, etc. are folded correctly, so "in principle" it should work. However, in HTML files I get tons of "[-]" next to nearly every tag there is, and clicking them almost never has any effect. E.g. a <table> tag in one line, then several lines of table definition, and a </table> tag a few lines later - clicking on [-] doesn't change anything.

    Clicking on the second <tr> tag within the table causes the entire rest of the file to collapse, right until the </html> tag.

    This happened with an HTML tidy proofread file, so it's not because of missing "ending" tags that could have thrown UE off course.

    Also (of course) Python code folding doesn't work. Python groups sections of code by indentation and de-indentation (exdentation?), and that doesn't seem to be configurable in UE...

    Time for an update? ;)
    Tim

    2
    NewbieNewbie
    2

      Feb 08, 2005#2

      Another question on folding. Does folding work for languages other than C/C++? I see that in parenthesis in the feature list, and I use UE almost exclusively for Java, so I wanted to be sure it was for any language (any C based language maybe?).

      15
      Basic UserBasic User
      15

        Feb 09, 2005#3

        If you read the help, UltraEdit has fold strings defined for many languages, what you need to do is add JAVA_LANG to your java definition line:

        /L1"Java" JAVA_LANG (other crusty stuff)

        and it should work.

        If it doesn't work for a specific language, then you can just do

        /Open Fold Strings = "{"
        /Close Fold Strings = "}"

        in your wordfile.
        I'm not the anti-christ, I just do his work.

        2
        NewbieNewbie
        2

          Feb 10, 2005#4

          So how do you get multiple fold strings to work?

          58
          Advanced UserAdvanced User
          58

            Feb 10, 2005#5

            By adding them to the wordfile ;-)

            Here's an example for using code folding on wordfiles:

            Code: Select all

            /Open Fold Strings = "/C1" "/C2" "/C3" "/C4" "/C5" "/C6" "/C7" "/C8"
            /Close Fold Strings = "/C2" "/C3" "/C4" "/C5" "/C6" "/C7" "/C8" "/L2" "/L3" "/L4" "/L5" "/L6" "/L7" "/L8" "/L9" "/L10" "/L11" "/L12" "/L13" "/L14" "/L15" "/L16" "/L17" "/L18" "/L19"
            /Ignore Fold Strings =  "// /"
            Manni

            2
            NewbieNewbie
            2

              Feb 10, 2005#6

              Thanks! Stupid me was using "str1","str2"

              236
              MasterMaster
              236

                Mar 22, 2005#7

                I just installed V11.00b and code folding in HTML still produces no sensible results in most cases. E.g. on a <html> tag, it folds six lines until a </b> tag (the </html> tag is way down below). No idea at all what's happening there.

                Is there a way to turn code folding off for certain languages?

                Greetings,
                Tim

                48
                Basic UserBasic User
                48

                  Mar 22, 2005#8

                  Hmm, i have exactly the same issue pietzcker described.

                  Folding in HTML doesn't work correctly. Actually, UE folding never worked OK for me. Maybe because the algorithm IDM used, or wordfile, or both but it's almost useless for now.

                  Anyway I'm sure IDM will make the best they can to have it fixed soon.

                  351
                  Basic UserBasic User
                  351

                    Apr 01, 2005#9

                    pietzcker wrote:Is there a way to turn code folding off for certain languages?
                    Though I haven't tried it, you might explore removing the /Open Fold String and /Close Fold String lines in your wordfile.txt for the offending language.

                    2
                    NewbieNewbie
                    2

                      Apr 04, 2005#10

                      What about defining custom folds?

                      I don't want curly braces to be the fold points for my php. Instead I want #Region and #End Region to be my fold points, but entering these into the Open and Close fold lines in the wordfile does nothing at all.

                        Apr 04, 2005#11

                        And this one is great...

                        Given a comment like

                        Code: Select all

                            /*
                            ############################################
                            ## PKD - PKD Inc.
                            ## Website Code - Functional Include for Ynfynyt Jest dot Com
                            ##
                            ## Paul Kahl
                            ## PHP code started on 4/4/2005 9:32AM
                            ## Last Edit: 4/4/2005 9:32AM
                            ############################################
                        
                            ## environment variable REQUEST_URI
                            */
                        The fold looks like

                        Code: Select all

                            /*
                        
                            ## Environment variable REQUEST_URI
                            */
                        And /* and */ aren't even defined in my folds... and FOLDS is the only place this ought to be defined.

                        12
                        Basic UserBasic User
                        12

                          Apr 05, 2005#12

                          Ynfynyty wrote:What about defining custom folds?

                          I don't want curly braces to be the fold points for my php. Instead I want #Region and #End Region to be my fold points, but entering these into the Open and Close fold lines in the wordfile does nothing at all.
                          Maybe you have defined "#" as a comment? Post the part of your word file for that language and maybe someone can help. It seems that many of the configurable options may affect other options. Also possible is that you added the fold strings to the wrong language. PHP files are multi-language files. You must add the #Region and #End Region fold strings to PHP language and not to HTML language. And block comments can be always folded.

                          As for changing what to fold on, you can do that. I defined keywords that I wanted to fold on for AutoSys JIL. Below is part fo the wordfile:

                          Code: Select all

                          /L19"AutoSys JIL" Line Comment = # Block Comment On = /* Block Comment Off = */ Escape Char = \ File Extensions = JIL
                          /Delimiters = ~!@$%^*()+=/\[]{}:;"<>´` ,	.?
                          /Indent Strings = "{("
                          /Unindent Strings = "})"
                          /Open Fold Strings = "insert_job:"
                          /Close Fold Strings = "profile:" "alarm_if_fail:"
                          ...
                          This enables me to fold lines that have those words. For example:

                          Code: Select all

                          /* ----------------- odm_ConvStores.0010.000 ----------------- */ 
                          
                          insert_job: odm_ConvStores.0010.000   job_type: b 
                          #owner: queue@testcm2
                          permission: gx,ge,wx,we,mx,me
                          description: "Create fulloads for stores that have not acked the merged file"
                          alarm_if_fail: 1
                          
                          
                          /* ----------------- odm_ConvStores.0010.005 ----------------- */ 
                          
                          insert_job: odm_ConvStores.0010.005   job_type: c 
                          box_name: odm_ConvStores.0010.000
                          command: sendevent -E SET_GLOBAL -G "ODM_CONVSTORES_TMS=`date +%Y%m%d%H%M%S`"
                          machine: testcm2
                          #owner: queue@testcm2
                          permission: gx,ge,wx,we,mx,me
                          description: "Creates fulloads for stores that have not acked the merge file"
                          alarm_if_fail: 1
                          Folds to this:

                          Code: Select all

                          /* ----------------- odm_ConvStores.0010.000 ----------------- */ 
                          
                          insert_job: odm_ConvStores.0010.000   job_type: b 
                          alarm_if_fail: 1
                          
                          
                          /* ----------------- odm_ConvStores.0010.005 ----------------- */ 
                          
                          insert_job: odm_ConvStores.0010.005   job_type: c 
                          alarm_if_fail: 1
                          - Chris
                          Living in Florida is like being on vacation all the time!

                          6,675585
                          Grand MasterGrand Master
                          6,675585

                            Jun 07, 2012#13

                            Starting with UltraEdit v18.10 and UEStudio v12.10 a new code folding mechanism is available in UltraEdit for any language - code folding based on indent level.

                            Code folding based on indent level is automatically used for Python files with file extension PY (in any case). Being more precise for any wordfile containing file extension PY the language marker PYTHON_LANG is set internally in UltraEdit even if this language marker is missing in the wordfile. Code folding based on indent level is enabled automatically for all files with a file extension listed in a wordfile containing either file extension PY or the language marker PYTHON_LANG.

                            For all other syntax highlighted files code folding based on indent level can be used instead of code folding based on open/close fold strings by adding to the wordfile on first line anywhere between /Lxx"language name" and File Extensions = ... the keyword EnableCFByIndent.

                            Please note that EnableCFByIndent disables code folding based on open/close fold strings and therefore open/close fold strings definitions in the same wordfile are ignored by UltraEdit / UEStudio.

                            2362
                            MasterMaster
                            2362

                              Jun 07, 2012#14

                              The Code Folding by Indent works fabulously. Even in plain text files (I made a word file for plain text that has the EnableCFByIndent keyword) it works, even when no indent strings are defined. It works on how the user indents the document.

                              This makes it so much easier to work on files. Especially since it is difficult or near impossible to define some of the indents in some languages, as you can't use regex to define them, and, although the indents aren't required, they make for better readability. Being able to now fold those sections is a dream for me.

                              Now, just got to wait on UEStudio 12.10 so that I can start taking advantage of it in my actual work. It was great playing with it in UE 18.10, but I need UEStudio for my day-to-day work, because I need to compile and debug, among a host of other reasons.

                              Ah, well. It shouldn't take long now since 18.10 addressed the issues that needed to be addressed.

                              1
                              NewbieNewbie
                              1

                                Feb 10, 2017#15

                                I just upgraded from v22 to v23. Now I can't get code folding to work for Python files.

                                UE recognizes my *.py files, the syntax highlighting is working. Function list is working. Under Config - Code Folding all options are checked on except "Enable in non syntax highlighted files" and "Detect XHTML...". I can show/hide selected text. Otherwise no "+" boxes appear.

                                I have about 15 files open, including 4 Python files. I just dragged one *.py tab to a 2nd UE window, and code folding works in the 2nd window, but still not in the first one.

                                I hope I'm missing something.

                                Read more posts (4 remaining)