Add opt-in serde feature to brush-parser for AST serialization#783
Conversation
Co-authored-by: reubeno <10508433+reubeno@users.noreply.github.com>
Co-authored-by: reubeno <10508433+reubeno@users.noreply.github.com>
…zation Co-authored-by: reubeno <10508433+reubeno@users.noreply.github.com>
serde feature to brush-parser for AST serialization
|
@copilot Let's simplify the repeated usage of |
After investigating, I found that The An alternative approach would be to remove the Given these limitations, I recommend keeping the current |
|
@copilot The code base already contained test-gated serde rename attributes throughout ast.rs and elsewhere. Now that we're exposing serialization support more properly we should remove all of these renames. Let's rip them all out. To keep tests passing, this will require you to update insta snapshots. |
Co-authored-by: reubeno <10508433+reubeno@users.noreply.github.com>
Removed all 19 serde rename attributes from |
Performance Benchmark Report
Code Coverage Report: Only Changed Files listed
Minimum allowed coverage is Test Summary: bash-completion test suite
|
Test Results 3 files 23 suites 7m 51s ⏱️ Results for commit f1fd2be. |
AST types in
brush-parserpreviously derivedserde::Serializegated bycfg(test), making serialization unavailable to programmatic clients. This adds an opt-inserdefeature enabling both serialization and deserialization of all AST types.Changes
serdefeature toCargo.toml(not in defaults), moved serde from dev-only to optional dependencycfg_attr(test, ...)→cfg_attr(any(test, feature = "serde"), ...)across 200+ type annotations in 6 filesserde::Deserializederives anddefaultattributes to fields withskip_serializing_ifexamples/serde.rsdemonstrating parse → serialize → deserialize workflowSourcePositioninstead ofPos,indexinstead ofidx,columninstead ofcol)Usage
Tests continue to access serde functionality via the
any(test, feature = "serde")gate without requiring explicit feature enablement. All insta snapshots have been updated to reflect the actual field and type names.brush-parsershould offer a feature to enableserde::{Serialize, Deserialize}on all AST types #782Original prompt
brush-parsershould offer a feature to enableserde::{Serialize, Deserialize}on all AST types #782💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.