Examples of Visual Studio "GoTo Definition" for custom language?

Are there examples of implementing a custom language extension (textual DSL) in Visual Studio 2017, with support for "GoTo Definition"? It seems there is not enough flexibility in the VisualStudioWorkspace to support generic symbol tables (i.e., not C# or VB).

There is support for GoTo Definition for custom languages in Visual Studio Code.

The support for "GoTo Definition" in Java for Visual Studio, in JavaIntellisenseController.GoToSourceImpl(), doesn't seem to actually resolve Java symbols.

Roslyn implements the abstract method Microsoft.VisualStudio.LanguageServices.VisualStudioWorkspace.TryGoToDefinition(), but this API uses types specific to .NET languages, like Microsoft.CodeAnalysis.ISymbol.

Is there another way, maybe using a custom Workspace class?


Solution 1:

Building a language server looks like it will soon be a useful alternative to building custom language support in Visual Studio from scratch. Visual Studio is getting a new experimental facility for language servers, available in preview here. Examples of language servers built in C# are available from Microsoft and OmniSharp. The latter looks like a general scaffold for building language servers in C#.

This answer doesn't point to a working open source example of a custom language implementation for Visual Studio with "GoTo Definition" support, as asked, but it provides a more workable alternative. The question about re-using the VisualStudioWorkspace is moot; a language server maintains its own workspace state.

Language servers don't implement syntax highlighting. VS Code uses a TextMate grammar for syntax highlighting. But there are hints that more refined syntax highlighting will be available from the language server protocol in the future.