Skip to content

Commit e4f3dcc

Browse files
committed
Merge pull request PowerShell#130 from PowerShell/daviwil/profile-support
Add support for loading host profile scripts
2 parents 4293111 + b18754c commit e4f3dcc

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

package.json

+14-2
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@
121121
},
122122
"args": [
123123
"/debugAdapter",
124-
"/logLevel:Verbose"
124+
"/logLevel:Verbose",
125+
"/hostName:\"Visual Studio Code Host\"",
126+
"/hostProfileId:Microsoft.VSCode",
127+
"/hostVersion:0.5.0"
125128
],
126129
"configurationAttributes": {
127130
"launch": {
@@ -179,7 +182,11 @@
179182
"program": "bin/Microsoft.PowerShell.EditorServices.Host.x86.exe"
180183
},
181184
"args": [
182-
"/debugAdapter"
185+
"/debugAdapter",
186+
"/logLevel:Verbose",
187+
"/hostName:\"Visual Studio Code Host\"",
188+
"/hostProfileId:Microsoft.VSCode",
189+
"/hostVersion:0.5.0"
183190
],
184191
"configurationAttributes": {
185192
"launch": {
@@ -228,6 +235,11 @@
228235
"default": false,
229236
"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."
230237
},
238+
"powershell.enableProfileLoading": {
239+
"type": "boolean",
240+
"default": false,
241+
"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."
242+
},
231243
"powershell.scriptAnalysis.enable": {
232244
"type": "boolean",
233245
"default": true,

src/main.ts

+14-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,20 @@ export function activate(context: vscode.ExtensionContext): void {
6363
// The language server is only available on Windows
6464
if (os.platform() == "win32")
6565
{
66-
let args = [];
66+
// Get the current version of this extension
67+
var hostVersion =
68+
vscode
69+
.extensions
70+
.getExtension("ms-vscode.PowerShell")
71+
.packageJSON
72+
.version;
73+
74+
let args = [
75+
"/hostName:\"Visual Studio Code Host\"",
76+
"/hostProfileId:\"Microsoft.VSCode\"",
77+
"/hostVersion:" + hostVersion
78+
];
79+
6780
if (settings.developer.editorServicesWaitForDebugger) {
6881
args.push('/waitForDebugger');
6982
}

src/settings.ts

+2
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export interface IDeveloperSettings {
1818

1919
export interface ISettings {
2020
useX86Host?: boolean,
21+
enableProfileLoading?: boolean,
2122
scriptAnalysis?: IScriptAnalysisSettings,
2223
developer?: IDeveloperSettings,
2324
}
@@ -37,6 +38,7 @@ export function load(myPluginId: string): ISettings {
3738

3839
return {
3940
useX86Host: configuration.get<boolean>("useX86Host", false),
41+
enableProfileLoading: configuration.get<boolean>("enableProfileLoading", false),
4042
scriptAnalysis: configuration.get<IScriptAnalysisSettings>("scriptAnalysis", defaultScriptAnalysisSettings),
4143
developer: configuration.get<IDeveloperSettings>("developer", defaultDeveloperSettings)
4244
}

0 commit comments

Comments
 (0)