1
0
mirror of https://github.com/golang/go synced 2024-11-18 00:04:43 -07:00

internal/lsp: check file kind before showing warning

We had been previously popping up warning for go.mod files.

Change-Id: I6ff016e94ec46467a5c60309f825798961df66f6
Reviewed-on: https://go-review.googlesource.com/c/tools/+/254939
Trust: Rebecca Stambler <rstambler@golang.org>
Trust: Robert Findley <rfindley@google.com>
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Robert Findley <rfindley@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
This commit is contained in:
Rebecca Stambler 2020-09-14 22:52:54 -04:00
parent 3c2036f9a9
commit 6498648128

View File

@ -323,6 +323,13 @@ func (s *Server) checkForOrphanedFile(ctx context.Context, snapshot source.Snaps
return
}
for _, uri := range uris {
fh, err := snapshot.GetFile(ctx, uri)
if err != nil {
continue
}
if fh.Kind() != source.Go {
continue
}
pkgs, err := snapshot.PackagesForFile(ctx, uri, source.TypecheckWorkspace)
if len(pkgs) > 0 || err == nil {
return