-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Handle curly quotes well #5152
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
Handle curly quotes well #5152
Conversation
Also it now doesn't destroy the rest of the file if a string is left unterminated. Will never fix "content” since curly quotes are valid string content.
There's a special message for curly quotes.
Also now prioritizes error messages on a single line for display to the user, since ECJ doesn't always get that right, reported mismatched argument lists when there's a syntax error and so on.
|
Also I've forced |
|
Looks good. However I think we need to give these priority treatment in the error checker (the same as missing curly braces), otherwise ECJ is going to spit out bunch of nonsense like this: Would you mind if I clone your branch, commit some changes to rectify this, and send you a message so you can merge them back before we accept this PR? |
|
@JakubValtar I don't mind at all. Please could you submit it as a PR to my branch when you're done? Also I feel that that makes my prioritization code a bit redundant, so you could delete that if you think that's best? |
|
|
3a7d3bd to
6ed11f4
Compare
|
@JakubValtar did you make any progress with your plan to clone and clean this up? Or is that merged back in here? |
|
It's still on my todo list. Gonna do this by the end of this week.
…On Tue, 22 Aug 2017, 15:56 Ben Fry ***@***.***> wrote:
@JakubValtar <https://github.com/jakubvaltar> did you make any progress
with your plan to clone and clean this up? Or is that merged back in here?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#5152 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ADB6ilBZ9NaTSL_MynI7daAYL7Ek0MBeks5sat3vgaJpZM4OEU8s>
.
|
|
Got it; thanks! |
|
@GKFX I sent the pull request, sorry it took me a while :/ Thanks for the original PR, good stuff! I just moved stuff around a bit to make it ready for more custom errors and new build system. All error checking is now done in PDEX.ErrorChecker and problems are prioritized manually so that user sees only the most severe problems (curly quotes > curly braces > rest), showing other stuff when program structure is messed up does not make much sense and gives lots of false alarms. I removed the prioritozation code, becasue it was not doing much right now, but if we need to fine tune the priorities in the future we can revive it. |
Curly quotes followup
|
@JakubValtar Looks awesome, thank you! |
|
Does that mean this is ready to merge @JakubValtar? |
|
@benfry I think it is ready. Check the error messages whether you like them. One thing which surfaced is that autoformat might break strings which For sure it does not format well this: Not sure if also: |
String s = "te“xt";definitely should be unharmed; I tested strings like that. If the opening quote is straight, the autoformatter doesn't give curly quotes any special meaning. If the user has managed to type String s = “te“xt”;then I think that all quotes will be straightened (I'm not at my development machine right now and can't check what happens.) But it would be quite hard to distinguish that from something like String s = “te“.xt(“”);so straightening all quotes that aren't in a real string seems like a reasonable thing to do. |
|
@GKFX Thanks, I just tested it and it's fine. Well-formed strings are not affected and in others quotes are straightened. Yesterday I somehow I managed to get a curly quoted string shredded onto multiple lines, but can't reproduce, so it's probably some obscure scenario which will happen to some unlucky soul once in a decade. @benfry Merge time? |
|
Thanks to you both. Now merged. |
|
Great! All credit goes to @GKFX for diving into it. |
|
This appears to be breaking unicode characters: #5413 Presumably because of this change in Can you two look into a fix? (This is holding up the next release.) |
|
Sure, I think I already started on that issue before but didn't finish it yet |
|
Just confirmed that it's due to that change; not a problem on macOS, but affects Windows. Haven't checked Linux. |
|
(Let's continue discussion over at #5413) |
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |



Fix #5133.
The autoformatter now automatically corrects curly quotes when they're used to wrap string or character literals, provided this is safe to do. It is also now less upset by unterminated strings.
On compiling and editing, errors relating to them are reworded.
I've also started prioritising the errors spat out by ECJ since occasionally the first one on the line is not the most relevant one.