Serve reflection hover from a recorded snapshot
Per the user's decision, the launcher accepts --reflection-snapshot and the server parses the versioned snapshot at startup. reflection::hover_at selects the innermost entity whose provenance covers a position and returns its bounded virtual view; hover falls back to it after compiler occurrence hover, converting the client position because reflection columns are bytes. Registered reflection tests grew to 25 cases, and a real stdio session returned the Markdown view with source links inside the recorded range and null outside it.
This commit is contained in:
1 parent
62d6ad01e8
commit
7acbfc4029
11 files changed
+148
-9
No files matched your search
@@ -3,6 +3,7 @@
|
||||
#include <Void/LanguageServer/Documents/DocumentStore.hpp>
|
||||
#include <vls/Framing.hpp>
|
||||
#include <vls/WorkspaceSession.hpp>
|
||||
#include <vls/reflection/Provenance.hpp>
|
||||
|
||||
#include <functional>
|
||||
#include <iosfwd>
|
||||
@@ -35,6 +36,7 @@ class Server {
|
||||
Void::LanguageServer::Documents::DocumentStore documents_;
|
||||
WorkspaceSession workspace_;
|
||||
std::unique_ptr<semantic::EditorDiagnostics> diagnostics_;
|
||||
std::shared_ptr<const reflection::Snapshot> reflection_;
|
||||
};
|
||||
|
||||
// Thin transport loop shared by the executable and stream-failure unit tests.
|
||||
|
||||
@@ -22,6 +22,8 @@ struct WorkspaceLaunch {
|
||||
std::optional<Void::LanguageServer::Workspace::PartialWorkspaceSettings> user_settings,
|
||||
cli_settings;
|
||||
std::shared_ptr<const semantic::GccProfile> diagnostics_profile{};
|
||||
// Versioned reflection provenance snapshot served as read-only hover.
|
||||
std::optional<std::filesystem::path> reflection_snapshot;
|
||||
};
|
||||
|
||||
struct SemanticDriver {
|
||||
|
||||
@@ -240,4 +240,14 @@ struct SpliceOrigin {
|
||||
// chain for an identity wins and the result stays within the snapshot limits.
|
||||
[[nodiscard]] Snapshot snapshot_from_splices(std::span<const SpliceOrigin>, Limits = Limits{});
|
||||
|
||||
struct Position {
|
||||
std::uint32_t line{}, character{};
|
||||
auto operator<=>(const Position &) const = default;
|
||||
};
|
||||
|
||||
// Hover for the innermost entity whose provenance chain covers POSITION in
|
||||
// PATH. Ranges are compiler byte columns; an absent match is null rather
|
||||
// than a lexical guess.
|
||||
[[nodiscard]] std::optional<Hover> hover_at(const Snapshot &, std::string_view path, Position,
|
||||
const Limits & = Limits{});
|
||||
} // namespace vls::reflection
|
||||
Reference in new issue
Block a user