Serve type hierarchy from observer class facts

Occurrences carry their result type uid, decoded types are retained per
editor entry, and a bounded core selects direct bases and inverse
subtypes. The server advertises typeHierarchyProvider and serves
prepareTypeHierarchy, supertypes and subtypes. Registered feature tests
cover the selection; a real stdio session prepared DerivedA and
returned Base as supertype and DerivedA/DerivedB as subtypes of Base.
This commit is contained in:
faumaray committed 2026-12-05 23:36:05 +03:00
1 parent b1c8a4a625
commit 86b9923532
14 files changed
+357 -15

No files matched your search

@@ -134,13 +134,19 @@ def analyze(work, nonce, admitted, complete=True, partial=None):
check(isinstance(occurrence, dict), "occurrence is not an object")
check({"name", "type", "canonicalType", "use", "definition"} <= set(occurrence)
and set(occurrence) <= {"name", "type", "canonicalType", "signature",
"use", "definition"},
"use", "definition", "resultTypeUid"},
f"unexpected occurrence keys {sorted(occurrence)}")
name = occurrence["name"]
check(re.fullmatch(r"[A-Za-z_]\w{0,63}", name, re.ASCII), f"bad name {name!r}")
check(isinstance(occurrence["type"], str) and occurrence["type"], "bad type")
check(isinstance(occurrence["canonicalType"], str) and occurrence["canonicalType"],
"bad canonical type")
if "resultTypeUid" in occurrence:
uid = occurrence["resultTypeUid"]
check(type(uid) is int and uid > 0, f"bad resultTypeUid {uid!r}")
check(any(reference["uid"] == uid
for entry in report["types"] for reference in [entry["self"]]),
f"resultTypeUid {uid} has no type entry")
if "signature" in occurrence:
signature = occurrence["signature"]
check(isinstance(signature, str) and 0 < len(signature) <= 300, "bad signature")