如何将Codelens提供商与参考提供商链接到代码API
我已经有一个自定义语言的现有参考提供商。它有效,它使用参考文献打开参考,然后转到eek:转到参考,
尽管,我不使用这些命令editor.actor.action.peeklocations或editor.actor.action.showReferences for参考提供商,所有内容都是由VS Code API自动管理的,我们只需要实现ProvidEreFerences并返回位置和URI即可。
现在,我想对Codelens提供商进行与TypeCript完成的操作,即单击引用时,它打开了一个窥视窗口。 : 代码镜头参考
我已经提供 是否有一种方法可以直接链接该密码和参考提供商,因此单击引用相同的引用时?
I already have an existing reference provider for the custom language. It works, it opens a references using go to references and go to peek: Go to references
Although, I am not using these commands editor.action.peekLocations or editor.action.showReferences for the reference provider and everything is automatically managed by VS Code API, we just need to implement provideReferences and return location and uri.
Now, I want to do the same with codelens provider as done for typecript, i.e., on clicking on references, it opens a peek window. :
Code lens references
I have provide
Is there a way, to directly link this codelens and reference provider, so on clicking on the references it does the same?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
找到答案,我们必须使用VS-Code内置命令的“ editor.action.showreferences”命令。参考Vscode的GitHub仓库: https://github.com/microsoft/vscode/blob/main/main/extensions/typescript-language-features/src/languagefeatures/codelens/basecodelens/basecodelensprovider.ts
Found the answer, We have to use "editor.action.showReferences" command from VS- Code built-in commands. Reference from the github repo of vscode: https://github.com/microsoft/vscode/blob/main/extensions/typescript-language-features/src/languageFeatures/codeLens/baseCodeLensProvider.ts