Skip to content

Commit

Permalink
internal/lsp: exit graceful for modfiles in semantic tokens
Browse files Browse the repository at this point in the history
Change-Id: I86e6dbdd6e51af9b947c34fd04489ed34687b3c3
Reviewed-on: https://go-review.googlesource.com/c/tools/+/319849
Trust: Robert Findley <[email protected]>
Run-TryBot: Robert Findley <[email protected]>
gopls-CI: kokoro <[email protected]>
Reviewed-by: Heschi Kreinick <[email protected]>
TryBot-Result: Go Bot <[email protected]>
  • Loading branch information
findleyr committed May 13, 2021
1 parent cd1be5d commit 09ab05b
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/lsp/semantic.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ func (s *Server) computeSemanticTokens(ctx context.Context, td protocol.TextDocu
}
return template.SemanticTokens(ctx, snapshot, fh.URI(), add, data)
}
if fh.Kind() != source.Go {
return nil, nil
}
pkg, err := snapshot.PackageForFile(ctx, fh.URI(), source.TypecheckFull, source.WidestPackage)
if err != nil {
return nil, err
Expand Down

0 comments on commit 09ab05b

Please sign in to comment.