Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools@v0.0.0-20201105173854-bc9fc8d8c4bc / internal / lsp / signature_help.go
1 // Copyright 2018 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
4
5 package lsp
6
7 import (
8         "context"
9
10         "golang.org/x/tools/internal/event"
11         "golang.org/x/tools/internal/lsp/debug/tag"
12         "golang.org/x/tools/internal/lsp/protocol"
13         "golang.org/x/tools/internal/lsp/source"
14 )
15
16 func (s *Server) signatureHelp(ctx context.Context, params *protocol.SignatureHelpParams) (*protocol.SignatureHelp, error) {
17         snapshot, fh, ok, release, err := s.beginFileRequest(ctx, params.TextDocument.URI, source.Go)
18         defer release()
19         if !ok {
20                 return nil, err
21         }
22         info, activeParameter, err := source.SignatureHelp(ctx, snapshot, fh, params.Position)
23         if err != nil {
24                 event.Error(ctx, "no signature help", err, tag.Position.Of(params.Position))
25                 return nil, nil
26         }
27         return &protocol.SignatureHelp{
28                 Signatures:      []protocol.SignatureInformation{*info},
29                 ActiveParameter: float64(activeParameter),
30         }, nil
31 }