mirror of
https://github.com/golang/go
synced 2024-11-05 16:56:16 -07:00
d7fc2cf50e
It encourages poor performing log lines, and also reduces the readability of those lines. Also delete the Key.With method which was unused, and should never be used instead of the event.Label function anyway. Change-Id: I9b55102864ee49a7d03e60af022a2002170c0fb1 Reviewed-on: https://go-review.googlesource.com/c/tools/+/222851 Run-TryBot: Ian Cottrell <iancottrell@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Emmanuel Odeke <emm.odeke@gmail.com>
31 lines
978 B
Go
31 lines
978 B
Go
// Copyright 2018 The Go Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file.
|
|
|
|
package lsp
|
|
|
|
import (
|
|
"context"
|
|
|
|
"golang.org/x/tools/internal/lsp/debug/tag"
|
|
"golang.org/x/tools/internal/lsp/protocol"
|
|
"golang.org/x/tools/internal/lsp/source"
|
|
"golang.org/x/tools/internal/telemetry/event"
|
|
)
|
|
|
|
func (s *Server) signatureHelp(ctx context.Context, params *protocol.SignatureHelpParams) (*protocol.SignatureHelp, error) {
|
|
snapshot, fh, ok, err := s.beginFileRequest(params.TextDocument.URI, source.Go)
|
|
if !ok {
|
|
return nil, err
|
|
}
|
|
info, activeParameter, err := source.SignatureHelp(ctx, snapshot, fh, params.Position)
|
|
if err != nil {
|
|
event.Print(ctx, "no signature help", tag.Position.Of(params.Position), event.Err.Of(err))
|
|
return nil, nil
|
|
}
|
|
return &protocol.SignatureHelp{
|
|
Signatures: []protocol.SignatureInformation{*info},
|
|
ActiveParameter: float64(activeParameter),
|
|
}, nil
|
|
}
|