Skip to content

Commit

Permalink
Add sane VSCode local settings and recommended extensions (#540)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
qhdwight and umroverPerception authored Sep 24, 2023
1 parent 3c7b9ca commit f310e07
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 14 deletions.
20 changes: 6 additions & 14 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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/
12 changes: 12 additions & 0 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -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",
],
}
37 changes: 37 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -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,
}

0 comments on commit f310e07

Please sign in to comment.