c# - Roslyn ImportAdderService doesn't visit trivia -
the microsoft.codeanalysis.editing.importadderservice.addimportsasync
method visits non-trivia syntax nodes, , therefore doesn't add namespace imports them. leads results, cref's in xml documentation comments cannot simplified short names, when using microsoft.codeanalysis.simplification.simplifier
.
the biggest problem have this, simplification can lead inconsistent results. assume have multiple cref's, , 1 cref, have namespace import (introduced due type, used in non-trivia node). then, 1 cref's gets shortened, , others don't.
for clarification.
before applying importadderservice
, simplifier
:
namespace namespace { /// <summary> /// <see cref=""system.collections.ienumerable"" /> /// <see cref=""system.collections.generic.ienumerable{t}"" />. /// </summary> internal class mydeclaration { system.collections.ienumerable field; } }
after applying importadderservice
, simplifier
:
using system.collections; namespace namespace { /// <summary> /// <see cref=""ienumerable"" /> /// <see cref=""system.collections.generic.ienumerable{t}"" />. /// </summary> internal class mydeclaration { ienumerable field; } }
question
can work around issue? want add usings types referenced in cref tags.
or design?
i guess indeed missing feature, tell importadderservice
visit trivia syntax nodes.
Comments
Post a Comment