@@ -43,6 +43,7 @@ export interface DisplayInfo {
4343 kind : DisplayInfoKind ;
4444 displayParts : ts . SymbolDisplayPart [ ] ;
4545 documentation : ts . SymbolDisplayPart [ ] | undefined ;
46+ tags : ts . JSDocTagInfo [ ] | undefined ;
4647}
4748
4849export function getSymbolDisplayInfo (
@@ -61,13 +62,14 @@ export function getSymbolDisplayInfo(
6162 const displayParts = createDisplayParts (
6263 symbol . declaration . name , kind , /* containerName */ undefined ,
6364 typeChecker . typeToString ( symbol . tsType ) ) ;
64- const documentation = symbol . kind === SymbolKind . Reference ?
65- getDocumentationFromTypeDefAtLocation ( tsLS , symbol . targetLocation ) :
66- getDocumentationFromTypeDefAtLocation ( tsLS , symbol . initializerLocation ) ;
65+ const quickInfo = symbol . kind === SymbolKind . Reference ?
66+ getQuickInfoFromTypeDefAtLocation ( tsLS , symbol . targetLocation ) :
67+ getQuickInfoFromTypeDefAtLocation ( tsLS , symbol . initializerLocation ) ;
6768 return {
6869 kind,
6970 displayParts,
70- documentation,
71+ documentation : quickInfo ?. documentation ,
72+ tags : quickInfo ?. tags ,
7173 } ;
7274}
7375
@@ -121,28 +123,37 @@ export function unsafeCastDisplayInfoKindToScriptElementKind(kind: DisplayInfoKi
121123 return kind as string as ts . ScriptElementKind ;
122124}
123125
124- function getDocumentationFromTypeDefAtLocation (
125- tsLS : ts . LanguageService , tcbLocation : TcbLocation ) : ts . SymbolDisplayPart [ ] | undefined {
126+ function getQuickInfoFromTypeDefAtLocation (
127+ tsLS : ts . LanguageService , tcbLocation : TcbLocation ) : ts . QuickInfo | undefined {
126128 const typeDefs =
127129 tsLS . getTypeDefinitionAtPosition ( tcbLocation . tcbPath , tcbLocation . positionInFile ) ;
128130 if ( typeDefs === undefined || typeDefs . length === 0 ) {
129131 return undefined ;
130132 }
131- return tsLS . getQuickInfoAtPosition ( typeDefs [ 0 ] . fileName , typeDefs [ 0 ] . textSpan . start )
132- ?. documentation ;
133+ return tsLS . getQuickInfoAtPosition ( typeDefs [ 0 ] . fileName , typeDefs [ 0 ] . textSpan . start ) ;
133134}
134135
135136export function getDirectiveDisplayInfo (
136137 tsLS : ts . LanguageService , dir : PotentialDirective ) : DisplayInfo {
137138 const kind = dir . isComponent ? DisplayInfoKind . COMPONENT : DisplayInfoKind . DIRECTIVE ;
138139 const decl = dir . tsSymbol . declarations . find ( ts . isClassDeclaration ) ;
139140 if ( decl === undefined || decl . name === undefined ) {
140- return { kind, displayParts : [ ] , documentation : [ ] } ;
141+ return {
142+ kind,
143+ displayParts : [ ] ,
144+ documentation : [ ] ,
145+ tags : undefined ,
146+ } ;
141147 }
142148
143149 const res = tsLS . getQuickInfoAtPosition ( decl . getSourceFile ( ) . fileName , decl . name . getStart ( ) ) ;
144150 if ( res === undefined ) {
145- return { kind, displayParts : [ ] , documentation : [ ] } ;
151+ return {
152+ kind,
153+ displayParts : [ ] ,
154+ documentation : [ ] ,
155+ tags : undefined ,
156+ } ;
146157 }
147158
148159 const displayParts =
@@ -152,6 +163,7 @@ export function getDirectiveDisplayInfo(
152163 kind,
153164 displayParts,
154165 documentation : res . documentation ,
166+ tags : res . tags ,
155167 } ;
156168}
157169
@@ -167,7 +179,12 @@ export function getTsSymbolDisplayInfo(
167179 }
168180 const res = tsLS . getQuickInfoAtPosition ( decl . getSourceFile ( ) . fileName , decl . name . getStart ( ) ) ;
169181 if ( res === undefined ) {
170- return { kind, displayParts : [ ] , documentation : [ ] } ;
182+ return {
183+ kind,
184+ displayParts : [ ] ,
185+ documentation : [ ] ,
186+ tags : undefined ,
187+ } ;
171188 }
172189
173190 const type = checker . getDeclaredTypeOfSymbol ( symbol ) ;
@@ -179,5 +196,6 @@ export function getTsSymbolDisplayInfo(
179196 kind,
180197 displayParts,
181198 documentation : res . documentation ,
199+ tags : res . tags ,
182200 } ;
183201}
0 commit comments