use std.meta.fieldNames
instead of manually re-implementing it
This commit is contained in:
parent
ae5fa110b5
commit
6836f9361d
@ -562,22 +562,8 @@ fn initializeHandler(server: *Server, request: types.InitializeParams) Error!typ
|
|||||||
.full = .{ .bool = true },
|
.full = .{ .bool = true },
|
||||||
.range = .{ .bool = true },
|
.range = .{ .bool = true },
|
||||||
.legend = .{
|
.legend = .{
|
||||||
.tokenTypes = comptime block: {
|
.tokenTypes = std.meta.fieldNames(semantic_tokens.TokenType),
|
||||||
const tokTypeFields = std.meta.fields(semantic_tokens.TokenType);
|
.tokenModifiers = std.meta.fieldNames(semantic_tokens.TokenModifiers),
|
||||||
var names: [tokTypeFields.len][]const u8 = undefined;
|
|
||||||
for (tokTypeFields, &names) |field, *name| {
|
|
||||||
name.* = field.name;
|
|
||||||
}
|
|
||||||
break :block &names;
|
|
||||||
},
|
|
||||||
.tokenModifiers = comptime block: {
|
|
||||||
const tokModFields = std.meta.fields(semantic_tokens.TokenModifiers);
|
|
||||||
var names: [tokModFields.len][]const u8 = undefined;
|
|
||||||
for (tokModFields, &names) |field, *name| {
|
|
||||||
name.* = field.name;
|
|
||||||
}
|
|
||||||
break :block &names;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user