Skip to content

Commit c5c8d6b

Browse files
committed
fixed gotodefinition in struct literals
1 parent 3e9661d commit c5c8d6b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

handlers/gotoDefinition.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,14 @@ func (def *definitionVisitor) VisitFuncCall(e *ast.FuncCall) ast.VisitResult {
143143
}
144144

145145
func (def *definitionVisitor) VisitStructLiteral(e *ast.StructLiteral) ast.VisitResult {
146+
if len(e.Args) != 0 {
147+
for _, expr := range e.Args {
148+
if helper.IsInRange(expr.GetRange(), def.pos) {
149+
return ast.VisitRecurse
150+
}
151+
}
152+
}
153+
146154
if struc, ok := e.Struct, e.Struct != nil; ok {
147155
def.location = &protocol.Location{
148156
URI: def.getUri(struc),

0 commit comments

Comments
 (0)