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.
112 lines
3.1 KiB
C++
112 lines
3.1 KiB
C++
#pragma once
|
|
|
|
#include <compare>
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <expected>
|
|
#include <map>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <vector>
|
|
|
|
namespace vls::navigation {
|
|
|
|
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 Location {
|
|
std::string path;
|
|
Range range;
|
|
auto operator<=>(const Location &) const = default;
|
|
};
|
|
|
|
// Semantic identity of one binding. The definition location joins equal
|
|
// symbols across analysis contexts; the name distinguishes unrelated symbols
|
|
// without a proven definition.
|
|
struct Binding {
|
|
std::string name;
|
|
std::optional<Location> definition;
|
|
auto operator<=>(const Binding &) const = default;
|
|
};
|
|
|
|
struct Fact {
|
|
Binding binding;
|
|
std::string context;
|
|
std::string source; // use file
|
|
std::string content; // content identity of the observed source
|
|
Range use;
|
|
bool editable{};
|
|
std::string provenance;
|
|
};
|
|
|
|
struct ContextState {
|
|
std::string context;
|
|
bool complete{};
|
|
std::string reason;
|
|
};
|
|
|
|
struct FactSet {
|
|
std::string backend;
|
|
std::uint64_t generation{};
|
|
std::vector<Fact> facts;
|
|
std::vector<ContextState> contexts;
|
|
std::map<std::string, std::string> current_sources; // path -> current content
|
|
};
|
|
|
|
enum class Refusal {
|
|
none,
|
|
unknown_binding,
|
|
ambiguous_binding,
|
|
incomplete_coverage,
|
|
stale_source,
|
|
non_editable_origin,
|
|
generated_name,
|
|
invalid_name,
|
|
unchanged_name,
|
|
multi_file_without_transaction,
|
|
};
|
|
|
|
struct References {
|
|
std::vector<Location> locations;
|
|
bool coverage_complete{};
|
|
std::vector<std::string> incomplete_contexts;
|
|
bool truncated{};
|
|
};
|
|
|
|
struct Edit {
|
|
std::string path;
|
|
Range range;
|
|
std::string replacement;
|
|
std::string content; // content identity the edit was prepared against
|
|
};
|
|
|
|
struct RenamePlan {
|
|
Refusal refusal{Refusal::none};
|
|
std::string detail;
|
|
std::vector<Edit> edits;
|
|
[[nodiscard]] bool ready() const { return refusal == Refusal::none && !edits.empty(); }
|
|
};
|
|
|
|
// Resolves the unique binding at a position. Overlapping distinct bindings are
|
|
// ambiguous and never resolved by iteration order.
|
|
[[nodiscard]] std::expected<Binding, Refusal> binding_at(const FactSet &, std::string_view path,
|
|
Position);
|
|
|
|
// All proven uses. Partial locations are retained for diagnosis, but
|
|
// coverage_complete is false whenever any context is incomplete.
|
|
[[nodiscard]] References references(const FactSet &, const Binding &, std::size_t limit = 512);
|
|
|
|
// Only a ready plan may be applied. Refusals are explicit for incomplete
|
|
// coverage, stale sources, non-editable origins, ambiguous bindings,
|
|
// generated/invalid names and multi-file edits without a transactional client.
|
|
[[nodiscard]] RenamePlan prepare_rename(const FactSet &, std::string_view path, Position,
|
|
std::string_view replacement, bool transactional_client);
|
|
|
|
} // namespace vls::navigation
|