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:
1 parent
ca04975d54
commit
da8003f6d4
310 files changed
+47552
-480
No files matched your search
@@ -0,0 +1,112 @@
|
||||
#pragma once
|
||||
|
||||
#include <Void/LanguageServer/Protocol/Json.hpp>
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <expected>
|
||||
#include <filesystem>
|
||||
#include <memory>
|
||||
#include <optional>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
namespace vls::gcc {
|
||||
|
||||
namespace Protocol = Void::LanguageServer::Protocol;
|
||||
using TraceResult = std::expected<void, std::string>;
|
||||
|
||||
// The journal is exclusively created and binds the immutable input to this invocation.
|
||||
// Commands are journalled before dispatch. Acknowledgement is a separate compiler event.
|
||||
class Trace {
|
||||
public:
|
||||
static std::expected<std::unique_ptr<Trace>, std::string>
|
||||
create(const std::filesystem::path &output, std::string_view source,
|
||||
std::string_view compiler_sha, std::string_view nonce, std::int64_t pid);
|
||||
~Trace();
|
||||
[[nodiscard]] TraceResult event(std::string_view line);
|
||||
[[nodiscard]] TraceResult authorize(std::uint32_t stop, std::string_view action);
|
||||
[[nodiscard]] std::optional<std::uint32_t> stopped() const;
|
||||
[[nodiscard]] bool ended() const;
|
||||
[[nodiscard]] std::string_view terminal() const;
|
||||
[[nodiscard]] Protocol::Json inspection() const;
|
||||
[[nodiscard]] TraceResult finish(std::string_view outcome, int exit_code,
|
||||
std::string_view diagnostics);
|
||||
|
||||
private:
|
||||
struct State;
|
||||
explicit Trace(std::unique_ptr<State>);
|
||||
std::unique_ptr<State> state_;
|
||||
};
|
||||
|
||||
struct ReplayEvent {
|
||||
std::uint32_t sequence;
|
||||
std::string_view kind;
|
||||
std::optional<std::uint32_t> frame;
|
||||
std::optional<std::uint32_t> parent;
|
||||
// Present together on a compiler resumed event.
|
||||
std::optional<std::uint32_t> acknowledged_stop;
|
||||
std::optional<std::string_view> acknowledged_action;
|
||||
};
|
||||
|
||||
struct ReplayValuePoint {
|
||||
std::uint32_t value_sequence;
|
||||
std::optional<std::uint32_t> stop_sequence;
|
||||
};
|
||||
|
||||
struct ReplayMetadata {
|
||||
std::string_view backend;
|
||||
std::string_view nonce;
|
||||
std::int64_t pid;
|
||||
std::string_view compiler_sha256;
|
||||
std::string_view source_sha256;
|
||||
bool partial;
|
||||
bool corrupt;
|
||||
std::optional<std::string_view> journal_error;
|
||||
std::optional<std::string_view> outcome;
|
||||
std::optional<int> exit_code;
|
||||
};
|
||||
|
||||
// Views borrow this recording. A shared owner keeps its validated prefix and raw bytes alive.
|
||||
class ReplayRecording {
|
||||
public:
|
||||
static std::expected<std::shared_ptr<const ReplayRecording>, std::string>
|
||||
open(const std::filesystem::path &absolute_path);
|
||||
~ReplayRecording();
|
||||
|
||||
[[nodiscard]] ReplayMetadata metadata() const;
|
||||
[[nodiscard]] std::string_view source_bytes() const;
|
||||
[[nodiscard]] std::optional<std::string_view> diagnostic_bytes() const;
|
||||
[[nodiscard]] std::size_t event_count() const;
|
||||
|
||||
// Zero-based offset; offset == event_count() is an empty page. Larger offsets or
|
||||
// requests above max_page_size return an error. The span is an O(1) immutable slice.
|
||||
static constexpr std::size_t max_page_size = 256;
|
||||
[[nodiscard]] std::expected<std::span<const ReplayEvent>, std::string>
|
||||
event_page(std::size_t offset, std::size_t count) const;
|
||||
|
||||
// Strictly beyond the entire value/optional-stop pair. Omit the anchor for first/last.
|
||||
// A boundary returns an empty optional; a sequence outside the verified prefix is an error.
|
||||
[[nodiscard]] std::expected<std::optional<ReplayValuePoint>, std::string>
|
||||
next_value(std::optional<std::uint32_t> after = {}) const;
|
||||
[[nodiscard]] std::expected<std::optional<ReplayValuePoint>, std::string>
|
||||
previous_value(std::optional<std::uint32_t> before = {}) const;
|
||||
|
||||
// Owned JSON uses Trace's frame schema. Historical state is immediately after the event.
|
||||
// final_cursor also sees subsequent command authorization and final stop consumption.
|
||||
// Each query copies only its active frames, last leave and identity, at most 4096 events deep.
|
||||
[[nodiscard]] std::expected<Protocol::Json, std::string>
|
||||
cursor_at(std::uint32_t sequence) const;
|
||||
[[nodiscard]] Protocol::Json final_cursor() const;
|
||||
|
||||
private:
|
||||
struct State;
|
||||
explicit ReplayRecording(std::unique_ptr<State>);
|
||||
std::unique_ptr<const State> state_;
|
||||
};
|
||||
|
||||
[[nodiscard]] std::expected<Protocol::Json, std::string>
|
||||
replay(const std::filesystem::path &journal, std::optional<std::uint32_t> sequence);
|
||||
|
||||
} // namespace vls::gcc
|
||||
Reference in new issue
Block a user