Skip to content

Add support for loading host profile scripts #130

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

Merged
merged 1 commit into from
Mar 30, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@
},
"args": [
"/debugAdapter",
"/logLevel:Verbose"
"/logLevel:Verbose",
"/hostName:\"Visual Studio Code Host\"",
"/hostProfileId:Microsoft.VSCode",
"/hostVersion:0.5.0"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The debugger configuration is a little unfortunate since we have to update the version in 3 places in this file now. We'll need a version bump script in the near future.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Which "host" version is this? VSCode or PSES? If PSES, can't we read the version number from an assembly attribute via refection?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the VS Code extension's version. There will be a different property in the runspace for getting the PSES version

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha.

],
"configurationAttributes": {
"launch": {
Expand Down Expand Up @@ -179,7 +182,11 @@
"program": "bin/Microsoft.PowerShell.EditorServices.Host.x86.exe"
},
"args": [
"/debugAdapter"
"/debugAdapter",
"/logLevel:Verbose",
"/hostName:\"Visual Studio Code Host\"",
"/hostProfileId:Microsoft.VSCode",
"/hostVersion:0.5.0"
],
"configurationAttributes": {
"launch": {
Expand Down Expand Up @@ -228,6 +235,11 @@
"default": false,
"description": "If true, causes the 32-bit language service to be used on 64-bit Windows. On 32-bit Windows this setting has no effect. This setting does not affect the debugger which has its own architecture configuration."
},
"powershell.enableProfileLoading": {
"type": "boolean",
"default": false,
"description": "If true, causes user and system wide profiles (profile.ps1 and Microsoft.VSCode_profile.ps1) to be loaded into the PowerShell session. This affects IntelliSense and interactive script execution. The debugger is not affected by this setting."
},
"powershell.scriptAnalysis.enable": {
"type": "boolean",
"default": true,
Expand Down
15 changes: 14 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,20 @@ export function activate(context: vscode.ExtensionContext): void {
// The language server is only available on Windows
if (os.platform() == "win32")
{
let args = [];
// Get the current version of this extension
var hostVersion =
vscode
.extensions
.getExtension("ms-vscode.PowerShell")
.packageJSON
.version;

let args = [
"/hostName:\"Visual Studio Code Host\"",
"/hostProfileId:\"Microsoft.VSCode\"",
"/hostVersion:" + hostVersion
];

if (settings.developer.editorServicesWaitForDebugger) {
args.push('/waitForDebugger');
}
Expand Down
2 changes: 2 additions & 0 deletions src/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export interface IDeveloperSettings {

export interface ISettings {
useX86Host?: boolean,
enableProfileLoading?: boolean,
scriptAnalysis?: IScriptAnalysisSettings,
developer?: IDeveloperSettings,
}
Expand All @@ -37,6 +38,7 @@ export function load(myPluginId: string): ISettings {

return {
useX86Host: configuration.get<boolean>("useX86Host", false),
enableProfileLoading: configuration.get<boolean>("enableProfileLoading", false),
scriptAnalysis: configuration.get<IScriptAnalysisSettings>("scriptAnalysis", defaultScriptAnalysisSettings),
developer: configuration.get<IDeveloperSettings>("developer", defaultDeveloperSettings)
}
Expand Down