简体   繁体   English

在 VS Code 测试资源管理器中,如何关闭装订线中的“播放”图标?

[英]In VS Code Test Explorer, How to turn off the "play" icon in gutter?

In VS Code, with the Python, Text Explorer, and Python Test Explorer extensions, I am able to unit test great with pytest.在 VS Code 中,借助 Python、文本资源管理器和 Python 测试资源管理器扩展,我能够使用 pytest 进行出色的单元测试。

But two of the "gutter" icons interfere with each other, and I canoot figure out how to remove one of them.但是两个“排水沟”图标相互干扰,我无法弄清楚如何删除其中一个。

Background背景

There are two different windows for Test Explorer with this setup - one for the base Test Explorer, and one for the Python Test Explorer extension.使用此设置的测试资源管理器有两个不同的窗口 - 一个用于基本测试资源管理器,一个用于 Python 测试资源管理器扩展。 They work basically the same but I find the organization of the tests better in the Python one, so I use that.它们的工作原理基本相同,但我发现 Python 中的测试组织更好,所以我使用它。

In the test code itself, there are various code lenses applied, and other decorators, that allow you to interact with the tests by running, debugging, opening that test in the test explorer window, etc.在测试代​​码本身中,应用了各种代码镜头和其他装饰器,允许您通过运行、调试、在测试资源管理器窗口中打开该测试等方式与测试进行交互。

These decorators include an icon that shows up in the gutter, which allows you to run the test, then changes afterward to show success or failure.这些装饰器包括一个显示在排水沟中的图标,它允许您运行测试,然后更改以显示成功或失败。 If you right-click on that icon you get multiple test options, as shown below.如果您右键单击该图标,您将获得多个测试选项,如下所示。 There is also a secondary icon showing the status behind the triangle "play" icon in the image below:下图中还有一个辅助图标显示三角形“播放”图标后面的状态:

  • 用于测试和右上下文菜单的装订线图标的图像

The settings for test explorer allow removing the secondary icon in the background (the faint green circle with the checkmark behind the bright triangle "play" icon), with a setting called "Test Explorer: Gutter Decoration".测试资源管理器的设置允许删除背景中的辅助图标(浅绿色圆圈,明亮的三角形“播放”图标后面带有复选标记),设置名为“测试资源管理器:装订线装饰”。 Changing that removes this secondary icon:更改删除此辅助图标:

  • Gutter Decorator True:天沟装饰器真: 在此处输入图像描述
  • Gutter Decorator False:天沟装饰错误: 在此处输入图像描述

Question问题

So, my question is - how do I remove the Test Explorer "play" icon from the gutter?所以,我的问题是 - 如何从排水沟中删除测试资源管理器的“播放”图标?

This icon appears to be the main icon connected to the main Test Explorer UI, rather than the Python one (the commands will go to the main UI window and run it's test runs, rather than the Python window).此图标似乎是连接到主测试资源管理器 UI 的主图标,而不是 Python 图标(命令将转到主 UI 窗口并运行它的测试运行,而不是 Python 窗口)。 It gets in the way of the status gutter icon behind it that shows the status of the Python test runs and is unnecessary in my setup.它妨碍了它后面的状态排水沟图标,该图标显示了 Python 测试运行的状态,并且在我的设置中是不必要的。

I recently had my PC wiped and I used to have this turned off somehow, but I can't find the setting now.我最近清理了我的电脑,我曾经以某种方式关闭它,但我现在找不到设置。 Thanks!谢谢!

Please try to delete Test Explorer extension.请尝试删除Test Explorer扩展。 This extension is no longer updated.此扩展程序不再更新。

It turns out the Test Explorer extension is no longer being updated, per MingJie-MSFT's answer, as it appears the extension was integrated into the main VS Code codebase.事实证明,根据 MingJie-MSFT 的回答,Test Explorer 扩展不再更新,因为该扩展似乎已集成到主 VS Code 代码库中。

This led me to search the settings again, and I found that most of the settings from the extension (search for "Test Explorer") are now duplicated in another section called "Testing".这导致我再次搜索设置,我发现扩展程序中的大部分设置(搜索“测试资源管理器”)现在都在另一个名为“测试”的部分中重复。

So, it turns out the play icon was showing up from the new integrated test explorer, not from the extension.因此,事实证明播放图标是从新的集成测试资源管理器中显示的,而不是从扩展中显示的。 So I was able to shut it off in the new setting:所以我能够在新设置中将其关闭: 在此处输入图像描述

However, per MingJie-MSFT's answer, the Test Explorer extension is no longer being maintained, so unless the Python specific Test Explorer extension UI was integrated into VS Code as well, at some point this alternate UI (which I prefer some of the design decisions) will likely no longer be available.但是,根据 MingJie-MSFT 的回答,不再维护测试资源管理器扩展,因此除非 Python 特定的测试资源管理器扩展 UI 也集成到 VS Code 中,否则在某些时候这个替代 UI(我更喜欢一些设计决策) 可能不再可用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM