Skip to content

Commit ed1fd80

Browse files
committed
Merge branch 'main' of https://github.com/microsoft/vscode-cpptools into main
2 parents 94e02c7 + e655870 commit ed1fd80

File tree

1 file changed

+13
-21
lines changed

1 file changed

+13
-21
lines changed

Extension/src/LanguageServer/settings.ts

Lines changed: 13 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -712,29 +712,21 @@ export class CppSettings extends Settings {
712712
return true;
713713
}
714714
}
715-
if (editorConfigSettings.root !== undefined) {
716-
if (typeof editorConfigSettings.root === "boolean") {
717-
if (editorConfigSettings.root) {
718-
return true;
719-
}
720-
} else if (typeof editorConfigSettings.root === "string") {
721-
if (editorConfigSettings.root.toLowerCase() === "true") {
722-
return true;
723-
}
724-
}
725-
}
726-
} else {
727-
const clangFormatPath1: string = path.join(parentPath, ".clang-format");
728-
if (fs.existsSync(clangFormatPath1)) {
729-
return true;
730-
} else {
731-
const clangFormatPath2: string = path.join(parentPath, "_clang-format");
732-
if (fs.existsSync(clangFormatPath2)) {
733-
return true;
734-
}
715+
switch (typeof editorConfigSettings.root) {
716+
case "boolean":
717+
return editorConfigSettings.root;
718+
case "string":
719+
return editorConfigSettings.root.toLowerCase() === "true";
720+
default:
721+
return false;
735722
}
736723
}
737-
return false;
724+
const clangFormatPath1: string = path.join(parentPath, ".clang-format");
725+
if (fs.existsSync(clangFormatPath1)) {
726+
return true;
727+
}
728+
const clangFormatPath2: string = path.join(parentPath, "_clang-format");
729+
return fs.existsSync(clangFormatPath2);
738730
};
739731
// Scan parent paths to see which we find first, ".clang-format" or ".editorconfig"
740732
const fsPath: string = document.uri.fsPath;

0 commit comments

Comments
 (0)