From 66fe55668e8bab03e12377dd55613f6f8b11b9e5 Mon Sep 17 00:00:00 2001 From: Ivan Kravets Date: Wed, 12 Apr 2023 22:21:51 +0300 Subject: [PATCH] Resolved an issue where the incorrect debugging environment was generated for VSCode in "Auto" mode // Resolve #4597 --- HISTORY.rst | 3 ++- docs | 2 +- .../templates/ide-projects/vscode/.vscode/launch.json.tpl | 4 ++-- platformio/project/integration/generator.py | 6 ++++-- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/HISTORY.rst b/HISTORY.rst index d3218bba..8d526a6c 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -26,7 +26,8 @@ PlatformIO Core 6 * Implemented a fix for shell injection vulnerabilities when converting INO files to CPP, ensuring your code is safe and secure (`issue #4532 `_) * Restored the project generator for the `NetBeans IDE `__, providing you with more flexibility and options for your development workflow * Resolved an issue where the `build_cache_dir `__ setting was not being recognized consistently across multiple environments (`issue #4574 `_) -* Fixed an issue where organization details could not be updated using the `pio org update `__ command, ensuring that your organization's information remains up-to-date and accurate +* Fixed an issue where organization details could not be updated using the `pio org update `__ command +* Resolved an issue where the incorrect debugging environment was generated for VSCode in "Auto" mode (`issue #4597 `_) 6.1.6 (2023-01-23) ~~~~~~~~~~~~~~~~~~ diff --git a/docs b/docs index 2c2cc23f..6647f6e0 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit 2c2cc23f42e9c8268223e9b3b4b53739d88bb38c +Subproject commit 6647f6e074168012e48e21666db6bd7a1df33130 diff --git a/platformio/assets/templates/ide-projects/vscode/.vscode/launch.json.tpl b/platformio/assets/templates/ide-projects/vscode/.vscode/launch.json.tpl index 15756575..c419d27e 100644 --- a/platformio/assets/templates/ide-projects/vscode/.vscode/launch.json.tpl +++ b/platformio/assets/templates/ide-projects/vscode/.vscode/launch.json.tpl @@ -16,7 +16,7 @@ % "request": "launch", % "name": "PIO Debug (skip Pre-Debug)", % "executable": _escape_path(prog_path), -% "projectEnvName": env_name, +% "projectEnvName": env_name if forced_env_name else default_debug_env_name, % "toolchainBinDir": _escape_path(os.path.dirname(gdb_path)), % "internalConsoleOptions": "openOnSessionStart", % } @@ -28,7 +28,7 @@ % debug["name"] = "PIO Debug" % debug["preLaunchTask"] = { % "type": "PlatformIO", -% "task": ("Pre-Debug (%s)" % env_name) if len(config.envs()) > 1 and original_env_name else "Pre-Debug", +% "task": ("Pre-Debug (%s)" % env_name) if len(config.envs()) > 1 and forced_env_name else "Pre-Debug", % } % noloading = predebug.copy() % noloading["name"] = "PIO Debug (without uploading)" diff --git a/platformio/project/integration/generator.py b/platformio/project/integration/generator.py index 4ea3bbf3..12f53ef0 100644 --- a/platformio/project/integration/generator.py +++ b/platformio/project/integration/generator.py @@ -19,6 +19,7 @@ import sys import bottle from platformio import fs, util +from platformio.debug.helpers import get_default_debug_env from platformio.proc import where_is_program from platformio.project.helpers import load_build_metadata @@ -27,7 +28,7 @@ class ProjectGenerator: def __init__(self, config, env_name, ide, board_ids=None): self.config = config self.project_dir = os.path.dirname(config.path) - self.original_env_name = env_name + self.forced_env_name = env_name self.env_name = str(env_name or self.get_best_envname(board_ids)) self.ide = str(ide) @@ -86,7 +87,8 @@ class ProjectGenerator: "platformio", "name", os.path.basename(self.project_dir) ), "project_dir": self.project_dir, - "original_env_name": self.original_env_name, + "forced_env_name": self.forced_env_name, + "default_debug_env_name": get_default_debug_env(self.config), "env_name": self.env_name, "user_home_dir": os.path.abspath(fs.expanduser("~")), "platformio_path": sys.argv[0]