| Summary: | [typing] Automatically insert brace at correct position moves { entered in empty string to end of line | ||||||
|---|---|---|---|---|---|---|---|
| Product: | [Eclipse Project] JDT | Reporter: | Rasa Mišeikytė <rasa.miseikyte> | ||||
| Component: | Text | Assignee: | Julian Honnen <julian.honnen> | ||||
| Status: | VERIFIED FIXED | QA Contact: | |||||
| Severity: | major | ||||||
| Priority: | P3 | CC: | anma-e, basinilya, daniel_megert, julian.honnen, laville, mauromol, noopur_gupta, p.rader, restful.koala, rgrunber, sewe, stephan.herrmann | ||||
| Version: | 4.8 | ||||||
| Target Milestone: | 4.16 M1 | ||||||
| Hardware: | All | ||||||
| OS: | All | ||||||
| See Also: |
https://git.eclipse.org/r/159048 https://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=8ac6881d75ce9eb05ca2c5dd8a38f18fece5c75a https://bugs.eclipse.org/bugs/show_bug.cgi?id=546931 |
||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
It happens when "Preferences > Java > Editor > Typing > Automatically insert at correct position > Braces" is checked. As a workaround for now, you can disable this option. *** Bug 527552 has been marked as a duplicate of this bug. *** (In reply to Noopur Gupta from comment #1) > As a workaround for now, you can disable this option. You can simply press 'Delete' to move the '{' to the expected position. That trick works with almost all smart typing options. (In reply to Dani Megert from comment #3) > (In reply to Noopur Gupta from comment #1) > > As a workaround for now, you can disable this option. > > You can simply press 'Delete' to move the '{' to the expected position. That > trick works with almost all smart typing options. I tried 'Delete' but it didn't work. Did you mean the 'Backspace' key instead? 'Backspace' works and brings back the '{' to the correct position. Nice trick! (In reply to Noopur Gupta from comment #4) > (In reply to Dani Megert from comment #3) > > (In reply to Noopur Gupta from comment #1) > > > As a workaround for now, you can disable this option. > > > > You can simply press 'Delete' to move the '{' to the expected position. That > > trick works with almost all smart typing options. > > I tried 'Delete' but it didn't work. Did you mean the 'Backspace' key > instead? 'Backspace' works and brings back the '{' to the correct position. > Nice trick! Yes, 'Backspace'. *** Bug 527997 has been marked as a duplicate of this bug. *** *** Bug 540819 has been marked as a duplicate of this bug. *** Please note that the workaround to hit backspace works only if you press it IMMEDIATELY after the "{". If you meanwhile have typed something else (quite common), hitting backspace repeatedly won't cancel the effect of this undesired insertion.
I would also raise the importance to "normal" at least, since the current behaviour is quite frustrating (see my report in bug #540819 - sorry for the duplicate). *** Bug 541002 has been marked as a duplicate of this bug. *** (In reply to Stephan Herrmann from comment #10) > *** Bug 541002 has been marked as a duplicate of this bug. *** This one contains an even trickier example. I just had to search this bug again to find the workaround, after being unable to insert '{' into a string literal.
I can confirm, even after having heard about the workaround, 10 months later I was completely clueless how to teach Eclipse the basics of text editing. This is not a minor problem.
New Gerrit change created: https://git.eclipse.org/r/159048 Gerrit change https://git.eclipse.org/r/159048 was merged to [master]. Commit: http://git.eclipse.org/c/jdt/eclipse.jdt.ui.git/commit/?id=8ac6881d75ce9eb05ca2c5dd8a38f18fece5c75a verified on Version: 2020-06 (4.16) Build id: I20200406-0600 |
Created attachment 269503 [details] error happens when trying to enter { at line 110 (to pass "{" as third term of new StringJoiner(...)) Oxygen: Java code editor: Impossible to enter { within empty string "" - every time Eclipse creates this { at the end of the line: only way I managed to create string "{" was when keeping it the only items in line (moving rest of code down). Example code attached: error happens when trying to enter { at line 110 (to pass "{" as third term of new StringJoiner(...)) Looking forward for fix!!! -- Configuration Details -- Product: Eclipse 4.7.0.20170620-1800 (org.eclipse.epp.package.java.product)Installed Features: org.eclipse.jdt 3.13.0.v20170612-0950