'Using C#-Language Server of Visual Studio 2019 in VSIX Extension

I'd like to create a new extension that allows some kind of text templating similar to Microsoft's T4 runtime text templating engine.

Those templates can contain C# code and I'd like to have LSP functionality for these snippets within the Visual Studio text editor, i.e. renaming, go to definition, hover tips etc.

Is there a way to use/connect to the existing C# language server in such a way that I can send the C# code snippets to it for processing?

How does the Razor engine in ASP.net do it?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source