- 
                Notifications
    
You must be signed in to change notification settings  - Fork 730
 
Quick Info fixes #1971
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
Quick Info fixes #1971
Changes from all commits
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 | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 
          
            
          
           | 
    @@ -129,6 +129,9 @@ func getQuickInfoAndDeclarationAtLocation(c *checker.Checker, symbol *ast.Symbol | |||||||||||||
| } | ||||||||||||||
| } | ||||||||||||||
| flags := symbol.Flags | ||||||||||||||
| if flags&ast.SymbolFlagsProperty != 0 && declaration != nil && ast.IsMethodDeclaration(declaration) { | ||||||||||||||
| flags = ast.SymbolFlagsMethod | ||||||||||||||
| } | ||||||||||||||
| if flags&ast.SymbolFlagsType != 0 && (ast.IsPartOfTypeNode(node) || ast.IsTypeDeclarationName(node)) { | ||||||||||||||
| // If the symbol has a type meaning and we're in a type context, remove value-only meanings | ||||||||||||||
| flags &^= ast.SymbolFlagsVariable | ast.SymbolFlagsFunction | ||||||||||||||
| 
          
            
          
           | 
    @@ -165,7 +168,11 @@ func getQuickInfoAndDeclarationAtLocation(c *checker.Checker, symbol *ast.Symbol | |||||||||||||
| } | ||||||||||||||
| b.WriteString(c.SymbolToStringEx(symbol, container, ast.SymbolFlagsNone, symbolFormatFlags)) | ||||||||||||||
| b.WriteString(": ") | ||||||||||||||
| b.WriteString(c.TypeToStringEx(c.GetTypeOfSymbolAtLocation(symbol, node), container, typeFormatFlags)) | ||||||||||||||
| if callNode := getCallOrNewExpression(node); callNode != nil { | ||||||||||||||
| b.WriteString(c.SignatureToStringEx(c.GetResolvedSignature(callNode), container, typeFormatFlags|checker.TypeFormatFlagsWriteCallStyleSignature|checker.TypeFormatFlagsWriteTypeArgumentsOfSignature|checker.TypeFormatFlagsWriteArrowStyleSignature)) | ||||||||||||||
        
    
 | 
||||||||||||||
| b.WriteString(c.SignatureToStringEx(c.GetResolvedSignature(callNode), container, typeFormatFlags|checker.TypeFormatFlagsWriteCallStyleSignature|checker.TypeFormatFlagsWriteTypeArgumentsOfSignature|checker.TypeFormatFlagsWriteArrowStyleSignature)) | |
| if sig := c.GetResolvedSignature(callNode); sig != nil { | |
| b.WriteString(c.SignatureToStringEx(sig, container, typeFormatFlags|checker.TypeFormatFlagsWriteCallStyleSignature|checker.TypeFormatFlagsWriteTypeArgumentsOfSignature|checker.TypeFormatFlagsWriteArrowStyleSignature)) | |
| } else { | |
| b.WriteString(c.TypeToStringEx(c.GetTypeOfSymbolAtLocation(symbol, node), container, typeFormatFlags)) | |
| } | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The flags reassignment overwrites all flags with only SymbolFlagsMethod, losing other potentially important flag information. Consider using bitwise operations to add the Method flag while preserving other flags:
flags = (flags &^ ast.SymbolFlagsProperty) | ast.SymbolFlagsMethod.