bram209 / leptosfmt

A formatter for the leptos view! macro
Apache License 2.0
271 stars 29 forks source link

Add option to override html macro #109

Closed SofusA closed 8 months ago

SofusA commented 8 months ago

Closes #17 and to some extend #98

I am quite new to rust and i am not sure this would be the best way to achieve this, since I had to change settings to be references.

You can now override the view macro name in the cli and in settings. This allows for aliasing the macro, or use with plain rstml macro.

bram209 commented 8 months ago

Hey, thanks for your contribution. I wonder if we could we also fix #105 in this PR? I think it would be an easy fix

Also, would it make sense to allow multiple aliases? We could default to vec!["leptos::view", view"], but user could add additional aliases through configuration

SofusA commented 8 months ago

Hey, thanks for your contribution. I wonder if we could we also fix #105 in this PR? I think it would be an easy fix

Also, would it make sense to allow multiple aliases? We could default to vec!["leptos::view", view"], but user could add additional aliases through configuration

Yeah that would be nice. I will try to give it a shot.

SofusA commented 8 months ago

I have pushed new commit which closes #105

bram209 commented 8 months ago

looking good, can you add the new configuration setting to the example leptosfmt.toml in the readme? See: https://github.com/bram209/leptosfmt?tab=readme-ov-file#configuration

SofusA commented 8 months ago

The code i pushed yesterday did not work for fully qualified paths since Path::is_ident does not support leading colons.

So i combine the path segments into the full path as a string (view_macro::get_macro_full_path) and use that to compare macro names

SofusA commented 8 months ago

I have broken --stdin somehow

bram209 commented 8 months ago

looks good to me, thanks!

resolves #17 resolves #105