#pragma once #include #include #include #include #include #include #include #include namespace vls::features::inlay_hints { struct Position { std::uint32_t line{}, character{}; auto operator<=>(const Position &) const = default; }; struct Range { Position start, end; auto operator<=>(const Range &) const = default; }; struct Hint { Position position; std::string label; std::uint32_t kind{}; // LSP InlayHintKind: 2 is Parameter bool padding_left{}, padding_right{}; auto operator<=>(const Hint &) const = default; }; struct Limits { std::size_t arguments{16}; std::size_t hints{256}; std::size_t labelBytes{128}; }; // Byte offsets of the top-level argument starts of the call whose '(' follows // CALLEE_END. Nested brackets, literals and comments do not split arguments. [[nodiscard]] std::vector argument_starts(std::string_view text, std::size_t callee_end, const Limits & = Limits{}); // One parameter-type hint before each argument, taken from the compiler // signature for that position. Hints outside the requested range are skipped; // a signature without that parameter contributes nothing. [[nodiscard]] std::vector parameter_hints(std::span signatures, 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 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 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