Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
440 changes: 251 additions & 189 deletions generator/lsp.json

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions packages/python/lsprotocol/_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -734,6 +734,17 @@ def _language_kind_hook(
return object_
return converter.structure(object_, lsp_types.LanguageKind)

def _text_edit_hook(
object_: Any, _: type
) -> Union[
lsp_types.TextEdit, lsp_types.AnnotatedTextEdit, lsp_types.SnippetTextEdit
]:
if "snippet" in object_:
return converter.structure(object_, lsp_types.SnippetTextEdit)
if "annotationId" in object_:
return converter.structure(object_, lsp_types.AnnotatedTextEdit)
return converter.structure(object_, lsp_types.TextEdit)

structure_hooks = [
(
Optional[
Expand Down Expand Up @@ -1079,6 +1090,14 @@ def _language_kind_hook(
Union[lsp_types.LanguageKind, str],
_language_kind_hook,
),
(
Union[
lsp_types.TextEdit,
lsp_types.AnnotatedTextEdit,
lsp_types.SnippetTextEdit,
],
_text_edit_hook,
),
]
for type_, hook in structure_hooks:
converter.register_structure_hook(type_, hook)
Expand Down
Loading