Skip to content

Server 2016 - Intellisense Delay with PowerShell Extension #1205

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

Closed
clavrus opened this issue Feb 21, 2018 · 10 comments
Closed

Server 2016 - Intellisense Delay with PowerShell Extension #1205

clavrus opened this issue Feb 21, 2018 · 10 comments
Labels
Issue-Performance Something's slow.

Comments

@clavrus
Copy link

clavrus commented Feb 21, 2018

System Details

  • Operating system name and version: Windows Server 2016
  • VS Code version: 1.20.1
  • PowerShell extension version: 1.5.1
  • Output from $PSVersionTable: below

code -v
1.20.1
f88bbf9137d24d36d968ea6b2911786bfe103002
x64

$pseditor.EditorServicesVersion

Major  Minor  Build  Revision
-----  -----  -----  --------
1      5      1      0       

code --list-extensions --show-versions

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]

$PSVersionTable

Name                           Value                                                                                                                                                                                            
----                           -----                                                                                                                                                                                            
PSVersion                      5.1.14393.1944                                                                                                                                                                                   
PSEdition                      Desktop                                                                                                                                                                                          
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                                                                                                                                                                          
BuildVersion                   10.0.14393.1944                                                                                                                                                                                  
CLRVersion                     4.0.30319.42000                                                                                                                                                                                  
WSManStackVersion              3.0                                                                                                                                                                                              
PSRemotingProtocolVersion      2.3                                                                                                                                                                                              
SerializationVersion           1.1.0.1                                                                                                                                                                                          


Issue Description

  • VSCode Version: 1.20.1
  • OS Version: Server 2016
  • PowerShell Extension 1.5.1
  • PowerShell Version 5.1

Steps to Reproduce:

  1. Open a new document with PowerShell as language
  2. Type in 'Get-' (or any other command) and wait 4-10 seconds for Intellisense to complete

Does this issue occur when all extensions are disabled?: No - Related to PowerShell Extension, HTML intellisense works great

System Info:
CPU: Intel (R) Xeon(R) CPU E5-2660 v3 @ 2.60GHz (4 x 2598)
Memory: 24.00GB (16.08GB free)
Process Argv: C:\Program Files\Microsoft VS Code\Code.exe
Screen Reader: no
VM: 100%

Notes:

  1. It does not matter if I try any other command, or type in more of it so there's only one option for it.
  2. PowerShell ISE intellisense is immediate
  3. VSCode (same versions) on desktop works exactly how I'd expect it.
  4. This was not introduced with a new version, been a problem since beginning.
  5. I tried to use the issue reporter, the 'Preview On Github' button wasn't performing any actions.
  6. It does not matter if it's the first time I try intellisense on a type of command.

Attached Logs

2018-02-21-1913-ProcMon.zip

@clavrus
Copy link
Author

clavrus commented Feb 21, 2018

Note: This is in the editor, not the terminal. Terminal intellisense works fine.

@rkeithhill
Copy link
Contributor

Can you attach a zip of the extension log files? See the following for instructions on how to do this - https://github.com/PowerShell/vscode-powershell#2-capture-verbose-logs-and-send-them-to-us

@clavrus
Copy link
Author

clavrus commented Feb 22, 2018

logs.zip

@clavrus
Copy link
Author

clavrus commented Feb 22, 2018

I updated to the PowerShell extension 1.6 and no change in behavior

@rkeithhill
Copy link
Contributor

Hmm everything is clipping along nicely until we attempt to process your profile:

2018-02-22 12:51:38 [VERBOSE] - Method "ExecuteCommand" at line 491 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Session\PowerShellContext.cs

    Attempting to execute command(s):
    
        C:\Users\su-rp53\Documents\WindowsPowerShell\profile.ps1
        Out-Default
    

2018-02-22 12:51:38 [VERBOSE] - Method "OnSessionStateChanged" at line 1172 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Session\PowerShellContext.cs

    Session state changed --
    
        Old state: Ready
        New state: Running
        Result: NotFinished

2018-02-22 12:52:15 [ERROR] - Method "CreateInputPromptHandler" at line 750 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Session\Host\EditorServicesPSHostUserInterface.cs

    Prompt handler requested while another prompt is already active.

2018-02-22 12:53:09 [VERBOSE] - Method "NotifyBeginApplication" at line 145 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Session\Host\EditorServicesPSHost.cs

    NotifyBeginApplication() called.

2018-02-22 12:53:09 [VERBOSE] - Method "NotifyEndApplication" at line 154 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Session\Host\EditorServicesPSHost.cs

    NotifyEndApplication() called.

