If you're having trouble with the MayaPy extension in VS Code note that it still utilizes ptvsd, which Microsoft has deprecated as of 2020.
This tutorial will guide you through the process of setting up debugging with debugpy, the latest and improved Python debugger for VS Code.
Note: This tutorial is primarily intended for users of Python 3 and Maya 2022 (or later).
Note: You need to have the official Python extension installed in VS Code.