fix: first line file type matching
This commit is contained in:
		
							parent
							
								
									9cdc802802
								
							
						
					
					
						commit
						00f843c54f
					
				
					 2 changed files with 6 additions and 3 deletions
				
			
		| 
						 | 
					@ -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,
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -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 = .{
 | 
				
			||||||
| 
						 | 
					@ -62,7 +62,7 @@ pub const dockerfile = .{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub const dtd = .{
 | 
					pub const dtd = .{
 | 
				
			||||||
    .icon = "",
 | 
					    .icon = "",
 | 
				
			||||||
    .extensions = &[_][]const u8{ "dtd" },
 | 
					    .extensions = &[_][]const u8{"dtd"},
 | 
				
			||||||
    .comment = "<!--",
 | 
					    .comment = "<!--",
 | 
				
			||||||
    .highlights = @embedFile("tree-sitter-xml/dtd/queries/highlights.scm"),
 | 
					    .highlights = @embedFile("tree-sitter-xml/dtd/queries/highlights.scm"),
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
| 
						 | 
					@ -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 = "--",
 | 
				
			||||||
| 
						 | 
					@ -268,7 +270,7 @@ pub const typescript = .{
 | 
				
			||||||
 | 
					
 | 
				
			||||||
pub const xml = .{
 | 
					pub const xml = .{
 | 
				
			||||||
    .icon = "",
 | 
					    .icon = "",
 | 
				
			||||||
    .extensions = &[_][]const u8{ "xml" },
 | 
					    .extensions = &[_][]const u8{"xml"},
 | 
				
			||||||
    .comment = "<!--",
 | 
					    .comment = "<!--",
 | 
				
			||||||
    .highlights = @embedFile("tree-sitter-xml/xml/queries/highlights.scm"),
 | 
					    .highlights = @embedFile("tree-sitter-xml/xml/queries/highlights.scm"),
 | 
				
			||||||
    .first_line_matches = .{ .prefix = "<?xml " },
 | 
					    .first_line_matches = .{ .prefix = "<?xml " },
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue