Skip to content
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

Sourceror.parse_expression fails if the code only contains comments #63

Closed
zachdaniel opened this issue Aug 14, 2022 · 7 comments
Closed

Comments

@zachdaniel
Copy link
Contributor

For example: Sourceror.parse("# hello_world()").

I'm not sure what the path to contributing a fix would be, but happy to fix it with some guidance.

@NickNeck
Copy link
Contributor

I have fixed a similar issue here https://github.com/doorgan/sourceror/pull/58/files . Maybe that fix needs some additions.

@NickNeck
Copy link
Contributor

@zachdaniel I have tested it and for me it looks fine.

iex(1)> Sourceror.parse_string!("# hello_world()")
{:__block__,
 [
   __sourceror__: %{trailing_block: true},
   trailing_comments: [
     %{
       column: 1,
       line: 1,
       next_eol_count: 0,
       previous_eol_count: 1,
       text: "# hello_world()"
     }
   ],
   leading_comments: [],
   line: 1
 ], [{:__block__, [trailing_comments: [], leading_comments: []], []}]}

@zachdaniel
Copy link
Contributor Author

Yep, looks like its been fixed in github but not in the latest published hex version :)

@zachdaniel
Copy link
Contributor Author

Thanks!

@zachdaniel
Copy link
Contributor Author

Would be good to cut a release at some point if possible, as this can cause some pain points for Ash users that are using our provided formatter plugin, which fails on files that are only comments :)

@doorgan
Copy link
Owner

doorgan commented Aug 16, 2022

@zachdaniel I was meaning to cut a patch release after fixing a remaining issue with #53 but then life got in the way :)
I just published v0.11.2 including the fix for this particular issue so you can have a quick fix for Ash. I'll release a new patch when a fix the remaining issue in #53.

@zachdaniel
Copy link
Contributor Author

Thanks so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants