Skip to content

[folding] Support flags on folding.markers RegExps #72989

Closed

Description

A language-configuration.json file can supply a pair of regular expressions start and end (doc). At the moment there's no way to specify regexp flags, for example to make the matches case-insensitive.

Previous enhancements tackled a similar issue for wordPattern and indentationRules by allowing their regexps to be objects with pattern and flags properties.

Please enhance languageConfigurationExtensionPoint.ts (code pointer) to support pattern and flags on start and end. See also #27591 (comment)

It'd also be good to augment the doc , which currently doesn't mention the pattern+flags syntax.

Activity

  1. added
    editor-folding
    feature-request
    on Apr 29, 2019
  2. changed the title [-]Support flags on folding.markers RegExps[/-] [+][folding] Support flags on folding.markers RegExps[/+] on Apr 29, 2019
  3. kirides commented on May 28, 2019

    @kirides

    Yes please.
    I'm in the process of writing an extension to manage some legacy language that features words that would make a "marker" for folding. These words can be any cAsE.

  4. mithom commented on Sep 29, 2025

    @mithom

    in other places it worked to do (?i:CaSeInSensITIVE)

    but i painfully already discovered these start and end regexes are less powerfull than otherplace. you also cannot use capture group reference between them to make sure sections are matched.
    You cannot provide a list of pairs. you do not have context of next/previous line, making you even unable to recreate the built-in indentation folder.

  5. jibbius commented on Apr 24, 2026

    @jibbius

    This feature appears to have been silently delivered already.
    See commit: 9794671

    This syntax works for me:

    {
          "folding": {
              "markers": {
                  "start": { "pattern": "^\\s*#?\\s*\\bIF\\b.*$", "flags": "i" },
                  "end":   { "pattern": "^\\s*#?\\s*\\bENDIF\\b.*$", "flags": "i" }
              }
          }
      }
    

    Remaining:

    • Update docs
    • Update schema (currently throws an (invalid) warning. Incorrect type. Expected: "string"
  6. locked and limited conversation to collaborators on Jul 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

editor-foldingfeature-requestverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions