Visual Studio Code: Is it possible to make a decorations hoverMessage clickable

时光怂恿深爱的人放手 提交于 2019-12-01 19:41:30
Matt Bierner

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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!