Skip to content

Commit a11f2ac

Browse files
committed
update:support overload anonymous reference
1 parent ab79a37 commit a11f2ac

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

gopls/internal/lsp/source/implementation_gox.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,9 @@ func gopPathEnclosingObjNode(f *ast.File, pos token.Pos) []ast.Node {
430430
if pos == n.Star {
431431
pos = n.X.Pos()
432432
}
433+
case *ast.FuncLit:
434+
//goxls:overload anonymous function
435+
found = n.Type.Func <= pos && pos <= n.Type.Func+token.Pos(len("func"))
433436
}
434437

435438
return !found

gopls/internal/lsp/source/references_gox.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,9 @@ func gopObjectsAt(info *typesutil.Info, file *ast.File, pos token.Pos) (map[type
581581
return nil, nil, fmt.Errorf("%w for import %s", errNoObjectFound, GopUnquoteImportPath(leaf))
582582
}
583583
targets[obj] = leaf
584+
case *ast.FuncLit:
585+
obj := info.Implicits[leaf]
586+
targets[obj] = leaf
584587
}
585588

586589
if len(targets) == 0 {

0 commit comments

Comments
 (0)