-
Notifications
You must be signed in to change notification settings - Fork 79
Multi-line f-string for vs code configuration file contents #87
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Open
paulober
wants to merge
1
commit into
raspberrypi:update_vscode_json_to_sdk1_5
Choose a base branch
from
paulober:fix-single-quote-templates
base: update_vscode_json_to_sdk1_5
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+130
−121
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1128,127 +1128,136 @@ def generateProjectFiles(projectPath, projectName, sdkPath, projects, debugger): | |
|
||
for p in projects : | ||
if p == 'vscode': | ||
launch = ('{\n' | ||
' "version": "0.2.0",\n' | ||
' "configurations": [\n' | ||
' {\n' | ||
' "name": "Pico Debug (Cortex-Debug)",\n' | ||
' "cwd": "${workspaceRoot}",\n' | ||
' "executable": "${command:cmake.launchTargetPath}",\n' | ||
' "request": "launch",\n' | ||
' "type": "cortex-debug",\n' | ||
' "servertype": "openocd",\n' | ||
f' "gdbPath": "{gdbPath}",\n' | ||
' "device": "RP2040",\n' | ||
' "configFiles": [\n' | ||
f' "interface/{debugger}",\n' | ||
' "target/rp2040.cfg"\n' | ||
' ],\n' | ||
' "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd",\n' | ||
' "runToEntryPoint": "main",\n' | ||
' // Give restart the same functionality as runToEntryPoint - main\n' | ||
' "postRestartCommands": [\n' | ||
' "break main",\n' | ||
' "continue"\n' | ||
' ],\n' | ||
' "openOCDLaunchCommands": [\n' | ||
' "adapter speed 1000"\n' | ||
' ]\n' | ||
' },\n' | ||
' {\n' | ||
' "name": "Pico Debug (Cortex-Debug with external OpenOCD)",\n' | ||
' "cwd": "${workspaceRoot}",\n' | ||
' "executable": "${command:cmake.launchTargetPath}",\n' | ||
' "request": "launch",\n' | ||
' "type": "cortex-debug",\n' | ||
' "servertype": "external",\n' | ||
' "gdbTarget": "localhost:3333",\n' | ||
f' "gdbPath": "{gdbPath}",\n' | ||
' "device": "RP2040",\n' | ||
' "svdFile": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd",\n' | ||
' "runToEntryPoint": "main",\n' | ||
' // Give restart the same functionality as runToEntryPoint - main\n' | ||
' "postRestartCommands": [\n' | ||
' "break main",\n' | ||
' "continue"\n' | ||
' ]\n' | ||
' },\n' | ||
' {\n' | ||
' "name": "Pico Debug (C++ Debugger)",\n' | ||
' "type": "cppdbg",\n' | ||
' "request": "launch",\n' | ||
' "cwd": "${workspaceRoot}",\n' | ||
' "program": "${command:cmake.launchTargetPath}",\n' | ||
' "MIMode": "gdb",\n' | ||
' "miDebuggerPath": "{gdbPath}",\n' | ||
' "miDebuggerServerAddress": "localhost:3333",\n' | ||
' "debugServerPath": "openocd",\n' | ||
' "debugServerArgs": "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \\"adapter speed 1000\\"",\n' | ||
' "serverStarted": "Listening on port .* for gdb connections",\n' | ||
' "filterStderr": true,\n' | ||
' "stopAtEntry": true,\n' | ||
' "hardwareBreakpoints": {\n' | ||
' "require": true,\n' | ||
' "limit": 4\n' | ||
' },\n' | ||
' "preLaunchTask": "Flash",\n' | ||
' "svdPath": "${env:PICO_SDK_PATH}/src/rp2040/hardware_regs/rp2040.svd"\n' | ||
' },\n' | ||
' ]\n' | ||
'}\n') | ||
|
||
properties = ('{\n' | ||
' "configurations": [\n' | ||
' {\n' | ||
' "name": "Pico",\n' | ||
' "includePath": [\n' | ||
' "${workspaceFolder}/**",\n' | ||
' "${env:PICO_SDK_PATH}/**"\n' | ||
' ],\n' | ||
' "defines": [],\n' | ||
f' "compilerPath": "{cPath}",\n' | ||
' "cStandard": "c17",\n' | ||
' "cppStandard": "c++14",\n' | ||
' "intelliSenseMode": "linux-gcc-arm",\n' | ||
' "configurationProvider" : "ms-vscode.cmake-tools"\n' | ||
' }\n' | ||
' ],\n' | ||
' "version": 4\n' | ||
'}\n') | ||
|
||
settings = ( '{\n' | ||
' "cmake.statusbar.advanced": {\n' | ||
' "debug": {\n' | ||
' "visibility": "hidden"\n' | ||
' },\n' | ||
' "launch": {\n' | ||
' "visibility": "hidden"\n' | ||
' },\n' | ||
' "build": {\n' | ||
' "visibility": "hidden"\n' | ||
' },\n' | ||
' "buildTarget": {\n' | ||
' "visibility": "hidden"\n' | ||
' }\n' | ||
' },\n' | ||
' "cmake.buildBeforeRun": true,\n' | ||
' "cmake.configureOnOpen": true,\n' | ||
' "cmake.configureSettings": {\n' | ||
' "CMAKE_MODULE_PATH": "${env:PICO_INSTALL_PATH}/pico-sdk-tools"\n' | ||
' },\n' | ||
' "cmake.generator": "Ninja",\n' | ||
' "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools"\n' | ||
'}\n') | ||
|
||
extensions = ( '{\n' | ||
' "recommendations": [\n' | ||
' "marus25.cortex-debug",\n' | ||
' "ms-vscode.cmake-tools",\n' | ||
' "ms-vscode.cpptools",\n' | ||
' "ms-vscode.cpptools-extension-pack",\n' | ||
' "ms-vscode.vscode-serial-monitor"\n' | ||
' ]\n' | ||
'}\n') | ||
# Visual Studio Code launch configurations | ||
launch = f'''{{ | ||
"version": "0.2.0", | ||
"configurations": [ | ||
{{ | ||
"name": "Pico Debug (Cortex-Debug)", | ||
"cwd": "${{workspaceRoot}}", | ||
"executable": "${{command:cmake.launchTargetPath}}", | ||
"request": "launch", | ||
"type": "cortex-debug", | ||
"servertype": "openocd", | ||
"gdbPath": "{gdbPath}", | ||
"device": "RP2040", | ||
"configFiles": [ | ||
"interface/{debugger}", | ||
"target/rp2040.cfg" | ||
], | ||
"svdFile": "${{env:PICO_SDK_PATH}}/src/rp2040/hardware_regs/rp2040.svd", | ||
"runToEntryPoint": "main", | ||
// Give restart the same functionality as runToEntryPoint - main | ||
"postRestartCommands": [ | ||
"break main", | ||
"continue" | ||
], | ||
"openOCDLaunchCommands": [ | ||
"adapter speed 1000" | ||
] | ||
}}, | ||
{{ | ||
"name": "Pico Debug (Cortex-Debug with external OpenOCD)", | ||
"cwd": "${{workspaceRoot}}", | ||
"executable": "${{command:cmake.launchTargetPath}}", | ||
"request": "launch", | ||
"type": "cortex-debug", | ||
"servertype": "external", | ||
"gdbTarget": "localhost:3333", | ||
"gdbPath": "{gdbPath}", | ||
"device": "RP2040", | ||
"svdFile": "${{env:PICO_SDK_PATH}}/src/rp2040/hardware_regs/rp2040.svd", | ||
"runToEntryPoint": "main", | ||
// Give restart the same functionality as runToEntryPoint - main | ||
"postRestartCommands": [ | ||
"break main", | ||
"continue" | ||
] | ||
}}, | ||
{{ | ||
"name": "Pico Debug (C++ Debugger)", | ||
"type": "cppdbg", | ||
"request": "launch", | ||
"cwd": "${{workspaceRoot}}", | ||
"program": "${{command:cmake.launchTargetPath}}", | ||
"MIMode": "gdb", | ||
"miDebuggerPath": "{gdbPath}", | ||
"miDebuggerServerAddress": "localhost:3333", | ||
"debugServerPath": "openocd", | ||
"debugServerArgs": "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \\"adapter speed 1000\\"", | ||
paulober marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"serverStarted": "Listening on port .* for gdb connections", | ||
"filterStderr": true, | ||
"stopAtEntry": true, | ||
"hardwareBreakpoints": {{ | ||
"require": true, | ||
"limit": 4 | ||
}}, | ||
"preLaunchTask": "Flash", | ||
"svdPath": "${{env:PICO_SDK_PATH}}/src/rp2040/hardware_regs/rp2040.svd" | ||
}}, | ||
] | ||
}} | ||
''' | ||
|
||
# cpp-tools extension settings | ||
properties = f'''{{ | ||
"configurations": [ | ||
{{ | ||
"name": "Pico", | ||
"includePath": [ | ||
"${{workspaceFolder}}/**", | ||
"${{env:PICO_SDK_PATH}}/**" | ||
], | ||
"defines": [], | ||
"compilerPath": "{cPath}", | ||
"cStandard": "c17", | ||
"cppStandard": "c++14", | ||
"intelliSenseMode": "linux-gcc-arm", | ||
"configurationProvider": "ms-vscode.cmake-tools" | ||
}} | ||
], | ||
"version": 4 | ||
}} | ||
''' | ||
|
||
|
||
# Visual Studio Code settings | ||
settings = f'''{{ | ||
"cmake.statusbar.advanced": {{ | ||
"debug": {{ | ||
"visibility": "hidden" | ||
}}, | ||
"launch": {{ | ||
"visibility": "hidden" | ||
}}, | ||
"build": {{ | ||
"visibility": "hidden" | ||
}}, | ||
"buildTarget": {{ | ||
"visibility": "hidden" | ||
}} | ||
}}, | ||
"cmake.buildBeforeRun": true, | ||
"cmake.configureOnOpen": true, | ||
"cmake.configureSettings": {{ | ||
"CMAKE_MODULE_PATH": "${{env:PICO_INSTALL_PATH}}/pico-sdk-tools" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just a note, PICO_INSTALL_PATH only exists on Windows when the installer is used. Should be harmless otherwise but should be tested I think. |
||
}}, | ||
"cmake.generator": "Ninja", | ||
"C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools" | ||
}} | ||
''' | ||
|
||
# recommended Visual Studio Code extensions | ||
extensions = f'''{{ | ||
"recommendations": [ | ||
"marus25.cortex-debug", | ||
"ms-vscode.cmake-tools", | ||
"ms-vscode.cpptools", | ||
"ms-vscode.cpptools-extension-pack", | ||
"ms-vscode.vscode-serial-monitor" | ||
] | ||
}} | ||
''' | ||
|
||
# Create a build folder, and run our cmake project build from it | ||
if not os.path.exists(VSCODE_FOLDER): | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.