Skip to content

Commit 7cd463e

Browse files
authored
Change LSPObject to be an alias of object (#121)
Closes #120
1 parent d83ff38 commit 7cd463e

2 files changed

Lines changed: 9 additions & 12 deletions

File tree

generator/utils.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -615,14 +615,16 @@ def _add_structure(
615615
for d in definitions:
616616
self._add_structure(d, lsp_model)
617617

618-
indent = " " * 4
618+
indent = "" if struct_def.name == "LSPObject" else " " * 4
619619
doc = _get_indented_documentation(struct_def.documentation, indent)
620620
class_name = struct_def.name
621621

622622
class_lines = [
623623
"" if class_name == "LSPObject" else "@attrs.define",
624624
"@functools.total_ordering" if class_name == "Position" else "",
625-
f"class {class_name}:",
625+
f"{class_name} = object"
626+
if class_name == "LSPObject"
627+
else f"class {class_name}:",
626628
f'{indent}"""{doc}"""' if struct_def.documentation else "",
627629
f"{indent}# Since: {_sanitize_comment(struct_def.since)}"
628630
if struct_def.since
@@ -651,7 +653,7 @@ def _add_structure(
651653
methods = self._get_additional_methods(class_name)
652654

653655
# If the class has no properties then add `pass`
654-
if len(properties) == 0 and not methods:
656+
if len(properties) == 0 and not methods and class_name != "LSPObject":
655657
code_lines += [f"{indent}pass"]
656658

657659
if methods:

lsprotocol/types.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6443,15 +6443,10 @@ class WorkspaceUnchangedDocumentDiagnosticReport:
64436443
provided."""
64446444

64456445

6446-
class LSPObject:
6447-
"""LSP object definition.
6448-
6449-
@since 3.17.0
6450-
"""
6451-
6452-
# Since: 3.17.0
6453-
6454-
pass
6446+
LSPObject = object
6447+
"""LSP object definition.
6448+
@since 3.17.0"""
6449+
# Since: 3.17.0
64556450

64566451

64576452
@attrs.define

0 commit comments

Comments
 (0)