#973 custom keyword for code folding

scintilla (96)

I would like to propose adding a custom keyword that can trigger the code folding option in a scintilla-based editor, e.g. (fold) ... (end)

[-] some_code % some_comment_ending_with (fold)
 |  more_code
 L  some_code % some_comment_ending_with (end)

Here are some use cases:

• copyright/license statements, e.g.

[-] # Copyright © 2013 John Doe <johndoe@mail.net> (fold)
 |  # SoftwareXYZ is free software: you can redistribute it and/or modify
 |  # ...
 L  # (end)

• configuration/import statements, e.g. in latex

[-] % preamble (fold)
 |  \usepackage[utf8]{inputenc}
 |  ...
 L  % preamble (end)

• (custom) latex enviornments, e.g.

[-]\section{section name} % (fold)
 | \label{sec:section_name}
 | ...
 L % section section_name (end)

• any multiline comment, e.g.

[-] /* (fold)
 |   * some comment
 |   * ...
 L   */ // (end)

^ A single-line comment is necessary for this to work in general.

This feature can be useful in many languages/markups, so a general adoption is preferable. Specifically, LaTeX provides many use cases and would benefit greatly.

Note: The (fold) ... (end) structure is already used in the LaTeX bundle of the TextMate editor. So unless there is a specific reason for a better keyword I would vote to keep it for reasons of consistency. Obviously, the keyword pair should be unambiguous, so it is not in conflict with any other languages.

Thank you for considering.


  • Neil Hodgson

    Neil Hodgson - 2013-01-17
    • labels: --> scintilla
    • assigned_to: Neil Hodgson
    • milestone: Completed --> Won't_Implement
    • priority: 5 --> 2
  • Neil Hodgson

    Neil Hodgson - 2013-01-17

    Some languages already support folding comment blocks such as C++. Custom folding keywords are also implemented in ways that match the language design. For example, #region .. #endregion for C# and //{ and //} for C++.

    Imposing a particular global keyword pair would cause false matches which is already a problem with some folding keywords. It would also require modifying every single folder.

  • Neil Hodgson

    Neil Hodgson - 2013-10-15
    • status: open --> closed

Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.

No, thanks