Skip to content

Commit 6784c95

Browse files
committed
Fix project selector test
1 parent e2b0f5a commit 6784c95

File tree

2 files changed

+4
-19
lines changed

2 files changed

+4
-19
lines changed

src/observers/ProjectStatusBarObserver.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
* Licensed under the MIT License. See License.txt in the project root for license information.
44
*--------------------------------------------------------------------------------------------*/
55

6-
import { basename, join } from 'path';
6+
import { basename } from 'path';
77
import { BaseEvent, WorkspaceInformationUpdated } from "../omnisharp/loggingEvents";
88
import { BaseStatusBarItemObserver } from './BaseStatusBarItemObserver';
99
import { EventType } from '../omnisharp/EventType';
@@ -27,22 +27,7 @@ export class ProjectStatusBarObserver extends BaseStatusBarItemObserver {
2727
let label: string;
2828
let msbuild = event.info.MsBuild;
2929
if (msbuild && msbuild.SolutionPath) {
30-
if (msbuild.SolutionPath.endsWith(".sln")) {
31-
label = basename(msbuild.SolutionPath);
32-
}
33-
else {
34-
// a project file was open, determine which project
35-
for (const project of msbuild.Projects) {
36-
// Get the project name.
37-
label = basename(project.Path);
38-
39-
// The solution path is the folder containing the open project. Combine it with the
40-
// project name and see if it matches the project's path.
41-
if (join(msbuild.SolutionPath, label) === project.Path) {
42-
break;
43-
}
44-
}
45-
}
30+
label = basename(msbuild.SolutionPath);
4631
this.SetAndShowStatusBar('$(file-directory) ' + label, 'o.pickProjectAndStart');
4732
}
4833
else {

src/omnisharp/server.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,8 +561,8 @@ export class OmniSharpServer {
561561

562562
// To maintain previous behavior when there are mulitple targets available,
563563
// launch with first Solution or Folder target.
564-
const firstFolderOrSolutionTarget = launchTargets.find(target => target.kind == LaunchTargetKind.Folder)
565-
?? launchTargets.find(target => target.kind == LaunchTargetKind.Solution);
564+
const firstFolderOrSolutionTarget = launchTargets
565+
.find(target => target.kind == LaunchTargetKind.Folder || target.kind == LaunchTargetKind.Solution);
566566
if (firstFolderOrSolutionTarget) {
567567
return this.restart(firstFolderOrSolutionTarget);
568568
}

0 commit comments

Comments
 (0)