【问题标题】:How do I filter problems by multiple criteria? AND or OR如何按多个条件过滤问题?与或或
【发布时间】:2021-11-10 14:49:20
【问题描述】:

在问题窗格中,您可以按文本或文件过滤/排除,但如果我想按多个条件进行过滤怎么办?像过滤那些包含文本 X OR Y(或 X AND Y)的消息。我知道您可以使用逗号过滤多种类型的文件,是否有类似的文本机制?

【问题讨论】:

    标签: visual-studio-code filter vscode-problem-matcher


    【解决方案1】:

    我写的一个扩展,Problems: Copy 允许您使用正则表达式过滤文本。所以你可以这样做:

    {
      "key": "alt+c",                      // whatever keybinding you want, no default
      "command": "problems-copy.copyAll",
      "args": {
        "errors": true,                   // will be included in the result
        "warnings": true,
        // "hints": true,          // any category not in the keybinding will NOT be in the result
        "informations": true,
        
        "messageFilter": "/const2|typeof/",   // wrapped in regex literals
      }
    }
    

    所以这将复制单词const2typeof 的问题。使用适当的正则表达式,您应该能够构建您想要的过滤器。


    此扩展程序实际上无法过滤出现在问题面板中的问题 - 该功能在扩展程序 api 中不可用。使用扩展程序,您可以将过滤后的问题复制/粘贴到另一个编辑器(或电子表格等)。

    【讨论】:

    • 很遗憾,它无法完成,但感谢您提供的替代方案
    猜你喜欢
    • 1970-01-01
    • 2021-03-28
    • 1970-01-01
    • 1970-01-01
    • 2014-04-19
    • 2012-02-14
    • 1970-01-01
    • 2018-12-05
    • 2018-11-23
    相关资源
    最近更新 更多