Visual Studio Code:是否可以使装饰hoverMessage 可点击 [英] Visual Studio Code: Is it possible to make a decorations hoverMessage clickable
本文介绍了Visual Studio Code:是否可以使装饰hoverMessage 可点击的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为 VSCode 开发一个扩展.我正在装饰文本编辑器并悬停一些项目.是否可以在hoverMessage
处制作可点击的项目并根据它修改范围.
Hi I am developing an extension for VSCode. I am decorating the text editor and hovering some items. Is it possible to make clickable items at hoverMessage
and modify the range according to it.
扩展名是:https://marketplace.visualstudio.com/items?itemName=serayuzgur.crates
您可以从 GIF 中看到 hoverMessage
You can see the hoverMessage
from the GIF
推荐答案
是的,使用 markdown 然后你可以创建 一个命令链接,当用户点击它时将执行一个命令:
Yes, using markdown you can then create a command link that will execute a command when a user clicks on it:
import * as vscode from 'vscode';
const myContent = new vscode.MarkdownString('[link](command:myCommand?arg1)');
// Command Uris are disabled by default for security reasons.
// If you set this flag, make sure your content is not constructed
// using untrusted/unsanitized text.
myContent.isTrusted = true;
const myHover = new Hover(myContent);
此命令可以执行您想要的任何操作
This command can perform whatever action you want
这篇关于Visual Studio Code:是否可以使装饰hoverMessage 可点击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文