Ejemplo n.º 1
0
        public static HoverResponse FromHoverEvent(HoverTextProduced responseEvent)
        {
            var markupContent = responseEvent switch
            {
                HoverMarkdownProduced markdown => new MarkupContent(MarkupKind.Markdown, markdown.Content),
                HoverPlainTextProduced plainText => new MarkupContent(MarkupKind.Plaintext, plainText.Content),
                _ => throw new NotSupportedException(),
            };

            return(new HoverResponse(
                       markupContent,
                       Range.FromLinePositionSpan(responseEvent.Range)));
        }
        public static void PublishHoverTextResponse(this KernelInvocationContext context, RequestHoverText command, IReadOnlyCollection <FormattedValue> content, LinePositionSpan?linePositionSpan = null)
        {
            var response = new HoverTextProduced(command, content, linePositionSpan);

            context.Publish(response);
        }
Ejemplo n.º 3
0
        public static HoverResponse FromHoverEvent(HoverTextProduced responseEvent)
        {
            var preferredContent = responseEvent.Content.OrderBy(c => PriorityFromMimeType(c.MimeType)).First();

            return(new HoverResponse(new MarkupContent(MarkupKindFromMimeType(preferredContent.MimeType), preferredContent.Value)));
        }