make types.Diagnostic correctly parseable
This commit is contained in:
parent
548ced259f
commit
ca58cbb3f3
@ -335,10 +335,10 @@ fn getAstCheckDiagnostics(
|
|||||||
} else if (std.mem.startsWith(u8, msg, "note: ")) {
|
} else if (std.mem.startsWith(u8, msg, "note: ")) {
|
||||||
var latestDiag = &diagnostics.items[diagnostics.items.len - 1];
|
var latestDiag = &diagnostics.items[diagnostics.items.len - 1];
|
||||||
|
|
||||||
var fresh = if (latestDiag.relatedInformation.len == 0)
|
var fresh = if (latestDiag.relatedInformation) |related_information|
|
||||||
try server.arena.allocator().alloc(types.DiagnosticRelatedInformation, 1)
|
try server.arena.allocator().realloc(@ptrCast([]types.DiagnosticRelatedInformation, related_information), related_information.len + 1)
|
||||||
else
|
else
|
||||||
try server.arena.allocator().realloc(@ptrCast([]types.DiagnosticRelatedInformation, latestDiag.relatedInformation), latestDiag.relatedInformation.len + 1);
|
try server.arena.allocator().alloc(types.DiagnosticRelatedInformation, 1);
|
||||||
|
|
||||||
const location = types.Location{
|
const location = types.Location{
|
||||||
.uri = handle.uri(),
|
.uri = handle.uri(),
|
||||||
|
@ -117,11 +117,11 @@ pub const DiagnosticRelatedInformation = struct {
|
|||||||
|
|
||||||
pub const Diagnostic = struct {
|
pub const Diagnostic = struct {
|
||||||
range: Range,
|
range: Range,
|
||||||
severity: DiagnosticSeverity,
|
severity: ?DiagnosticSeverity,
|
||||||
code: string,
|
code: ?string,
|
||||||
source: string,
|
source: ?string,
|
||||||
message: string,
|
message: string,
|
||||||
relatedInformation: []const DiagnosticRelatedInformation = &.{},
|
relatedInformation: ?[]const DiagnosticRelatedInformation = null,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub const TextDocument = struct {
|
pub const TextDocument = struct {
|
||||||
|
Loading…
Reference in New Issue
Block a user