locked
Contained languages in Visual Studio 2010 RRS feed

  • Question

  • Hi,

    If I remember correctly, language services which hosted another languages (like aspx language service hosting C#, VB etc.) had to be created in VC++ and it wasn't exactly an easy task. Has anything changed in this area for Visual Studio 2010? Is it possible to create such a language service in pure C# now?

    Thanks for info.


    -md-
    Thursday, June 24, 2010 11:05 AM

Answers

  • Hi Martin,

    This is, indeed, possible. Our architect, Jack Tilford, is working on pulling a sample and some documentation on doing this together. That being said, it is no small amount of work and it will take a lot of effort to both implement and test. 

    As soon as this comes together, I'll come back and post links. : )

    Cheers,

    Chris Granger
    Visual Studio Pro Experience

    • Marked as answer by Martin Dvorak Wednesday, July 7, 2010 10:35 AM
    Thursday, July 1, 2010 10:51 PM

All replies

  • Hi Martin,

    Thanks for your post.

    As far as I know, there is not a good way to create a language service in other language service. But you can try to create a new language service which includes features of both language services. And I think it does not make sense if you create a language service included all features of Visual C++ and C#, for there are lots of conflicts between these two language services.

    If I misunderstood you, or you have any comments, please feel free to let me know.

     

    Regards,

    Nancy Shao [MSFT]
    MSDN Subscriber Support in Forum
    If you have any feedback on our support, please contact msdnmg @ microsoft.com


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Friday, June 25, 2010 5:17 AM
  • Hi Nancy,

    thanks for reply. Sorry, I probably haven't made myself clear enough. English is not my native language so sometimes it's a struggle for me :-) I'll try to be more specific.

    I want to create a language service for a language whose source code may contain blocks of code written in another languages (like C#, VB etc.) and I want all features which Visual Studio provides for these languages to work in these blocks properly (like syntax coloring, Intellisense etc.).

    It's very similar to ASPX files which contain C# or VB code or HTML files which contain Javascript. In Visual Studio, you have syntax coloring and intellisense working in javascript blocks when you edit HTML file and I would like to implement the same functionality for my language. In other words I want to reuse other language services the same way ASPX or HTML editor does that.

    From what I have learned the key component for implementation of this functionality is IVsContainedLanguage interface. In VS SDK term the parent language seems to be called host language or primary language and children languages are called contained or secondary language. I was also led to believe that with VS 2008 SDK there was no way to create host language service in C# only.

    Because I do not want to go back to C++ I was hoping maybe this situation has changed (since VS 2010 moved to .NET and WPF for most parts including the source code editor), and it is now possible to create host language service in C# only. Hence my previous question.

    If it is possible to do it in C#, I would move mountains for some working samples to start from. Even samples in C++ would be fine if C++ is still needed.

    I'll be happy to clarify the question even more if it's still not clear enough.

    Thanks very much for answers.


    -md-
    Friday, June 25, 2010 2:47 PM
  • Hi Martin,

    Please check the Spark View engine at http://sparkviewengine.com/. If you agree to their licencing terms you can then download and browse their code.  There is a "Tools.sln" containing what you are looking for.

     

    Friday, June 25, 2010 5:12 PM
  • Hi Constantin,

    Thanks for the tip. I happen to know about this implementation (and the source code). It is written in C++ and for VS 2008, which is why my original question still stands - I am still hoping that with VS 2010 things have changed and it is now possible to do this in C#. Can anybody from the team confirm/deny this, please?

    Thanks very much.


    -md-
    Monday, June 28, 2010 9:15 AM
  • Hi Martin,

    This is, indeed, possible. Our architect, Jack Tilford, is working on pulling a sample and some documentation on doing this together. That being said, it is no small amount of work and it will take a lot of effort to both implement and test. 

    As soon as this comes together, I'll come back and post links. : )

    Cheers,

    Chris Granger
    Visual Studio Pro Experience

    • Marked as answer by Martin Dvorak Wednesday, July 7, 2010 10:35 AM
    Thursday, July 1, 2010 10:51 PM
  • Thanks Chris, that's really great news! I'll be looking forward to both the sample and the documentation.


    -md-
    Wednesday, July 7, 2010 10:40 AM
  • Hi Chris,

    Are there any news regarding the sample and the documentation?

    Thanks, Martin


    -md-
    Wednesday, March 9, 2011 5:26 PM