|
1 | | -% import codecs |
2 | 1 | % import json |
3 | 2 | % import os |
4 | 3 | % |
|
47 | 46 | % return data |
48 | 47 | % end |
49 | 48 | % |
50 | | -% def _contains_external_configurations(launch_config): |
| 49 | +% def _contains_custom_configurations(launch_config): |
| 50 | +% pio_config_names = [ |
| 51 | +% c["name"] |
| 52 | +% for c in get_pio_configurations() |
| 53 | +% ] |
51 | 54 | % return any( |
52 | 55 | % c.get("type", "") != "platformio-debug" |
| 56 | +% or c.get("name", "") in pio_config_names |
53 | 57 | % for c in launch_config.get("configurations", []) |
54 | 58 | % ) |
55 | 59 | % end |
|
59 | 63 | % return launch_config |
60 | 64 | % end |
61 | 65 | % |
| 66 | +% pio_config_names = [ |
| 67 | +% c["name"] |
| 68 | +% for c in get_pio_configurations() |
| 69 | +% ] |
62 | 70 | % external_configurations = [ |
63 | | -% config |
64 | | -% for config in launch_config["configurations"] |
65 | | -% if config.get("type", "") != "platformio-debug" |
| 71 | +% c |
| 72 | +% for c in launch_config["configurations"] |
| 73 | +% if c.get("type", "") != "platformio-debug" or c.get("name", "") not in pio_config_names |
66 | 74 | % ] |
67 | 75 | % |
68 | 76 | % launch_config["configurations"] = external_configurations |
|
73 | 81 | % launch_config = {"version": "0.2.0", "configurations": []} |
74 | 82 | % launch_file = os.path.join(project_dir, ".vscode", "launch.json") |
75 | 83 | % if os.path.isfile(launch_file): |
76 | | -% with codecs.open(launch_file, "r", encoding="utf8") as fp: |
| 84 | +% with open(launch_file, "r", encoding="utf8") as fp: |
77 | 85 | % launch_data = _remove_comments(fp.readlines()) |
78 | 86 | % try: |
79 | 87 | % prev_config = json.loads(launch_data) |
80 | | -% if _contains_external_configurations(prev_config): |
| 88 | +% if _contains_custom_configurations(prev_config): |
81 | 89 | % launch_config = _remove_pio_configurations(prev_config) |
82 | 90 | % end |
83 | 91 | % except: |
|
91 | 99 | % |
92 | 100 | // AUTOMATICALLY GENERATED FILE. PLEASE DO NOT MODIFY IT MANUALLY |
93 | 101 | // |
94 | | -// PIO Unified Debugger |
| 102 | +// PlatformIO Debugging Solution |
95 | 103 | // |
96 | | -// Documentation: https://docs.platformio.org/page/plus/debugging.html |
97 | | -// Configuration: https://docs.platformio.org/page/projectconf/section_env_debug.html |
| 104 | +// Documentation: https://docs.platformio.org/en/latest/plus/debugging.html |
| 105 | +// Configuration: https://docs.platformio.org/en/latest/projectconf/sections/env/options/debug/index.html |
98 | 106 |
|
99 | 107 | {{ json.dumps(get_launch_configuration(), indent=4, ensure_ascii=False) }} |
0 commit comments