added default vscode launch config

This commit is contained in:
Timerix 2025-04-25 20:29:19 +05:00
parent f0038dd7c7
commit 653d459999
4 changed files with 83 additions and 10 deletions

View File

@ -89,18 +89,30 @@ do
else else
mkdir -p "$new_project_dir" mkdir -p "$new_project_dir"
fi fi
if ask_yn "create default cbuild project config?"; then
# create project config
project_config_path="$new_project_dir/project.config" project_config_path="$new_project_dir/project.config"
cp "$CBUILD_INSTALL_DIR/default.config" "$project_config_path.temp" cp "$CBUILD_INSTALL_DIR/default.config" "$project_config_path.temp"
myprint "Enter project name: " myprint "Enter project name: "
read -r project_name read -r project_name
sed "s,\%PROJECT_NAME\%,$project_name,g" "$project_config_path.temp" > "$project_config_path" sed "s,\%PROJECT_NAME\%,$project_name,g" \
"$project_config_path.temp" > "$project_config_path"
rm "$project_config_path.temp" rm "$project_config_path.temp"
myprint "${GREEN}created config at '$project_config_path'" myprint "${GREEN}created config at '$project_config_path'"
fi
if ask_yn "Copy default .gitignore?"; then if ask_yn "Copy default .gitignore?"; then
cp "$CBUILD_INSTALL_DIR/.gitignore" "$new_project_dir/" cp -v "$CBUILD_INSTALL_DIR/.gitignore" "$new_project_dir/"
fi fi
if ask_yn "Copy default .vscode launch tasks?"; then
new_project_vscode_dir="$new_project_dir/.vscode"
mkdir -p "$new_project_vscode_dir"
cp -vr "$CBUILD_INSTALL_DIR/default_vscode/"* "$new_project_vscode_dir/"
sed "s,\%PROJECT_NAME\%,$project_name,g" \
"$new_project_vscode_dir/launch.json" > "$new_project_vscode_dir/launch.json.temp"
mv "$new_project_vscode_dir/launch.json.temp" "$new_project_vscode_dir/launch.json"
fi
exit 0 exit 0
;; ;;
*) *)

1
default_vscode/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
settings.json

View File

@ -0,0 +1,29 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "gdb_debug",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/bin/%PROJECT_NAME%",
"windows": { "program": "${workspaceFolder}/bin/%PROJECT_NAME%.exe" },
"preLaunchTask": "build_exec_dbg",
"stopAtEntry": false,
"cwd": "${workspaceFolder}/bin",
"externalConsole": false,
"internalConsoleOptions": "neverOpen",
"MIMode": "gdb",
"miDebuggerPath": "gdb",
"setupCommands": [
{
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
}

31
default_vscode/tasks.json Normal file
View File

@ -0,0 +1,31 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "build_exec_dbg",
"detail": "build project with debug symbols",
"type": "cppbuild",
"command": "bash",
"args": [
"-c",
"cbuild build_exec_dbg"
],
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": ["$gcc"],
"group": {
"kind": "build"
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": true
}
}
]
}