Files
Language-Server/include/vls/Server.hpp
T
faumaray 7acbfc4029 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.
2026-12-05 20:46:41 +03:00

47 lines
1.3 KiB
C++

#pragma once
#include <Void/LanguageServer/Documents/DocumentStore.hpp>
#include <vls/Framing.hpp>
#include <vls/WorkspaceSession.hpp>
#include <vls/reflection/Provenance.hpp>
#include <functional>
#include <iosfwd>
#include <optional>
#include <string>
#include <string_view>
namespace vls {
namespace semantic {
class EditorDiagnostics;
}
inline constexpr std::string_view server_version = "0.1.0";
struct DispatchResult {
std::optional<std::string> response;
std::optional<int> exit_code;
std::string diagnostic{};
};
class Server {
public:
explicit Server(WorkspaceLaunch launch = {}, std::function<bool(std::string)> send = {});
~Server();
[[nodiscard]] DispatchResult handle(std::string_view body);
private:
enum class State { awaiting_initialize, running, shutdown };
State state_{State::awaiting_initialize};
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.
[[nodiscard]] int run_stdio(std::istream &input, std::ostream &output, std::ostream &diagnostics,
FrameLimits limits = {}, WorkspaceLaunch launch = {});
} // namespace vls