-
Notifications
You must be signed in to change notification settings - Fork 748
Display inherited JSDoc documentation in quick info #2111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
627d866
2f03c6b
00febb7
2088eb6
edd0e5a
2ff4b9d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -72,7 +72,7 @@ func (l *LanguageService) getDocumentationFromDeclaration(c *checker.Checker, de | |||||||||||||||
| } | ||||||||||||||||
| isMarkdown := contentFormat == lsproto.MarkupKindMarkdown | ||||||||||||||||
| var b strings.Builder | ||||||||||||||||
| if jsdoc := getJSDocOrTag(declaration); jsdoc != nil && !containsTypedefTag(jsdoc) { | ||||||||||||||||
| if jsdoc := getJSDocOrTag(c, declaration); jsdoc != nil && !containsTypedefTag(jsdoc) { | ||||||||||||||||
| l.writeComments(&b, c, jsdoc.Comments(), isMarkdown) | ||||||||||||||||
| if jsdoc.Kind == ast.KindJSDoc { | ||||||||||||||||
| if tags := jsdoc.AsJSDoc().Tags; tags != nil { | ||||||||||||||||
|
|
@@ -143,14 +143,6 @@ func getQuickInfoAndDeclarationAtLocation(c *checker.Checker, symbol *ast.Symbol | |||||||||||||||
| return "", nil | ||||||||||||||||
| } | ||||||||||||||||
| declaration := symbol.ValueDeclaration | ||||||||||||||||
| if symbol.Flags&ast.SymbolFlagsClass != 0 && inConstructorContext(node) { | ||||||||||||||||
| if s := symbol.Members[ast.InternalSymbolNameConstructor]; s != nil { | ||||||||||||||||
| symbol = s | ||||||||||||||||
| declaration = core.Find(symbol.Declarations, func(d *ast.Node) bool { | ||||||||||||||||
| return ast.IsConstructorDeclaration(d) || ast.IsConstructSignatureDeclaration(d) | ||||||||||||||||
| }) | ||||||||||||||||
| } | ||||||||||||||||
| } | ||||||||||||||||
| flags := symbol.Flags | ||||||||||||||||
| if flags&ast.SymbolFlagsProperty != 0 && declaration != nil && ast.IsMethodDeclaration(declaration) { | ||||||||||||||||
| flags = ast.SymbolFlagsMethod | ||||||||||||||||
|
|
@@ -209,30 +201,43 @@ func getQuickInfoAndDeclarationAtLocation(c *checker.Checker, symbol *ast.Symbol | |||||||||||||||
| b.WriteString(t.AsLiteralType().String()) | ||||||||||||||||
| } | ||||||||||||||||
| case flags&(ast.SymbolFlagsFunction|ast.SymbolFlagsMethod) != 0: | ||||||||||||||||
| signatures := getSignaturesAtLocation(c, symbol, checker.SignatureKindCall, node) | ||||||||||||||||
| if len(signatures) == 1 { | ||||||||||||||||
| if d := signatures[0].Declaration(); d != nil && d.Flags&ast.NodeFlagsJSDoc == 0 { | ||||||||||||||||
| declaration = d | ||||||||||||||||
| } | ||||||||||||||||
| } | ||||||||||||||||
| prefix := core.IfElse(flags&ast.SymbolFlagsMethod != 0, "(method) ", "function ") | ||||||||||||||||
| writeSignatures(&b, c, signatures, container, prefix, symbol) | ||||||||||||||||
| case flags&ast.SymbolFlagsConstructor != 0: | ||||||||||||||||
| signatures := getSignaturesAtLocation(c, symbol.Parent, checker.SignatureKindConstruct, node) | ||||||||||||||||
| if len(signatures) == 1 { | ||||||||||||||||
| if d := signatures[0].Declaration(); d != nil && d.Flags&ast.NodeFlagsJSDoc == 0 { | ||||||||||||||||
| declaration = d | ||||||||||||||||
| if ast.IsIdentifier(node) && ast.IsFunctionLikeDeclaration(node.Parent) && node.Parent.Name() == node { | ||||||||||||||||
| declaration = node.Parent | ||||||||||||||||
| signatures := []*checker.Signature{c.GetSignatureFromDeclaration(declaration)} | ||||||||||||||||
| writeSignatures(&b, c, signatures, container, prefix, symbol) | ||||||||||||||||
| } else { | ||||||||||||||||
| signatures := getSignaturesAtLocation(c, symbol, checker.SignatureKindCall, node) | ||||||||||||||||
| if len(signatures) == 1 { | ||||||||||||||||
| if d := signatures[0].Declaration(); d != nil && d.Flags&ast.NodeFlagsJSDoc == 0 { | ||||||||||||||||
| declaration = d | ||||||||||||||||
| } | ||||||||||||||||
| } | ||||||||||||||||
| writeSignatures(&b, c, signatures, container, prefix, symbol) | ||||||||||||||||
| } | ||||||||||||||||
| writeSignatures(&b, c, signatures, container, "constructor ", symbol.Parent) | ||||||||||||||||
| case flags&(ast.SymbolFlagsClass|ast.SymbolFlagsInterface) != 0: | ||||||||||||||||
| if node.Kind == ast.KindThisKeyword || ast.IsThisInTypeQuery(node) { | ||||||||||||||||
| b.WriteString("this") | ||||||||||||||||
| } else if node.Kind == ast.KindConstructorKeyword && (ast.IsConstructorDeclaration(node.Parent) || ast.IsConstructSignatureDeclaration(node.Parent)) { | ||||||||||||||||
| declaration = node.Parent | ||||||||||||||||
| signatures := []*checker.Signature{c.GetSignatureFromDeclaration(declaration)} | ||||||||||||||||
| writeSignatures(&b, c, signatures, container, "constructor ", symbol) | ||||||||||||||||
| } else { | ||||||||||||||||
| b.WriteString(core.IfElse(flags&ast.SymbolFlagsClass != 0, "class ", "interface ")) | ||||||||||||||||
| b.WriteString(c.SymbolToStringEx(symbol, container, ast.SymbolFlagsNone, symbolFormatFlags)) | ||||||||||||||||
| params := c.GetDeclaredTypeOfSymbol(symbol).AsInterfaceType().LocalTypeParameters() | ||||||||||||||||
| writeTypeParams(&b, c, params) | ||||||||||||||||
| var signatures []*checker.Signature | ||||||||||||||||
| if flags&ast.SymbolFlagsClass != 0 && getCallOrNewExpression(node) != nil { | ||||||||||||||||
| signatures = getSignaturesAtLocation(c, symbol, checker.SignatureKindConstruct, node) | ||||||||||||||||
|
Comment on lines
+227
to
+228
|
||||||||||||||||
| if flags&ast.SymbolFlagsClass != 0 && getCallOrNewExpression(node) != nil { | |
| signatures = getSignaturesAtLocation(c, symbol, checker.SignatureKindConstruct, node) | |
| if flags&ast.SymbolFlagsClass != 0 { | |
| callOrNewExpr := getCallOrNewExpression(node) | |
| if callOrNewExpr != nil && ast.IsNewExpression(callOrNewExpr) { | |
| signatures = getSignaturesAtLocation(c, symbol, checker.SignatureKindConstruct, node) | |
| } |
Uh oh!
There was an error while loading. Please reload this page.