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

@@ -81,6 +81,13 @@ class EditorDiagnostics {
// Calls made inside a prepared item's function.
[[nodiscard]] Void::LanguageServer::Protocol::Json
call_hierarchy_outgoing(const Void::LanguageServer::Protocol::Json &item) const;
// Type hierarchy at a call position and from a prepared item.
[[nodiscard]] Void::LanguageServer::Protocol::Json
prepare_type_hierarchy(std::string_view uri, Documents::Position position) const;
[[nodiscard]] Void::LanguageServer::Protocol::Json
type_hierarchy_supertypes(const Void::LanguageServer::Protocol::Json &item) const;
[[nodiscard]] Void::LanguageServer::Protocol::Json
type_hierarchy_subtypes(const Void::LanguageServer::Protocol::Json &item) const;
// Parameter-type hints from the compiler signature, within the range.
[[nodiscard]] Void::LanguageServer::Protocol::Json inlay_hints(std::string_view uri,
Documents::Range range) const;
+3
View File
@@ -22,6 +22,8 @@ struct Occurrence {
// Whole definition extent when the compiler reported one (function body
// included). Call hierarchy uses it to attribute nested calls.
std::optional<Documents::Range> extent;
// Uid of the reported class type of this call's result, when present.
std::uint32_t result_type_uid{};
[[nodiscard]] bool has_definition() const noexcept { return definition_file != nullptr; }
};
@@ -29,6 +31,7 @@ struct Occurrence {
struct TypeRef {
std::string name, path;
Documents::Range range;
std::uint32_t uid{};
};
// A class observed as a call's result type and its direct bases.
struct ReflectedType {