Compare commits
2 commits
11d0e9e7e3
...
fb19d50c20
| Author | SHA1 | Date | |
|---|---|---|---|
| fb19d50c20 | |||
|
|
c0e315495c |
2 changed files with 3 additions and 4 deletions
|
|
@ -6,8 +6,8 @@
|
||||||
|
|
||||||
.dependencies = .{
|
.dependencies = .{
|
||||||
.syntax = .{
|
.syntax = .{
|
||||||
.url = "git+https://github.com/neurocyte/flow-syntax?ref=master#272a2d0b01f708dcd02d43c2ed997fd7b82d6224",
|
.url = "git+https://github.com/neurocyte/flow-syntax?ref=master#56929f0c523b59153e17919be2cd09d8bef32cd0",
|
||||||
.hash = "flow_syntax-0.7.2-X8jOoeFTAQAHSg9vmbAahKdrA8DDf0N-MJl8l09vMDZh",
|
.hash = "flow_syntax-0.7.2-X8jOoeFTAQBeP2Tn08Tw1jsMdifLEDBgPLqPqNelAupy",
|
||||||
},
|
},
|
||||||
.flags = .{
|
.flags = .{
|
||||||
.url = "git+https://github.com/neurocyte/flags?ref=main#984b27948da3e4e40a253f76c85b51ec1a9ada11",
|
.url = "git+https://github.com/neurocyte/flags?ref=main#984b27948da3e4e40a253f76c85b51ec1a9ada11",
|
||||||
|
|
|
||||||
|
|
@ -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