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

@@ -92,6 +92,7 @@ struct use_entry {
char type[max_type + 1]{};
char canonical[max_type + 1]{};
char signature[max_signature + 1]{};
unsigned result_type_uid{};
bool conflict{};
};
@@ -729,6 +730,9 @@ void record_use(tree call, tree decl) {
}
if (result_type && TYPE_P(result_type)) {
record_type(result_type);
if (find_type(TYPE_UID(result_type))) {
entry.result_type_uid = TYPE_UID(result_type);
}
}
const char *signature = decl_as_string(decl, TFF_SCOPE | TFF_RETURN_TYPE);
if (signature && std::strlen(signature) <= max_signature && utf8_valid(signature)) {
@@ -858,6 +862,9 @@ void finish(void *, void *) {
json_string(out, use.type);
std::fputs(",\"canonicalType\":", out);
json_string(out, use.canonical);
if (use.result_type_uid) {
std::fprintf(out, ",\"resultTypeUid\":%u", use.result_type_uid);
}
if (use.signature[0]) {
std::fputs(",\"signature\":", out);
json_string(out, use.signature);