-
Notifications
You must be signed in to change notification settings - Fork 510
Provide configuration option to specify a PowerShell profile to load in the language service #124
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
Comments
Hey @harbars, do you get IntelliSense for this snap-in when using the PowerShell ISE? I'm trying to determine what might be causing this to not work in VS Code. Theoretically any IntelliSense you're able to get in the ISE will also appear in VS Code with the PowerShell extension. |
Hi David, Yes, once you run Add-PSSnapIn Microsoft.SharePoint.Powershell the intellisense works in ISE. But only after you run that line, or of course add it to the ISE profile so it runs on startup. (can I do that with VS Code perhaps?) s. From: David Wilson [mailto:[email protected]] Hey @harbarshttps://github.com/harbars, do you get IntelliSense for this snap-in when using the PowerShell ISE? I'm trying to determine what might be causing this to not work in VS Code. Theoretically any IntelliSense you're able to get in the ISE will also appear in VS Code with the PowerShell extension. — |
We've talked about having a host specific profile. Something like The downside to this approach is that it would load for every VSCode workspace when you might only need it for certain workspaces. |
Yeah, we definitely need profile support at some point before we hit 1.0. Having a REPL available would also help to run the Add-PSSnapIn call like you can do now in the ISE. @harbars, one thing you can try is to type in the |
Hi Keith, Yeah that would work for the most common scenario. Basically you have to be on a SharePoint box to get the intellisense anyway (the snapin is in the GAC etc) so it wouldn’t be unreasonable to have it load everytime you hit up VS Code on that box. Obviously in the long run we want MS to stop with the Snapin and ship a Module, but in the meantime this would be a great assist to those using/wanting to use VS Code instead of ISE for their SP PoSh (that’s a lot of peeps!). s. From: Keith Hill [mailto:[email protected]] We've talked about having a host specific profile. Something like ms-vscode-powershell_profile.ps1. You would put this in one of the standard profile locations and what it contains would load every time you started the editor or debug host. Would that approach work for you? The downside to this approach is that it would load for every VSCode workspace when you might only need it for certain workspaces. — |
Yeah, duh! OK – that works – I am such a n00b – was hitting f5! Thanks! A profile support would be most welcome more generally Cheers From: David Wilson [mailto:[email protected]] Yeah, we definitely need profile support at some point before we hit 1.0. Having a REPL available would also help to run the Add-PSSnapIn call like you can do now in the ISE. @harbarshttps://github.com/harbars, one thing you can try is to type in the Add-PSSnapIn Microsoft.SharePoint.Powershell line in a .ps1 file you're editing, select the code, and press F8. This will cause that line to be evaluated just like in the ISE. Once you do this, I believe you should start getting IntelliSense for that snap-in. — |
Not a problem! I've renamed the issue to track the request for having a setting to configure a profile to be loaded at startup. |
This change adds support for loading both host-specific and host-agnostic profile scripts for both the current user and all users on the same system. For VS Code, the profile names are Microsoft.VSCode_profile.ps1 and profile.ps1. The new 'enableProfileLoading' setting controls whether profiles are loaded automatically when the language server starts up. For now this setting is turned off by default. Resolves #124.
...or ability to configure legacy Snapins to load to gain intellisense for their cmdlets.
The text was updated successfully, but these errors were encountered: