-
Notifications
You must be signed in to change notification settings - Fork 513
Unfolding not always possible #2518
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
Unfolding not always possible #2518
Comments
@DarkLite1 is there anything in the logs suggesting an error? |
Also a sample script that you've seen this with would be very helpful. |
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 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. |
Figured out how to reproduce this:
|
I can confirm this is something that started in the last release (preview@2020.2.0). To reproduce do the steps @DarkLite1 provided in his last post. BTW is 2020.3.0 already on the way? Or can this be fix before that? |
Does it work if you go into the console and press Ctrl+C? |
Ctrl+C doesn't seems to effect this. |
@DarkLite1 could you post your example as text? |
I can confirm this. My observation is that extension spends a lot of time to analyze PS Script Analyzer along with my customized settings for it. |
Can you expand on this? How did you observe this? Does it seem to be interacting with folding? |
@rjmholt It's simple:
|
It sounds a bit like the folding just isn't ready because the extension is still starting. If you edit a script, does folding then take a while again? |
I see 2020.3.0 stable is out (you probably should also update the preview extension to the same version as stable so everyone that on it will also be on 2020.3.0 and not stay behind) Tested on it and it looks like it still happening but the freezes is shorter. |
Releasing takes a little while and we all work on several things, so we'll probably do a preview release in the coming week or so. Not our preferred choice, but it will only happen once since there will be no more fork.
Ok so it sounds like a file performance issue where we're looking through too many files. Are these files PowerShell files?
With every change:
It's not really a simple question of cutting things out unfortunately, but we should be able to sift through and see where we're touching the file system. We currently don't control how PSSA operates either and it does some PowerShell stuff that looks at modules. We're investing in work to make PSSA easier to integrate though. But it's big work. |
Adding @glennsarti in case he has any thoughts considering he contributed the folding feature. |
My PR out will re-enable a feature Glenn added and allow anything set in the following settings to be automatically ignored when looking for symbols (used in folding and references): files.exclude |
Unfolding is not dependant on the Language Server. That's all client side. As comment above, it can be a perf issue on generating the folding regions.
IIRC yeah that code didn't make to 2.0 and I didn't have time to migrate it as there was no unit testing running at the point * glares at Tyler and Rob * However there should not be any reason for those two features to be related. Folding only happens for a specified file. There are no file traversals. What may be happening is a thread locking issue or a single-threaded problem where the folding range request is blocked by a long running traversal operation? |
Although I don't understand this: Seems odd to create a logger on the Folding Handler in an unrelated class. |
typos! |
Right. My guess is that since Folding and references both needs symbols to be calculated first, the Folding lag is due to that. |
Thank you for the reply. But just to be clear, there are no network shares open in my workspace. All files are on the local drive. Also, this issue is only appearing since the upgrading to the latest PowerShell preview extension. |
I have spent an hour trying to pinpoint the cause of the problem, it looks like the number of files in your VSCode open folder dose not effect the problem but the number of subfolders do. |
This is very good data @ili101. Thank you for taking the time to provide this |
@ili101 thanks for your help in figuring this out, Really appreciate it. In my workspace there are 3 open folders, the maximum depth of these folders is usually @(
'T:\Test\bob\PowerShell',
'T:\Prod',
'C:\Program Files\WindowsPowerShell\Modules'
).ForEach({
$Folder = Get-ChildItem -Recurse -Path $_ -Directory
$File = Get-ChildItem -Recurse -Path $_ -File
[PSCustomObject]@{Path = $_; Folders = $Folder.Count; Files = $File.Count}
}) | fl Returns: Path : T:\Test\bob\PowerShell
Folders : 8
Files : 36
Path : T:\Prod
Folders : 109
Files : 355
Path : C:\Program Files\WindowsPowerShell\Modules
Folders : 192
Files : 1298 |
I made something to help reproduce.
Locally on SSD it freezes for me from 5-30 seconds. Hope this helps |
Can you all give the PowerShell Preview extension a try? We just did a release of it. Don't forget to disable the regular PowerShell extension for VS Code when you enable the PowerShell Preview extension for VS Code |
@TylerLeonhardt Tested ili101 example, the issue still happens - for a short moment, folding and unfolding is not possible. |
After some testing here are my findings:
So in short, @ili101 is correct. It all depends on the quantity of sub folders you have. Keep in mind that when there are plenty of sub folders like for modules, or if you share |
Just tested on v2020.4.0 from yesterday. This version have nice performance optimizations but the core problem is still there. |
@ili101 thanks for your response could you please open a new issue with an ask for better performance for finding references of functions..thanks! |
@SydneyhSmith why is a new ticket needed when the core problem is still there? |
That's fair @DarkLite1. @ili101 @DarkLite1 could you try disabling CodeLens to see if that helps at all: "editor.codeLens": true |
Hi @TylerLeonhardt Edit: With the 10,000 folders it locks for a minute on every edit. 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 |
This is because CodeLens triggers on every edit - vscode controls 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 |
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 |
But keep in mind, that'll be tricky to implement because we can't keep too much in memory otherwise... #1613 |
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. |
This issue was closed automatically as repro info was indicated as needed, but there has been no activity in over a week. Please feel free to reopen with any available information! |
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:
Angular.ng-template@0.900.14
dbaeumer.vscode-eslint@2.1.1
EditorConfig.EditorConfig@0.14.4
eg2.vscode-npm-script@0.3.11
esbenp.prettier-vscode@3.20.0
humao.rest-client@0.23.1
johnpapa.angular-essentials@9.0.1
johnpapa.Angular2@9.1.1
johnpapa.vscode-peacock@3.5.0
johnpapa.winteriscoming@1.3.0
mikestead.dotenv@1.0.1
ms-azuretools.vscode-cosmosdb@0.12.1
ms-vscode.azure-account@0.8.8
ms-vscode.powershell-preview@2020.2.0
msjsdiag.debugger-for-chrome@4.12.6
msjsdiag.debugger-for-edge@1.0.14
nrwl.angular-console@11.1.3
PKief.material-icon-theme@4.0.1
streetsidesoftware.code-spell-checker@1.8.0
xabikos.JavaScriptSnippets@1.7.2
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
The text was updated successfully, but these errors were encountered: