collapse more fn signatures

This commit is contained in:
Meghan Denny 2021-09-30 18:45:45 -07:00
parent 43796f6326
commit 4bc8b92e19
4 changed files with 10 additions and 39 deletions

View File

@ -35,12 +35,7 @@ var actual_log_level: std.log.Level = switch (std.builtin.mode) {
else => .notice,
};
pub fn log(
comptime message_level: std.log.Level,
comptime scope: @Type(.EnumLiteral),
comptime format: []const u8,
args: anytype,
) void {
pub fn log(comptime message_level: std.log.Level, comptime scope: @Type(.EnumLiteral), comptime format: []const u8, args: anytype) void {
if (@enumToInt(message_level) > @enumToInt(actual_log_level)) {
return;
}

View File

@ -51,14 +51,8 @@ fn fromDynamicTreeInternal(arena: *std.heap.ArenaAllocator, value: std.json.Valu
const actual_type = if (is_optional) std.meta.Child(field.field_type) else field.field_type;
const is_struct = comptime std.meta.trait.is(.Struct)(actual_type);
const is_default = comptime if (is_struct) std.meta.trait.hasDecls(actual_type, .{
"default",
"value_type",
}) else false;
const is_transform = comptime if (is_struct) std.meta.trait.hasDecls(actual_type, .{
"original_type",
"transform",
}) else false;
const is_default = comptime if (is_struct) std.meta.trait.hasDecls(actual_type, .{ "default", "value_type" }) else false;
const is_transform = comptime if (is_struct) std.meta.trait.hasDecls(actual_type, .{ "original_type", "transform" }) else false;
if (value.Object.get(field.name)) |json_field| {
if (is_exists) {

View File

@ -68,13 +68,7 @@ fn fnProtoToSignatureInfo(document_store: *DocumentStore, arena: *std.heap.Arena
};
}
pub fn getSignatureInfo(
document_store: *DocumentStore,
arena: *std.heap.ArenaAllocator,
handle: *DocumentStore.Handle,
absolute_index: usize,
comptime data: type,
) !?types.SignatureInformation {
pub fn getSignatureInfo(document_store: *DocumentStore, arena: *std.heap.ArenaAllocator, handle: *DocumentStore.Handle, absolute_index: usize, comptime data: type) !?types.SignatureInformation {
const innermost_block = analysis.innermostBlockScope(handle.*, absolute_index);
const tree = handle.tree;
const token_tags = tree.tokens.items(.tag);

View File

@ -79,12 +79,8 @@ pub const MessageType = enum(i64) {
Info = 3,
Log = 4,
pub fn jsonStringify(
value: MessageType,
options: json.StringifyOptions,
out_stream: anytype,
) !void {
try json.stringify(@enumToInt(value), options, out_stream);
pub fn jsonStringify(value: MessageType, options: std.json.StringifyOptions, out_stream: anytype) !void {
try std.json.stringify(@enumToInt(value), options, out_stream);
}
};
@ -175,16 +171,12 @@ pub const MarkupContent = struct {
PlainText = 0,
Markdown = 1,
pub fn jsonStringify(
value: Kind,
options: json.StringifyOptions,
out_stream: anytype,
) !void {
pub fn jsonStringify(value: Kind, options: std.json.StringifyOptions, out_stream: anytype) !void {
const str = switch (value) {
.PlainText => "plaintext",
.Markdown => "markdown",
};
try json.stringify(str, options, out_stream);
try std.json.stringify(str, options, out_stream);
}
};
@ -329,12 +321,8 @@ const InitializeResult = struct {
Full = 1,
Incremental = 2,
pub fn jsonStringify(
value: @This(),
options: json.StringifyOptions,
out_stream: anytype,
) !void {
try json.stringify(@enumToInt(value), options, out_stream);
pub fn jsonStringify(value: @This(), options: std.json.StringifyOptions, out_stream: anytype) !void {
try std.json.stringify(@enumToInt(value), options, out_stream);
}
},
renameProvider: bool,