summaryrefslogtreecommitdiffstats
path: root/packages/python/lsprotocol/converters.py
diff options
context:
space:
mode:
Diffstat (limited to 'packages/python/lsprotocol/converters.py')
-rw-r--r--packages/python/lsprotocol/converters.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/packages/python/lsprotocol/converters.py b/packages/python/lsprotocol/converters.py
new file mode 100644
index 0000000..db12c65
--- /dev/null
+++ b/packages/python/lsprotocol/converters.py
@@ -0,0 +1,17 @@
+# Copyright (c) Microsoft Corporation. All rights reserved.
+# Licensed under the MIT License.
+
+from typing import Optional
+
+import cattrs
+
+from . import _hooks
+
+
+def get_converter(
+ converter: Optional[cattrs.Converter] = None,
+) -> cattrs.Converter:
+ """Adds cattrs hooks for LSP lsp_types to the given converter."""
+ if converter is None:
+ converter = cattrs.Converter()
+ return _hooks.register_hooks(converter)