Issue Type: Bug
In a PowerShell window, run:
$global:options['CustomArgumentCompleters'] -eq $null
and note that it's TRUE
Now run the same command in a regular PowerShell window and note that it's FALSE.
This prevents a number of scripts from running within VS Code's PowerShell, including the popular "z" replacement for changing directories.
VS Code version: Code 1.21.1 (79b44aa704ce542d8ca4a3cc44cfca566e7720f1, 2018-03-14T14:47:13.351Z)
OS version: Windows_NT ia32 10.0.17123
System Info
|Item|Value|
|---|---|
|CPUs|Intel(R) Core(TM) i7 CPU X 980 @ 3.33GHz (12 x 3373)|
|Memory (System)|24.00GB (15.42GB free)|
|Process Argv|C:\Program Files (x86)\Microsoft VS Code\Code.exe|
|Screen Reader|no|
|VM|0%|
Extensions (17)
Extension|Author (truncated)|Version
---|---|---
latex-preview|ajs|0.5.1
vs-kubernetes|bre|0.0.9
xml|Dot|1.9.2
gitlens|eam|8.1.1
Ionide-FAKE|Ion|1.2.3
Ionide-fsharp|Ion|3.17.3
Ionide-Paket|Ion|1.9.1
kubernetes-snippets|ipe|0.1.9
python|ms-|2018.2.1
azure-account|ms-|0.3.3
cpptools|ms-|0.15.0
csharp|ms-|1.14.0
PowerShell|ms-|1.6.0
vsliveshare|ms-|0.2.206
vscode-docker|Pet|0.0.25
vscode-icons|rob|7.21.0
vscode-arduino|vsc|0.2.11
Reproduces without extensions
Moved over from https://github.com/Microsoft/vscode/issues/46079
I suspect that the "z" change directory utility has some script that it puts in a profile file. If that script is in Microsoft.PowerShell_profile.ps1 it will not get run inside the PowerShell Integrated Console terminal window. If you move that script to profile.ps1 then it will get loaded by all hosts for the current user.
@shanselman So just to clear things up:
$global:options['CustomArgumentCompleters'] -eq $null:PowerShell Integrated Console (part of PowerShell extension): False
Regular PowerShell console in VSCode (ships with VSCode): True
PowerShell.exe/pwsh.exe: True
PowerShell ISE: <not sure>
Do I have this right?
Keep in mind that the ISE, powershell.exe, and the PowerShell Integrated Console are all different hosts and have their own unique profiles as @rkeithhill mentioned.
p.s. big fan of what you do and your work 馃憤
Yes, in fact, in the ISE it's "Cannot index into a null array." because #global:options is itself $null there as well.
OK, that's it - moving z's stuff into profile.ps1 fixed this. Thanks for your patience and guidance! Hopefully this gets google juice and helps someone else!
Most helpful comment
Yes, in fact, in the ISE it's "Cannot index into a null array." because #global:options is itself $null there as well.
OK, that's it - moving z's stuff into profile.ps1 fixed this. Thanks for your patience and guidance! Hopefully this gets google juice and helps someone else!