-
Notifications
You must be signed in to change notification settings - Fork 29.3k
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] Spontaneous "Unfold All" #137890
Comments
I have a possible explanation of what is happening here. When this happens do you know whether the "chevron" icons for folding also momentarily disappeared? It might be impossible to say if you don't have the "Editor: Show Folding Controls" option set to "Always". It seems that when the folding "range provider" for the language returns a set of ranges which don't include a currently collapsed range then vscode uncollapses that range. With the default typescript provider you can see this behaviour by opening some typescript code, folding a section of the code which doesn't include any /* or */, and then typing "/*" on a new line above the folded section. The folded section will unfold without you doing anything else. So if a folding range provider temporarily omits some or all previously defined ranges from what it returns, folded ranges can pop back into view. In the worst case if the provider through some error occasionally returns an empty set of ranges then all current folds will be expanded. I don't think this is desirable behaviour. Folding providers might be temporarily faked out by opening comments or quotation marks or deletions of comment ends or closing quotation marks. And they might have bugs which occasionally result in bad returned data. My preference would be that the current state of folds, i.e. the set of collapsed regions, be entirely divorced from what the folding range provider returns. Maintained separately and only uncollapsed by the user. This would create some potential conflicts when a calculated range overlaps a collapsed range but some rules of thumb could be invented to address those. On the plus side, removing a relationship between collapsed and foldable would enable adding a feature to allow users to select an arbitrary group of lines and fold them. |
The example you mention (having The current approach is to always autocomplete @SolidStateLEDLighting If you could pin this down to reproducible steps that would be great. |
I followed the suggestion from the first response -- I changed the setting to keep the chevrons in view in the left column. I had a global unfold all happen once -- but I did not notice the chevrons disappearing before the expansion.
The second thing that I noticed is that this file has been taken from other code -- and it was full of /* */ comments -- and I prefer all // comments.
So, I did find a few orphaned */ at the end of some of the comments that I had changed over. I removed them.
I have had only one incident of "unfold all" happen since that point (when I copied and paste a variable into that file).
I'm trying to find reproducible occurrences of this problem -- but so far -- I don't see them. I suspect most of the anomaly has gone away, a few more days working in that file will be more conclusive.
Keith
…________________________________
From: Martin Aeschlimann ***@***.***>
Sent: Monday, November 29, 2021 4:17 PM
To: microsoft/vscode ***@***.***>
Cc: keith ssledlighting.com ***@***.***>; Mention ***@***.***>
Subject: Re: [microsoft/vscode] Spontaneous "Unfold All" (Issue #137890)
The example you mention (having /** but not */for a short time) is in-deed a problematic case.
Keeping the folded ranges is tricky. I'm worried it can lead to very strange folding ranges sticking around.
The current approach is to always autocomplete /** with a */, so that you don't end up commenting out a full document.
@SolidStateLEDLighting<https://github.com/SolidStateLEDLighting> If you could pin this down to reproducible steps that would be great.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#137890 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AGGOKE7JXFJK5BIK2VDYI73UOMZLFANCNFSM5IY2S57A>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
It could also have been caused by a slow extension startup. |
I only have 3 plug-ins running... and my expansion problems happens at different times over many hours of working in the project.
…________________________________
From: Martin Aeschlimann ***@***.***>
Sent: Monday, November 29, 2021 4:53 PM
To: microsoft/vscode ***@***.***>
Cc: keith ssledlighting.com ***@***.***>; Mention ***@***.***>
Subject: Re: [microsoft/vscode] Spontaneous "Unfold All" (Issue #137890)
It could also have been caused by a slow extension startup.
When VS Code starts up, it restores all previous folding ranges and waits around 10 seconds for the extension that provided these ranges to report ranges again.
If that takes too long, we give up and unfold the ranges. The problem is that we don't know if the extension will ever come alive (maybe it was disabled/uninstalled).
The fix for that would be on the extension side, to prioritize folding range requests without waiting e.g for validation to complete.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#137890 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AGGOKE35BEEL7APQRLLDCGTUOM5P7ANCNFSM5IY2S57A>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
After another week of testing -- I still have this problem. The spontaneous unfold all happens when I click into the file and make it active. Typically, this happens after I return back from working in another file.
The chevrons in the left column do NOT disappear before the action occurs.
…________________________________
From: keith ssledlighting.com ***@***.***>
Sent: Monday, November 29, 2021 5:04 PM
To: microsoft/vscode ***@***.***>
Subject: Re: [microsoft/vscode] Spontaneous "Unfold All" (Issue #137890)
I only have 3 plug-ins running... and my expansion problems happens at different times over many hours of working in the project.
________________________________
From: Martin Aeschlimann ***@***.***>
Sent: Monday, November 29, 2021 4:53 PM
To: microsoft/vscode ***@***.***>
Cc: keith ssledlighting.com ***@***.***>; Mention ***@***.***>
Subject: Re: [microsoft/vscode] Spontaneous "Unfold All" (Issue #137890)
It could also have been caused by a slow extension startup.
When VS Code starts up, it restores all previous folding ranges and waits around 10 seconds for the extension that provided these ranges to report ranges again.
If that takes too long, we give up and unfold the ranges. The problem is that we don't know if the extension will ever come alive (maybe it was disabled/uninstalled).
The fix for that would be on the extension side, to prioritize folding range requests without waiting e.g for validation to complete.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#137890 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AGGOKE35BEEL7APQRLLDCGTUOM5P7ANCNFSM5IY2S57A>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
I've been having almost this exact issue as well relatively frequently, along with being unable to find a way to reproduce it on demand. C++ also, although I have a few more extensions. |
I continue to have this problem.
I mostly see it when I copy from another file first -- or when I change a variable manually in another file -- when click back over to my working area - then I get a full spontaneous expansion.
…________________________________
From: Metalit ***@***.***>
Sent: Thursday, December 16, 2021 11:15 AM
To: microsoft/vscode ***@***.***>
Cc: keith ssledlighting.com ***@***.***>; Mention ***@***.***>
Subject: Re: [microsoft/vscode] Spontaneous "Unfold All" (Issue #137890)
I've been having almost this exact issue as well relatively frequently, along with being unable to find a way to reproduce it on demand. C++ also, although I have a few more extensions.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#137890 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AGGOKE7YPQTYVELJ6QNCTLTURFKULANCNFSM5IY2S57A>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
I just experience the problem again --- I copied from another file -- selected the tab of my working file -- hovered over the text without any action and 1 or 2 seconds later, the file unfolded all.
I am forced now to stop everything -- fold all -- and then unfold the areas that I'm working in again.
K.
…________________________________
From: keith ssledlighting.com ***@***.***>
Sent: Thursday, December 16, 2021 1:11 PM
To: microsoft/vscode ***@***.***>
Subject: Re: [microsoft/vscode] Spontaneous "Unfold All" (Issue #137890)
I continue to have this problem.
I mostly see it when I copy from another file first -- or when I change a variable manually in another file -- when click back over to my working area - then I get a full spontaneous expansion.
________________________________
From: Metalit ***@***.***>
Sent: Thursday, December 16, 2021 11:15 AM
To: microsoft/vscode ***@***.***>
Cc: keith ssledlighting.com ***@***.***>; Mention ***@***.***>
Subject: Re: [microsoft/vscode] Spontaneous "Unfold All" (Issue #137890)
I've been having almost this exact issue as well relatively frequently, along with being unable to find a way to reproduce it on demand. C++ also, although I have a few more extensions.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#137890 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AGGOKE7YPQTYVELJ6QNCTLTURFKULANCNFSM5IY2S57A>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
I have a pattern.... If I copy a variable from an .hpp header file -- and just before I paste it into the corresponding .cpp file -- that file will unfold all.
It doesn't happen every time, but this is the circumstance where I see the automatic expansion occur.
Incidentally, this is involves pasting into a switch statement. (I do a lot state transition work with switch/case statements)
…________________________________
From: keith ssledlighting.com ***@***.***>
Sent: Friday, December 17, 2021 1:12 AM
To: microsoft/vscode ***@***.***>
Subject: Re: [microsoft/vscode] Spontaneous "Unfold All" (Issue #137890)
I just experience the problem again --- I copied from another file -- selected the tab of my working file -- hovered over the text without any action and 1 or 2 seconds later, the file unfolded all.
I am forced now to stop everything -- fold all -- and then unfold the areas that I'm working in again.
K.
________________________________
From: keith ssledlighting.com ***@***.***>
Sent: Thursday, December 16, 2021 1:11 PM
To: microsoft/vscode ***@***.***>
Subject: Re: [microsoft/vscode] Spontaneous "Unfold All" (Issue #137890)
I continue to have this problem.
I mostly see it when I copy from another file first -- or when I change a variable manually in another file -- when click back over to my working area - then I get a full spontaneous expansion.
________________________________
From: Metalit ***@***.***>
Sent: Thursday, December 16, 2021 11:15 AM
To: microsoft/vscode ***@***.***>
Cc: keith ssledlighting.com ***@***.***>; Mention ***@***.***>
Subject: Re: [microsoft/vscode] Spontaneous "Unfold All" (Issue #137890)
I've been having almost this exact issue as well relatively frequently, along with being unable to find a way to reproduce it on demand. C++ also, although I have a few more extensions.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<#137890 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AGGOKE7YPQTYVELJ6QNCTLTURFKULANCNFSM5IY2S57A>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
|
That the problem happens after switching back to the code from another file is significant. That's a time when collapsed state information is reloaded from a save area and then resynchronized with the folding range provider. (C++ specific extension in this case.) It seems to me that the key to the problem is that vscode discards collapsed regions when they aren't present in a set returned by the range provider. That could be triggered by a bug in either vscode or the range provider. Perhaps a subtle timing bug. Regardless of the exact cause I think the solution should be to hold onto already collapsed regions regardless of what the range provider returns. I understand the concern about that being tricky. But not doing it seems wrong. Not just for this case and not just to allow for errors in range providers. Even when there are no bugs the current approach causes all collapsed regions below a line where we temporarily delete an end-of-comment to unfold. I'm not on the vscode team. But I'm digging into the code to see if I can propose a fix which Microsoft might accept. I'm thinking that it will include adding a small checksum to folding memento's to ensure that what gets collapsed on restarts is what the user intended. |
So yes, I suspect it's the cpp folding provider not being consistent, or too slow. Adding traces could be a first good step to understand that. |
Another case.
I had just returned from editing the hpp to the cpp of the same class --- and had my mouser point over the terminal window to "control click" and vector to an error in the cpp. When I touched the ctrl button, it triggered an unfold all. I had not even clicked into the cpp file yet.
…________________________________
From: Martin Aeschlimann ***@***.***>
Sent: Friday, December 17, 2021 6:09 PM
To: microsoft/vscode ***@***.***>
Cc: keith ssledlighting.com ***@***.***>; Mention ***@***.***>
Subject: Re: [microsoft/vscode] Spontaneous "Unfold All" (Issue #137890)
So yes, I suspect it's the cpp folding provider not being consistent, or too slow. Adding traces could be a first good step to understand that.
@PieterBranderhorst<https://github.com/PieterBranderhorst> Your help is very welcome and if you want to give it a try with keeping the folded ranges longer, I'd love to see such a solution
—
Reply to this email directly, view it on GitHub<#137890 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AGGOKE7Y4WQ2JPSY5QK6JXTURMD57ANCNFSM5IY2S57A>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Another case...
I just copied and pasted a section of code in a single .cpp file. The unfold all triggered when I did a right moused click and selected "format document". The document formatted and then expanded all.
Incidentally, I copied and pasted inside a case and switch statement which I expanded manually before that operation.
This is a massive headache. I now have to fold all and re-expand my working area again... .and again... and again.
…________________________________
From: keith ssledlighting.com ***@***.***>
Sent: Saturday, December 18, 2021 11:16 PM
To: microsoft/vscode ***@***.***>
Subject: Re: [microsoft/vscode] Spontaneous "Unfold All" (Issue #137890)
Another case.
I had just returned from editing the hpp to the cpp of the same class --- and had my mouser point over the terminal window to "control click" and vector to an error in the cpp. When I touched the ctrl button, it triggered an unfold all. I had not even clicked into the cpp file yet.
________________________________
From: Martin Aeschlimann ***@***.***>
Sent: Friday, December 17, 2021 6:09 PM
To: microsoft/vscode ***@***.***>
Cc: keith ssledlighting.com ***@***.***>; Mention ***@***.***>
Subject: Re: [microsoft/vscode] Spontaneous "Unfold All" (Issue #137890)
So yes, I suspect it's the cpp folding provider not being consistent, or too slow. Adding traces could be a first good step to understand that.
@PieterBranderhorst<https://github.com/PieterBranderhorst> Your help is very welcome and if you want to give it a try with keeping the folded ranges longer, I'd love to see such a solution
—
Reply to this email directly, view it on GitHub<#137890 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AGGOKE7Y4WQ2JPSY5QK6JXTURMD57ANCNFSM5IY2S57A>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
@aeschli I'm working on it. Of course this won't fix the underlying issue which is probably in the C++ range provider but it will make vscode's folding tolerant of such issues in range providers. I'm adding a command (ctrl K + ctrl .) to fold a selected range of lines at the same time rather than later because it will make testing this change easier. |
New info -- When I pasted code into the center of a switch statement -- I realized now that I was missing a bracket. So, I can understand if the code expanded on that switch statement and beyond in protest of the error. The parser should probably expand out all the code it thinks in involved with an error -- but that should have not include any code before that error.
…________________________________
From: PieterBranderhorst ***@***.***>
Sent: Wednesday, December 22, 2021 12:17 PM
To: microsoft/vscode ***@***.***>
Cc: keith ssledlighting.com ***@***.***>; Mention ***@***.***>
Subject: Re: [microsoft/vscode] Spontaneous "Unfold All" (Issue #137890)
@aeschli<https://github.com/aeschli> I'm working on it. Of course this won't fix the underlying issue which is probably in the C++ range provider but it will make vscode's folding tolerant of such issues in range providers. I'm adding a command (ctrl K + ctrl .) to fold a selected range of lines at the same time rather than later because it will make testing this change easier.
—
Reply to this email directly, view it on GitHub<#137890 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AGGOKEZLD3A5ROPKICJIS33USFGPDANCNFSM5IY2S57A>.
Triage notifications on the go with GitHub Mobile for iOS<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675> or Android<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Issue Type: Bug
I had this problem before - you guys told me that it was probably a faulty plug-in. I removed all the plugs-ins I could. The problem seemed to go away -- and now it returned -- (VS Code just updated a few days ago).
I'll be working in a large file that is mostly folded and with normal acitvity -- the code suddenly does an "Unfold All" and just opens up the entire file. This is infuritating because I have to do a "Fold All" and then open up the section that I'm working on all over again. It is a miserable bug that I don't know how to reproduce.
I only have 3 plug-ins still running:
There has to be a way to log a trail of activity on this to lock down the reason for this UI bug?
VS Code version: Code 1.62.3 (ccbaa2d, 2021-11-17T08:11:14.551Z)
OS version: Windows_NT x64 10.0.19042
Restricted Mode: No
System Info
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
skia_renderer: enabled_on
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Extensions (3)
The text was updated successfully, but these errors were encountered: