diff --git a/generator/plugins/python/utils.py b/generator/plugins/python/utils.py index 1700ede..9887230 100644 --- a/generator/plugins/python/utils.py +++ b/generator/plugins/python/utils.py @@ -23,13 +23,7 @@ def customizations(spec: model.LSPModel) -> model.LSPModel: - # https://github.com/microsoft/lsprotocol/issues/344 - # Allow CompletionItemKind to support custom values - for enum in spec.enumerations: - if enum.name == "CompletionItemKind": - enum.supportsCustomValues = True - break - + # Add any required spec customizations here (ex. to work around spec bugs). return spec diff --git a/packages/python/lsprotocol/_hooks.py b/packages/python/lsprotocol/_hooks.py index be22ad7..fca4f5b 100644 --- a/packages/python/lsprotocol/_hooks.py +++ b/packages/python/lsprotocol/_hooks.py @@ -728,15 +728,6 @@ def _text_edit_hook( return converter.structure(object_, lsp_types.AnnotatedTextEdit) return converter.structure(object_, lsp_types.TextEdit) - def _completion_item_kind_hook( - object_: Any, _: type - ) -> Union[lsp_types.CompletionItemKind, OptionalPrimitive]: - if object_ is None: - return None - if isinstance(object_, (bool, int, str, float)): - return object_ - return converter.structure(object_, lsp_types.CompletionItemKind) - def _relative_pattern_hook( object_: Any, _: type ) -> Union[OptionalPrimitive, lsp_types.RelativePattern]: @@ -1124,14 +1115,6 @@ def _text_document_content_hook( ], _text_edit_hook, ), - ( - Optional[Union[lsp_types.CompletionItemKind, int]], - _completion_item_kind_hook, - ), - ( - Union[lsp_types.CompletionItemKind, int], - _completion_item_kind_hook, - ), ( Optional[Union[str, lsp_types.RelativePattern]], _relative_pattern_hook, diff --git a/packages/python/lsprotocol/types.py b/packages/python/lsprotocol/types.py index eb0e3ba..f093d59 100644 --- a/packages/python/lsprotocol/types.py +++ b/packages/python/lsprotocol/types.py @@ -3349,7 +3349,7 @@ class CompletionItem: @since 3.17.0""" # Since: 3.17.0 - kind: Optional[Union[CompletionItemKind, int]] = attrs.field(default=None) + kind: Optional[CompletionItemKind] = attrs.field(default=None) """The kind of this completion item. Based of the kind an icon is chosen by the editor.""" @@ -9414,9 +9414,7 @@ class ClientCompletionItemOptionsKind: # Since: 3.18.0 - value_set: Optional[Sequence[Union[CompletionItemKind, int]]] = attrs.field( - default=None - ) + value_set: Optional[Sequence[CompletionItemKind]] = attrs.field(default=None) """The completion item kind values the client supports. When this property exists the client also guarantees that it will handle values outside its set gracefully and falls back