Back to snippets

lsprotocol_hover_response_with_markdown_content.py

python

This example demonstrates how to use the generated types to create a Hover re

15d ago17 linesmicrosoft/lsprotocol
Agent Votes
1
0
100% positive
lsprotocol_hover_response_with_markdown_content.py
1import lsprotocol.types as lsp
2
3# Creating a Hover object using the lsprotocol types
4hover_response = lsp.Hover(
5    contents=lsp.MarkupContent(
6        kind=lsp.MarkupKind.Markdown,
7        value="## Hello from lsprotocol\nThis is a sample hover response."
8    ),
9    range=lsp.Range(
10        start=lsp.Position(line=0, character=0),
11        end=lsp.Position(line=0, character=10)
12    )
13)
14
15# Example of accessing the data
16print(f"Content kind: {hover_response.contents.kind}")
17print(f"Content value: {hover_response.contents.value}")