Report full function extents from the stock observer

The observer emits an optional extent inside each proven definition
span from the body's last statement finish (the C++ frontend does not
set function_end_locus). The occurrence decoder binds it to the same
snapshot through the negotiated encoding and rejects malformed
extents; call hierarchy attributes nested calls to the enclosing
extent. A real stdio session reported both inner calls as outgoing
from outer, and the observer and occurrence corpora still pass.
This commit is contained in:
faumaray committed 2026-12-05 17:28:59 +03:00
1 parent a098e45dc9
commit ec86a79a1a
11 files changed
+239 -11

No files matched your search

+8 -4
View File
@@ -1470,11 +1470,13 @@ Json EditorDiagnostics::call_hierarchy_incoming(const Json &item) const {
call.range = {{occurrence.use.start.line, occurrence.use.start.character},
{occurrence.use.end.line, occurrence.use.end.character}};
if (occurrence.has_definition()) {
const auto &extent =
occurrence.extent ? *occurrence.extent : occurrence.definition;
features::call_hierarchy::Definition definition{
occurrence.name,
occurrence.definition_file->identity.canonical_path.native(),
{{occurrence.definition.start.line, occurrence.definition.start.character},
{occurrence.definition.end.line, occurrence.definition.end.character}}};
{{extent.start.line, extent.start.character},
{extent.end.line, extent.end.character}}};
call.callee_definition = definition;
known.push_back(std::move(definition));
}
@@ -1535,11 +1537,13 @@ Json EditorDiagnostics::call_hierarchy_outgoing(const Json &item) const {
call.range = {{occurrence.use.start.line, occurrence.use.start.character},
{occurrence.use.end.line, occurrence.use.end.character}};
if (occurrence.has_definition()) {
const auto &extent =
occurrence.extent ? *occurrence.extent : occurrence.definition;
features::call_hierarchy::Definition definition{
occurrence.name,
occurrence.definition_file->identity.canonical_path.native(),
{{occurrence.definition.start.line, occurrence.definition.start.character},
{occurrence.definition.end.line, occurrence.definition.end.character}}};
{{extent.start.line, extent.start.character},
{extent.end.line, extent.end.character}}};
call.callee_definition = definition;
known.push_back(std::move(definition));
}