diff options
Diffstat (limited to 'src/syntax.zig')
| -rw-r--r-- | src/syntax.zig | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/syntax.zig b/src/syntax.zig index 08b26096..96af9fa7 100644 --- a/src/syntax.zig +++ b/src/syntax.zig @@ -241,13 +241,6 @@ fn forExt(ext: []const u8) !?Selected { return null; } -fn forLang(name: []const u8) !?Selected { - const canonical = if (grammar_manifest.byName(name)) |i| grammar_manifest.all[i].name else name; - for (&specs) |*spec| { - if (std.ascii.eqlIgnoreCase(canonical, spec.name)) return try ensure(spec); - } - return null; -} fn runQuery(styles: []u8, sel: Selected, tree: *ts.Tree, base: usize) void { const cursor = sel.cursor; cursor.exec(sel.query, tree.rootNode()); @@ -938,6 +931,14 @@ fn codeAfterLocation(line: []const u8) ?struct { path: []const u8, at: usize, te return .{ .path = target.path, .at = at, .text = line[at..] }; } +fn forLang(name: []const u8) !?Selected { + const canonical = if (grammar_manifest.byName(name)) |i| grammar_manifest.all[i].name else name; + for (&specs) |*spec| { + if (std.ascii.eqlIgnoreCase(canonical, spec.name)) return try ensure(spec); + } + return null; +} + fn inject(styles: []u8, source: []const u8, node: ts.Node, markdown: bool) void { const kind = node.kind(); if (markdown and std.mem.eql(u8, kind, "inline")) { |
