Skip to content

Commit

Permalink
Fix enum definition name hover
Browse files Browse the repository at this point in the history
  • Loading branch information
kralicky committed Jan 4, 2024
1 parent 21c25f7 commit 56baafc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/lsp/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,12 @@ func deepPathSearch(path []ast.Node, parseRes parser.Result, linkRes linker.Resu
case *ast.ReservedNode:
}
case ast.IdentValueNode:
want.desc = haveDesc.Values().ByName(protoreflect.Name(wantNode.AsIdentifier()))
// this could be either the enum name itself or a value name
if haveNode, ok := have.node.(*ast.EnumNode); ok && haveNode.Name == wantNode {
want.desc = haveDesc
} else {
want.desc = haveDesc.Values().ByName(protoreflect.Name(wantNode.AsIdentifier()))
}
}
case protoreflect.EnumValueDescriptor:
switch wantNode := want.node.(type) {
Expand Down

0 comments on commit 56baafc

Please sign in to comment.