Skip to content

Temporarily mitigate intermittent IntelliSense slowness #430

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

Merged
merged 1 commit into from
Apr 7, 2017

Conversation

daviwil
Copy link
Contributor

@daviwil daviwil commented Apr 7, 2017

This change mitigates seemingly intermittent IntelliSense slowness by
preventing Get-Command and Get-Help from being called on cmdlets from
the PowerShellGet and PackageManagement modules. Something in the
PackageManagement module is causing completions to be returned at 10x
delay when that module is loaded. If the module is removed from the
session, completions go back to their normal duration.

By avoiding calling Get-Command on these cmdlets, we avoid loading
PackageManagement when the user types a string like Get-P which
incidentally happens to make VS Code see the Get-Package cmdlet and
try to resolve its details.

This fix is temporary and will be removed in the future once
OneGet/oneget#275 is fixed.

Related to PowerShell/vscode-powershell#647

This change mitigates seemingly intermittent IntelliSense slowness by
preventing Get-Command and Get-Help from being called on cmdlets from
the PowerShellGet and PackageManagement modules.  Something in the
PackageManagement module is causing completions to be returned at 10x
delay when that module is loaded.  If the module is removed from the
session, completions go back to their normal duration.

By avoiding calling Get-Command on these cmdlets, we avoid loading
PackageManagement when the user types a string like `Get-P` which
incidentally happens to make VS Code see the `Get-Package` cmdlet and
try to resolve its details.

This fix is temporary and will be removed in the future once
OneGet/oneget#275 is fixed.

Related to PowerShell/vscode-powershell#647
@daviwil daviwil added this to the 0.12.1 milestone Apr 7, 2017
@daviwil daviwil requested a review from rkeithhill April 7, 2017 03:02
@daviwil
Copy link
Contributor Author

daviwil commented Apr 7, 2017

Keith, do you think there's any risk of confusion to users by making this change? I think the potential benefit of not having IntelliSense perf issues outweighs any possible discomfort from missing the cmdlet signatures for PowerShellGet and PackageManagement.

@rkeithhill
Copy link
Contributor

I don't notice much of a slowdown on my work PC. Maybe 3-5 secs for the first time I try to complete Install-Package. But this does seem to be affecting folks so we should try to address it. I wonder if perhaps this black list should be an extension setting that gets passed into PSES though? That way, folks could customize it. Maybe I use PowerShellGet a lot and am willing to put up with the delay?

The downside to the setting though is if this is a temporary glitch, it might become unnecessary in the future.

@daviwil
Copy link
Contributor Author

daviwil commented Apr 7, 2017

Yeah, I don't think that it should be configurable since it's temporary. The problem is that once PackageManagement is loaded, IntelliSense is permanently slower until you remove that module. Same issue in powershell.exe and PowerShell ISE.

The only degradation for PowerShellGet and PackageManagement is the loss of extra info in completion results, they'll still get completions for those commands though.

private static HashSet<string> NounBlackList =
new HashSet<string>
{
"Module",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean we won't get info for Import-Module? That is a pretty commonly used command. The rest, less so. But if it is temporary, then let's try it and see if folks complain about missing info for these nouns.

I wonder if it would be worth returning some static text for these nouns like "Intellisense for this noun disabled due to perf issue, will be fixed in the future." or something like that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably not worth the extra effort at the moment, I imagine many people won't even notice it. If people do notice and complain, I'll definitely find a way to make it a bit more obvious what's going on.

@daviwil daviwil merged commit f862b8c into PowerShell:develop Apr 7, 2017
@daviwil daviwil deleted the avoid-completion-slowness branch April 7, 2017 03:38
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

Successfully merging this pull request may close these issues.

3 participants