Menu

Visual separator-line between functions

2013-01-20
2013-02-03
  • Dave_Scream

    Dave_Scream - 2013-01-20

    Hi,
    Is there some way to place separator line between functions like when folding?

    for example when I fold some text, separator line appear:

    It would be cool if UDL2.0 or somethink will allow to specify some "between functions separator style" where I can specify or just black line like in previous example, or just a little grayed line, so visually it will help much.

    for now I each time use macros ALT+B to insert long comment line //------- and in UDL specify comments style background a little grayed like this:

     

    Last edit: Dave_Scream 2013-01-20
  • cchris

    cchris - 2013-01-20

    I don't think UDL has to handle this. One thing you could do is defining a macro that would take the selected word and make a skeleton out of it, , complete ith bars and comments.

    CChris

     
  • Loreia2

    Loreia2 - 2013-01-23

    Hi,

    UDL can't insert text into buffer. UDL's job is to highlight the code.
    What you can do is to leave an empty line before function definition.

    ~~~~~~~~~~~~~~~~~~~~~~
    }

    function
    {
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~

    and untick Fold Compact.
    In this way, functions won't be folded to close to one another.

    BR,
    Loreia

     
  • François-R Boyer

    Dave,

    I added a "ModelineTopLevelSeparator" addon to my modeline parser plugin (https://sourceforge.net/projects/npppythonplugsq/files/Modeline%20Parser/), which adds a separator line in the first empty line before a top level fold header. The line is not thin but a full character height (either in alpha blending or background color); color is easy to change in the .py file. It should work with any language that has folding. Note that the separators are not updated as you type, but only on save or menu Plugins/Modeline Parser/Reparse modeline. Also, it does not know what a function is, separators will be shown for any fold at top level.

     
  • François-R Boyer

    Loreia,

    One thing that would be good to add in UDL (if it's not already there), and also in the style configurator, which could be good for separator comments, is the possibility to set the EOL filling of a style (SCI_STYLESETEOLFILLED) to true.

     
  • Loreia2

    Loreia2 - 2013-01-25

    Thanks for suggestion Francois.

    I just did a quick test of this feature and I like it a lot. Unfortunately, I removed feature of applying style to new line characters, so I can't just switch this on and forget about it. It will take some time to integrate this into UDL, but I will definitely do it.

    Thanks for the tip.

    BR,
    Loreia

     
  • Byzod

    Byzod - 2013-01-30

    Can we make the folding like what looks like in Visual Studio? Is it possible?
    Selecting function body is rather difficult in npp, sometimes you may make mistakes: when copy/cut a function, you probably only copy/cut the signature of your function, leaving a chunk of headless function body...

    In VS 2012

    In Npp

    If the folded body is at the same line of folding head it might be better, personally suggested.

     
  • Loreia2

    Loreia2 - 2013-01-30

    Hi Byzod,

    this is Scintilla feature, you may ask there.

    BR,
    Loreia

     
  • cchris

    cchris - 2013-02-03

    The feature already exists in Scintilla : http://www.scintilla.org/ScintillaDoc.html#SCI_SETFOLDFLAGS
    Notepad++ doesn't provide an interface for this, but you can always use NppExec (repeatedly :s ) to send the message to current Scintilla with the flags you like.

    CChris

     
  • François-R Boyer

    Unfortunately, SC_FOLDFLAG_LINEBEFORE_EXPANDED will draw a line above all expanded folds, not only top level folds. Also, the line is drawn above fold, not above function header.

     
MongoDB Logo MongoDB