Native VBS and CMake builds of the server and every registered suite: protocol and document sync, VBS/compdb providers, stock GCC diagnostics (including in-process default profile preparation), the stock occurrence observer and hover/definition, the bounded Scheduler, C++ module graph, scan and artifact cache with real CMI production, the context-aware symbol index with schema-2 snapshot migration, navigation and guarded rename, reflection provenance with splice-origin extraction, index-backed completion and signature help, live GCC worker control with a registered DAP suite, and the Neovim and VS Code clients. VoidLibrary follows main. The private GCC 16.2.0 frontend is reproduced from the versioned patches and verified stepping reflection/template code with projected values 17/34 and 41/82.
63 lines
2.3 KiB
C++
63 lines
2.3 KiB
C++
#pragma once
|
|
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <optional>
|
|
#include <span>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <vector>
|
|
|
|
namespace vls::features::signature {
|
|
|
|
struct Limits {
|
|
std::size_t signatures{8};
|
|
std::size_t parameters{64};
|
|
std::size_t labelBytes{1024};
|
|
std::size_t parameterBytes{256};
|
|
std::size_t scanBytes{64 * 1024};
|
|
};
|
|
|
|
struct Parameter {
|
|
std::string label;
|
|
// Byte range of label within the signature label, when it can be located.
|
|
std::optional<std::pair<std::uint32_t, std::uint32_t>> range;
|
|
auto operator<=>(const Parameter &) const = default;
|
|
};
|
|
|
|
struct Signature {
|
|
std::string label;
|
|
std::vector<Parameter> parameters;
|
|
auto operator<=>(const Signature &) const = default;
|
|
};
|
|
|
|
struct Result {
|
|
std::vector<Signature> signatures;
|
|
std::uint32_t active_signature{};
|
|
std::uint32_t active_parameter{};
|
|
};
|
|
|
|
// Splits one compiler signature into a label and its parameter list. Commas
|
|
// nested in (), [], {} or a plausible template argument list do not separate
|
|
// parameters. A signature without a parameter list keeps an empty list.
|
|
[[nodiscard]] Signature parse(std::string_view signature, const Limits & = Limits{});
|
|
|
|
// Number of the active parameter at the byte offset: top-level commas between
|
|
// the innermost open parenthesis and the offset, ignoring literals, comments
|
|
// and nested brackets. The backward scan is bounded by the limit.
|
|
[[nodiscard]] std::uint32_t active_parameter(std::string_view text, std::size_t offset,
|
|
const Limits & = Limits{});
|
|
|
|
// True when the offset lies inside the argument list opened after the callee
|
|
// span [use_start, use_end): the first '(' after the span and its matching ')'
|
|
// must enclose the offset. The scan is bounded and ignores literals/comments.
|
|
[[nodiscard]] bool in_call(std::string_view text, std::size_t use_start, std::size_t use_end,
|
|
std::size_t offset, const Limits & = Limits{});
|
|
|
|
// Complete signature help for a call site. Empty or malformed signatures are
|
|
// skipped; an empty result means no signature is available.
|
|
[[nodiscard]] Result build(std::span<const std::string> signatures, std::string_view text,
|
|
std::size_t offset, const Limits & = Limits{});
|
|
|
|
} // namespace vls::features::signature
|