Repository navigation
Description
Issue Description
Since the last update of the PowerShell Preview extension there is an issue with unfolding certain code blocks. When refactoring some code you will see that pressing CTRL + 0 will collapse all regions but sometimes it's no longer possible to expand the regions by clicking on the arrow in front of the collapsed code. When doing this nothing is unfolding and after 10 to 15 seconds it does unfold sometimes, but not always.
It's pretty hard to replicate this as it happens randomly but quite often. Usually I run a Pester test script to test a script and then when I come back the folding becomes an issue.
System Details
VSCode version:
1.43.0-insider d1c48c103cabc6e729f59787c0b9c86fb3d39e73 x64
VSCode extensions:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
PSES version: 2.0.0.0
PowerShell version:
Name Value
PSVersion 5.1.14393.3471
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.14393.3471
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Activity
rjmholt commentedon Mar 3, 2020
DarkLite1 (@DarkLite1) is there anything in the logs suggesting an error?
TylerLeonhardt commentedon Mar 3, 2020
Also a sample script that you've seen this with would be very helpful.
DarkLite1 commentedon Mar 4, 2020
I knew this question was coming ;) It's just very hard to consistently reproduce, but it happens quite often as in every 2 times after refactoring code.
I've add some test code in attachment. When both files are open and you are in the file ``Set permissions.Tests.ps1
and pressF5` to execute it, everything goes fine. Than you refactor something in the production file or the test file, press `CTRL + 0` or try to unfold a specific section and it will fail 1 out of 3 times. What's also not working is formatting code after refactoring, copy/pasting a pester `it` clause for example. When you do that and press `ALT + CTRL + F` nothing is happening for a while.I hope you guys (or girls) see something I can't see. Thanks anyhow for looking into this and sorry for not being able to be more precise.
Test.zip
DarkLite1 commentedon Mar 5, 2020
Figured out how to reproduce this:
Testie.ps1in attachmentCTRL + KandCTRL + 0AUTHOR [email protected]Process{to unfold itNotice that unfolding that section is impossible
Testie.zip
ili101 commentedon Mar 5, 2020
I can confirm this is something that started in the last release ([email protected]).
But it's not an unfolding problem, it's everything the extension do hang for a long time.
To reproduce do the steps DarkLite1 (@DarkLite1) provided in his last post.
Add to step 4 more things like F8 on some line and hover over a variable to get the intelligence tooltip.
The unfold will not work, the F8 will not execute and the tooltip will say "Loading..."
Then wait for ~1 minute, it will suddenly unfold, Run the F8 and show the tooltip info.
BTW is 2020.3.0 already on the way? Or can this be fix before that?
rjmholt commentedon Mar 5, 2020
Does it work if you go into the console and press Ctrl+C?
ili101 commentedon Mar 5, 2020
Ctrl+C doesn't seems to effect this.
rjmholt commentedon Mar 5, 2020
DarkLite1 (@DarkLite1) could you post your example as text?
rjmholt commentedon Mar 5, 2020
Can you expand on this? How did you observe this? Does it seem to be interacting with folding?
33 remaining items
SydneyhSmith commentedon Apr 16, 2020
ili101 thanks for your response could you please open a new issue with an ask for better performance for finding references of functions..thanks!
DarkLite1 commentedon Apr 17, 2020
Sydney Smith (@SydneyhSmith) why is a new ticket needed when the core problem is still there?
TylerLeonhardt commentedon Apr 17, 2020
That's fair DarkLite1 (@DarkLite1).
ili101 DarkLite1 (@DarkLite1) could you try disabling CodeLens to see if that helps at all:
"editor.codeLens": true
ili101 commentedon Apr 18, 2020
Hi TylerLeonhardt
With
"editor.codeLens": falsethere is no issue so it's something in there (At last I know I can tern it off when opening this big folder now)Edit: With the 10,000 folders it locks for a minute on every edit.
I then change the test to create 10,000 ps1 files with "
Test-TheBug" instead of the folders, with the files it locks for a minute once at load, detects all 10,000 references and then works without any problems.So with files it locks once to scans the references then manage to update the references on the fly without impacting performance, but with the folders it locks on every change continually
TylerLeonhardt commentedon Apr 18, 2020
This is because CodeLens triggers on every edit - vscode controls this.
And it recursively looking at the filesystem to generate references - we control this.
Some concerns:
There's room for improvement here for sure. We could use a combination of file system watchers and caches to possibly increase perf here.
I wonder if this is why TypeScript doesn't have CodeLens on by default 🤔too many
node_modulesfolders... and a very computational operation...DarkLite1 commentedon Apr 18, 2020
I encountered another issue that might be related to this. When I rename a folder in vs code and there are lots of node.js projects in those folders the renaming cannot happen. The system just keeps on waiting and errors out.
Back to this topic, it might be related as I am using the
PowerShell Previewextension. I think a file watcher would be a really great idea. It's then only fired when a single file is CRUD. That might fix the issue.TylerLeonhardt commentedon Apr 18, 2020
But keep in mind, that'll be tricky to implement because we can't keep too much in memory otherwise... #1613
TylerLeonhardt commentedon Apr 18, 2020
so I don't think we're cancelling CodeLens requests at the moment (VS Code tells us to cancel them, but we need to implement what cancelling means)... Can you attach the logs here (and the payload logs!).
I want to see how many times VS Code says to cancel CodeLens requests. If there are a lot, then we can implement cancelation (by doing something with the cancellation token here) that will help with performance.