-
Notifications
You must be signed in to change notification settings - Fork 453
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
Beautify on save adding extra character(s) to results #1213
Comments
Would you mind generating the debug.md file? This really helps us to reproduce the problem so that we can direct targeted guidance to all concerned parties. https://github.com/Glavin001/atom-beautify/blob/master/docs/troubleshooting.md |
https://gist.github.com/anonymous/ccd9cc18973fc63eee2ade737be9f631 here you go. Its a good one, where its more then just adding brackets. Took a bit to happen on a file that didn't have corporate info |
I am looking at this and I see extra characters at the bottom of the original code sample that don't appear related to the above code:
|
are you asking me about the above? It does that alot..
|
@chevalierc When I looked at the debug.md file the original code sample already had the extra characters at the bottom. That source sample is code that exists before the beautification operation, which means the defect is elsewhere. |
|
I'll create a new debug next time. I'm very confident it is from this package. I only have 2 3rd party packages installed on my two machines and the odd out package is different for each machine. Ill try disabling that package as well. |
I recommend creating a small snippet of code that can reproduce this issue, generating the |
First wanted to say I greatly appreciate your guys package. Has made writing code so much more enjoyable. Did some debugging this morning. I was thinking maybe the NPM package Disabling beautify for an hour I didn't have an issues unfortunately. I usually have the issue pop up around 20 minutes to some times immediately following removing the past mistake. I keep creating debugs and they have the extra characters in the Another piece of info, I have tried the different JS engines but they surprisingly causes identical issues. The issue has never append in HTML files. I'll keep looking for pasterns in errors and try and capture some useful info for @prettydiff . Keeping the package regardless as it is very valuable. |
Awesome to hear 😄 . Thank you!
Could you elaborate on this? Was there a typo/mistake in your previous code and when you saved Atom-Beautify executed and created the extra brace. This could be a If removing |
After saving a file, it would add the extra characters. I would remove the extra character, then save, but It would again add the extra characters during the save.
Will do. Hadn't thought of that. |
Both @chevalierc and @ikeamanual are experiencing extra characters being added after beautify on save. Unfortunately, I have 3 midterms coming up and a new work project, so my time is limited and also I have not yet reproduced this so I may not be much help, yet. I am confident we have narrowed it down to If you could both change Logger Level to |
I attach the debug log here, and a screenshot. This is from duplicate issue #1236 which was closed. To generate this log I started with correct html, an href with a " at the end.
Note that the extra > does not appear in the log, only on the screen. But see the screenshot... Also note that the extra > is actually saved to disk in my html file, I see it with "cat piet.html". |
If you were to Ctrl-S (save and run beautify again) does the extra I'm fairly confident there is something wrong with how the beautification results are being set for the TextEditor: https://github.com/Glavin001/atom-beautify/blob/master/src/beautify.coffee#L111-L119 It could also be another package making changes to the TextEditor while Atom-Beautify is off processing and then comes back and attempts to update the already changed TextEditor. If this were the case, even something as simple as highlighting/selecting the all of the text (Ctrl-A / Command-A) in the TextEditor and then saving could cause problems if
Also is your This is a great start. Could you verify you are using |
I changed the log level from debug to verbose. Yes, if I do another Ctrl-S right after I first see the extra > then the > is show in the log. Here are the actions for this log:
|
Note that if I repeatedly do Ctrl-S, no extra > keep adding. To get the beautifier to add extra >>>> I first have to create some invalid html. Adding a extra newline is not invalid html. So if I fix the html by adding the last ", then do Ctrl-S, then create invalid html by removing the last ", then do Ctrl-S, then I get a second extra > at the end of my file. So the bug seems to be trigged by invalid html, not just removing spacing... |
@ikeamanual If you change beautifiers and attempt to repeat this experiment do you continue to get the extra characters? Both issues used the same beautifier even if the languages are different. |
If I configure Pretty Diff and do the same thing the code is actually chopped off behind the <a. |
Note that I cannot reproduce the extra > on a Windows 10 laptop. |
Yep, that is a reproducible limitation of Pretty Diff. This suggests the problem could be related to the specific beautifier or its relationship to Atom Beautify. |
Just stopping into say I have been using with beautify on-save for the past week and haven't had any of the relevant issues. Ill read the rest of this thread soon, to see how else I can help? |
I have two classrooms of 30 that have had to disable it due to a number of issues, one of which is extra characters being added. |
@dalelotts Do you know which beautifiers your students where using when the extra characters were generated? |
@prettydiff All are set to the default. JS Beautify. |
+1 also experiencing this intermittently using jsbeautify In my attempt to fix this, I have now broken beautify on save for JS files, other files still beautify on save :( |
I've had to disable this plugin for the same reason. I've been using with with js and at times it adds a block around 10 lines long at the end on each save! |
+1. Also happening for me. |
I do not fully understand why disabling the plugin is required course of action, as this issue appears only with Regardless, I do want to resolve this bug. Questions for anyone able to reproduce this bug:
Please provide a Ideally, someone who is able to reproduce this issue will debug a little and hopefully be able to submit a Pull Request solving this issue. I think the applicable code to start looking at is https://github.com/Glavin001/atom-beautify/blob/master/src/beautify.coffee#L115-L119 |
I get this issue all the time with atom-beautify and it's quite annoying. |
@Simon-Payne Could you provide us with your debug.md when this happens. We need evidence of the problem in order to properly investigate and solve the defect. |
I'm having this problem too.. with both html and js files. (never had it with php or anything else). |
I have disabled "Beautify on save" to continue using this package. |
Has this happened to anyone in the last few months? If so, can you provide further details. |
Yep, tonight I just scrambled my c code up good using atom beautify on save (with clang). It will be fun to sort out since I added a big chunk since my last commit. This critical issue has been open long enough that you might assume it was fixed but someone just forgot to hit the close button. Must be a hard one to sort out. Anyhow... disabling and moving on. |
Description
I have been using this add on for a while. Occasionally it adds extra characters (usually closing brackets but occasionally whole words). It recently picked up. Changing from js-beautify to pretty-diff didn't stop the issues.
Expected Results
The beautified code should have looked like:
but produces
and ocassionaly stuff like this:
Steps to Reproduce
Atom Beautify: Beautify Editor
Debug
Here is a link to the
debug.md
Gist: https://gist.github.com/anonymous/ccd9cc18973fc63eee2ade737be9f631Checklist
so I know this is not a duplicate issue
debug.md
Gist to this issueThe text was updated successfully, but these errors were encountered: