Skip to content

Commit

Permalink
internal/lsp: avoid panic during interface assertion
Browse files Browse the repository at this point in the history
This change fixes a panic in the non-standard request.

Fixes golang/go#43462

Change-Id: I216a56f96ca6159cb9b102183ba3a3eddd186889
GitHub-Last-Rev: 992e818
GitHub-Pull-Request: #265
Reviewed-on: https://go-review.googlesource.com/c/tools/+/281092
Reviewed-by: Peter Weinberger <pjw@google.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Trust: Rebecca Stambler <rstambler@golang.org>
  • Loading branch information
pohzipohzi authored and dmitshur committed Jan 2, 2021
1 parent c4dccaf commit 2993f55
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions internal/lsp/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,9 @@ func (s *Server) workDoneProgressCancel(ctx context.Context, params *protocol.Wo
}

func (s *Server) nonstandardRequest(ctx context.Context, method string, params interface{}) (interface{}, error) {
paramMap := params.(map[string]interface{})
if method == "gopls/diagnoseFiles" {
switch method {
case "gopls/diagnoseFiles":
paramMap := params.(map[string]interface{})
for _, file := range paramMap["files"].([]interface{}) {
snapshot, fh, ok, release, err := s.beginFileRequest(ctx, protocol.DocumentURI(file.(string)), source.UnknownKind)
defer release()
Expand Down

0 comments on commit 2993f55

Please sign in to comment.