Skip to content

[folding] Manual folding range not useful after copy-paste #201431

Open

Description

@irvnriir

Does this issue occur when all extensions are disabled?: Yes

I saw it with indentation-based folding . This issue has been in VSC since 1st release, it does happen relatively often and is annoying .

Steps to Reproduce:

  1. Create text editor tab and add this:
    1
        2
        3
    	    4
    	    5
        6
        7
    8
    
    
    1
        2
    	    4
        6
    8
    
  2. Run editor.foldAll .
  3. Copy the 1st tree, then select the 2nd tree and run Paste .
  4. Try folding on the pasted tree .

The example case may be showing only a part of it, i wouldn't be surprised if there are multiple such issues, including ones which don't involve copying .

This doesn't get fixed with Refresh, but may get fixed if you cut and paste the part which made the issue show up .

Probably the same: #171413 and there is probably more .

Activity

  1. RedCMD commented on Dec 23, 2023

    @RedCMD
    Contributor

    I've had this issue with many json files before
    and I think another language as well?

  2. irvnriir commented on Jan 3, 2024

    @irvnriir
    Author

    also, ffs, add ability to disable folding of trailing whitespace in indentation-based folding .

  3. aeschli commented on Jan 8, 2024

    @aeschli
    Contributor

    After folding it looks like this:
    image

    Correct?

    The code reapplies the folded ranges, 2-3 becomes a manually folded range.
    That feature was added to avoid loosing folded ranges. I agree that in this example it is not useful.
    There's a command Remove Manual Folding Ranges to remove that range again.

  4. changed the title [-]Folding regions are determined wrong after copy-paste[/-] [+][folding] Manual folding range not useful after copy-paste[/+] on Jan 8, 2024
  5. added
    editor-folding
    bug
    on Jan 8, 2024
  6. irvnriir commented on Jan 8, 2024

    @irvnriir
    Author

    the "not useful", Backlog..

  7. pbaksa commented on Feb 16, 2026

    @pbaksa

    The incorrect folding range is remembered even after computer restart, only cut&paste fixes it.

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

Metadata

Metadata

Labels

bugeditor-folding

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions