PowerShell / vscode-powershell

Provides PowerShell language and debugging support for Visual Studio Code
https://marketplace.visualstudio.com/items/ms-vscode.PowerShell
MIT License
1.72k stars 495 forks source link

Autocomplete hung or not work at all after using function in VScode (powershell ext) #2642

Closed mariomarinov4 closed 4 years ago

mariomarinov4 commented 4 years ago

Issue Description Autocomplete hung in Editor or not work at all after using function.

I am experiencing a problem with Intellisense autocomplete. Open a new fresh PS integrated console and as soon as enter the following text (function) in editor and press Tab, the autocomplete works, but after a few seconds report 4 problems without any interaction from my side. Please see screenshot below.

Missing closing '}' in statement block or type definition. Missing ')' in function parameter list. Unexpected token ')' in expression or statement. Unexpected token '}' in expression or statement.

I have deleted all text in Editor and try another command like Get-AdUser, but autocomplete is not working anymore. It's simply says "Loading". Even if I try to close the current editor tab and open a new one it's still not working. It doesn't matter what I do, the 4 problems hung there. If I clear all text in editor and wait for some time, a few minutes the problems are gone and autocomplete working again, but it's very annoying to wait for this to fix itself. The only solution is to reload the window or restart the ps session.

Attached Logs

image image

Environment Information Windows 10 1909

Visual Studio Code

Name Version
Operating System Windows_NT x64 10.0.18363
VSCode 1.44.2
PowerShell Extension Version 2020.4.0

PowerShell Information

Name Value
PSVersion 7.0.0
PSEdition Core
GitCommitId 7.0.0
OS Microsoft Windows 10.0.18363
Platform Win32NT
PSCompatibleVersions 1.0 2.0 3.0 4.0 5.0 5.1.10032.0 6.0.0 6.1.0 6.2.0 7.0.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0

Visual Studio Code Extensions

Visual Studio Code Extensions(Click to Expand) |Extension|Author|Version| |---|---|---| |night-owl|sdras|1.1.3| |powershell|ms-vscode|2020.4.0| |shell-launcher|Tyriar|0.4.1| |vscode-icons|vscode-icons-team|10.1.1|
PrzemyslawKlys commented 4 years ago

Probably related: https://github.com/PowerShell/vscode-powershell/issues/2627

mariomarinov4 commented 4 years ago

Probably related: #2627 Hi @PrzemyslawKlys , thanks for your reply. Actually I have seen the post that you mentioned.

I think that I managed to fixed it. Reinstall VScode and Powershell extension.

Now it's working. Even if I type the "function" and in the middle of the word func... press tab it's complete the whole command itself and report the 4 problems,

image

but now when I remove the whole text in the editor, the problems are gone as well. Before they stuck somehow and intellisense were completely gone, Now it's ok.

image

PrzemyslawKlys commented 4 years ago

Thanks for the tip. I did delete the Preview extension, restarted program a few times, deleted disabled extension of PowerShell and after reinstall of Preview PowerShell, it's much snappier. Before I was waiting 4 seconds on the newly open window, but now it's instant. Lets see how it behaves in future. @TylerLeonhardt just FYI. Maybe some kind of cache issue for all my upgrades. Something to potentially investigate as an option to clear/cleanup on upgrades maybe?

PrzemyslawKlys commented 4 years ago

After few hours in Code the issue is back. So it's not related to total cleanup :(