From 5ed842df272e9d24aa31a859462488154cff9630 Mon Sep 17 00:00:00 2001 From: Henry Huang <69825683+hhenry01@users.noreply.github.com> Date: Wed, 8 Nov 2023 12:59:49 -0800 Subject: [PATCH] Fix cpp Config (#199) * Fix cpp config * Remove c_cpp_properties.json * Update clang-tidy CI --- .../config/sailbot_workspace.code-workspace | 14 ++++++++++++++ .github/actions/clang-tidy/run.sh | 2 +- .vscode/c_cpp_properties.json | 18 ------------------ build.sh | 6 ------ 4 files changed, 15 insertions(+), 25 deletions(-) delete mode 100644 .vscode/c_cpp_properties.json diff --git a/.devcontainer/config/sailbot_workspace.code-workspace b/.devcontainer/config/sailbot_workspace.code-workspace index 5e2539185..8f61c7a21 100644 --- a/.devcontainer/config/sailbot_workspace.code-workspace +++ b/.devcontainer/config/sailbot_workspace.code-workspace @@ -180,11 +180,25 @@ "mypy-type-checker.interpreter": ["/usr/bin/python3"], // c/c++ + + "C_Cpp.intelliSenseEngine": "disabled", // Use clangd intellisense instead (it's better) + + "clangd.path": "/usr/bin/clangd", + "clangd.onConfigChanged": "restart", + "clangd.arguments": [ + "-log=verbose", + "-pretty", + "--background-index", + "--compile-commands-dir=/workspaces/sailbot_workspace/build/" + ], + "[cpp]": { + "editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd", "editor.formatOnSave": true, "editor.rulers": [120], }, "[c]": { + "editor.defaultFormatter": "llvm-vs-code-extensions.vscode-clangd", "editor.formatOnSave": true, "editor.rulers": [120], }, diff --git a/.github/actions/clang-tidy/run.sh b/.github/actions/clang-tidy/run.sh index 5c08e0795..d3872d336 100755 --- a/.github/actions/clang-tidy/run.sh +++ b/.github/actions/clang-tidy/run.sh @@ -7,4 +7,4 @@ if [[ $LOCAL_RUN != "true" ]]; then ./build.sh RelWithDebInfo OFF fi -python3 .github/actions/clang-tidy/ament_clang_tidy.py compile_commands.json --jobs 8 +python3 .github/actions/clang-tidy/ament_clang_tidy.py build/compile_commands.json --jobs 8 diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json deleted file mode 100644 index e346acd25..000000000 --- a/.vscode/c_cpp_properties.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "configurations": [ - { - "name": "Linux", - "includePath": [ - "${workspaceFolder}/**", - "/opt/ros/humble/include/**" - ], - "defines": [], - "compilerPath": "/usr/bin/clang", - "compileCommands": "${workspaceFolder}/build/compile_commands.json", - "cStandard": "c99", - "cppStandard": "c++14", - "intelliSenseMode": "linux-clang-x64" - } - ], - "version": 4 -} diff --git a/build.sh b/build.sh index 353fc3a91..6dac9b36d 100755 --- a/build.sh +++ b/build.sh @@ -41,9 +41,3 @@ colcon build \ --merge-install \ --symlink-install \ --cmake-args "-DCMAKE_BUILD_TYPE=$BUILD_TYPE" "-DSTATIC_ANALYSIS=$STATIC_ANALYSIS" "-DUNIT_TEST=$UNIT_TEST" "--no-warn-unused-cli" - -# For Clangd -if [[ -f $ROS_WORKSPACE/build/compile_commands.json && ! -f $ROS_WORKSPACE/compile_commands.json ]] -then - ln -s $ROS_WORKSPACE/build/compile_commands.json $ROS_WORKSPACE -fi