@@ -24,11 +24,11 @@ export enum LaunchTargetKind {
2424 * Represents the project or solution that OmniSharp is to be launched with.
2525 * */
2626export interface LaunchTarget {
27- label : string ;
28- description : string ;
29- directory : string ;
30- target : string ;
31- kind : LaunchTargetKind ;
27+ label : string ;
28+ description : string ;
29+ directory : string ;
30+ target : string ;
31+ kind : LaunchTargetKind ;
3232}
3333
3434export function getDefaultFlavor ( kind : LaunchTargetKind ) {
@@ -47,7 +47,8 @@ export function getDefaultFlavor(kind: LaunchTargetKind) {
4747/**
4848 * Returns a list of potential targets on which OmniSharp can be launched.
4949 * This includes `project.json` files, `*.sln` files (if any `*.csproj` files are found), and the root folder
50- * (if it doesn't contain a `project.json` file, but `project.json` files exist).
50+ * (if it doesn't contain a `project.json` file, but `project.json` files exist). In addition, the root folder
51+ * is included if there are any `*.csproj` files present, but a `*.sln* file is not found.
5152 */
5253export function findLaunchTargets ( ) : Thenable < LaunchTarget [ ] > {
5354 if ( ! vscode . workspace . rootPath ) {
@@ -68,6 +69,7 @@ function select(resources: vscode.Uri[], rootPath: string): LaunchTarget[] {
6869 // * If there are .csproj files, .sln files are considered as launch targets.
6970 // * Any project.json file is considered a launch target.
7071 // * If there is no project.json file in the root, the root as added as a launch target.
72+ // * Additionally, if there are .csproj files, but no .sln file, the root is added as a launch target.
7173 //
7274 // TODO:
7375 // * It should be possible to choose a .csproj as a launch target
@@ -80,6 +82,7 @@ function select(resources: vscode.Uri[], rootPath: string): LaunchTarget[] {
8082
8183 let targets : LaunchTarget [ ] = [ ] ,
8284 hasCsProjFiles = false ,
85+ hasSlnFile = false ,
8386 hasProjectJson = false ,
8487 hasProjectJsonAtRoot = false ;
8588
@@ -88,6 +91,8 @@ function select(resources: vscode.Uri[], rootPath: string): LaunchTarget[] {
8891 resources . forEach ( resource => {
8992 // Add .sln files if there are .csproj files
9093 if ( hasCsProjFiles && isSolution ( resource ) ) {
94+ hasSlnFile = true ;
95+
9196 targets . push ( {
9297 label : path . basename ( resource . fsPath ) ,
9398 description : vscode . workspace . asRelativePath ( path . dirname ( resource . fsPath ) ) ,
@@ -113,8 +118,10 @@ function select(resources: vscode.Uri[], rootPath: string): LaunchTarget[] {
113118 }
114119 } ) ;
115120
116- // Add the root folder if there are project.json files, but none in the root.
117- if ( hasProjectJson && ! hasProjectJsonAtRoot ) {
121+ // Add the root folder under the following circumstances:
122+ // * If there are .csproj files, but no .sln file, and none in the root.
123+ // * If there are project.json files, but none in the root.
124+ if ( ( hasCsProjFiles && ! hasSlnFile ) || ( hasProjectJson && ! hasProjectJsonAtRoot ) ) {
118125 targets . push ( {
119126 label : path . basename ( rootPath ) ,
120127 description : '' ,
0 commit comments