fix: support for $0 in snippets
This commit is contained in:
parent
50db9082d8
commit
a897e6bf87
1 changed files with 9 additions and 1 deletions
|
|
@ -136,8 +136,16 @@ pub fn parse(allocator: std.mem.Allocator, snippet: []const u8) Error!Snippet {
|
||||||
for (tabstops.items) |item| if (item.id == n) {
|
for (tabstops.items) |item| if (item.id == n) {
|
||||||
(try tabstop.addOne(allocator)).* = item.range;
|
(try tabstop.addOne(allocator)).* = item.range;
|
||||||
};
|
};
|
||||||
(try result.addOne(allocator)).* = try tabstop.toOwnedSlice(allocator);
|
if (tabstop.items.len > 0)
|
||||||
|
(try result.addOne(allocator)).* = try tabstop.toOwnedSlice(allocator);
|
||||||
}
|
}
|
||||||
|
var tabstop: std.ArrayList(Range) = .empty;
|
||||||
|
errdefer tabstop.deinit(allocator);
|
||||||
|
for (tabstops.items) |item| if (item.id == 0) {
|
||||||
|
(try tabstop.addOne(allocator)).* = item.range;
|
||||||
|
};
|
||||||
|
if (tabstop.items.len > 0)
|
||||||
|
(try result.addOne(allocator)).* = try tabstop.toOwnedSlice(allocator);
|
||||||
return .{
|
return .{
|
||||||
.text = try text.toOwnedSlice(),
|
.text = try text.toOwnedSlice(),
|
||||||
.tabstops = try result.toOwnedSlice(allocator),
|
.tabstops = try result.toOwnedSlice(allocator),
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue