From c3021de37237d1ab40e37a7be1c853347406d795 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Tue, 10 Dec 2024 20:10:10 +0100 Subject: [PATCH] feat: add descriptive names for file types --- src/syntax/src/file_type.zig | 2 ++ src/syntax/src/file_types.zig | 62 +++++++++++++++++++++++++++++++++-- 2 files changed, 62 insertions(+), 2 deletions(-) diff --git a/src/syntax/src/file_type.zig b/src/syntax/src/file_type.zig index b27a0f9..dfecb1b 100644 --- a/src/syntax/src/file_type.zig +++ b/src/syntax/src/file_type.zig @@ -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, diff --git a/src/syntax/src/file_types.zig b/src/syntax/src/file_types.zig index 4bfa21f..b6e26bf 100644 --- a/src/syntax/src/file_types.zig +++ b/src/syntax/src/file_types.zig @@ -1,9 +1,11 @@ pub const agda = .{ + .description = "Agda", .extensions = .{"agda"}, .comment = "--", }; pub const bash = .{ + .description = "Bash", .color = 0x3e474a, .icon = "󱆃", .extensions = .{ "sh", "bash", ".profile" }, @@ -14,6 +16,7 @@ pub const bash = .{ }; pub const c = .{ + .description = "C", .icon = "", .extensions = .{"c"}, .comment = "//", @@ -22,6 +25,7 @@ pub const c = .{ }; pub const @"c-sharp" = .{ + .description = "C#", .color = 0x68217a, .icon = "󰌛", .extensions = .{"cs"}, @@ -30,6 +34,7 @@ pub const @"c-sharp" = .{ }; pub const conf = .{ + .description = "Config", .color = 0x000000, .icon = "", .extensions = .{ "conf", "config", ".gitconfig" }, @@ -39,6 +44,7 @@ pub const conf = .{ }; pub const cmake = .{ + .description = "CMake", .color = 0x004078, .icon = "", .extensions = .{ "CMakeLists.txt", "cmake", "cmake.in" }, @@ -50,6 +56,7 @@ pub const cmake = .{ }; pub const cpp = .{ + .description = "C++", .color = 0x9c033a, .icon = "", .extensions = .{ "cc", "cpp", "cxx", "hpp", "hxx", "h", "ipp", "ixx" }, @@ -64,6 +71,7 @@ pub const cpp = .{ }; pub const css = .{ + .description = "CSS", .color = 0x3d8fc6, .icon = "󰌜", .extensions = .{"css"}, @@ -71,11 +79,13 @@ pub const css = .{ }; pub const diff = .{ + .description = "Diff", .extensions = .{ "diff", "patch" }, .comment = "#", }; pub const dockerfile = .{ + .description = "Docker", .color = 0x019bc6, .icon = "", .extensions = .{ "Dockerfile", "dockerfile", "docker", "Containerfile", "container" }, @@ -83,6 +93,7 @@ pub const dockerfile = .{ }; pub const dtd = .{ + .description = "DTD", .icon = "󰗀", .extensions = .{"dtd"}, .comment = "