-
Notifications
You must be signed in to change notification settings - Fork 1
SMT setup VSCodeConfig
VSCode has many configuration options and an active plugin ecosystem. Editor configuration (as well as the editor itself) is a user choice and we respect this. This guide thus a a collection of useful snippets, extensions, and debug launch configurations, which we think are worth sharing with the team.
A plethora of extensions are available for VSCode. Most of them target streamlining workflows, which can be a huge time-saver. We found the following to be useful (in no particular order)
-
Python (language support including
pylance
& debugger) / Black Formatter - Modern Fortran (without the fortls engine or else the extension dies trying to figure out GEOS)
-
H5Web for
netcdf
inline viewing - DaCe SDFG Editor (in case you work with DaCe graphs)
- your standard set of
git
extensions - Live Share (remote pair-programming)
- Draw.io Integration (draw & share graphs directly from within VSCode - we've seen scaling errors when mixed with graphs created from the website)
While pre-commit
is the source of truth, having format on save support in the editor can be a huge time-saver. To enable format on save
- Install the "Black Formatter" extension (see above)
- Configure "Black Formatter" as the default formatter for python files and enable format on save. In
.vscode/settings.json
add
{
"[python]": {
"editor.defaultFormatter": "ms-python.black-formatter",
"editor.formatOnSave": true
},
}
In VSCode, debugging tasks can be configured with so called “launch configurations”, that live in launch.json
files. Sharing these here will help the team debug faster.
{
"name": "Translate - pyMoist",
"type": "debugpy",
"request": "launch",
"module": "pytest",
"args": [
"-s",
"-v",
"-x",
"--data_path=/home/mad/work/fp/geos/src/Components/@GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/test_data/geos_11.5.2/moist",
"--grid=default",
"--backend=numpy",
"--which_modules=evap_subl_pdf",
"/home/mad/work/fp/geos/src/Components/@GEOSgcm_GridComp/GEOSagcm_GridComp/GEOSphysics_GridComp/GEOSmoist_GridComp/pyMoist/tests"
],
"env": {
"PACE_TEST_N_THRESHOLD_SAMPLES": "0",
"PACE_FLOAT_PRECISION": "32"
}
}