public async Task HandleAsync(RequestHoverText command, KernelInvocationContext context) { if (!command.DocumentIdentifier.TryDecodeDocumentFromDataUri(out var documentContents)) { return; } var(document, offset) = GetDocumentWithOffsetFromCode(documentContents); var text = await document.GetTextAsync(); var cursorPosition = text.Lines.GetPosition(new LinePosition(command.Position.Line, command.Position.Character)); var absolutePosition = cursorPosition + offset; var service = QuickInfoService.GetService(document); var info = await service.GetQuickInfoAsync(document, absolutePosition); if (info == null) { return; } var scriptSpanStart = text.Lines.GetLinePosition(offset); var linePosSpan = text.Lines.GetLinePositionSpan(info.Span); var correctedLinePosSpan = linePosSpan.SubtractLineOffset(scriptSpanStart); context.PublishHoverMarkdownResponse(command, info.ToMarkdownString(), correctedLinePosSpan); }