Files
nx_post_support/server/libs/tclint/commands/schema.py
T
Christoph Brandau 53ebc5d055 chore(lsprotocol): migrate to 2025.0.0 and cleanup artifacts
The changes align the project with the 2025.0.0 lsprotocol
release, removing the old backport and updating type hints
in the protocol hooks to use Sequence where appropriate. The
dist-info and packaging metadata for older lsprotocol
versions are replaced with the new 2025.0.0 artifacts.

- Remove exceptiongroup backport used on Python <3.11
- Use Sequence instead of List in LS protocol hooks
- Replace old dist-info with 2025.0.0 metadata
2026-09-03 08:39:12 +02:00

46 lines
1.1 KiB
Python

from collections.abc import Callable
from voluptuous import Optional, Or, Schema, Self
_switch_value = Or({"type": "any"}, {"type": "int"}, None)
_positional_value = Or(
{"type": "any"},
{"type": "int"},
{"type": "variadic"},
{"type": "script"},
{"type": "expression"},
)
# Need to define this as a Schema with required=True to ensure that this requirement
# persists through the Or in the main schema definition.
_command_args = Schema(
{
Optional("positionals", default=[]): [
{
"name": str,
"required": bool,
"value": _positional_value,
}
],
Optional("switches", default={}): {
Optional(str): {
"required": bool,
"repeated": bool,
"value": _switch_value,
Optional("metavar"): str,
}
},
},
required=True,
)
commands_schema = Schema(
{Optional(str): Or(_command_args, None, {"subcommands": Self}, Callable)},
required=True,
)
schema = Schema(
{"name": str, "commands": commands_schema},
required=True,
)