@@ -16,7 +16,8 @@ import { Options } from './options';
1616export enum LaunchTargetKind {
1717 Solution ,
1818 ProjectJson ,
19- Folder
19+ Folder ,
20+ Csx
2021}
2122
2223/**
@@ -44,7 +45,7 @@ export function findLaunchTargets(): Thenable<LaunchTarget[]> {
4445 const options = Options . Read ( ) ;
4546
4647 return vscode . workspace . findFiles (
47- /*include*/ '{**/*.sln,**/*.csproj,**/project.json}' ,
48+ /*include*/ '{**/*.sln,**/*.csproj,**/project.json,**/*.csx }' ,
4849 /*exclude*/ '{**/node_modules/**,**/.git/**,**/bower_components/**}' ,
4950 /*maxResults*/ options . maxProjectResults )
5051 . then ( resources => {
@@ -72,7 +73,8 @@ function select(resources: vscode.Uri[], rootPath: string): LaunchTarget[] {
7273 hasCsProjFiles = false ,
7374 hasSlnFile = false ,
7475 hasProjectJson = false ,
75- hasProjectJsonAtRoot = false ;
76+ hasProjectJsonAtRoot = false ,
77+ hasCSX = false ;
7678
7779 hasCsProjFiles = resources . some ( isCSharpProject ) ;
7880
@@ -104,6 +106,11 @@ function select(resources: vscode.Uri[], rootPath: string): LaunchTarget[] {
104106 kind : LaunchTargetKind . ProjectJson
105107 } ) ;
106108 }
109+
110+ // Discover if there is any CSX file
111+ if ( ! hasCSX && isCsx ( resource ) ) {
112+ hasCSX = true ;
113+ }
107114 } ) ;
108115
109116 // Add the root folder under the following circumstances:
@@ -119,6 +126,17 @@ function select(resources: vscode.Uri[], rootPath: string): LaunchTarget[] {
119126 } ) ;
120127 }
121128
129+ // if we noticed any CSX file(s), add a single CSX-specific target pointing at the root folder
130+ if ( hasCSX ) {
131+ targets . push ( {
132+ label : "CSX" ,
133+ description : path . basename ( rootPath ) ,
134+ target : rootPath ,
135+ directory : rootPath ,
136+ kind : LaunchTargetKind . Csx
137+ } ) ;
138+ }
139+
122140 return targets . sort ( ( a , b ) => a . directory . localeCompare ( b . directory ) ) ;
123141}
124142
@@ -134,6 +152,10 @@ function isProjectJson(resource: vscode.Uri): boolean {
134152 return / \pr o j e c t .j s o n $ / i. test ( resource . fsPath ) ;
135153}
136154
155+ function isCsx ( resource : vscode . Uri ) : boolean {
156+ return / \. c s x $ / i. test ( resource . fsPath ) ;
157+ }
158+
137159export interface LaunchResult {
138160 process : ChildProcess ;
139161 command : string ;
0 commit comments