14

我目前正在编写一个工具来帮助维护单元和集成测试(编码测试)。我已经开始扩展 Visual Studio 以使开发人员体验更好,这让我注意到了新的 CodeLens 功能。

我目前作为工具提示显示的内容可能实际上应该是 CodeLens 信息的一部分。

问题:有谁知道如何在 Visual Studio中扩展CodeLens ?

谢谢。

4

3 回答 3

5

正如@RichardBanks 所说,CodeLens 正式不可扩展。从技术上讲,我认为目前可能。在 Visual Studio 目录中查找*CodeSense*.dll提示。目前没有文档,API 仍然可以更改。

我建议您仅出于研究目的冒险进行此操作,在 Microsoft 开放 API 之前,分发任何“插件”似乎都是一个非常糟糕的主意,他们可能会这样做。

于 2014-01-09T22:52:40.823 回答
5

CodeLens is officially extensible since Visual Studio 2019 was released.

CodeLens for Everyone

CodeLens has been a feature found only in Visual Studio Enterprise, but that will change in an upcoming preview of Visual Studio 2019, when it will also be available for the Community edition, likely in 2019. CodeLens shows the number of references a type or method has, information about unit tests covering the method, and data directly from Application Insights.

In addition, Microsoft has made CodeLens fully extensible1, so third-party extensions can start to add their own experiences on top of it. CodeLens makes key information about your types easy to find, while keeping you in the source code. Lenses for source control history and IntelliTrace are still an Enterprise-only feature.

Looks like this is the best place to start looking at when implementing your own CodeLens extension.


1. Highlight mine.

于 2020-04-20T11:27:45.950 回答
4

Code Lens 当前不可扩展。

我不能肯定地说,但我认为团队仍然希望在他们打开扩展之前添加一些功能(例如 git 支持)。

于 2014-01-09T22:32:34.127 回答