From 8a76ebe06114d0affb826c247103b98c7d629b7e Mon Sep 17 00:00:00 2001 From: paulober <44974737+paulober@users.noreply.github.com> Date: Wed, 8 May 2024 16:19:14 +0200 Subject: [PATCH] Added support for updating the forcedInclude paths on SDK change Signed-off-by: paulober <44974737+paulober@users.noreply.github.com> --- src/utils/vscodeConfigUtil.mts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/utils/vscodeConfigUtil.mts b/src/utils/vscodeConfigUtil.mts index d20d84d0..28eff790 100644 --- a/src/utils/vscodeConfigUtil.mts +++ b/src/utils/vscodeConfigUtil.mts @@ -7,6 +7,7 @@ import { dirname } from "path/posix"; interface Configuration { includePath: string[]; + forcedInclude: string[]; compilerPath: string; } @@ -32,6 +33,16 @@ async function updateCppPropertiesFile( ); // Add the new pico-sdk includePath config.includePath.push(`\${userHome}/.pico-sdk/sdk/${newSDKVersion}/**`); + + // Remove the old pico-sdk forcedInclude values set by this extension + config.forcedInclude = config.forcedInclude.filter( + item => !item.startsWith("${userHome}/.pico-sdk") + ); + // Add the new pico-sdk forcedInclude + config.forcedInclude.push( + `\${userHome}/.pico-sdk/sdk/${newSDKVersion}/src/common/pico_base/include/pico.h` + ); + // Update the compilerPath config.compilerPath = "${userHome}/.pico-sdk/toolchain" +