Add guard against reloading a file that's not a variants file (#3878)

* Add guard against reloading a file that's not a variants file

* Update CHANGELOG.md

* Update CHANGELOG.md
This commit is contained in:
Jonathan Phippen 2024-07-09 10:40:13 -07:00 коммит произвёл GitHub
Родитель 433561885d
Коммит b7951a7213
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
2 изменённых файлов: 17 добавлений и 9 удалений

Просмотреть файл

@ -1,5 +1,12 @@
# What's New?
## 1.19.0
Bug Fixes:
- Fix issue where `cmake.preferredGenerators` wasn't falling back to the next entry when the first entry didn't exist [#2709](https://github.com/microsoft/vscode-cmake-tools/issues/2709)
- Potential fix for attempting to load a non-variants file as a variants file and throwing a parse exception [#3727](https://github.com/microsoft/vscode-cmake-tools/issues/3727)
## 1.18.43
Features:
@ -21,7 +28,6 @@ Bug Fixes:
- Fix issue where `preferredGenerator.platform` and `preferredGenerator.toolset` wasn't being compared between the old and new kit to trigger a clean configure on a kit selection change. [#2699](https://github.com/microsoft/vscode-cmake-tools/issues/2699)
- Still allow for users to add `--warn-unused-cli`. Now instead of overriding, it will remove our default `--no-warn-unused-cli`. [#1090](https://github.com/microsoft/vscode-cmake-tools/issues/1090)
- Ensure `useCMakePresets` context is set after making a CMakePreset.json with `Quick Start`. [#3734](https://github.com/microsoft/vscode-cmake-tools/issues/3734)
- Fix issue where `cmake.preferredGenerators` wasn't falling back to the next entry when the first entry didn't exist [#2709](https://github.com/microsoft/vscode-cmake-tools/issues/2709)
## 1.18.42

Просмотреть файл

@ -233,14 +233,16 @@ export class VariantManager implements vscode.Disposable {
this.customVariantsFileExists = false;
const validate = await loadSchema('./schemas/variants-schema.json');
if (!filepath || !await fs.exists(filepath)) {
const workspaceFolder: string = this.workspaceFolder.uri.fsPath;
const candidates = [
path.join(workspaceFolder, 'cmake-variants.json'),
path.join(workspaceFolder, 'cmake-variants.yaml'),
path.join(workspaceFolder, '.vscode/cmake-variants.json'),
path.join(workspaceFolder, '.vscode/cmake-variants.yaml')
];
// Variants file should be one of these four options
const workspaceFolder: string = this.workspaceFolder.uri.fsPath;
const candidates = [
path.join(workspaceFolder, 'cmake-variants.json'),
path.join(workspaceFolder, 'cmake-variants.yaml'),
path.join(workspaceFolder, '.vscode/cmake-variants.json'),
path.join(workspaceFolder, '.vscode/cmake-variants.yaml')
];
if (!filepath || !await fs.exists(filepath) || !candidates.includes(filepath)) {
for (const testpath of candidates) {
if (await fs.exists(testpath)) {
filepath = testpath;