PowerShell / PowerShell/vscode-powershell

$env:PSModulePath Question / Potential Issue

Open
#1,266 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Area-IntelliSense Issue-Bug
Dominant language
TypeScript
Stars
1.9k
Forks
547
PR merge metrics
No merged PRs in 30d

Description

I'm having an issue with Intellisense being very slow.

I've managed to whittle it down to VS Code loading modules over the network, so every time I hit tab, it goes off to the network share and does what it needs to do and then Intellisense works.

This can be up to 2 minutes at a time, however.

I removed the entry from $env:PSModulePath in the integrated VS Code terminal, fine, Intellisense is once again rapid and I can continue happily with my work, then around 30 seconds or so later, everything slows down again.

Lo and behold, the UNC of the file share is back in $env:PSModulePath! I've tested this in the ISE and do not get the same issue after removing the UNC share path.

Happy to submit logs if required, hoping there's just something I'm missing, however.

EDIT: It seems to be that when I hit tab or Intellisense trys to fire, it adds the UNC share path back to my $env:PSModulePath. Again tried with the ISE and don't get the same thing, so I believe this to be a bug.

SECOND EDIT: It appears to add the path back into $env:PSModulePath as soon as you click into the editor window.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the report in the VS Code integrated PowerShell terminal: remove the UNC entry from $env:PSModulePath, click the editor, and trigger IntelliSense or Tab completion. Inspect the extension's handling of PSModulePath and module discovery, comparing the behavior with ISE. Done means the UNC path is not unexpectedly re-added and IntelliSense does not block on the network share.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell, typescript, vscode
Domain
developer-experience, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.