Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is the Roslyn model so C#/VB.NET centric that it precludes XAML analysis now and in the future?

I have just read the blog entry by JetBrains (Resharper) that suggests that Roslyn could never do XAML analysis:

Another core difference is that Roslyn covers exactly two languages, C# and VB.NET, whereas ReSharper architecture is multilingual

(quote from resharper blog)

For the uninitiated Resharper can do very good static analysis on XAML code allowing code completion and refactoring together with C#.

I am curious. Is the Roslyn architecture general enough to be extended to other languages than C# and VB.Net such as XAML or is it very specific.

To avoid suggesting this is opinion based I am looking for evidence in the source. Obviously any code can be refactored /re-engineered over time to fit some other purpose but I'm only interested in current evidence in the source or references to quotes from Roslyn develepors indicating that there is intent to extend Roslyn as an analysis engine to other languages such as XAML.

like image 563
bradgonesurfing Avatar asked Apr 11 '14 07:04

bradgonesurfing


1 Answers

Hard to teach "languages" in a paragraph or two. People tend top call many things "language" and in some very general sense they might be but in real-world of programming "language" means programming language. In that world, XAML is not language at all :-) because you can't write code in it.

XAML is a data description format and yes in a very general sense it can be called a language (has some basic constructs, their combination rules, and the result denotes something meaningful). But it doesn't have even its own syntax - it's XML. So it belongs to a group with say MSBuild and HTML. The kind of analysis you could, in theory, do with that is entirely different and very much related to the actual domain that the format describes.

For MSBuild files, you could write some code to analyze dependencies it denotes and says try to find and point out holes in that but all you need for that are a few standard .NET classes. You don't need a parser, don't have any code generation, etc. You just load XML like any other and you already have everything and cam cruise around and dig out relations. Same for XAML. For everything XML-based "Roslyn" is XmlDocument, or XPathDocument.

Roslyn breaks it basks to produce a tree structure that allows you the same kind of cruising freedom that you get just by loading the XAML document into XmlDocument.

like image 91
Pera Avatar answered Nov 07 '22 22:11

Pera