Skip to content

purs-tidy deletes code when a trailing parenthesis is missing #89

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

Closed
mikesol opened this issue Mar 2, 2022 · 4 comments
Closed

purs-tidy deletes code when a trailing parenthesis is missing #89

mikesol opened this issue Mar 2, 2022 · 4 comments

Comments

@mikesol
Copy link

mikesol commented Mar 2, 2022

https://www.youtube.com/watch?v=iX2nVDKrhWA

In the example above, you can see that when I run format using [email protected] via VSCode, it deletes around 2/3 of the document. I believe this is due to a missing trailing parenthesis on one statement - when I closed the parenthesis, purs-tidy ran correctly.

I realize this may not be very helpful without the document in question, so please let me know if you'd like any additional info. Thanks!

@natefaubion
Copy link
Owner

Sorry, it’s impossible for me to tell what’s going on in that video. If you have a syntax error, purs tidy should not try to format anything. Are you sure you are actually using 0.7 and don’t have some other local version installed?

@mikesol
Copy link
Author

mikesol commented Mar 2, 2022

In my package.json it says 0.7.0, although there could be some local version overriding it.

In the video, at the ~14s mark when I select "Format Document" in VSCode, roughly 2/3 of the text in the file is deleted. I'm not sure if it's purs-tidy doing the deletion or if it is the VSCode plugin. Would it make more sense to file this issue in the VSCode GH repo? At a high level, what I'm trying to report is that a lot of text was deleted when attempting to format a file, but I'm not sure where in the pipeline the report is most helpful/useful.

@natefaubion
Copy link
Owner

I don't think anyone is going to be able to help you without some kind of repro. A YouTube video isn't a repro, unfortunately. purs-tidy at 0.7.0 specifically does not attempt to format files that contain parse errors. In versions prior to 0.7.0, it would try to format files with parse errors, and it did so poorly. If in actuality, an earlier version was being used, then your result seems like it could be a possibility, and I'd suggest you upgrade to 0.7.0. It's also possible that if you are actually using 0.7.1, there's a bug in the new parser implementation. However, if it's truly 0.7.0, I don't think I can help you without a true repro.

@mikesol
Copy link
Author

mikesol commented Mar 3, 2022

Apologies for the YT video - I know it's not much help in terms of reproducing the bug, but as I came across it during work and thought it would be helpful to report something, I wrote this up. I've been doing my best to reproduce the issue but I can't get it to trigger again, even when duplicating the same parenthesis error. I'll close the issue, and if I spot it again in a way that is reproducible, I'll reopen.

@mikesol mikesol closed this as completed Mar 3, 2022
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

2 participants