feat: add descriptive names for file types

This commit is contained in:
CJ van den Berg 2024-12-10 20:10:10 +01:00
parent 5be7cbff20
commit eda5f22464
2 changed files with 62 additions and 2 deletions

View file

@ -11,6 +11,7 @@ pub const FileType = @This();
color: u24,
icon: []const u8,
name: []const u8,
description: []const u8,
lang_fn: LangFn,
extensions: []const []const u8,
highlights: [:0]const u8,
@ -119,6 +120,7 @@ fn load_file_types(comptime Namespace: type) []const FileType {
.color = if (@hasField(@TypeOf(args), "color")) args.color else 0xffffff,
.icon = if (@hasField(@TypeOf(args), "icon")) args.icon else "󱀫",
.name = lang,
.description = args.description,
.lang_fn = if (@hasField(@TypeOf(args), "parser")) args.parser else get_parser(lang),
.extensions = vec(args.extensions),
.comment = args.comment,