Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose the indent for block scalar #1026

Open
928PJY opened this issue Dec 25, 2024 · 1 comment
Open

Expose the indent for block scalar #1026

928PJY opened this issue Dec 25, 2024 · 1 comment

Comments

@928PJY
Copy link

928PJY commented Dec 25, 2024

Is your feature request related to a problem? Please describe.
We are leveraging this library to parse the YAML content written by our end-users. We need accurate location information of the source content. However, for the block scalar type, the node start and end information currently refer to the range of the entire property value, including the | or >, but not the value (indentation and block syntax are removed). This prevents us from obtaining accurate location information.
For example:

property: |
  value

When we use the parser.Consume<NodeEvent>() to get the node after key, we get a Literal scalar type with the following property:

  • Start.Line: 1
  • Start.Column: 11
  • End.Line: 3
  • End Column: 1
  • Value: value\n

Describe the solution you'd like
We expected the removed indent to be visible on the scalar node as well so we can accurately report the location information if we need to address an issue with the value, such as:

  • Indent: 2
@EdwardCooke
Copy link
Collaborator

Just to clarify that you’re thinking the values should represent the location of the letter v instead of the |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants