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.
110 lines
3.2 KiB
C++
110 lines
3.2 KiB
C++
#pragma once
|
|
|
|
#include <Void/LanguageServer/Documents/DocumentSnapshot.hpp>
|
|
|
|
#include <compare>
|
|
#include <cstddef>
|
|
#include <cstdint>
|
|
#include <expected>
|
|
#include <functional>
|
|
#include <memory>
|
|
#include <optional>
|
|
#include <string>
|
|
#include <string_view>
|
|
#include <vector>
|
|
|
|
namespace vls::semantic {
|
|
namespace Documents = Void::LanguageServer::Documents;
|
|
using DiagnosticSnapshot = std::shared_ptr<const Documents::DocumentSnapshot>;
|
|
|
|
// GCC can emit literal filenames, including percent signs. These spellings are
|
|
// supplied by the launcher and are compared exactly, without URL decoding.
|
|
struct ArtifactName {
|
|
std::string uri, base_uri;
|
|
auto operator<=>(const ArtifactName &) const = default;
|
|
};
|
|
struct DiagnosticArtifact {
|
|
ArtifactName name;
|
|
DiagnosticSnapshot snapshot;
|
|
};
|
|
struct ReportedRegion {
|
|
std::uint32_t first_line, first_column, last_line, end_column;
|
|
};
|
|
enum class ColumnUnit { ascii_consensus, utf8_bytes, gcc_display };
|
|
enum class FirstLineBom { unknown, counted, skipped };
|
|
struct CoordinatePolicy {
|
|
ColumnUnit unit{ColumnUnit::ascii_consensus};
|
|
unsigned tabstop{8};
|
|
FirstLineBom bom{FirstLineBom::unknown};
|
|
};
|
|
struct LocationRequest {
|
|
const DiagnosticArtifact &artifact;
|
|
ReportedRegion region;
|
|
std::size_t result_index, location_index;
|
|
bool related;
|
|
};
|
|
|
|
struct DiagnosticJob {
|
|
std::string invocation_id, input_view_id;
|
|
DiagnosticSnapshot owner;
|
|
std::vector<DiagnosticArtifact> artifacts;
|
|
// The input owner accounts for unresolved includes and lookup dependencies.
|
|
bool inputs_complete{};
|
|
// Return a policy only for a proven physical location in the immutable
|
|
// inputs. A matching snippet cannot establish the origin of a #line remap.
|
|
std::function<std::optional<CoordinatePolicy>(const LocationRequest &)> physical_origin;
|
|
};
|
|
struct DiagnosticOutput {
|
|
std::string_view invocation_id, input_view_id;
|
|
std::optional<int> exit_code;
|
|
bool stream_complete{};
|
|
std::string_view sarif;
|
|
};
|
|
enum class DiagnosticError {
|
|
invalid_job,
|
|
wrong_capture,
|
|
incomplete_stream,
|
|
failed_process,
|
|
malformed_report,
|
|
unsupported_report,
|
|
wrong_owner,
|
|
tool_failure,
|
|
resource_limit
|
|
};
|
|
enum class LocationGap {
|
|
none,
|
|
no_location,
|
|
unknown_artifact,
|
|
artifact_mismatch,
|
|
incomplete_region,
|
|
unproven_origin,
|
|
ambiguous_column
|
|
};
|
|
struct DiagnosticLocation {
|
|
LocationGap gap{LocationGap::no_location};
|
|
DiagnosticSnapshot snapshot;
|
|
std::optional<Documents::Range> range;
|
|
};
|
|
struct RelatedLocation {
|
|
std::string message;
|
|
DiagnosticLocation location;
|
|
};
|
|
enum class DiagnosticSeverity { error, warning, information, hint };
|
|
struct CompilerDiagnostic {
|
|
DiagnosticSeverity severity;
|
|
std::string message, rule;
|
|
DiagnosticLocation location;
|
|
std::vector<RelatedLocation> related;
|
|
};
|
|
struct DiagnosticBatch {
|
|
std::string invocation_id, input_view_id;
|
|
DiagnosticSnapshot owner;
|
|
std::vector<CompilerDiagnostic> diagnostics;
|
|
// The publisher must still validate that this invocation is current.
|
|
bool complete_for_owner{};
|
|
};
|
|
|
|
[[nodiscard]] std::expected<DiagnosticBatch, DiagnosticError>
|
|
decode_gcc_diagnostics(const DiagnosticJob &, const DiagnosticOutput &);
|
|
} // namespace vls::semantic
|