Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Folding resets after restarting VS Code #111

Open
Kycko opened this issue Jan 19, 2024 · 5 comments
Open

Folding resets after restarting VS Code #111

Kycko opened this issue Jan 19, 2024 · 5 comments

Comments

@Kycko
Copy link

Kycko commented Jan 19, 2024

Describe the issue

VS Code resets all the folding when I close it and open again. I've found the problem in your extention, see microsoft/vscode#189610.

To reproduce

Fold some functions in .gs file (Google Apps Script, language mode JavaScript), close and then open again VS Code. You will see all the functions unfolded.

  • VSCode: 1.85.2
  • Explicit Folding: 0.23.1
  • Language: Google Apps Script (basically JavaScript)
  • Language Provider: built-in?

Code Example

function SH_get_full_range(sheet) {
    return sheet.getRange(1, 1, sheet.getMaxRows(), sheet.getMaxColumns());
}

Settings

"explicitFolding.rules": {
        "javascript": [
            {
                "begin": "{",
                "end"  : "}"
            },
            {
                "begin": "`",
                "end"  : "`"
            },
            {"foldLastLine": true}
        ],
        "snippets": [
            {
                "begin": "{",
                "end"  : "}"
            },
            {
                "begin": "`",
                "end"  : "`"
            },
            {"foldLastLine": true}
        ]
    }

Expected behavior

Save the folding state after VS Code restarts.

Screenshots

image
image

@daiyam
Copy link
Member

daiyam commented Jan 19, 2024

Do you have the following settings?

"editor.foldingStrategy": "auto",
"editor.defaultFoldingRangeProvider": "zokugun.explicit-folding",

@Kycko
Copy link
Author

Kycko commented Jan 19, 2024

foldingStrategy is set to auto by default.
I've changed defaultFoldingRangeProvider to zokugun.explicit-folding, but the issue isn't solved.

@Kycko
Copy link
Author

Kycko commented Jan 21, 2024

I've noticed the folding resets only in the files I see when opening VS Code. If the file is opened but it's in other tab, the folding is saved. 🤔

image

@daiyam
Copy link
Member

daiyam commented Jan 21, 2024

The folding state is managed by VSCode so I would incline to say it's a VSCode bug.

I have also the issue when, sometimes, I have extra foldings. It took me a while to understand it was foldings generated by the default folding provider (before switching to my provider), then saved as "Manual Folding Ranges" by VSCode. Solution: command Remove Manual Folding Ranges

@Kycko
Copy link
Author

Kycko commented Jan 21, 2024

Ran this command, didn't help me.

As I mentioned in microsoft/vscode#189610 the folding state doesn't reset if I disable your extention. Seems there is some conflict in saved folding state and your extention when it's loaded after app start.

Maybe the logs will help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants