【问题标题】:Custom Icon for VSCode Python TestsVSCode Python 测试的自定义图标
【发布时间】:2021-07-07 00:26:46
【问题描述】:

我希望 Python 测试与 VSCode 中的常规 Python 文件具有不同的图标,以便于区分代码和测试。所以*.py 的一个图标和test*.py 的另一个图标。似乎是一件容易的事,但到目前为止还没有运气。

默认情况下它没有内置在 VSCode 中 - https://github.com/microsoft/vscode/issues/12493。您可以将文件模式与不同的语言相关联,例如:更改文件图标但随后会破坏测试的 linting 等的纯文本:

    "files.associations": {
        "*.py": "python",
        "*_test.py": "plaintext"
    },

材质图标主题不支持通配符。 https://github.com/PKief/vscode-material-icon-theme/issues/330#issuecomment-428258408。 IE 以下不起作用:

    "material-icon-theme.files.associations": {
        "*.py": "python",
        "*_test.py": "python-misc"
    }

vscode-icons 也不支持通配符:https://github.com/vscode-icons/vscode-icons/issues/2617

【问题讨论】:

  • 你必须写一个fileicon主题,或者调整一个你喜欢的

标签: python visual-studio-code icons


【解决方案1】:

Material Iconvscode-icons 开发人员解释说,VSCode does NOT support glob naming for icon themes 阻止他们支持此功能。

所以我用VSCode-icons 尝试过这个:

  "vsicons.associations.files": [
    { "icon": "pyret",  "extensions": ["test.py"], "filename": false, "format": "svg"},
  ],

它可以更改名称为a.test.py的文件的图标,并将a.py与python的图标保持一致。

但问题是测试框架无法发现名称像a.test.py的测试,即使像这样a..py

真可惜。也许我们应该等待它的支持。

【讨论】:

  • 知道了。看起来微软对此有一个开放的功能请求:github.com/microsoft/vscode/issues/12493
  • @Daniel Flippance 是的。
  • 等着看有没有其他人有不同的答案
  • @Daniel Flippance 同意这一点。
猜你喜欢
  • 1970-01-01
  • 2022-10-17
  • 1970-01-01
  • 1970-01-01
  • 2022-11-29
  • 2017-06-02
  • 2016-03-02
  • 2022-12-21
  • 2021-03-19
相关资源
最近更新 更多