-
-
Notifications
You must be signed in to change notification settings - Fork 336
Closed
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed
Description
Please read the FAQ for the bug you encountered.
- I have read the existing FAQ
⏯ Playground Link
Description:
There is an issue with the serialization and deserialization of SerializableStopBy in ast-grep. The current implementation provides a custom deserialization logic for SerializableStopBy, but the serialization logic relies on Serde’s Serialize derive macro. This asymmetry causes YAML configurations to be transformed into an unrecognized format when serialized back, making them incompatible with ast-grep’s own deserialization.
Steps to Reproduce:
- Start with a valid YAML configuration that ast-grep can parse correctly.
- Deserialize the YAML into a Rust structure.
- Serialize the structure back into YAML.
- Attempt to use the newly serialized YAML with ast-grep.
- Observe that ast-grep fails to recognize the modified YAML.
Expected Behavior:
- The serialized YAML should be compatible with ast-grep’s deserialization logic.
- Serialization and deserialization should be symmetrical, ensuring that round-tripping YAML configurations do not break compatibility.
Actual Behavior:
- The YAML configuration changes after serialization.
- ast-grep fails to recognize the new YAML format due to the mismatch between its custom deserialization and the standard Serde serialization.
Potential Fix:
- Implement a custom serialization logic for SerializableStopBy that mirrors the deserialization logic.
- Ensure that the serialized YAML output remains compatible with ast-grep’s expected input format.
Environment:
- ast-grep version: 0.34.4
- Rust version: 1.84.1
Additional Context:
I am working on a wrapper around ast-grep that needs to modify its YAML configuration dynamically. However, due to this issue, my tool is unable to generate valid YAML configurations that ast-grep can understand.
Let me know if more details are needed. Thanks!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requesthelp wantedExtra attention is neededExtra attention is needed