Skip to content

Code Comments Folding Block Issue - Please Help! #259

Open

Description

@mattbriggsuk

Hi,

How is it possible to disable folding blocks within code comments?

        // Code Comments
        e.SetFoldingMarkers(@"/\*(.*)", @"\*/", RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnoreCase);

        // Example Code
        e.SetFoldingMarkers(@"foo",     @"bar", RegexOptions.Multiline | RegexOptions.Singleline | RegexOptions.IgnoreCase);

There should not be any folding markers against foo-bar within /* */ comments, .i.e:

/*
foo
bar
*/

I want to avoid using RegEx Lookbehind and Lookaheads, as this is likely to cause performance issues.

What would be the best approach?

  • Introduce an overload within the SetFoldingMarkers method to indicate no sub-folding blocks?
  • Do something within fctb_VisibleRangeChanged, fctb_VisibleRangeChangedDelayed, fctb_TextChangedDelayed etc.?
  • Do something with the fctb.FindEndOfFoldingBlockStrategy ?
  • Something else?

The bug exists within the PowerfulCSharpEditor example provided:

code_comment_bug

Any help or suggestions would be greatly appreciated, as I would like to give my end-users the best user experience possible,

Activity

  1. Hexman768 commented on May 14, 2025

    @Hexman768
    Collaborator

    @mattbriggsuk The FCTB control seems to have been designed explicitly to support code folding blocks for comments that take up multiple lines.

    There could possibly be a feature created to allow this behavior to be enabled/disabled. However, I do not have any plans to start on that work anytime soon.

  2. Hexman768 commented on Jun 6, 2025

    @Hexman768
    Collaborator

    @mattbriggsuk I do believe however, that it should be setting folder markers for the end of the comment also, not just the start. I will have to investigate how that behavior works in the control and post an update here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions