c# - Using roslyn for hover over data for source tree symbols -
question: how apply personal documentationprovider source tree symbols? type of symbol when use symbolfinder.findsymbolatposition()
specifically want override getdocumentationforsymbol() function. have overridden autocomplete symbols not symbols hover over.
background:
hi, using roslyn gather intellisense text editor creating. 1 of things need make quick info or tool tips. have working autocomplete suggestions. using snippet looks this
compilation = csharpcompilation.create( "myintellisense", new[] { csharpsyntaxtree.parsetext(dotnetcode) }, assemblies .select(i => metadatareference .createfromfile(i.location, metadatareferenceproperties.assembly, new dotnetdocumentationprovider( new csharpcompilationoptions(outputkind.dynamicallylinkedlibrary));
this uses own personal dotnetdocumentationprovider parses xml , documentation way need it. works assembly symbols types of symbols have when use recommender.getrecommendedsymbolsatposition().
edit: wanted give more background :)
i symbols in 2 different ways.
1) 1 way when call
var symbols = recommender.getrecommendedsymbolsatposition(semanticmodel, offset, solution.workspace);
i use when user asks auto-complete information these symbols can go through , each 1 call:
var information = symbol.getdocumentationcommentxml();
this calls function have overridden class documentationprovider :
protected override string getdocumentationforsymbol(string documentationmemberid, cultureinfo preferredculture, cancellationtoken cancellationtoken = default(cancellationtoken))
2) second way when user hovers on
var symbol = symbolfinder.findsymbolatposition(semanticmodel, offset, workspace, cancellationtoken);
i call exact same function (from same line of code actually, keeping dry)
var information = symbol.getdocumentationcommentxml();
but not invoke overridden getdocumentationcommentxml() instead default roslyn 1 called.
thanks!
not finding of symbols need,how find more symbols using roslyn api
another question asked, when solved issue solved problem having here. problem thought
_workspace.currentsolution.addmetadatareferences(_currentproject.id,_compilation.references);
updated workspace working in. not returns solution references added. needed use
_workspace.tryapplychanges(referencesolution);
to save it. jason answering other question found @ link. if post here mark answer.
Comments
Post a Comment