mirror of
https://github.com/golang/go
synced 2024-11-18 14:54:40 -07:00
internal/lsp: add scheme checks to CodeLens
I missed this newly-added function in CL 219483. Change-Id: I4490f579236a7ed358fb7a7ed80276560f19b04e Reviewed-on: https://go-review.googlesource.com/c/tools/+/219539 Run-TryBot: Heschi Kreinick <heschi@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
parent
b320d3a0f5
commit
dc8ced655d
@ -70,25 +70,14 @@ func (s *Server) cancelRequest(ctx context.Context, params *protocol.CancelParam
|
||||
}
|
||||
|
||||
func (s *Server) codeLens(ctx context.Context, params *protocol.CodeLensParams) ([]protocol.CodeLens, error) {
|
||||
uri := params.TextDocument.URI.SpanURI()
|
||||
view, err := s.session.ViewOf(uri)
|
||||
if err != nil {
|
||||
snapshot, fh, ok, err := s.beginFileRequest(params.TextDocument.URI, source.Mod)
|
||||
if !ok {
|
||||
return nil, err
|
||||
}
|
||||
if !view.Snapshot().IsSaved(uri) {
|
||||
if !snapshot.IsSaved(fh.Identity().URI) {
|
||||
return nil, nil
|
||||
}
|
||||
fh, err := view.Snapshot().GetFile(uri)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
switch fh.Identity().Kind {
|
||||
case source.Go:
|
||||
return nil, nil
|
||||
case source.Mod:
|
||||
return mod.CodeLens(ctx, view.Snapshot(), uri)
|
||||
}
|
||||
return nil, nil
|
||||
return mod.CodeLens(ctx, snapshot, fh.Identity().URI)
|
||||
}
|
||||
|
||||
func (s *Server) nonstandardRequest(ctx context.Context, method string, params interface{}) (interface{}, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user