From 9602b48adcec377c5b50b314ad05f4ebc3ecfdb0 Mon Sep 17 00:00:00 2001 From: Gregor Best Date: Sun, 12 May 2024 17:11:41 +0200 Subject: [PATCH] L: don't panic if hover help is not available (#73) --- internal/lsp/acmelsp/remote.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/internal/lsp/acmelsp/remote.go b/internal/lsp/acmelsp/remote.go index 7125ff7..dcbf36f 100644 --- a/internal/lsp/acmelsp/remote.go +++ b/internal/lsp/acmelsp/remote.go @@ -188,13 +188,21 @@ func (rc *RemoteCmd) Hover(ctx context.Context) error { if err != nil { return err } + hov, err := rc.server.Hover(ctx, &protocol.HoverParams{ TextDocumentPositionParams: *pos, }) if err != nil { return err } + + if hov == nil { + fmt.Fprintln(rc.Stdout, "No hover help available.") + return nil + } + fmt.Fprintf(rc.Stdout, "%v\n", hov.Contents.Value) + return nil }