Compare commits

..

No commits in common. "eb1b0b7b7aea20c0c1e28bcfb0bce9ca35151e89" and "bfd98c3b90da7f034ad15ff24630a752889f643f" have entirely different histories.

View file

@ -1312,7 +1312,7 @@ fn send_symbol_items(to: tp.pid_ref, file_path: []const u8, items: []const u8) (
var item: []const u8 = ""; var item: []const u8 = "";
var node_count: usize = 0; var node_count: usize = 0;
while (len > 0) : (len -= 1) { while (len > 0) : (len -= 1) {
if (!(try cbor.matchValue(&iter, cbor.extract_cbor(&item)))) return error.InvalidSymbolInformationArray; if (!(try cbor.matchValue(&iter, cbor.extract_cbor(&item)))) return error.InvalidSymbolInformation;
node_count += try send_symbol_information(to, file_path, item, ""); node_count += try send_symbol_information(to, file_path, item, "");
} }
return to.send(.{ "cmd", "add_document_symbol_done", .{file_path} }) catch |e| { return to.send(.{ "cmd", "add_document_symbol_done", .{file_path} }) catch |e| {
@ -1373,8 +1373,7 @@ fn invalid_symbol_information_field(field: []const u8) error{InvalidSymbolInform
} }
pub const SymbolInformationError = error{ pub const SymbolInformationError = error{
InvalidSymbolInformationFieldName, InvalidSymbolInformation,
InvalidSymbolInformationArray,
InvalidSymbolInformationField, InvalidSymbolInformationField,
InvalidTargetURI, InvalidTargetURI,
} || LocationLinkError || cbor.Error; } || LocationLinkError || cbor.Error;
@ -1398,7 +1397,7 @@ fn send_symbol_information(to: tp.pid_ref, file_path: []const u8, item: []const
tags[0] = 0; tags[0] = 0;
while (len > 0) : (len -= 1) { while (len > 0) : (len -= 1) {
var field_name: []const u8 = undefined; var field_name: []const u8 = undefined;
if (!(try cbor.matchString(&iter, &field_name))) return error.InvalidSymbolInformationFieldName; if (!(try cbor.matchString(&iter, &field_name))) return error.InvalidSymbolInformation;
if (std.mem.eql(u8, field_name, "name")) { if (std.mem.eql(u8, field_name, "name")) {
if (!(try cbor.matchValue(&iter, cbor.extract(&name)))) return invalid_symbol_information_field("name"); if (!(try cbor.matchValue(&iter, cbor.extract(&name)))) return invalid_symbol_information_field("name");
} else if (std.mem.eql(u8, field_name, "detail")) { } else if (std.mem.eql(u8, field_name, "detail")) {
@ -1415,6 +1414,7 @@ fn send_symbol_information(to: tp.pid_ref, file_path: []const u8, item: []const
tags[idx] = this_tag; tags[idx] = this_tag;
idx += 1; idx += 1;
} }
try cbor.skipValue(&iter);
} else if (std.mem.eql(u8, field_name, "deprecated")) { } else if (std.mem.eql(u8, field_name, "deprecated")) {
if (!(try cbor.matchValue(&iter, cbor.extract(&deprecated)))) return invalid_symbol_information_field("deprecated"); if (!(try cbor.matchValue(&iter, cbor.extract(&deprecated)))) return invalid_symbol_information_field("deprecated");
} else if (std.mem.eql(u8, field_name, "range")) { } else if (std.mem.eql(u8, field_name, "range")) {