invert priorities in file type guess
This commit is contained in:
parent
11d0e9e7e3
commit
c0e315495c
1 changed files with 1 additions and 2 deletions
|
|
@ -167,13 +167,12 @@ pub fn guess_file_type(file_path: ?[]const u8, content: []const u8) ?@This() {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn guess(file_path: ?[]const u8, content: []const u8) ?@This() {
|
fn guess(file_path: ?[]const u8, content: []const u8) ?@This() {
|
||||||
if (guess_first_line(content)) |ft| return ft;
|
|
||||||
for (get_all_names()) |file_type_name| {
|
for (get_all_names()) |file_type_name| {
|
||||||
const file_type = get(file_type_name) catch unreachable orelse unreachable;
|
const file_type = get(file_type_name) catch unreachable orelse unreachable;
|
||||||
if (file_path) |fp| if (syntax.FileType.match_file_type(file_type.extensions orelse continue, fp))
|
if (file_path) |fp| if (syntax.FileType.match_file_type(file_type.extensions orelse continue, fp))
|
||||||
return file_type;
|
return file_type;
|
||||||
}
|
}
|
||||||
return null;
|
return guess_first_line(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn guess_first_line(content: []const u8) ?@This() {
|
fn guess_first_line(content: []const u8) ?@This() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue