VSCode 扩展中的自定义视图装饰 [英] Custom view decorations in VSCode extension

查看:33
本文介绍了VSCode 扩展中的自定义视图装饰的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在构建一个 VS Code 扩展,它使用 TreeDataProvider 来创建项目列表.该列表具有嵌套的子项,我想在父项中显示这些子项的计数.

I'm building a VS Code extension and it uses a TreeDataProvider to create a list of items. The list has nested children and I would like to show a count for these in the parent.

我已经查找了示例并试图了解 git 扩展是如何做到的,但没有成功.也许有人可以提供一个如何做到这一点的例子.

I've looked for examples and tried to understand how the git extension does it but no luck. Perhaps someone can provide an example of how to do this.

推荐答案

对视图中自定义装饰的支持似乎正在进行中.在 建议状态" 一会儿,见:

Support for custom decorations in views appears to be a work-in-progress. There has been an API for it in the "proposed state" for a while, see:

源代码控制和问题修饰已经显示如果设置了 TreeView.resourceUri,则在自定义视图中.

Source Control and Problem decorations already shown in custom views if TreeView.resourceUri is set.

  • 源代码控制装饰通过源代码控制 API 进行管理 -每个 SourceControlResourceState 实例都可以附加 decorations.你提到的 Git 扩展就是这样做的.
  • 问题修饰源自与 URI 关联的问题"(错误、警告...).这些也显示在问题面板中.可以使用 Diagnostics API 创建问题或使用问题匹配器.
  • Source Control decorations are managed via the Source Control API - each SourceControlResourceState instance can have decorations attached to it. That would be how the Git extension you mentioned does it.
  • Problem decorations are derived from the "problems" (errors, warnings...) associated with a URI. These are also shown in the Problems panel. Problems can be created using the Diagnostics API or with a problem matcher.

这篇关于VSCode 扩展中的自定义视图装饰的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