Skip to content

Improve action-related code generation #49

@akoptelov

Description

@akoptelov

Currently there are build.rs files that are responsible for generating boilerplate code for redux actions. There are some issues:

  • basic regex matching does not respect comments, and depends on particular form of action declarations
  • resulting code is formatted using cargo fmt that also formats other files in the project
  • the result is obscured in the code with formatting, concatenation and all

First step I would suggest is to use quote package to express resulting code. It will solve the later two issues, as it is quite expressive, and results a token stream that can be easily formatted.

Then the next step might be to either use proc macros (not sure it is possible in this case) or rust parser to analyze actions declarations.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions