Skip to content

Commit 63ae97f

Browse files
committed
Simplify finding launchsettings.json
1 parent 9ebaa32 commit 63ae97f

File tree

1 file changed

+14
-18
lines changed

1 file changed

+14
-18
lines changed

src/omnisharp/utils.ts

Lines changed: 14 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -178,27 +178,23 @@ function isBlazorWebAssemblyHosted(project: protocol.MSBuildProject, isProjectBl
178178

179179
async function isBlazorWebAssemblyProject(project: MSBuildProject): Promise<boolean> {
180180
const projectDirectory = path.dirname(project.Path);
181-
const launchSettingsPattern = new vscode.RelativePattern(projectDirectory, '**/launchSettings.json');
182-
const excludedPathPattern = `{${Options.getExcludedPaths(vscode, true).join(',')}}`;
181+
const launchSettingsPath = path.join(projectDirectory, 'Properties', 'launchSettings.json');
183182

184-
const launchSettings = await vscode.workspace.findFiles(launchSettingsPattern, excludedPathPattern);
185-
if (!launchSettings) {
186-
return false;
187-
}
183+
try {
184+
if (!fs.pathExistsSync(launchSettingsPath)) {
185+
return false;
186+
}
187+
188+
const launchSettingContent = fs.readFileSync(launchSettingsPath);
189+
if (!launchSettingContent) {
190+
return false;
191+
}
188192

189-
for (const launchSetting of launchSettings) {
190-
try {
191-
const launchSettingContent = fs.readFileSync(launchSetting.fsPath);
192-
if (!launchSettingContent) {
193-
continue;
194-
}
195-
196-
if (launchSettingContent.indexOf('"inspectUri"') > 0) {
197-
return true;
198-
}
199-
} catch {
200-
// Swallow IO errors from reading the launchSettings.json files
193+
if (launchSettingContent.indexOf('"inspectUri"') > 0) {
194+
return true;
201195
}
196+
} catch {
197+
// Swallow IO errors from reading the launchSettings.json files
202198
}
203199

204200
return false;

0 commit comments

Comments
 (0)