Skip to content

Commit cd83d0a

Browse files
committed
Fix project detection to handle many CS files
1 parent 799416d commit cd83d0a

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/omnisharp/launcher.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,22 @@ export interface LaunchTarget {
3737
* (if it doesn't contain a `project.json` file, but `project.json` files exist). In addition, the root folder
3838
* is included if there are any `*.csproj` files present, but a `*.sln* file is not found.
3939
*/
40-
export function findLaunchTargets(options: Options): Thenable<LaunchTarget[]> {
40+
export async function findLaunchTargets(options: Options): Promise<LaunchTarget[]> {
4141
if (!vscode.workspace.workspaceFolders) {
4242
return Promise.resolve([]);
4343
}
4444

45-
return vscode.workspace.findFiles(
46-
/*include*/ '{**/*.sln,**/*.csproj,**/project.json,**/*.csx,**/*.cake,**/*.cs}',
47-
/*exclude*/ '{**/node_modules/**,**/.git/**,**/bower_components/**}',
48-
/*maxResults*/ options.maxProjectResults)
49-
.then(resourcesToLaunchTargets);
45+
const projectFiles = await vscode.workspace.findFiles(
46+
/*include*/ '{**/*.sln,**/*.csproj,**/project.json,**/*.csx,**/*.cake}',
47+
/*exclude*/ '{**/node_modules/**,**/.git/**,**/bower_components/**}',
48+
/*maxResults*/ options.maxProjectResults);
49+
50+
const csFiles = await vscode.workspace.findFiles(
51+
/*include*/ '{**/*.cs}',
52+
/*exclude*/ '{**/node_modules/**,**/.git/**,**/bower_components/**}',
53+
/*maxResults*/ options.maxProjectResults);
54+
55+
return resourcesToLaunchTargets(projectFiles.concat(csFiles));
5056
}
5157

5258
function resourcesToLaunchTargets(resources: vscode.Uri[]): LaunchTarget[] {

0 commit comments

Comments
 (0)