collapse more fn signatures
This commit is contained in:
parent
43796f6326
commit
4bc8b92e19
@ -35,12 +35,7 @@ var actual_log_level: std.log.Level = switch (std.builtin.mode) {
|
|||||||
else => .notice,
|
else => .notice,
|
||||||
};
|
};
|
||||||
|
|
||||||
pub fn log(
|
pub fn log(comptime message_level: std.log.Level, comptime scope: @Type(.EnumLiteral), comptime format: []const u8, args: anytype) void {
|
||||||
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)) {
|
if (@enumToInt(message_level) > @enumToInt(actual_log_level)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -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 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_struct = comptime std.meta.trait.is(.Struct)(actual_type);
|
||||||
const is_default = comptime if (is_struct) std.meta.trait.hasDecls(actual_type, .{
|
const is_default = comptime if (is_struct) std.meta.trait.hasDecls(actual_type, .{ "default", "value_type" }) else false;
|
||||||
"default",
|
const is_transform = comptime if (is_struct) std.meta.trait.hasDecls(actual_type, .{ "original_type", "transform" }) else false;
|
||||||
"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 (value.Object.get(field.name)) |json_field| {
|
||||||
if (is_exists) {
|
if (is_exists) {
|
||||||
|
@ -68,13 +68,7 @@ fn fnProtoToSignatureInfo(document_store: *DocumentStore, arena: *std.heap.Arena
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getSignatureInfo(
|
pub fn getSignatureInfo(document_store: *DocumentStore, arena: *std.heap.ArenaAllocator, handle: *DocumentStore.Handle, absolute_index: usize, comptime data: type) !?types.SignatureInformation {
|
||||||
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 innermost_block = analysis.innermostBlockScope(handle.*, absolute_index);
|
||||||
const tree = handle.tree;
|
const tree = handle.tree;
|
||||||
const token_tags = tree.tokens.items(.tag);
|
const token_tags = tree.tokens.items(.tag);
|
||||||
|
@ -79,12 +79,8 @@ pub const MessageType = enum(i64) {
|
|||||||
Info = 3,
|
Info = 3,
|
||||||
Log = 4,
|
Log = 4,
|
||||||
|
|
||||||
pub fn jsonStringify(
|
pub fn jsonStringify(value: MessageType, options: std.json.StringifyOptions, out_stream: anytype) !void {
|
||||||
value: MessageType,
|
try std.json.stringify(@enumToInt(value), options, out_stream);
|
||||||
options: json.StringifyOptions,
|
|
||||||
out_stream: anytype,
|
|
||||||
) !void {
|
|
||||||
try json.stringify(@enumToInt(value), options, out_stream);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -175,16 +171,12 @@ pub const MarkupContent = struct {
|
|||||||
PlainText = 0,
|
PlainText = 0,
|
||||||
Markdown = 1,
|
Markdown = 1,
|
||||||
|
|
||||||
pub fn jsonStringify(
|
pub fn jsonStringify(value: Kind, options: std.json.StringifyOptions, out_stream: anytype) !void {
|
||||||
value: Kind,
|
|
||||||
options: json.StringifyOptions,
|
|
||||||
out_stream: anytype,
|
|
||||||
) !void {
|
|
||||||
const str = switch (value) {
|
const str = switch (value) {
|
||||||
.PlainText => "plaintext",
|
.PlainText => "plaintext",
|
||||||
.Markdown => "markdown",
|
.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,
|
Full = 1,
|
||||||
Incremental = 2,
|
Incremental = 2,
|
||||||
|
|
||||||
pub fn jsonStringify(
|
pub fn jsonStringify(value: @This(), options: std.json.StringifyOptions, out_stream: anytype) !void {
|
||||||
value: @This(),
|
try std.json.stringify(@enumToInt(value), options, out_stream);
|
||||||
options: json.StringifyOptions,
|
|
||||||
out_stream: anytype,
|
|
||||||
) !void {
|
|
||||||
try json.stringify(@enumToInt(value), options, out_stream);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
renameProvider: bool,
|
renameProvider: bool,
|
||||||
|
Loading…
Reference in New Issue
Block a user