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.
91 lines
3.3 KiB
C++
91 lines
3.3 KiB
C++
#pragma once
|
|
|
|
#include <Void/LanguageServer/Build/Providers.hpp>
|
|
|
|
#include <cstdint>
|
|
#include <expected>
|
|
#include <filesystem>
|
|
#include <functional>
|
|
#include <memory>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <string_view>
|
|
|
|
namespace vls {
|
|
|
|
namespace semantic {
|
|
class GccProfile;
|
|
}
|
|
|
|
struct WorkspaceLaunch {
|
|
std::optional<std::filesystem::path> root, build_root, producer_cwd;
|
|
std::optional<Void::LanguageServer::Workspace::PartialWorkspaceSettings> user_settings,
|
|
cli_settings;
|
|
std::shared_ptr<const semantic::GccProfile> diagnostics_profile{};
|
|
};
|
|
|
|
struct SemanticDriver {
|
|
std::filesystem::path executable;
|
|
Void::LanguageServer::Workspace::CompilerDriver family{
|
|
Void::LanguageServer::Workspace::CompilerDriver::unknown};
|
|
};
|
|
|
|
enum class SemanticContextIssue { unavailable, disabled, no_command, wrong_command, superseded };
|
|
|
|
struct SemanticContextError {
|
|
SemanticContextIssue issue;
|
|
std::string message;
|
|
};
|
|
|
|
struct SemanticLeaseData;
|
|
class SemanticContextLease {
|
|
public:
|
|
[[nodiscard]] const Void::LanguageServer::Build::Selection &selection() const;
|
|
[[nodiscard]] const Void::LanguageServer::Build::SelectionState &selection_state() const;
|
|
[[nodiscard]] const Void::LanguageServer::Build::DriverInput &driver() const;
|
|
[[nodiscard]] std::uint64_t configuration_generation() const;
|
|
[[nodiscard]] std::uint32_t worker_memory_limit_mib() const;
|
|
[[nodiscard]] const std::string &document_uri() const;
|
|
|
|
private:
|
|
friend class WorkspaceSession;
|
|
explicit SemanticContextLease(std::shared_ptr<const SemanticLeaseData> data);
|
|
std::shared_ptr<const SemanticLeaseData> data_;
|
|
};
|
|
|
|
class WorkspaceSession {
|
|
public:
|
|
// The optional test hook runs after observation and before the publication checks.
|
|
explicit WorkspaceSession(WorkspaceLaunch = {}, std::function<void()> before_publish = {});
|
|
~WorkspaceSession();
|
|
|
|
// The client settings object contains defaults and optional `workspaces`
|
|
// overrides keyed by a folder's admitted or canonical file URI.
|
|
[[nodiscard]] std::expected<void, std::string>
|
|
initialize(const Void::LanguageServer::Protocol::Json ¶ms);
|
|
[[nodiscard]] std::expected<void, std::string>
|
|
update_folders(const Void::LanguageServer::Protocol::Json *params);
|
|
[[nodiscard]] std::expected<void, std::string>
|
|
configure(const Void::LanguageServer::Protocol::Json *params);
|
|
[[nodiscard]] std::expected<Void::LanguageServer::Protocol::Json, std::string>
|
|
provider_status(const Void::LanguageServer::Protocol::Json *params);
|
|
|
|
// The caller explicitly selects the launcher driver. The lease retains the ordered
|
|
// original and checked command in selection()->selected, and its immutable generation.
|
|
[[nodiscard]] std::expected<SemanticContextLease, SemanticContextError>
|
|
acquire_semantic_context(std::string_view document_uri,
|
|
std::optional<std::string_view> workspace_uri,
|
|
const SemanticDriver &selected_driver);
|
|
[[nodiscard]] std::expected<void, SemanticContextError>
|
|
validate_semantic_context(const SemanticContextLease &lease);
|
|
|
|
// Invalidates launcher authority and in-flight observations for an admitted root.
|
|
void revoke_root_authority(const std::filesystem::path &root);
|
|
|
|
private:
|
|
struct State;
|
|
std::unique_ptr<State> state_;
|
|
};
|
|
|
|
} // namespace vls
|