Add return-type inlay hints after calls
The bounded inlay-hint core now matches a call's closing parenthesis (nested calls, literals and comments aware) and places a type hint labelled with the compiler's canonical type. EditorDiagnostics emits it for every occurrence independently of parameter signatures. Registered tests cover nested matching, placement, skipped cases and bounds; a real stdio session showed both the parameter and return hints at the fnv1a64 call.
This commit is contained in:
1 parent
0bf5873069
commit
2cced8363d
6 files changed
+135
-7
No files matched your search
@@ -3,6 +3,7 @@
|
||||
#include <compare>
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <optional>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
@@ -44,4 +45,15 @@ argument_starts(std::string_view text, std::size_t callee_end, const Limits & =
|
||||
std::string_view text, std::size_t callee_end,
|
||||
Range requested, const Limits & = Limits{});
|
||||
|
||||
// Offset just past the matching ')' of the call whose '(' follows CALLEE_END.
|
||||
[[nodiscard]] std::optional<std::size_t> call_end(std::string_view text, std::size_t callee_end,
|
||||
const Limits & = Limits{});
|
||||
|
||||
// A return-type hint after the call's closing parenthesis, labelled with the
|
||||
// compiler's canonical type. Absent when the type is empty, the call is
|
||||
// unterminated or the position is outside the requested range.
|
||||
[[nodiscard]] std::optional<Hint> return_type_hint(std::string_view text, std::size_t callee_end,
|
||||
std::string_view canonical_type, Range requested,
|
||||
const Limits & = Limits{});
|
||||
|
||||
} // namespace vls::features::inlay_hints
|
||||
Reference in new issue
Block a user