fix: first line file type matching

This commit is contained in:
CJ van den Berg 2024-02-21 15:31:51 +01:00
parent 9cdc802802
commit 00f843c54f
2 changed files with 6 additions and 3 deletions

View file

@ -100,6 +100,7 @@ fn DeclLang(comptime lang: []const u8, comptime args: FileTypeOptions) FileType
.comment = args.comment, .comment = args.comment,
.highlights = if (args.highlights) |h| h else @embedFile("tree-sitter-" ++ lang ++ "/queries/highlights.scm"), .highlights = if (args.highlights) |h| h else @embedFile("tree-sitter-" ++ lang ++ "/queries/highlights.scm"),
.injections = args.injections, .injections = args.injections,
.first_line_matches = args.first_line_matches,
}; };
} }

View file

@ -8,7 +8,7 @@ pub const bash = .{
.icon = "󱆃", .icon = "󱆃",
.extensions = &[_][]const u8{ "sh", "bash" }, .extensions = &[_][]const u8{ "sh", "bash" },
.comment = "#", .comment = "#",
.first_line_matches = .{ .prefix = "#!", .content = "bash" }, .first_line_matches = .{ .prefix = "#!", .content = "sh" },
}; };
pub const c = .{ pub const c = .{
@ -137,6 +137,7 @@ pub const lua = .{
.extensions = &[_][]const u8{"lua"}, .extensions = &[_][]const u8{"lua"},
.comment = "--", .comment = "--",
.injections = @embedFile("tree-sitter-lua/queries/injections.scm"), .injections = @embedFile("tree-sitter-lua/queries/injections.scm"),
.first_line_matches = .{ .prefix = "--", .content = "lua" },
}; };
pub const make = .{ pub const make = .{
@ -210,6 +211,7 @@ pub const php = .{
.injections = @embedFile("tree-sitter-php/queries/injections.scm"), .injections = @embedFile("tree-sitter-php/queries/injections.scm"),
}; };
// conflicts with haskell
// pub const purescript = .{ // pub const purescript = .{
// .extensions = &[_][]const u8{"purs"}, // .extensions = &[_][]const u8{"purs"},
// .comment = "--", // .comment = "--",