Skip to content

Automatically fold inactive regions #8992

Closed

Description

@sapphyrus

Type: Feature Request

The extension currently supports dimming inactive regions (#if, #ifdef, ...). Folding these regions is also already supported correctly.
I would like to suggest a feature that combines both of these to automatically fold inactive regions, as a command and on opening a file.
This is a duplicate of #5020, which was (perhaps incorrectly) marked as a duplicate of #407, which is now closed.

Activity

  1. sean-mcmanus commented on Mar 8, 2022

    @sean-mcmanus
    Contributor

    I don't believe there are VS Code APIs to implement this yet, see microsoft/vscode#40338 . Colen Garoutte-Carson (@Colengms) might know more.

  2. github-actions commented on May 8, 2022

    @github-actions

    This feature request is being closed due to insufficient upvotes. Please leave a 👍-upvote or 👎-downvote reaction on the issue to help us prioritize it. When enough upvotes are received, this issue will be eligible for our backlog.

  3. added
    more votes neededIssues that have been postponed until more community members upvote it
    on May 8, 2022
  4. modified the milestones: Triage, Backlog on Oct 21, 2022
  5. github-actions commented on Oct 21, 2022

    @github-actions

    This feature request has received enough votes to be added to our backlog.

  6. removed
    more votes neededIssues that have been postponed until more community members upvote it
    on Oct 21, 2022
  7. mrx23dot commented on Nov 16, 2023

    @mrx23dot

    This would be so useful! Eclipse does it too.
    The hard part is already done, inactive branches are marked:

    image

    when opening a file we just need to go through branches and see which one is marked as inactive.

    The logic how to do the folding (on multiline comments) is done in this repo:
    https://github.com/ietxaniz/vscode-fold-ninja

  8. le1smo commented on Jul 19, 2024

    @le1smo

    vote for this Feature Request

  9. l1006986533 commented on Jun 23, 2025

    @l1006986533

    85c086b
    just an demo implementation, no switch yet (always triggers folding on first time opening). Feedback welcome :)

    Image

  10. mrx23dot commented on Oct 10, 2026

    @mrx23dot

    One issue I found was:
    when opening a file at exact location via CMD pallet,
    e.g. usb_app.c:162
    it jumps to that line, but it jumps away to fold inactive #ifs, and stays there.
    only happens if file was not in focus.
    Also it happens every time, even if it was folded already.

  11. locked and limited conversation to collaborators on Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Feature RequestLanguage ServicefixedCheck the Milestone for the release in which the fix is or will be available.

Type

No type

Projects

  • Status
    Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions