This project is read-only.

CrefSyntax from ISymbol

Topics: APIs
May 28, 2014 at 9:42 PM
Edited May 28, 2014 at 9:50 PM
So I want to generate a code with <see cref="" /> and I have the thing I want cref to as an ISymbol. Unfortunately the SyntaxFactory.XmlCrefAttribute requires me to supply a CrefSyntax, and I wonder where should I get it from.

Do I really need tons of if (symbol is ITypeSymboInfo) to know if I should call SyntaxFactory.TypeCref (for which I hit the issue of missing ITypeSymbol -> TypeSyntax path btw.), .QualifiedCref, .NameMemberCref, .IndexerMemberCref, .OperatorMemberCref, .ConversionOperatorMemberCref?

I simply want to put the string there, not caring about whether it is a member or type!

Which brings me to another question, why would one want to use these typed syntaxes like XmlNameAttribute, XmlCretAttriibute etc. instead of XmlTextAttribute when generating code?

Edit: ...or even using a string already containing the desired xml?

May 29, 2014 at 9:58 PM
Edited May 29, 2014 at 9:58 PM
JanKucera wrote:
Edit: ...or even using a string already containing the desired xml?
Okay, seriously, I succeeded with using XmlTextElement and XmlTextAttribute, but it's non-trivial fiddling with the nodes, tokens and trivia in the tree to get these in properly. I also tried just to place the xml I want into XmlTextLiteral and it simply works. Is that good enough or is the work to return parsed tree worth the effort?