为什么 VSCode 不会在断点处停止进行调试?

问题描述

所以,我知道之前有一篇关于此的帖子:Debugger Not Stopping at Breakpoints in VS Code for Python

但是,我在较新版本的 VSCode 上遇到了完全相同的问题。

我的设置:

  • manjaro Linux
  • 官方 MS VSCode (1.55.2)
  • 添加了 Python 扩展,并且大部分为认值(以下是我的 settings.json 与 Python 相关的设置)
    _myList.sort((a,b) {
        
        DateFormat formatter = DateFormat("yyyy-MM-ddTHH:mm:ssZ");
            DateTime aTime = formatter.parse(a["timestamp"]);
            DateTime bTime = formatter.parse(b["timestamp"]);
        
        return aTime.compareto(bTime);
        //return bTime.compareto(aTime);
        } 
    
  • 这是我的 launch.json 设置:
    "[python]": {
        "editor.detectIndentation": true,"editor.insertSpaces": true
    },"python.autoComplete.addBrackets": true,"python.linting.Flake8Args": [
        "--ignore=F401,F841,E501,E305,E302"
    ],"python.linting.Flake8Enabled": true,"python.venvPath": "/home/greg/git/code/python/venvs"
    

解决方法

试试:

  1. 从项目中删除 launch.json(将其保存在其他地方以备不时之需)
  2. 重启 VS Code
  3. 尝试调试。如果它提示您输入 launch.json,请使用默认值。