@@ -73,20 +73,26 @@ func (l *LanguageService) getQuickInfoAndDocumentationForSymbol(c *checker.Check
7373func (l * LanguageService ) getDocumentationFromDeclaration (c * checker.Checker , symbol * ast.Symbol , declaration * ast.Node , location * ast.Node , contentFormat lsproto.MarkupKind ) string {
7474 // Handle binding elements specially (variables created from destructuring) - we need to get the documentation from the property type
7575 // The declaration passed in might be the binding element itself, but we need the interface property declaration
76- if symbol != nil && symbol .ValueDeclaration != nil && ast .IsBindingElement (symbol .ValueDeclaration ) && ast .IsIdentifier (location ) {
77- bindingElement := symbol .ValueDeclaration
78- parent := bindingElement .Parent
79- name := bindingElement .PropertyName ()
80- if name == nil {
81- name = bindingElement .Name ()
82- }
83- if ast .IsIdentifier (name ) && ast .IsObjectBindingPattern (parent ) {
84- propertyName := name .Text ()
85- objectType := c .GetTypeAtLocation (parent )
86- if objectType != nil {
87- propertySymbol := findPropertyInType (c , objectType , propertyName )
88- if propertySymbol != nil && propertySymbol .ValueDeclaration != nil {
89- declaration = propertySymbol .ValueDeclaration
76+ // Check all declarations to see if any is a binding element
77+ if symbol != nil && ast .IsIdentifier (location ) {
78+ for _ , decl := range symbol .Declarations {
79+ if decl != nil && ast .IsBindingElement (decl ) {
80+ bindingElement := decl
81+ parent := bindingElement .Parent
82+ name := bindingElement .PropertyName ()
83+ if name == nil {
84+ name = bindingElement .Name ()
85+ }
86+ if ast .IsIdentifier (name ) && ast .IsObjectBindingPattern (parent ) {
87+ propertyName := name .Text ()
88+ objectType := c .GetTypeAtLocation (parent )
89+ if objectType != nil {
90+ propertySymbol := findPropertyInType (c , objectType , propertyName )
91+ if propertySymbol != nil && propertySymbol .ValueDeclaration != nil {
92+ declaration = propertySymbol .ValueDeclaration
93+ break
94+ }
95+ }
9096 }
9197 }
9298 }
0 commit comments