Skip to content

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

Closed
harbars opened this issue Mar 24, 2016 · 7 comments
Labels
Issue-Enhancement A feature request (enhancement).

Comments

@harbars
Copy link

harbars commented Mar 24, 2016

...or ability to configure legacy Snapins to load to gain intellisense for their cmdlets.

@daviwil daviwil added the Issue-Enhancement A feature request (enhancement). label Mar 24, 2016
@daviwil daviwil added this to the Backlog milestone Mar 24, 2016
@daviwil
Copy link
Contributor

daviwil commented Mar 24, 2016

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.

@harbars
Copy link
Author

harbars commented Mar 24, 2016

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]]
Sent: 24 March 2016 23:29
To: PowerShell/vscode-powershell [email protected]
Cc: Spencer Harbar [email protected]
Subject: Re: [vscode-powershell] Feature Request: Add intellisense for SharePoint Snapin (#124)

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.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHubhttps://github.com//issues/124#issuecomment-201072889

@rkeithhill
Copy link
Contributor

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.

@daviwil
Copy link
Contributor

daviwil commented Mar 24, 2016

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 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.

@harbars
Copy link
Author

harbars commented Mar 24, 2016

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]]
Sent: 24 March 2016 23:31
To: PowerShell/vscode-powershell [email protected]
Cc: Spencer Harbar [email protected]
Subject: Re: [vscode-powershell] Feature Request: Add intellisense for SharePoint Snapin (#124)

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.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHubhttps://github.com//issues/124#issuecomment-201073238

@harbars
Copy link
Author

harbars commented Mar 24, 2016

Yeah, duh! OK – that works – I am such a n00b – was hitting f5!

Thanks!

A profile support would be most welcome more generally

Cheers
s.

From: David Wilson [mailto:[email protected]]
Sent: 24 March 2016 23:35
To: PowerShell/vscode-powershell [email protected]
Cc: Spencer Harbar [email protected]
Subject: Re: [vscode-powershell] Feature Request: Add intellisense for SharePoint Snapin (#124)

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.


You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHubhttps://github.com//issues/124#issuecomment-201073752

@daviwil daviwil changed the title Feature Request: Add intellisense for SharePoint Snapin Provide configuration option to specify a PowerShell profile to load in the language service Mar 24, 2016
@daviwil
Copy link
Contributor

daviwil commented Mar 24, 2016

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.

daviwil added a commit that referenced this issue Mar 30, 2016
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.
@daviwil daviwil modified the milestone: Backlog May 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue-Enhancement A feature request (enhancement).
Projects
None yet
Development

No branches or pull requests

3 participants