IntelliSense in the editor causes modules to be loaded
See original GitHub issueWhile I’m writing PowerShell code in Visual Studio Code on Mac, I notice that messages are randomly printed to the Integrated Terminal. Those messages typically indicate that a module is being imported, and sometimes my environment will change as a result (eg. posh-git changes my prompt) against my will.
While the rich Intellisense metadata is useful for development, we should investigate a method of providing this metadata while simultaneously preventing unwanted changes to the development environment. Ideas proposed by @daviwil and myself include:
- Add a setting that prevents automatic import of modules (or perhaps opts into it)
- Parse tooltips from
CompletionResultobjects, instead of importing module - Run metadata gathering in separate PowerShell Runspace or process
Cheers, Trevor Sullivan
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (3 by maintainers)
Top Results From Across the Web
IntelliSense in Visual Studio Code
This can be caused by a variety of reasons. First, try restarting VS Code. If the problem persists, consult the language extension's documentation....
Read more >Intellisense not working after loading module - SAPIEN Forums
Runspace contamination is a common cause for errors. The prescribed way of adding intellisense for a module that has been installed or added ......
Read more >Visual Studio Code: Intellisense not working - Stack Overflow
Solution: The path to the modules is set when a virtual environment is ... Installing Pylance addon caused Vscode Intellisense to stop.
Read more >Fixing Visual Studio's IntelliSense (auto-complete) in Unity
You may have accidentally unloaded the project solution, which caused IntelliSense to not work. f. Manually regenerating your Unity project ...
Read more >Options, Text Editor, C/C++, Advanced - Visual Studio
Indicates that the code browsing database and IntelliSense files ... file is deleted the next time you load the solution, thus causing the ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I’m sorry for commenting on such an old issue, I can open a new one if requested but I disagree with the conclusion here.
This is not a Powershell issue, if you open up ISE or a PS console with/without PSReadline it won’t auto import modules when you invoke command completion. This only happens in VS code, specifically when you are hovering over a command in the intellisense menu.
It’s pretty easy to demonstrate:
I think the problem is that VS code runs some additional code when you are hovering over an item in the intellisense menu to display command help. Powershell already provides the parameter sets as a tooltip if a module has been imported so the only thing VS code adds is the short synopsis for what the command does.
This feature needs to either be removed or made smarter so it only shows that help info if the module has already been imported, otherwise I don’t see how intellisense is ever going to feel good in VS code for Powershell.
Did some work on this but I think I want to polish it a bit more before I ship it.