Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upAdd line:col numbers of end of node to API v3 #626
Comments
|
Okay, so the change in the code is ludicrously simple:
// Line and Column hold the node position in the decoded YAML text.
// LineEnd and ColumnEnd hold the position of the end of the node.
// These fields are not respected when encoding the node.
Line int
Column int
LineEnd int
ColumnEnd int
n.Line = p.event.start_mark.line + 1
n.Column = p.event.start_mark.column + 1
n.LineEnd = p.event.end_mark.line + 1
n.ColumnEnd = p.event.end_mark.column + 1but the change in the tests looks to be a bit of a pain:
Here's the helper regex I wrote for me:
-- now I just have to fix the line and column numbers everywhere ;-; |
|
It appears the The |
The yaml library for JS supports giving the position of the node end in the file:
https://eemeli.org/yaml/#cst-nodes
I need that feature for the project I'm working on.
Here's what the code of API v3 currently look like:
yaml.goI'd like to add to fields,
LineEndandColumnEnd, that would capture the position of the end of the YAML node. I plan on working on this and making a Pull Request.I'm interested in ideas and thoughts.