This works for me
Edit your settings.json with the variables below. It can be your workspace settings only, or you global settings.
Basically it informs VSCode where to locate for QGIS packages.
Also, I have made a tutorial video showing how to set these variables from the console, without changing settings.json https://youtu.be/qobogVuXtJU
{
// Replicate the QGIS environment
"terminal.integrated.env.windows": {
"OSGEO4W_ROOT": "C:\\OSGeo4W",
"PATH":"C:\\OSGeo4W\\apps\\qt5\\bin;C:\\OSGeo4W\\apps\\Python39\\Scripts;C:\\OSGeo4W\\apps\\qgis-ltr\\bin;C:\\OSGeo4W\\bin;C:\\Windows\\system32;C:\\Windows;C:\\Windows\\system32\\WBem",
"GDAL_DATA": "C:\\OSGeo4W\\share\\gdal",
"GDAL_DRIVER_PATH": "C:\\OSGeo4W\\bin\\gdalplugins",
"GS_LIB": "C:\\OSGeo4W\\apps\\gs\\lib",
"JPEGMEM": "1000000",
"OPENSSL_ENGINES": "C:\\OSGeo4W\\lib\\engines-1_1",
"SSL_CERT_FILE": "C:\\OSGeo4W\\bin\\curl-ca-bundle.crt",
"SSL_CERT_DIR": "C:\\OSGeo4W\\apps\\openssl\\certs",
"PROJ_LIB": "C:\\OSGeo4W\\share\\proj",
"QT_PLUGIN_PATH": "C:\\OSGeo4W\\apps\\Qt5\\plugins",
"O4W_QT_PREFIX": "C:/OSGeo4W/apps/Qt5",
"O4W_QT_BINARIES": "C:/OSGeo4W/apps/Qt5/bin",
"O4W_QT_PLUGINS": "C:/OSGeo4W/apps/Qt5/plugins",
"O4W_QT_LIBRARIES": "C:/OSGeo4W/apps/Qt5/lib",
"O4W_QT_TRANSLATIONS": "C:/OSGeo4W/apps/Qt5/translations",
"O4W_QT_HEADERS": "C:/OSGeo4W/apps/Qt5/include",
"O4W_QT_DOC": "C:/OSGeo4W/apps/Qt5/doc",
"PYTHONHOME": "C:\\OSGeo4W\\apps\\Python39",
"PYTHONPATH": "C:\\OSGeo4W\\apps\\qgis-ltr\\python;C:\\OSGeo4W\\apps\\qgis-ltr\\python\\plugins",
"PYTHONUTF8": "1",
},
"python.autoComplete.extraPaths": ["C:\\OSGeo4W\\apps\\qgis-ltr\\python","C:\\OSGeo4W\\apps\\qgis-ltr\\python\\plugins"],
"python.pythonPath": "c:\\OSGeo4W\\bin\\python.exe",
"python.analysis.extraPaths": [
"C:\\OSGeo4W\\apps\\qgis-ltr\\python",
"C:\\OSGeo4W\\apps\\qgis-ltr\\python\\plugins"
]
}