通过Visual Studio扩展名进行自定义Intellicode预测
我想在带有扩展的Visual Studio中添加自定义Intellicode预测/内联建议。在VSCODE中,我可以使用vscode.inlinecompletionProvider/inlinecompletionItem
来执行此操作。在Visual Studio扩展中可以执行相同事情的类/方法是什么?
I would like to add the custom IntelliCode prediction/inline suggestion in Visual Studio with extension. In VSCode, I can use vscode.InlineCompletionProvider/InlineCompletionItem
to do that. What's the class/method that would do the same things in Visual Studio extension?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我有同样的要求,但我没有找到任何API。
但是,您可以做的是使用装饰来绘制看起来像代码的文本。
定义装饰:
获取图层并添加一个文本块:
您可以按以下方式获取当前的编辑器设置:
此方法的问题是样式和字体大小与编辑器略有不同。即使使用编辑器设置。
但是,我认为Intellicode和Github Copilot使用另一种技术。正如您在这里看到的那样:
github coilot
似乎整个代码已经插入了编辑器,但具有特殊的样式/行为。因此,有可能以某种方式,但我没有如何实现这一目标。
有关装饰的更多信息,例如:
使用Roslyn 的VSIX
I had the same requirement but I did not find any API for that.
However, what you can do is use adornments to draw a text that looks like code.
Define the adornment:
Get the layer and add a TextBlock:
You can get the current editor settings as follows:
The issue with this approach is that the styling and font size slightly differs from the editor. Even if you use the editor setting.
However I think that IntelliCode and GitHub Copilot use another technique. As you can see here:
GitHub Coilot
It seems as the whole code is already inserted to the editor but has a special styling/behaviour. So it is possible somehow, but I don't how to achieve that.
For more information on adornments look here for example:
Visual Studio Text Adornment VSIX using Roslyn
您可以实现基于自定义语言的语句完成。请看一下:
浏览:显示语句完成
实现自定义XAML Intellisense VS2017
扩展>
自定义IntelliSense扩展
另一个不同的选项是使用 github copilot for Visual Studio的扩展使用AI预测代码
You can implement your custom language-based statement completion. Please take a look at:
Walkthrough: Displaying Statement Completion
Implementing Custom XAML Intellisense VS2017 Extension
Visual-studio – Custom Intellisense Extension
Custom Intellisense Extension
Another different option is using GitHub Copilot extension for Visual Studio, it predicts code using AI