-
Notifications
You must be signed in to change notification settings - Fork 511
IntelliSense slow or unresponsive forced to kill powershell to force it to work. #1256
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
Comments
Hi there, thanks for the report. Can you please attach the logs (instructions: https://github.com/powershell/vscode-powershell#2-capture-verbose-logs-and-send-them-to-us) And also give me some details on how big your workspace is and how big your file is that's giving you slow intellisense? |
it shows the logs are already attached. workspace size
Powershell related files:
|
I confirm the behaviour, killing the Integrated Console in VSCode made the IntelliSense work back again. |
It seems that the following "old" line in my user settings was messing up things. Once removed, IntelliSense is working fine and quickly again. |
@ebmarquez oops missed the logs. Thanks for the extra info! |
This is one of the more important perf bugs that I've been hearing about. |
I also can confirm that killing the Powershell Integrated Console makes Intellisense work again. I have VScode v1.22.1. |
Yes, killing the PIC does make Intellisense "work" again. However, really need variable and function lookup Intellisense provides when the PowerShell session is running. I really hope performance can dramatically improve. Data points about my dev system: [PS] ...\MyDir> code -v
1.23.1
d0182c3417d225529c6d5ad24b7572815d0de9ac
x64
[PS] ...\MyDir> $pseditor.EditorServicesVersion
[PS] ...\MyDir> code --list-extensions --show-versions
alefragnani.Bookmarks@0.19.1
alefragnani.pascal@0.11.0
humao.rest-client@0.18.4
idleberg.innosetup@1.0.3
mechatroner.rainbow-csv@0.3.0
mohsen1.prettify-json@0.0.3
ms-python.python@2018.4.0
ms-vscode.csharp@1.15.2
ms-vscode.github-issues-prs@0.9.0
ms-vscode.PowerShell@1.7.0
robertohuertasm.vscode-icons@7.23.0
Shan.code-settings-sync@2.9.2
tariky.easy-snippet-maker@0.0.6
tht13.html-preview-vscode@0.1.1
wayou.vscode-todo-highlight@0.5.12
[PS] ...\MyDir> $PSVersionTable
Name Value
---- -----
PSVersion 5.1.17134.81
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.17134.81
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
Also, my workspace includes both a PowerShell module (1 PSM1) and a C# library. The PSM1 is ~2.8MB, and contains 33585 lines (~45% of those lines are blank). |
code -v
$pseditor.EditorServicesVersion
code --list-extensions --show-versions $PSVersionTable
I was having this problem consistently and found a possible cause. I was developing a PowerShell Module for internal use. An old version of the module which I'd forgotten about was installed in C:\Users\cpdohert\Documents\WindowsPowerShell\Modules\MyModule\MyModule.psm1 I was also regularly running Import-Module C:\Users\cpdohert\Documents\repos\MyModule\MyModule.psm1 -Force in a PowerShell ISE window outside VS Code. When I deleted the old C:\Users\cpdohert\Documents\WindowsPowerShell\Modules\MyModule\MyModule.psm1 file, IntelliSense began working speedily again. Also, the slowdown only occurred once I upgraded to 1.8.2. Under 1.8.1 this configuration did not cause any problems. |
Experiencing the same issues. Killing the terminal resolved the issue for me but I don't have old modules or packages. |
Two things that you can try for now are: We've been chipping away at performance issues recently, although there's still a lot of work to be done. But hopefully you'll experience some improvement in the next release. Here are the recent PRs:
The bigger performance gains are ones that require either changes in PSScriptAnalyzer or architectural changes in EditorServices, so we've been trying to fix those the "right" way, trying not to break too much. |
For me, the intellisense is very responsive until I add a function or an additional function to my script. To work around this, I comment out all functions I'm not currently working on: <#function Invoke-StuffThatImNotWorkingOn {
# ...
}
#>
Write-Host 'Yay! Intellisense aint garbage here!' Even having a single function slows intellisense responsiveness. It feels like the intellisense is processing every function one at a time by spawning a new instance without multi-threading. This work around is not great as you have to uncomment everything when you save and want to test (I've only used it on relatively small files). However, it exponentially increases the intellisense speed. |
I'd like to ask everyone on this thread if there was one out of these two that helped a lot or if both helped a lot. This will help us understand the situation |
Those help, but performance is still so bad that the extension borderline does not work. I've strongly considered removing it and just going back to plain PowerShell-oblivious token completion. From some casual dotTrace profiling, the performance issues that persist with those features disabled appear related to auto-formatting, having a significant number of modules installed, PowerShell's general slowness at loading modules, and the lack of cancellation support in PSES (once it falls behind, you might as well kill it, it's not going to catch up). Even with script analysis disabled, PSA is still loaded for formatting purposes, and still likes to go off and effectively import everything in PSModulePath. For people running on Windows (which ships with dozens of modules), that have RSAT installed (takes us over 100) and that have a lot of internal and third party modules installed, importing everything in PSModule path is a multi-minute affair. A ~minute long trace I took while the extension was out to lunch (and burning a core relentlessly) shows the following. Again, this is with script analysis and code lens off. So, it's the PSA formatter trying to get command info, which forces modules loads, which takes roughly forever. The files I actually have open only reference commands from a handful of modules that would take only a couple seconds to load, but it seems like it's loading everything? That or it's loading the same things over and over. |
@mattpwhite thanks for all this information it is super helpful to us! What setting are you using for auto-formatting (format on type, or format on save)...would you also please open an issue in the Script Analayzer repo as formatting is done by Script Analyzer so the improvements will happen there. |
@mattpwhite Thanks for the really great analysis! |
Just format on paste (and occasional explicit format selection). Formatting is far too buggy to apply to whole files. I usually end up with everything jammed up on the left without any indentation if I let it do a whole file. As if it’s decrementing the appropriate indent level more often than it’s incrementing it. I don’t trust it to do much more than line up a hashtable. I know I should probably log issues for that too. It’s pretty tedious to work out a minimal reproducer given the perf issues, but I’ll try to log those and this issue with PSA. |
It's probably easier to repro directly with something like: Import-Module PSScriptAnalyzer -Version 1.18.1
Invoke-Formatter -ScriptDefinition @'
<script>
'@ # Or alternative gc -raw ./file.ps1 | invoke-formatter Amongst a few other things, we're working on how to host PSScriptAnalyzer better and hope to see some improvements there. Unfortunately, PSScriptAnalyzer has a few rough spots that are hard for us to contain, but because it's part of the default experience, people expect it. I'm also contributing to PSSA when I find time, particularly in the performance area, so armed with the information you've provided I'm hoping we can find some real improvements here. |
Any news on this issue? Its very annoying... Thanks! |
Yes, please make some progress on this. It's crazy how bad this experience really is. I restart vscode multiple times a day because its so bad. |
@ebmarquez try out the powershell-preview extension if you'd like to evaluate the progress so far |
Going to close this as a result of the major architectural changes we made in the omnisharp port. |
System Details
$PSVersionTable
:Copy / paste the following commands into the PowerShell Integrated Console, and paste the output here:
code -v
$pseditor.EditorServicesVersion
code --list-extensions --show-versions
$PSVersionTable
logs.zip
The text was updated successfully, but these errors were encountered: