33 lines
770 B
C++
33 lines
770 B
C++
#pragma once
|
|
|
|
#include <vls/Framing.hpp>
|
|
|
|
#include <iosfwd>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <string_view>
|
|
|
|
namespace vls {
|
|
|
|
inline constexpr std::string_view server_version = "0.1.0";
|
|
|
|
struct DispatchResult {
|
|
std::optional<std::string> response;
|
|
std::optional<int> exit_code;
|
|
};
|
|
|
|
class Server {
|
|
public:
|
|
[[nodiscard]] DispatchResult handle(std::string_view body);
|
|
|
|
private:
|
|
enum class State { awaiting_initialize, running, shutdown };
|
|
State state_{State::awaiting_initialize};
|
|
};
|
|
|
|
// 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 = {});
|
|
|
|
} // namespace vls
|