-
-
Notifications
You must be signed in to change notification settings - Fork 91
template-injection: add subfeatures #958
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
Conversation
Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
I still need to de-regress #569 with this change:
This is caused by the subfeature having multiple lines, which don't match the exact substring on the YAML side (since the extracted YAML feature has extra indentation to make it syntactically correct). The subfeature on the other hand comes from the parsed YAML, so we don't see the indentation difference until it's too late. I'll need to think about the best way to handle this -- it's interestingly non-trivial because the YAML feature equivalent of the subfeature is actually longer/has more bytes in it. Edit: Thinking out loud: one idea is to match the span on the first line, allow all intermediate lines, and then match the span on the final line. Not pretty, but doesn't require any special normalization or other steps that would mess with the concrete feature. |
Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
De-regressed, but I'm not very happy with how brittle the approach is. I need to think about it more. |
I thought of another solution to this, one that should be less brittle: instead of trying to match the "head" and "tail" of the subfeature's fragment, we could support pattern-style fragments that accept differences in whitespace. This would still be mostly useful only in the case of multi-line subfeature fragments, but would allow us to transform a fragment like this:
into:
...which would then match correctly, regardless of how the subfeature is indented on the YAML syntax side of things. This should be pretty easy to do by walking an |
Signed-off-by: William Woodruff <william@yossarian.net>
Signed-off-by: William Woodruff <william@yossarian.net>
Following #949.
Signed-off-by: William Woodruff william@yossarian.net