Files
Language-Server/include/vls/Server.hpp
T
faumaray 4a029152e9 Consume a compiler-agnostic completion index
Under D-032, completion can now merge candidates from a documented,
versioned index file produced by any external tool. The bounded core
parses and selects the innermost covering scope, the server puts its
items ahead of index-backed ones and takes isIncomplete from the
scope's complete flag, and registered feature tests cover parsing,
selection and bounds. A real stdio session returned the provided
items first with isIncomplete false inside the scope and true outside.
2026-12-06 02:10:16 +03:00

49 lines
1.4 KiB
C++

#pragma once
#include <Void/LanguageServer/Documents/DocumentStore.hpp>
#include <vls/Framing.hpp>
#include <vls/WorkspaceSession.hpp>
#include <vls/features/CompletionSource.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_;
std::vector<features::completion_source::Scope> completion_scopes_;
};
// 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