Add line numbers to code block
This commit is contained in:
parent
2d655ef7a4
commit
0cf7a4ead5
3 changed files with 46 additions and 11 deletions
|
|
@ -113,12 +113,13 @@ pub const goto_line_meta: Meta = .{ .arguments = &.{.integer} };
|
|||
and to actually receiving the integer parameter, `goto_line` will
|
||||
extract from the context like this:
|
||||
|
||||
```zig
|
||||
pub fn goto_line(self: *Self, ctx: Context) Result {
|
||||
var line: usize = 0;
|
||||
if (!try ctx.args.match(.{tp.extract(&line)}))
|
||||
return error.InvalidGotoLineArgument;
|
||||
```
|
||||
>[]($block.attrs('line-numbers-js'))
|
||||
>```zig
|
||||
>pub fn goto_line(self: *Self, ctx: Context) Result {
|
||||
> var line: usize = 0;
|
||||
> if (!try ctx.args.match(.{tp.extract(&line)}))
|
||||
> return error.InvalidGotoLineArgument;
|
||||
>```
|
||||
|
||||
To send a parameter to a command, make sure that the type is exactly
|
||||
the same when retrieving it. We will refer as encode and decode when
|
||||
|
|
@ -178,4 +179,4 @@ buffer and editor.
|
|||
|
||||
* [Add tests](/docs/testing) to harden your code
|
||||
* [Sending parameters across](/docs/architecture/inner_data_exchange)
|
||||
* [Back to architecture](/docs/architecture)
|
||||
* [Back to architecture](/docs/architecture)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue