From f310e07c25e584f711dc3e09ff7ce238a3055513 Mon Sep 17 00:00:00 2001 From: Quintin Date: Sun, 24 Sep 2023 18:55:51 -0400 Subject: [PATCH] Add sane VSCode local settings and recommended extensions (#540) * Add vscode config. It recommends extensions and also modifies some settings with problematic defaults * Install eslint and pylance plugins, set gdb path in stone * More comments * Add black formatter and mypy checker * keep working * Fix import error for pylance devel * Add ros dist packages and format on save --------- Co-authored-by: umroverPerception --- .gitignore | 20 ++++++-------------- .vscode/extensions.json | 12 ++++++++++++ .vscode/settings.json | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 14 deletions(-) create mode 100644 .vscode/extensions.json create mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index 76fac1012..6ef1aee6b 100644 --- a/.gitignore +++ b/.gitignore @@ -1,16 +1,19 @@ -# Python Byte-compiled / optimized / DLL files +# Python __pycache__/ *.py[cod] *$py.class .mypy_cache/ *.egg-info/ +/venv/ # Common IDE's, ideally this should be in global gitignore per user .vscode/ .idea/ -/cmake-build*/ +.cache/ +cmake-build*/ +/build/ -#GUI Files +# GUI Files node_modules/ /src/teleop/gui/dist/ /src/teleop/gui/src/static/map @@ -21,19 +24,8 @@ yarn-error.log* # Bag Files /bags/ -# Catkin -/build/ -/devel/ -/logs/ - # Moteus moteus-cal* # CSV *.csv - -# Virtual Environment -/venv/ - -# clangd Output -.cache/ diff --git a/.vscode/extensions.json b/.vscode/extensions.json new file mode 100644 index 000000000..5a75809b9 --- /dev/null +++ b/.vscode/extensions.json @@ -0,0 +1,12 @@ +{ + "recommendations": [ + "ms-vscode.cpptools", + "ms-vscode.cmake-tools", + "ms-python.vscode-pylance", + "ms-python.black-formatter", + "dbaeumer.vscode-eslint", + "redhat.vscode-xml", + "redhat.vscode-yaml", + "llvm-vs-code-extensions.vscode-clangd", + ], +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..551b645dd --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,37 @@ +{ + //// Cmake + // Catkin only works with Make... ideally we could use Ninja + "cmake.generator": "Unix Makefiles", + // Set to the catkin build directory + "cmake.buildDirectory": "../../build/mrover", + // We want catkin to configure + // VSCode will try to use its own toolchain and ignore the catkin profile + "cmake.configureOnOpen": false, + "cmake.configureOnEdit": false, + "cmake.automaticReconfigure": false, + "cmake.debugConfig": { + "miDebuggerPath": "/usr/bin/gdb", + }, + //// Microsoft C++ + // Disable since clangd is used instead + "C_Cpp.intelliSenseEngine": "disabled", + //// Python + "python.analysis.inlayHints.variableTypes": true, + "python.analysis.inlayHints.callArgumentNames": "all", + "python.analysis.inlayHints.functionReturnTypes": true, + // ~/catkin_ws/devel/lib/python3/dist-packages is already in PYTHONPATH, + // but Pylance currently has a bug where it cannot handle the symlinks in it. + // Below we are just putting directly where those symlinks go + "python.analysis.extraPaths": [ + "/opt/ros/noetic/lib/python3/dist-packages", + "../../devel/.private/mrover/lib/python3/dist-packages", + ], + "[python]": { + "editor.defaultFormatter": "ms-python.black-formatter", + }, + // We use mypy for this, see style.sh + "python.analysis.typeCheckingMode": "off", + //// Miscellaneous + "redhat.telemetry.enabled": false, + "editor.formatOnSave": true, +} \ No newline at end of file