2018-02-22 12:54:15 [VERBOSE] - Method "OnSessionStateChanged" at line 1172 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Session\PowerShellContext.cs

    Session state changed --
    
        Old state: Running
        New state: Ready
        Result: Completed

2018-02-22 12:54:15 [ERROR] - Method "ExecuteCommand" at line 564 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Session\PowerShellContext.cs

    Execution of the following command(s) completed with errors:
    
        C:\Users\su-rp53\Documents\WindowsPowerShell\profile.ps1
        Out-Default

Could you temporarily rename your profile file - C:\Users\su-rp53\Documents\WindowsPowerShell\profile.ps1? Stick a .bak on it or something and then retry VSCode to see if the perf issue still exists. If it doesn't, we'll need to figure out what's going on with your profile.

@clavrus
Copy link
Author

clavrus commented Feb 23, 2018

You were correct. My profile.ps1 is set up to import a number of my commands, but I think I've identified the one line that vscode isn't liking.

Import-Module C:\scripts\modules\trconfig.psm1 - If I comment out this line, vscode intellisense is much snappier.

I've added the trconfig.txt for your reference. I don't see anything in it that should cause problems. I am able to import a different .psm1 file that has thousands of lines of functions without any problem.

Any ideas from looking at the trconfig on where to start before I start testing removing things from it?
trconfig.txt

@clavrus
Copy link
Author

clavrus commented Feb 23, 2018

It looks like it's this line that's causing it.

Add-PSSnapin Microsoft.Exchange.Management.PowerShell.SnapIn

@veepee78
Copy link

I have quite bad slowness too. All I see is "waiting..." for 10-30s everytime I try to use insellisense. Logs attached. Tried to disable everything in profile, no change.

vscode.zip

@rkeithhill
Copy link
Contributor

@veepee78 Thanks for attaching your log files! In your EditorServices.log file I'm seeing a 10 second gap every time we invoke PSSA (part of a codeLens/resolve request):

2018-02-23 10.50.22 [VERBOSE] - Method "ReadMessage" at line 123 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Protocol\MessageProtocol\MessageReader.cs

    Received Request 'codeLens/resolve' with id 12

2018-02-23 10.50.22 [VERBOSE] - Method "ResolveFilePath" at line 378 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Workspace\Workspace.cs

    Resolved path: c:\MaestroNG\IT\NG_Update\module-maestro-ng-update.psm1

2018-02-23 10.50.22 [VERBOSE] - Method "DelayThenInvokeDiagnostics" at line 1482 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Protocol\Server\LanguageServer.cs

    Analyzing script file: c:\MaestroNG\IT\NG_Update\module-maestro-ng-update.psm1

2018-02-23 10.50.22 [VERBOSE] - Method "GetDiagnosticRecordsAsync" at line 451 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Analysis\AnalysisService.cs

    Found 9 violations

2018-02-23 10.50.22 [VERBOSE] - Method "DelayThenInvokeDiagnostics" at line 1486 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Protocol\Server\LanguageServer.cs

    Analysis complete.

2018-02-23 10.50.32 [VERBOSE] - Method "WriteMessage" at line 61 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Protocol\MessageProtocol\MessageWriter.cs

    Writing Response 'codeLens/resolve' with id 12

2018-02-23 10.50.32 [VERBOSE] - Method "WriteMessage" at line 61 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Protocol\MessageProtocol\MessageWriter.cs

    Writing Event 'textDocument/publishDiagnostics'

2018-02-23 10.50.32 [VERBOSE] - Method "ReadMessage" at line 123 of C:\projects\powershelleditorservices\src\PowerShellEditorServices.Protocol\MessageProtocol\MessageReader.cs

    Received Event '$/cancelRequest'

CodeLens/PSSA should be running in the background until you click on one. Also, the slowest IntelliSense response I've seen from the language server in the log file is:

2018-02-23 10.51.05 [VERBOSE] - Method "GetCompletions" at line 135 of C:\projects\powershelleditorservices\src\PowerShellEditorServices\Language\AstOperations.cs

    IntelliSense completed in 108ms.

That doesn't mean that there isn't something on the client-side (VSCode side) that is slow.

@rjmholt rjmholt added the Issue-Performance Something's slow. label Mar 21, 2018
@rjmholt
Copy link
Contributor

rjmholt commented Dec 2, 2018

Going to deduplicate this issue to #647.

@rjmholt rjmholt closed this as completed Dec 2, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Performance Something's slow.
Projects
None yet
Development

No branches or pull requests

4 participants