You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

VSCode tasks.json排除规则失效:default_mouse_*.py仍显示

问题排查与修复:tasks.json排除规则不生效

你配置的exclude规则中,大括号内的逗号后带有空格,这会导致glob模式无法正确匹配目标文件,从而使得default_mouse_*.py没有被排除。

修改后的inputs配置如下:

"inputs": [
    {
      "id": "pickBuild",
      "type": "command",
      "command": "extension.commandvariable.transform",
      "args": {
        "text": "${pickFile:build}",
        "find": ".*(default_.*).py",
        "replace": "$1",
        "pickFile": {
          "build": {
            "include": "**/default_*.py",
            "exclude": "**/{default_keyboard_*.py,default_mouse_*.py}",
            "description": "Select build",
            "display": "fileName"
          }
        }
      }
    }
]

VS Code的glob匹配对大括号内的分隔符要求严格,逗号后不能带有空格。原配置中default_mouse_*.py前的空格会被视为匹配模式的一部分,导致无法匹配到实际的文件名,因此该类文件没有被排除。去掉空格后,规则会正确匹配default_keyboard_*.py和default_mouse_*.py,从而将它们从选择列表中移除。

内容的提问来源于stack exchange,提问作者FelX3

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.07 22:05:17