Open
Description
System Details Output
### VSCode version: 1.36.1 2213894ea0415ee8c85c5eea0d0ff81ecc191529 x64
### VSCode extensions:
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
### PSES version: 1.12.1.0
### PowerShell version:
Name Value
---- -----
PSVersion 7.0.0-preview.1
PSEdition Core
GitCommitId 7.0.0-preview.1
OS Microsoft Windows 10.0.18922
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
Background
At my company, we use user documents redirection, causing my powershell user module folder to be located on a network share. In order to avoid issues with PSModule auto-loading, I remove $HOME/documents/WindowsPowershell/Modules
from my modulepath and instead add $HOME/WindowsPowershell/Modules
and have relocated all my user specific modules there. This isn't respected in vscode.
Expected Behavior
PS > $mydocs = [environment]::GetFolderPath('MyDocuments')
PS > $pattern = [regex]::Escape($mydocs)
PS > $Env:PSModulePath = ($Env:psmodulepath -split ';' | where {$_ -notmatch $pattern}) -join ';'
PS > #Feel free to do whatever you'd like
PS > ($Env:PSmodulepath -split ';' | where {$_ -match $pattern}).count -eq 0
True
Actual Behavior
PS > $mydocs = [environment]::GetFolderPath('MyDocuments')
PS > $pattern = [regex]::Escape($mydocs)
PS > $Env:PSModulePath = ($Env:psmodulepath -split ';' | where {$_ -notmatch $pattern}) -join ';'
PS > #Type into a document with language "PowerShell"
PS > ($Env:PSmodulepath -split ';' | where {$_ -match $pattern}).count -eq 0
False