Implement the VLS roadmap on the native VBS build

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.
This commit is contained in:
faumaray committed 2026-12-05 14:06:50 +03:00
1 parent ca04975d54
commit da8003f6d4
310 files changed
+47552 -480

No files matched your search

+95
View File
@@ -0,0 +1,95 @@
#pragma once
#include <compare>
#include <cstddef>
#include <cstdint>
#include <span>
#include <string>
#include <string_view>
#include <vector>
namespace vls::features::completion {
// Candidate origin is explicit: this slice ranks workspace symbols from the
// analysis index and never claims compiler-native completion.
enum class Kind { unknown, function, type, variable, field, namespace_, module, keyword };
struct Limits {
std::size_t candidates{200};
std::size_t labelBytes{256};
std::size_t detailBytes{512};
std::size_t provenanceBytes{128};
};
// Stable identity of one completion candidate across a later resolve request.
struct Identity {
std::string name;
std::string path;
std::uint32_t line{}, character{};
auto operator<=>(const Identity &) const = default;
};
struct Candidate {
std::string label;
Kind kind{Kind::unknown};
std::string detail;
std::string provenance;
Identity identity;
auto operator<=>(const Candidate &) const = default;
};
struct Item {
std::string label;
Kind kind{Kind::unknown};
std::string detail;
std::string provenance;
std::string sort_text;
Identity identity;
// Byte offsets of the identifier prefix the item replaces.
std::size_t replacement_start{}, replacement_end{};
auto operator<=>(const Item &) const = default;
};
struct Result {
std::vector<Item> items;
// True until compiler-native completion exists; index candidates are not
// authoritative for visibility or accessibility.
bool incomplete{true};
std::string backend{"symbol-index"};
};
// Longest ASCII identifier prefix ending at the byte offset. Empty when the
// preceding text is not an identifier or the prefix starts with a digit.
[[nodiscard]] std::string_view prefix_at(std::string_view text, std::size_t offset);
// Filters candidates whose label starts with the prefix, deduplicates by label
// and kind, ranks deterministically (kind priority, shorter label, label) and
// bounds every field. The replacement range covers the prefix.
[[nodiscard]] Result complete(std::span<const Candidate>, std::string_view text, std::size_t offset,
const Limits & = Limits{});
// A candidate as the current index generation reports it.
struct Detail {
Identity identity;
Kind kind{Kind::unknown};
std::string detail;
std::string provenance;
auto operator<=>(const Detail &) const = default;
};
struct Resolved {
enum class Status { resolved, stale, unknown };
Status status{Status::unknown};
std::string documentation;
std::string detail;
};
// Resolves a captured candidate identity against the current generation.
// A changed generation is stale and an absent identity is unknown; neither
// ever returns details for a different entity. Documentation is bounded and
// fenced so that editor rendering cannot be escaped by the content.
[[nodiscard]] Resolved resolve(const Identity &, std::uint64_t captured_generation,
std::uint64_t current_generation, std::span<const Detail>,
const Limits & = Limits{});
} // namespace vls::features::completion
+34
View File
@@ -0,0 +1,34 @@
#pragma once
#include <vls/index/SymbolIndex.hpp>
#include <vls/navigation/Navigation.hpp>
#include <cstddef>
#include <span>
#include <string>
#include <string_view>
namespace vls::features {
// What the caller currently knows about one source path. Content identity is
// the same opaque value the index stored; an empty identity means the caller
// cannot prove the file's current content, so its facts stay non-editable.
struct IndexedSource {
std::string path;
std::string content;
bool editable{};
};
// Merges one published index generation into a navigation fact set.
//
// Contexts the set does not know yet are added with the index's completeness.
// Each record's use location and every proven reference become facts whose
// binding joins on name and definition. Facts are deduplicated by binding,
// source and use; an existing fact always wins, so compiler-derived content
// identities are never replaced by weaker index data. A record whose source
// is unknown stays in the set as a non-editable fact: rename then refuses
// instead of editing an unverified file. Returns the number of added facts.
std::size_t ingest_index_facts(navigation::FactSet &, const index::Generation &,
std::span<const IndexedSource>, std::size_t limit = 65536);
} // namespace vls::features
+62
View File
@@ -0,0 +1,62 @@
#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