internal/lsp: do not return interface itself when finding implementations

Finding implementations of an interface should not give the interface itself
as an implementation.

Fixes #35601

Change-Id: Id3352619ece90fb7ca906ddabca613742d156c76
Reviewed-on: https://go-review.googlesource.com/c/tools/+/208667
Run-TryBot: Rohan Challa <rohan@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
Rohan Challa 2019-11-25 14:40:42 -05:00
parent 66af5afb16
commit 73db347c3b
1 changed files with 4 additions and 0 deletions

View File

@ -77,6 +77,10 @@ func (i *IdentifierInfo) Implementation(ctx context.Context) ([]protocol.Locatio
if err != nil {
return nil, err
}
// Do not add interface itself to the list.
if ident.Declaration.spanRange == i.Declaration.spanRange {
continue
}
locations = append(locations, protocol.Location{
URI: protocol.NewURI(ident.Declaration.URI()),
Range: decRange,