-
Notifications
You must be signed in to change notification settings - Fork 16
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
Support for inline comments #39
Comments
Yeah, that makes sense. 🤔 I was originally wary of allowing inline comments because I was thinking the design would have to be inlineComment : String -> Expression And then I was thinking you could have a weird situation where the generated code isn't valid anymore. Buuut, what if we had withComment : String -> Expression -> Expression So you could insert an inline comment before any expression? |
I love that idea! Adding comments before expressions would definitely work for my purposes |
So, unfortunately this got more complicated :/ And I think I found the reason that I didn't do this initially Elm Syntax parses comments into a top level list that organizes things by source position. Which means we'd have to do some tricky source position math to get this to work. So, not going to happen in the near term. I did talk to a few people who've had similar comment challenges with elm-syntax though. Maybe it'll get updated! I'm going to keep this issue open because I would really like to add this. |
I'd like to be able to conveniently generate inline comments.
The main use I have for generated Elm code is copy-pastable example code for reusable components. Sometimes these components need to be hooked up to application Msgs in order to do anything. I want to be able to provide example code, but I don't want to write out a bunch of extra TEA wiring, so I will often comment out a non-functional sample implementation.
For example, the generated Elm code that I currently use for a Tabs component example includes commented out code around adding tooltips:
The text was updated successfully, but these errors were encountered: