Is your feature request related to a problem? Please describe.
At my company, we let users define SQL strings as part of a YAML configuration format we have. We let them edit this YAML config in a builtin editor on their dashboard; however, sometimes, there are errors in the queries they have written, which we want to report back to the user. In order to obtain an accurate location for the error, we need some way of going from a position in the parsed SQL scalar to a position in the source SQL scalar. Hence, we end up having to fully reimplement a YAML scalar parser in order to generate a source map from parsed to source value, despite using a YAML library.
Describe the solution you'd like
Some (probably optional) API for obtaining a source map (eg. FlowScalar/BlockScalar.sourceMap) which lets us map from a position i in the parsed scalar value to a position j in the source scalar's CTS's value. I haven't decided on the exact semantics yet (eg. mapping to/from folded whitespace), I just want to open the door to a discussion. :)
Describe alternatives you've considered
I've considered either biting the bullet and accepting that we need to do some manual YAML parsing in our project, creating a separate package which will handle this, or forcing users to define all queries using BLOCK_LITERAL syntax; however, none of those are really ideal IMO.
I understand if this is too much to ask / if the behaviour I need is too specific to our use case to implement in a general YAML library - if that's the case, I'd appreciate feedback on what else you think we could do. Thanks! :)
Is your feature request related to a problem? Please describe.
At my company, we let users define SQL strings as part of a YAML configuration format we have. We let them edit this YAML config in a builtin editor on their dashboard; however, sometimes, there are errors in the queries they have written, which we want to report back to the user. In order to obtain an accurate location for the error, we need some way of going from a position in the parsed SQL scalar to a position in the source SQL scalar. Hence, we end up having to fully reimplement a YAML scalar parser in order to generate a source map from parsed to source value, despite using a YAML library.
Describe the solution you'd like
Some (probably optional) API for obtaining a source map (eg. FlowScalar/BlockScalar.sourceMap) which lets us map from a position
iin the parsed scalar value to a positionjin the source scalar's CTS's value. I haven't decided on the exact semantics yet (eg. mapping to/from folded whitespace), I just want to open the door to a discussion. :)Describe alternatives you've considered
I've considered either biting the bullet and accepting that we need to do some manual YAML parsing in our project, creating a separate package which will handle this, or forcing users to define all queries using BLOCK_LITERAL syntax; however, none of those are really ideal IMO.
I understand if this is too much to ask / if the behaviour I need is too specific to our use case to implement in a general YAML library - if that's the case, I'd appreciate feedback on what else you think we could do. Thanks! :)