-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Tarmac-Styled Code Generation Support #33
Conversation
- Implemented two modules. - `ast`: Inspired from tarmac's implementation, extended for typescript support. Meant to serialize the provided lockfile's data and uses path components to achieve this in a way similar to tarmac. - `tarmac`, related to the specific functions for codegen related to the style. This is interchangable respectively with both the generate_lua/ts functions. - Added an extra option in the configuration to support tarmac style. Thank you for making this tool!
Applies indent by a `number_of_spaces` rather than a tab. This allows for more customization (if wanted) in the `asphalt.toml` if a user wishes to configure their indentation size.
Hey, thanks for your work! I haven't had time to look through the full implementation yet, but I am a bit concerned about the organization of code here before that. Ideally, So perhaps the structure could look somewhat more like:
for example Another minor thing-I am not a huge fan of naming the configuration (or the style itself) "tarmac" mode. I would much prefer if it the config option was named "style" and perhaps the options could be "flat" or "nested" (tarmac). We could then say in the readme, if you like the tarmac style, go with nested. I'm also going to end up putting codegen options, since we have three at this point, in it's own section in the configuration. But this probably belongs in a different PR. |
Thanks for your feedback! I got a better understanding of what you would intend for your project, and I will be making the requested changes to the best of my ability. On the |
To add to the discussion, would you prefer the config to have a style enum akin to this to replace ~ #[derive(Debug, Deserialize, Serialize, PartialEq)]
#[serde(rename_all = "snake_case")]
pub enum StyleType {
Flat,
Nested
} In the config I would add a style = "nested" ~ pub struct State {
...
pub style: StyleType,
...
} |
Yeah, that should work. Let's make sure it's optional and |
- Adds the enum definition - Updates config/state to support it. - Defaults to `Flat` if not in the config.
I've attempted to implement the concept in the previous comment with this commit: 1757304 |
Nice. Can we convert |
Gotcha! It is done. |
Thank you. I'm not going to release quite yet-going to restructure the config file a little bit, then I'll push out 0.5.0 |
Hello!
This PR is meant to add in the feature requested in #23 related to tarmac code style. I've implemented a solution for this. Utilizing your tests, the emits are as followed so far:
Examples
Luau Emit (4 spaces)
Typescript Emit (4 spaces)
This also adds an extra configuration that is
tarmac
, which will be false by default.Please feel free to request any changes or provide any edits or questions, and thank you for providing this useful tool!