From 64986481280e06c512dcd7674532f4f7f4cfc0c6 Mon Sep 17 00:00:00 2001 From: Rebecca Stambler Date: Mon, 14 Sep 2020 22:52:54 -0400 Subject: [PATCH] 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 Trust: Robert Findley Run-TryBot: Rebecca Stambler Reviewed-by: Robert Findley gopls-CI: kokoro TryBot-Result: Go Bot --- internal/lsp/text_synchronization.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/internal/lsp/text_synchronization.go b/internal/lsp/text_synchronization.go index facabbc9d9..0a39de3843 100644 --- a/internal/lsp/text_synchronization.go +++ b/internal/lsp/text_synchronization.go @@ -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