Skip to content

Commit 2cd2b81

Browse files
authored
Merge pull request #5192 from 50Wliu/users/winstonliu/server-autostart-preferred-path-nullability
Fix nullability for autoStart preferredPath
2 parents 7b1f541 + da8b747 commit 2cd2b81

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

src/omnisharp/extension.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -199,7 +199,7 @@ export async function activate(context: vscode.ExtensionContext, packageJSON: an
199199
}));
200200

201201
if (options.autoStart) {
202-
server.autoStart(context.workspaceState.get<string>('lastSolutionPathOrFolder'));
202+
server.autoStart(context.workspaceState.get<string>('lastSolutionPathOrFolder', ''));
203203
}
204204

205205
// stop server on deactivate

src/omnisharp/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -546,7 +546,7 @@ export class OmniSharpServer {
546546
}
547547
}
548548

549-
public autoStart(preferredPath: string | undefined): Thenable<void> {
549+
public autoStart(preferredPath: string): Thenable<void> {
550550
const options = this.optionProvider.GetLatestOptions();
551551
return findLaunchTargets(options).then(async launchTargets => {
552552
// If there aren't any potential launch targets, we create file watcher and try to
@@ -582,7 +582,7 @@ export class OmniSharpServer {
582582

583583
// If there's more than one launch target, we start the server if one of the targets
584584
// matches the preferred path.
585-
if (preferredPath !== undefined) {
585+
if (preferredPath.length > 0) {
586586
const preferredLaunchTarget = launchTargets.find((a) => a.target === preferredPath);
587587
if (preferredLaunchTarget) {
588588
return this.restart(preferredLaunchTarget);

0 commit comments

Comments
 (0)