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
8 changes: 1 addition & 7 deletions generator/plugins/python/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
17 changes: 0 additions & 17 deletions packages/python/lsprotocol/_hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]:
Expand Down Expand Up @@ -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,
Expand Down
6 changes: 2 additions & 4 deletions packages/python/lsprotocol/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""

Expand Down Expand Up @@ -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
Expand Down
Loading