question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IntelliSense in the editor causes modules to be loaded

See original GitHub issue

While 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 CompletionResult objects, instead of importing module
  • Run metadata gathering in separate PowerShell Runspace or process

Cheers, Trevor Sullivan

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
MartinGC94commented, May 14, 2021

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:

  • Open up a normal PS console and VS code
  • Check imported modules with Get-Module
  • Tab complete a command from an unimported module like Get-NetIPAddress
  • Check imported modules again with Get-Module
  • Note how only VS code will have imported the unwanted NetTCPIP module

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.

1reaction
daviwilcommented, May 15, 2017

Did some work on this but I think I want to polish it a bit more before I ship it.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found