From 44e51ca477ac78247f7d0a46bff3869ef99323a7 Mon Sep 17 00:00:00 2001 From: NickGuyver Date: Thu, 10 Oct 2024 06:37:17 -0700 Subject: [PATCH 1/7] Fix CMAKE_DO_NOT_EDIT_HEADER_PREFIX grammar --- src/utils/cmakeUtil.mts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/utils/cmakeUtil.mts b/src/utils/cmakeUtil.mts index 8608c30..c2fc11e 100644 --- a/src/utils/cmakeUtil.mts +++ b/src/utils/cmakeUtil.mts @@ -15,7 +15,7 @@ import { buildCMakeIncPath } from "./download.mjs"; export const CMAKE_DO_NOT_EDIT_HEADER_PREFIX = // eslint-disable-next-line max-len - "== DO NEVER EDIT THE NEXT LINES for Raspberry Pi Pico VS Code Extension to work =="; + "== DO NOT EDIT THE FOLLOWING LINES for the Raspberry Pi Pico VS Code Extension to work =="; export async function getPythonPath(): Promise { const settings = Settings.getInstance(); From 7dac9202986967848dd3c8578227e75704c59f5d Mon Sep 17 00:00:00 2001 From: NickGuyver Date: Thu, 10 Oct 2024 07:03:19 -0700 Subject: [PATCH 2/7] Update pico_project.py --- scripts/pico_project.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/pico_project.py b/scripts/pico_project.py index fe9bd40..a18e352 100644 --- a/scripts/pico_project.py +++ b/scripts/pico_project.py @@ -583,9 +583,9 @@ def GenerateCMake(folder, params): "# (note this can come from environment, CMake cache etc)\n\n" ) - # if you change the do never edit headline you need to change the check for it in extension.mts + # if you change the do not edit headline you need to change the check for it in extension.mts cmake_header_us = ( - "# == DO NEVER EDIT THE NEXT LINES for Raspberry Pi Pico VS Code Extension to work ==\n" + "# == DO NOT EDIT THE FOLLOWING LINES for the Raspberry Pi Pico VS Code Extension to work ==\n" "if(WIN32)\n" " set(USERHOME $ENV{USERPROFILE})\n" "else()\n" From 1e9f0014c89662db4277ccefcdd94665f3132a07 Mon Sep 17 00:00:00 2001 From: NickGuyver Date: Thu, 10 Oct 2024 08:21:05 -0700 Subject: [PATCH 3/7] Update cmakeUtil.mts --- src/utils/cmakeUtil.mts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/utils/cmakeUtil.mts b/src/utils/cmakeUtil.mts index c2fc11e..6522a34 100644 --- a/src/utils/cmakeUtil.mts +++ b/src/utils/cmakeUtil.mts @@ -16,6 +16,8 @@ import { buildCMakeIncPath } from "./download.mjs"; export const CMAKE_DO_NOT_EDIT_HEADER_PREFIX = // eslint-disable-next-line max-len "== DO NOT EDIT THE FOLLOWING LINES for the Raspberry Pi Pico VS Code Extension to work =="; +export const CMAKE_DO_NOT_EDIT_HEADER_PREFIX_OLD = + "== DO NEVER EDIT THE NEXT LINES for the Raspberry Pi Pico VS Code Extension to work =="; export async function getPythonPath(): Promise { const settings = Settings.getInstance(); @@ -333,7 +335,7 @@ export async function cmakeUpdateSDK( const cmakeFilePath = join(folder.fsPath, "CMakeLists.txt"); // This regex requires multiline (m) and dotall (s) flags to work const updateSectionRegex = new RegExp( - `^# ${CMAKE_DO_NOT_EDIT_HEADER_PREFIX}.*# =+$`, + `^# (${CMAKE_DO_NOT_EDIT_HEADER_PREFIX}|${CMAKE_DO_NOT_EDIT_HEADER_PREFIX_OLD}).*# =+$`, "ms" ); const picoBoardRegex = /^set\(PICO_BOARD\s+([^)]+)\)$/m; From 80cf850ae3259f35cd4077a06eeb4f5b91db72c0 Mon Sep 17 00:00:00 2001 From: NickGuyver Date: Tue, 15 Oct 2024 07:19:42 -0700 Subject: [PATCH 4/7] Update src/utils/cmakeUtil.mts Co-authored-by: will-v-pi <108662275+will-v-pi@users.noreply.github.com> --- src/utils/cmakeUtil.mts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/cmakeUtil.mts b/src/utils/cmakeUtil.mts index 6522a34..594d0a9 100644 --- a/src/utils/cmakeUtil.mts +++ b/src/utils/cmakeUtil.mts @@ -17,7 +17,8 @@ export const CMAKE_DO_NOT_EDIT_HEADER_PREFIX = // eslint-disable-next-line max-len "== DO NOT EDIT THE FOLLOWING LINES for the Raspberry Pi Pico VS Code Extension to work =="; export const CMAKE_DO_NOT_EDIT_HEADER_PREFIX_OLD = - "== DO NEVER EDIT THE NEXT LINES for the Raspberry Pi Pico VS Code Extension to work =="; +// eslint-disable-next-line max-len + "== DO NEVER EDIT THE NEXT LINES for Raspberry Pi Pico VS Code Extension to work =="; export async function getPythonPath(): Promise { const settings = Settings.getInstance(); From 64ce5ef2565911f6d05e411f28185fb383d5d496 Mon Sep 17 00:00:00 2001 From: NickGuyver Date: Tue, 15 Oct 2024 07:19:54 -0700 Subject: [PATCH 5/7] Update src/utils/cmakeUtil.mts Co-authored-by: will-v-pi <108662275+will-v-pi@users.noreply.github.com> --- src/utils/cmakeUtil.mts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/utils/cmakeUtil.mts b/src/utils/cmakeUtil.mts index 594d0a9..41927fd 100644 --- a/src/utils/cmakeUtil.mts +++ b/src/utils/cmakeUtil.mts @@ -336,7 +336,8 @@ export async function cmakeUpdateSDK( const cmakeFilePath = join(folder.fsPath, "CMakeLists.txt"); // This regex requires multiline (m) and dotall (s) flags to work const updateSectionRegex = new RegExp( - `^# (${CMAKE_DO_NOT_EDIT_HEADER_PREFIX}|${CMAKE_DO_NOT_EDIT_HEADER_PREFIX_OLD}).*# =+$`, + `^# (${CMAKE_DO_NOT_EDIT_HEADER_PREFIX}` + + `|${CMAKE_DO_NOT_EDIT_HEADER_PREFIX_OLD}).*# =+$`, "ms" ); const picoBoardRegex = /^set\(PICO_BOARD\s+([^)]+)\)$/m; From 7578ecf137cee2229fb5e8db32d62dc35341e509 Mon Sep 17 00:00:00 2001 From: NickGuyver Date: Wed, 30 Oct 2024 12:44:38 -0700 Subject: [PATCH 6/7] Update extension.mts fix by will-v-pi to detect older projects as pico projects --- src/extension.mts | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/extension.mts b/src/extension.mts index cb3309f..992d573 100644 --- a/src/extension.mts +++ b/src/extension.mts @@ -16,6 +16,7 @@ import NewProjectCommand from "./commands/newProject.mjs"; import Logger, { LoggerSource } from "./logger.mjs"; import { CMAKE_DO_NOT_EDIT_HEADER_PREFIX, + CMAKE_DO_NOT_EDIT_HEADER_PREFIX_OLD, cmakeGetSelectedBoard, cmakeGetSelectedToolchainAndSDKVersions, configureCmakeNinja, @@ -210,6 +211,14 @@ export async function activate(context: ExtensionContext): Promise { !readFileSync(cmakeListsFilePath) .toString("utf-8") .includes(CMAKE_DO_NOT_EDIT_HEADER_PREFIX) + !( + readFileSync(cmakeListsFilePath) + .toString("utf-8") + .includes(CMAKE_DO_NOT_EDIT_HEADER_PREFIX) || + readFileSync(cmakeListsFilePath) + .toString("utf-8") + .includes(CMAKE_DO_NOT_EDIT_HEADER_PREFIX_OLD) + ) ) { Logger.warn( LoggerSource.extension, From ef3ec124f3a9b0a9ccd5e77ef2b42f9f12a41601 Mon Sep 17 00:00:00 2001 From: NickGuyver Date: Wed, 30 Oct 2024 12:45:25 -0700 Subject: [PATCH 7/7] Update extension.mts forgot deletion of old --- src/extension.mts | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/extension.mts b/src/extension.mts index 992d573..96e4f84 100644 --- a/src/extension.mts +++ b/src/extension.mts @@ -208,9 +208,6 @@ export async function activate(context: ExtensionContext): Promise { // check if it has .vscode folder and cmake donotedit header in CMakelists.txt if ( !existsSync(join(workspaceFolder.uri.fsPath, ".vscode")) || - !readFileSync(cmakeListsFilePath) - .toString("utf-8") - .includes(CMAKE_DO_NOT_EDIT_HEADER_PREFIX) !( readFileSync(cmakeListsFilePath) .toString("utf-8")