From 74f61e5ab86390b3045353f598b90ab56c049afb Mon Sep 17 00:00:00 2001 From: Erik De Bonte Date: Fri, 18 Jul 2025 10:37:27 -0700 Subject: [PATCH 1/3] Remove customization for CompletionItemKind --- generator/plugins/python/utils.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) 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 From 1639d89e8437cbbced4eff05d909faadcacd9792 Mon Sep 17 00:00:00 2001 From: Erik De Bonte Date: Fri, 18 Jul 2025 10:52:57 -0700 Subject: [PATCH 2/3] Update generated python --- packages/python/lsprotocol/types.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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 From e2e037c62cff0c028f9363c746f22a96a15acf7b Mon Sep 17 00:00:00 2001 From: Erik De Bonte Date: Fri, 18 Jul 2025 12:20:18 -0700 Subject: [PATCH 3/3] Remove hook --- packages/python/lsprotocol/_hooks.py | 17 ----------------- 1 file changed, 17 deletions(-) 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,