Skip to content

Commit

Permalink
Merge branch 'main' into native-coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
gcampbell-msft authored Nov 21, 2024
2 parents e3bf947 + 0b8ebcf commit a4b6ed1
Show file tree
Hide file tree
Showing 18 changed files with 59 additions and 45 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Improvements:
- Fix "Test output isn't visible when failed" and also mark skipped tests as so. [#4116](https://github.com/microsoft/vscode-cmake-tools/issues/4116)
- Ensure that stopping tests actually forces the tests to stop running. [#2095](https://github.com/microsoft/vscode-cmake-tools/issues/2095)
- Retire the Show Options Moved Notification [#4039](https://github.com/microsoft/vscode-cmake-tools/issues/4039)
- Improve the pinned commands experience by defaulting settings and using VS Code state rather than modifying user settings. [#3977](https://github.com/microsoft/vscode-cmake-tools/issues/3977)

Bug Fixes:

Expand All @@ -27,6 +28,7 @@ Bug Fixes:
- Ensure that we're sanitizing paths for `cmake.copyCompileCommands`. [#3874](https://github.com/microsoft/vscode-cmake-tools/issues/3874)
- Ensure that tests are updated after a build. [#4148](https://github.com/microsoft/vscode-cmake-tools/pull/4148)
- Fix various GCC compiler errors and GCC linker errors not showing up in Problems View [#2864](https://github.com/microsoft/vscode-cmake-tools/issues/2864)
- Fix reloading presets when included files are changed or renamed and updated. [#3963](https://github.com/microsoft/vscode-cmake-tools/issues/3963)

## 1.19.52

Expand Down
2 changes: 1 addition & 1 deletion i18n/chs/src/ctest.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"no.driver.found": "找不到文件夹 {0} 的驱动程序",
"ctest.args.not.found": "无法获取测试参数",
"test.results.not.found": "找不到测试结果。",
"test.failed.with.exit.code": "测试{0}失败,退出代码 {1}。",
"test.failed.with.exit.code": "{0}\n测试 {1} 失败,退出代码: {2}。",
"test.failed.with.completion.status": "测试{0}失败,完成状态为 \"{1}\"",
"test.failed": "测试{0}失败。有关详细信息,请检查输出。",
"ctest.run.cancelled": "已取消 CTest 运行",
Expand Down
2 changes: 1 addition & 1 deletion i18n/cht/src/ctest.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"no.driver.found": "找不到資料夾 {0} 的驅動程式",
"ctest.args.not.found": "無法取得測試引數",
"test.results.not.found": "找不到測試結果。",
"test.failed.with.exit.code": "測試 {0} 失敗,結束代碼為 {1}。",
"test.failed.with.exit.code": "{0}\n測試 {1} 失敗,結束代碼為 {2}。",
"test.failed.with.completion.status": "測試 {0} 失敗,完成狀態為「{1}」。",
"test.failed": "測試 {0} 失敗。如需詳細資訊,請檢查輸出。",
"ctest.run.cancelled": "已取消 CTest 執行",
Expand Down
2 changes: 1 addition & 1 deletion i18n/csy/src/ctest.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"no.driver.found": "Pro složku {0} se nenašel žádný ovladač.",
"ctest.args.not.found": "Nepovedlo se získat argumenty testu.",
"test.results.not.found": "Výsledky testu se nenašly.",
"test.failed.with.exit.code": "Test {0} byl neúspěšný s ukončovacím kódem {1}.",
"test.failed.with.exit.code": "{0}\nTest {1} byl neúspěšný s ukončovacím kódem {2}.",
"test.failed.with.completion.status": "Test {0} byl neúspěšný se stavem dokončení {1}.",
"test.failed": "Test {0} byl neúspěšný. Další informace najdete ve výstupu.",
"ctest.run.cancelled": "Spuštění příkazu CTest bylo zrušeno.",
Expand Down
2 changes: 1 addition & 1 deletion i18n/deu/src/ctest.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"no.driver.found": "Für den Ordner {0} wurde kein Treiber gefunden.",
"ctest.args.not.found": "Testargumente konnten nicht abgerufen werden.",
"test.results.not.found": "Die Testergebnisse wurden nicht gefunden.",
"test.failed.with.exit.code": "Fehler beim Test \"{0}\" mit Exitcode \"{1}\".",
"test.failed.with.exit.code": "{0}\nFehler beim Test „{1}“ mit Exitcode „{2}“.",
"test.failed.with.completion.status": "Fehler beim Test \"{0}\" mit dem Abschlussstatus \"{1}\".",
"test.failed": "Fehler beim Test \"{0}\". Weitere Informationen finden Sie in der Ausgabe.",
"ctest.run.cancelled": "C-Testlauf wurde abgebrochen.",
Expand Down
2 changes: 1 addition & 1 deletion i18n/esn/src/ctest.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"no.driver.found": "No se ha encontrado ningún controlador para la carpeta {0}",
"ctest.args.not.found": "No se pudieron obtener los argumentos de prueba",
"test.results.not.found": "No se encontraron los resultados de la prueba.",
"test.failed.with.exit.code": "La prueba {0} ha fallado con código {1} de salida .",
"test.failed.with.exit.code": "{0}\nError de prueba {1} con código de salida{2}.",
"test.failed.with.completion.status": "La prueba {0} fallida con estado de finalización \"{1}\".",
"test.failed": "La prueba {0} ha fallado. Compruebe el resultado para obtener más información.",
"ctest.run.cancelled": "Se canceló la ejecución de CTest",
Expand Down
2 changes: 1 addition & 1 deletion i18n/fra/src/ctest.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"no.driver.found": "Pilote introuvable pour le dossier {0}",
"ctest.args.not.found": "Impossible d’obtenir les arguments de test",
"test.results.not.found": "Résultats des tests introuvables.",
"test.failed.with.exit.code": "Échec du test {0} avec le code de sortie {1}.",
"test.failed.with.exit.code": "{0}\nÉchec du test {1} avec le code de sortie {2}.",
"test.failed.with.completion.status": "Échec du test {0} avec l’état d’achèvement « {1} ».",
"test.failed": "Échec du test {0}. Pour plus d’informations, consultez la sortie.",
"ctest.run.cancelled": "L’exécution de CTest a été annulée",
Expand Down
2 changes: 1 addition & 1 deletion i18n/ita/src/ctest.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"no.driver.found": "Nessun driver trovato per la cartella {0}",
"ctest.args.not.found": "Non è stato possibile ottenere gli argomenti di test",
"test.results.not.found": "Risultati del test non trovati.",
"test.failed.with.exit.code": "Test {0} non riuscito con codice di uscita {1}.",
"test.failed.with.exit.code": "{0}\nTest {1} non riuscito con codice di uscita {2}.",
"test.failed.with.completion.status": "Test {0} non riuscito con stato di completamento \"{1}\".",
"test.failed": "Test {0} non riuscito. Per altre informazioni, controllare l'output.",
"ctest.run.cancelled": "Esecuzione CTest annullata",
Expand Down
2 changes: 1 addition & 1 deletion i18n/jpn/src/ctest.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"no.driver.found": "フォルダー {0} のドライバーが見つかりません",
"ctest.args.not.found": "テスト引数を取得できませんでした",
"test.results.not.found": "テスト結果が見つかりません。",
"test.failed.with.exit.code": "テスト {0} が終了コード {1} で失敗しました。",
"test.failed.with.exit.code": "{0}\nテスト {1} が終了コード {2} で失敗しました。",
"test.failed.with.completion.status": "テスト {0} が完了状態 \"{1}\" で失敗しました。",
"test.failed": "テスト {0} に失敗しました。詳細については、出力を確認してください。",
"ctest.run.cancelled": "CTest の実行が取り消されました",
Expand Down
2 changes: 1 addition & 1 deletion i18n/kor/src/ctest.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"no.driver.found": "{0} 폴더에 대한 드라이버를 찾을 수 없습니다.",
"ctest.args.not.found": "테스트 인수를 가져올 수 없습니다.",
"test.results.not.found": "테스트 결과를 찾을 수 없습니다.",
"test.failed.with.exit.code": "종료 코드 {1}을(를) 반환하며 테스트 {0}에 실패했습니다.",
"test.failed.with.exit.code": "{0}\n종료 코드 {2}을(를) 반환하며 테스트 {1}에 실패했습니다.",
"test.failed.with.completion.status": "완료 상태 \" {1} \"(으)로 테스트 {0}에 실패했습니다.",
"test.failed": "테스트 {0}에 실패했습니다. 자세한 내용은 출력을 확인하세요.",
"ctest.run.cancelled": "CTest 실행이 취소됨",
Expand Down
2 changes: 1 addition & 1 deletion i18n/plk/src/ctest.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"no.driver.found": "Nie znaleziono sterownika dla folderu {0}",
"ctest.args.not.found": "Nie można pobrać argumentów testu",
"test.results.not.found": "Nie znaleziono wyników testu.",
"test.failed.with.exit.code": "Test {0} zakończył się niepowodzeniem z kodem zakończenia {1}.",
"test.failed.with.exit.code": "{0}\nTest {1} zakończył się niepowodzeniem z kodem zakończenia {2}.",
"test.failed.with.completion.status": "Test {0} nie powiódł się ze statusem ukończenia „{1}”.",
"test.failed": "Test {0} nie powiódł się. Sprawdź dane wyjściowe, aby uzyskać więcej informacji.",
"ctest.run.cancelled": "Przebieg narzędzia CTest został anulowany",
Expand Down
2 changes: 1 addition & 1 deletion i18n/ptb/src/ctest.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"no.driver.found": "Nenhum driver encontrado na pasta {0}",
"ctest.args.not.found": "Não foi possível obter argumentos de teste",
"test.results.not.found": "Resultados do teste não encontrados.",
"test.failed.with.exit.code": "Ocorreu um erro no {0} teste com o código de saída {1}.",
"test.failed.with.exit.code": "{0}\nO teste {1} falhou com código de saída {2}.",
"test.failed.with.completion.status": "Ocorreu um erro no {0} teste com o status de conclusão \"{1}\".",
"test.failed": "Ocorreu um erro no {0} teste. Verifique a saída para obter mais informações.",
"ctest.run.cancelled": "A execução do teste foi cancelada",
Expand Down
2 changes: 1 addition & 1 deletion i18n/rus/src/ctest.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"no.driver.found": "Не найден драйвер для папки {0}",
"ctest.args.not.found": "Не удалось получить тестовые аргументы",
"test.results.not.found": "Результаты теста не найдены.",
"test.failed.with.exit.code": "Сбой теста {0}. Код выхода: {1}.",
"test.failed.with.exit.code": "{0}\nСбой теста {1}. Код выхода: {2}.",
"test.failed.with.completion.status": "Сбой теста {0} с состоянием завершения \"{1}\".",
"test.failed": "Сбой теста {0}. Дополнительные сведения см. в выходных данных.",
"ctest.run.cancelled": "Запуск CTest отменен",
Expand Down
2 changes: 1 addition & 1 deletion i18n/trk/src/ctest.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"no.driver.found": "{0} klasörü için sürücü bulunamadı",
"ctest.args.not.found": "Test bağımsız değişkenleri alınamadı",
"test.results.not.found": "Test sonuçları bulunamadı.",
"test.failed.with.exit.code": "{0} testi {1} çıkış kodu ile başarısız oldu.",
"test.failed.with.exit.code": "{0}\n{1} testi {2} çıkış kodu ile başarısız oldu.",
"test.failed.with.completion.status": "{0} testi, \"{1}\" tamamlanma durumuyla başarısız oldu.",
"test.failed": "{0} testi başarısız oldu. Daha fazla bilgi için lütfen çıkışa bakın.",
"ctest.run.cancelled": "CTest çalıştırması iptal edildi",
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3578,7 +3578,10 @@
"type": "string"
},
"description": "%cmake-tools.configuration.cmake.pinnedCommands.description%",
"default": [],
"default": [
"workbench.action.tasks.configureTaskRunner",
"workbench.action.tasks.runTask"
],
"scope": "resource"
},
"cmake.enableAutomaticKitScan": {
Expand Down
2 changes: 1 addition & 1 deletion package.nls.json
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@
},
"cmake-tools.configuration.cmake.launchBehavior.description": "Controls what happens with the launch terminal when you launch a target.",
"cmake-tools.configuration.cmake.automaticReconfigure.description": "Automatically configure CMake project directories when the kit or the configuration preset is changed.",
"cmake-tools.configuration.cmake.pinnedCommands.description":"List of CMake commands to pin.",
"cmake-tools.configuration.cmake.pinnedCommands.description":"List of CMake commands to always pin by default.",
"cmake-tools.configuration.cmake.enableAutomaticKitScan.description": "Enable automatic scanning for kits when a kit isn't selected. This will only take affect when CMake Presets aren't being used.",
"cmake-tools.configuration.cmake.preRunCoverageTarget.description": "Target to build before running tests with coverage using the test explorer",
"cmake-tools.configuration.cmake.postRunCoverageTarget.description": "Target to build after running tests with coverage using the test explorer",
Expand Down
22 changes: 19 additions & 3 deletions src/presets/presetsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ export class PresetsController implements vscode.Disposable {
// there might be timing issues, since listeners are invoked async.
await presetsController.reapplyPresets();

await presetsController.watchPresetsChange();

project.workspaceContext.config.onChange('allowCommentsInPresetsFile', async () => {
await presetsController.reapplyPresets();
vscode.workspace.textDocuments.forEach(doc => {
Expand Down Expand Up @@ -140,7 +138,8 @@ export class PresetsController implements vscode.Disposable {
// Need to reapply presets every time presets changed since the binary dir or cmake path could change
// (need to clean or reload driver)
async reapplyPresets() {
const referencedFiles: Map<string, preset.PresetsFile | undefined> = new Map();
const referencedFiles: Map<string, preset.PresetsFile | undefined> =
new Map();

// Reset all changes due to expansion since parents could change
await this._presetsParser.resetPresetsFiles(
Expand All @@ -158,6 +157,8 @@ export class PresetsController implements vscode.Disposable {
await this.setConfigurePreset(this.project.configurePreset.name);
}
// Don't need to set build/test presets here since they are reapplied in setConfigurePreset

await this.watchPresetsChange();
}

private showNameInputBox() {
Expand Down Expand Up @@ -1620,10 +1621,25 @@ export class PresetsController implements vscode.Disposable {
*/
class FileWatcher implements vscode.Disposable {
private watchers: Map<string, chokidar.FSWatcher>;
// Debounce the change handler to avoid multiple changes being triggered by a single file change. Two change events are coming in rapid succession without this.
private canRunChangeHandler = true;

public constructor(paths: string | string[], eventHandlers: Map<string, () => void>, options?: chokidar.WatchOptions) {
this.watchers = new Map<string, chokidar.FSWatcher>();

// We debounce the change event to avoid multiple changes being triggered by a single file change.
const onChange = eventHandlers.get('change');
if (onChange) {
const debouncedOnChange = () => {
if (this.canRunChangeHandler) {
onChange();
this.canRunChangeHandler = false;
setTimeout(() => (this.canRunChangeHandler = true), 500);
}
};
eventHandlers.set("change", debouncedOnChange);
}

for (const path of Array.isArray(paths) ? paths : [paths]) {
try {
const watcher = chokidar.watch(path, { ...options });
Expand Down
47 changes: 20 additions & 27 deletions src/ui/pinnedCommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ nls.config({ messageFormat: nls.MessageFormat.bundle, bundleFormat: nls.BundleFo
const localize: nls.LocalizeFunc = nls.loadMessageBundle();
const log = logging.createLogger('pinnedCommands');
const defaultTaskCommands: string[] = ["workbench.action.tasks.configureTaskRunner", "workbench.action.tasks.runTask"];
const mementoKey = "pinDefaultTasks";

interface PinnedCommandsQuickPickItem extends vscode.QuickPickItem {
command: string;
Expand Down Expand Up @@ -97,7 +96,6 @@ class PinnedCommandsTreeDataProvider implements vscode.TreeDataProvider<PinnedCo
private config: vscode.WorkspaceConfiguration | null;
private pinnedCommandsKey: string = "cmake.pinnedCommands";
private isInitialized = false;
private pinDefaultTasks = true;
private readonly _settingsSub ;
private extensionContext: vscode.ExtensionContext;

Expand All @@ -106,7 +104,6 @@ class PinnedCommandsTreeDataProvider implements vscode.TreeDataProvider<PinnedCo
this._settingsSub = configReader.onChange('pinnedCommands', () => this.doConfigureSettingsChange());
this.config = vscode.workspace.getConfiguration();
this.extensionContext = extensionContext;
this.pinDefaultTasks = this.extensionContext.globalState.get(mementoKey) === undefined; // the user has not unpinned any of the tasks commands yet.
onExtensionActiveCommandsChanged(this.doConfigureSettingsChange, this);
}

Expand All @@ -118,29 +115,29 @@ class PinnedCommandsTreeDataProvider implements vscode.TreeDataProvider<PinnedCo
this.config = vscode.workspace.getConfiguration();
this.pinnedCommands = []; //reset to empty list.
const localization = getExtensionLocalizedStrings();
if (this.config.has(this.pinnedCommandsKey)) {
const settingsPinnedCommands = this.config.get(this.pinnedCommandsKey) as string[];
const activeCommands = new Set<string>(PinnedCommands.getPinnableCommands());
for (const commandName of settingsPinnedCommands) {
const label = localization[`cmake-tools.command.${commandName}.title`];
const activeCommands = new Set<string>(PinnedCommands.getPinnableCommands());

const tryPushCommands = (commands: string[]) => {
commands.forEach((x) => {
const label = localization[`cmake-tools.command.${x}.title`];
if (this.findNode(label) === -1) {
// only show commands that are contained in the active commands for the extension.
this.pinnedCommands.push(new PinnedCommandNode(label, commandName, activeCommands.has(commandName)));
this.pinnedCommands.push(new PinnedCommandNode(label, x, activeCommands.has(x)));
}
}
});
};

// Pin the commands that are requested from the users settings.
if (this.config.has(this.pinnedCommandsKey)) {
const settingsPinnedCommands = this.config.get(this.pinnedCommandsKey) as string[];
tryPushCommands(settingsPinnedCommands);
}

if (this.pinDefaultTasks) {
if (this.pinnedCommands.filter(x => defaultTaskCommands.includes(x.commandName)).length !== defaultTaskCommands.length) {
defaultTaskCommands.forEach((x) => {
const label = localization[`cmake-tools.command.${x}.title`];
if (this.findNode(label) === -1) {
this.pinnedCommands.push(new PinnedCommandNode(label, x, true));
}
});
await this.updateSettings();
}
// Pin commands that were pinned in the last session.
const lastSessionPinnedCommands = this.extensionContext.workspaceState.get(this.pinnedCommandsKey) as string[];
if (lastSessionPinnedCommands) {
tryPushCommands(lastSessionPinnedCommands);
}

this.isInitialized = true;
}

Expand Down Expand Up @@ -174,10 +171,6 @@ class PinnedCommandsTreeDataProvider implements vscode.TreeDataProvider<PinnedCo
this.pinnedCommands.splice(index, 1);
await this.refresh();
}
if (this.pinDefaultTasks && defaultTaskCommands.includes(node.commandName)) {
await this.extensionContext.globalState.update(mementoKey, false);
this.pinDefaultTasks = false;
}
await this.updateSettings();
}

Expand All @@ -191,8 +184,8 @@ class PinnedCommandsTreeDataProvider implements vscode.TreeDataProvider<PinnedCo

async updateSettings() {
if (this.config) {
const newValue: string[] = this.pinnedCommands.map(x => x.commandName);
await this.config.update(this.pinnedCommandsKey, newValue, true); // update global
const pinnedCommands: string[] = this.pinnedCommands.map(x => x.commandName);
await this.extensionContext.workspaceState.update(this.pinnedCommandsKey, pinnedCommands);
}
}

Expand Down

0 comments on commit a4b6ed1

Please sign in to comment.