简体   繁体   English

将 Visual Studio 代码编辑器用作扩展中的控件

[英]Using Visual Studio Code Editor as a Control in an extension

I'm trying to write an extension for Visual Studio 2010. I want to add a number of code editors next to each other in one window to show a bunch of code extracts in one view.我正在尝试为 Visual Studio 2010 编写扩展。我想在一个 window 中添加多个代码编辑器,以便在一个视图中显示一堆代码提取。 Is it possible to use the Visual Studio Code Editor for C# as a Control to be able to place it into a panel or a WPF Canvas?是否可以将 C# 的 Visual Studio 代码编辑器用作控件,以便能够将其放入面板或 WPF Canvas 中? Is there a dll, where I can find the Visual Studio Code Editor and how can it be loaded?是否有 dll,我可以在其中找到 Visual Studio 代码编辑器以及如何加载它?

Thanks a lot ksman非常感谢 ksman

You can use Visual Studio Language Services feature which allows you to create your own language.您可以使用允许您创建自己的语言的Visual Studio 语言服务功能。 But you just want to use the code editor only for C# which is already available for you.但是您只想为 C# 使用代码编辑器,它已经可供您使用。 So, you can use the built in C# language service in order to get full features of a language service.因此,您可以使用内置的 C# 语言服务来获得语言服务的全部功能。

This shows how to create a separate dialog for a language service.显示了如何为语言服务创建单独的对话框。 You have to install visual studio SDK for the samples.您必须为示例安装 Visual Studio SDK。 You can create a user control by using this if we want to put it in a WPF application.如果我们想将它放在 WPF 应用程序中,您可以使用它来创建用户控件。

Here is some more links that gives important walkthroughs.这里还有一些提供重要演练的链接。

As far as I know there is no way to use a dll and cater this as you ask in the question.据我所知,没有办法使用 dll 来满足您在问题中提出的要求。 This is a quite big job for person who is not quite familar with the language services.对于不太熟悉语言服务的人来说,这是一项相当大的工作。 But would be interesting...但是会很有趣...

Finally, using of Visual Studio Language services is the correct way to do this.最后,使用 Visual Studio 语言服务是正确的方法。 But bit more work to do.但是还有更多工作要做。 I think the links I've provided will show you the path.我认为我提供的链接将向您展示路径。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM