Skip to content

Loading of third-part modules #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
tibmeister opened this issue Apr 6, 2016 · 9 comments
Closed

Loading of third-part modules #134

tibmeister opened this issue Apr 6, 2016 · 9 comments

Comments

@tibmeister
Copy link

Maybe not a bug but just not obvious but I work a lot with VMware's PowerCLI and as such I have to import a lot of modules and snappins but this doesn't seem to happen in VS Code. In using the ISE or PowerGUI when they started my Powershell Profile would be loaded which takes care of all of this but in VS Code with this extension that doesn't seem to be the case so I don't have Intellisense for the PowerCLI or custom commandlets.

@rkeithhill
Copy link
Contributor

Profile script loading support will be coming in the next drop of the extension. It will be turned off by default initially but you will be able to turn it on via user preferences. This will support the editor host/session but IIRC not the debug host i.e. you will need to make sure your script loads all the modules it needs for execution.

@tibmeister
Copy link
Author

So is there a way to load the modules to gain Intellisense, if not now then in a future release?

@rkeithhill
Copy link
Contributor

rkeithhill commented Apr 6, 2016

Yes but not in 0.5.0. The next release will process your profile scripts (including a host-specific script for VSCode) if you enable the user preference setting. This will enable completion lists for those modules you load in your profile scripts.

For more info on this see PowerShell/PowerShellEditorServices#111

@tibmeister
Copy link
Author

I looked through the Issue 111 but not seeing on how to enable this. I'm sure I'm just missing it.

@rkeithhill
Copy link
Contributor

The setting in the next update (> 0.5.0) will be powershell.enableProfileLoading. You'll override that and set it to true.

@tibmeister
Copy link
Author

Ahh, got it. I will clone that down and check it out.

@daviwil
Copy link
Contributor

daviwil commented Sep 2, 2016

Hey @tibmeister, did the new profile support solve your problem with loading third-party modules? Let me know!

@tibmeister
Copy link
Author

tibmeister commented Sep 8, 2016

Yes, after creating the Microsoft.VSCode_profile.ps1 file and copying the contents of the standard profile file into this then things began working as expected.

I didn't see this in the documentation anywhere and took a shot in the dark based on the way the ISE works and PowerGUI.

Definitely wondering how this would work on other OS's once we can run PowerShell there, Linux comes to mind personally.

@daviwil
Copy link
Contributor

daviwil commented Sep 8, 2016

Thanks for confirming that Jody! I'll go ahead and close this issue.

You can run PowerShell and the PowerShell VS Code extension on Linux and OS X right now:

https://github.com/PowerShell/PowerShell
https://github.com/PowerShell/PowerShell/blob/master/docs/learning-powershell/using-vscode.md

The profile support will work the same way as it does on Windows, just with OS-specific profile paths. If you open PowerShell on Linux you can use your favorite editor to edit the file in the path that's stored in the $profile variable.

@daviwil daviwil closed this as completed Sep 8, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants