Skip to content

Commit 3959bdf

Browse files
Pass EnableProfileLoading and InitialWorkingDirectory as initializationOptions (#3986)
To fix stdio clients, we needed to fix our startup logic so that the PowerShell host was actually started on initialization, not in the `onDidChangeConfiguration` handler. The previous way it was done only worked because it relied on a quirk of the VS Code client to send that request immediately, which other clients don’t necessarily do. In order to startup sooner though, we need any configuration that’s applicable on startup to be passed across the wire with the `initialize` request.
1 parent 85c04aa commit 3959bdf

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/session.ts

+5
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,11 @@ export class SessionManager implements Middleware {
540540
configurationSection: [ utils.PowerShellLanguageId, "files", "search" ],
541541
// fileEvents: vscode.workspace.createFileSystemWatcher('**/.eslintrc')
542542
},
543+
// NOTE: Some settings are only applicable on startup, so we send them during initialization.
544+
initializationOptions: {
545+
EnableProfileLoading: this.sessionSettings.enableProfileLoading,
546+
InitialWorkingDirectory: this.sessionSettings.cwd,
547+
},
543548
errorHandler: {
544549
// Override the default error handler to prevent it from
545550
// closing the LanguageClient incorrectly when the socket

src/settings.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ export function load(): ISettings {
268268
// is the reason terminals on macOS typically run login shells by default which set up
269269
// the environment. See http://unix.stackexchange.com/a/119675/115410"
270270
configuration.get<IStartAsLoginShellSettings>("startAsLoginShell", defaultStartAsLoginShellSettings),
271-
cwd:
271+
cwd: // TODO: Should we resolve this path and/or default to a workspace folder?
272272
configuration.get<string>("cwd", null),
273273
};
274274
}

0 commit comments

Comments
 (0)