Community
Participate
Working Groups
Eclipse 3.7 (I20110613-1736) JSDT 1.3.0 (20110527214303) WTP 3.3.0 (20100921193530) 1. Create a new JavaScript file and add this code: function() { var myArray = []; } 2. Put the editing caret between the square brackets, and press Enter. 3. You get function() { var myArray = [ ]; } Inside array literals, pressing Enter causes the editor to insert spaces to align the new line with the opening [ bracket. I expected it to just increase the indentation level. This happens when using a new workspace with all the default preference settings.
Issue raised also at http://stackoverflow.com/questions/7141183/
Please vote for this bug!
Guess this could be fixed wis kind of patch: https://github.com/narqo/webtools.jsdt.core/commit/1d40c05f5fc66b39607ddf9bbaf7d6349e52008b NOTE: Actually I got no Java and Eclipse PDE experience, but I'm on my way learning :)
Vladimir, before we can accept any patch from you, you need to sign the Contributor License Agreement. http://wiki.eclipse.org/Development_Resources/Contributing_via_Git#Eclipse_Foundation_Contributor_License_Agreement Thanks, Chris
This single issue forces me to install the behemoth that is Aptana. I must agree with a more recent reporting of the same issue (Bug 419931) that it is a "hideous, broken nightmare", and it "feels actively user-hostile". And forgive me, but it seems a bit ridiculous that this bug is still "new" (nevermind still open) after nearly 3 years, and a year-and-a-half-old potential fix.
(In reply to Chris Jaun from comment #4) > Vladimir, before we can accept any patch from you, you need to sign the > Contributor License Agreement. > > http://wiki.eclipse.org/Development_Resources/ > Contributing_via_Git#Eclipse_Foundation_Contributor_License_Agreement > > Thanks, > Chris Patch exists for two years. Stupid, arbitrary, harmful bureaucratic procedures prevent it from being applied.
(In reply to Szczepan Holyszewski from comment #6) > Patch exists for two years. Stupid, arbitrary, harmful bureaucratic > procedures prevent it from being applied. Requiring a signed CLA protects us all and ensures Eclipse will remain legally available for you to download and use in the future. https://www.eclipse.org/legal/clafaq.php
New Gerrit change created: https://git.eclipse.org/r/79027
Is it possible to imlement the following formatting behaviour: 1. var myArr = [|] 2. var myArr = [ | ] I think this is a better option for array formatting
*** Bug 419931 has been marked as a duplicate of this bug. ***
New Gerrit change created: https://git.eclipse.org/r/79660
With the provided change is implemented the expected behavior, except we're using spaces instead of tabs. See: http://i.imgur.com/nS02cOS.gif Thanks to all for the help in fixing this, especially to Shane, Angel, Nitin and Amisevsk.
(In reply to Patrik Suzzi from comment #12) > With the provided change is implemented the expected behavior, except we're > using spaces instead of tabs. > See: http://i.imgur.com/nS02cOS.gif > Thanks to all for the help in fixing this, especially to Shane, Angel, Nitin > and Amisevsk. I did try replying with an email, but it does not seem to have applied it to this issue, so appologies if I repeat myself. First of all, thank you for taking time to address this. This one problem had been a perpetual thorn in my side, and I'm anxious to see it resolved. However, from your example, that doesn't seem to be the expected behavior at all. If I have my formatter set up to use tab indents, I should hit enter once and have the line indented by one tab. Just like any other brackets (like braces for a function body for instance). Your gif shows me that you have to hit enter and have to clear out a bunch of spaces to get to the desired indentation level before adding additional lines, which is the problem I currently have. That is not an acceptable solution. Ideally it should work like Atom or Sublime when it comes to indenting array initializers.
(In reply to Jesse Shaffer from comment #13) To expound upon my last comment, If your indent is set to 4-space indent, This is my expected result: // | represents cursor position // ^ represents a single space character // before hitting enter myArray=[|]; // after hitting enter myArray=[ ^^^^| ] Again for tab indentation: // | represents cursor position // ---> represents a single tab character // before hitting enter myArray=[|] // after myArray=[ --->| ] Again, from the gif example, it appears that the cursor is indented with spaces all the way to the closing bracket, and then to "fix" the indentation you backspace to get it where you want it, which is not acceptable IMO.
The bugfix in changeset 2 uses tabs. See http://i.imgur.com/CD0HiAa.gif
Patric(In reply to Patrik Suzzi from comment #15) > The bugfix in changeset 2 uses tabs. > See http://i.imgur.com/CD0HiAa.gif I stand pleasantly corrected, thank you!
Note for PMC review This is the changeset: https://git.eclipse.org/r/#/c/79660/2 This bugfix makes more immediate the creation of arrays in JavaScript. This issue is around since a couple of years, and several developers already pointed this as a major flaw (i.e. Jesse, in this same bug ). AFAIK, there is no workaround. This fix just improves the user experience. The possible impact is little, as it affects only sections of code starting with '[', hence only arrays.
(rewriting the same things as above with a better model) PMC Defect Candidate info: 0. This is the changeset: https://git.eclipse.org/r/#/c/79660/2 1. This bugfix makes more immediate the creation of arrays in JavaScript. AFAIK, there is no workaround. 2. This issue is around since a couple of years, and several developers already pointed this as a major flaw (i.e. Jesse, in this same bug ). 3. Tested manually on a launch configuration. 4. The possible impacts are little, as it affects only sections of code starting with '[', hence only arrays.
Thanks Patrik.
Gerrit change https://git.eclipse.org/r/79660 was merged to [master]. Commit: http://git.eclipse.org/c/jsdt/webtools.jsdt.git/commit/?id=d1cf6821fb18fd72631c99d1880a676bf722ab3d
Reported: 2011-09-02 10:36 EDT by Mark Macdonald Modified: 2016-08-25 08:23 EDT 5 years to fix basic formatting bug... not bad. No wonder people left Eclipse for JetBrains' IDEs. Regards, Happy user of PyCharm for the last 4 years. ps. Sorry, but I couldn't resist.
@Piotr this is a fair point indeed. However, there is another side of the coin - The project was in a deep support phase for many years and our new team take over it starting from the begginning of 2016. The point is that we can not fix all in JSDT in one go, but we are ready to fix it step-by-step. Basically, this bug was fixed only because "dajester2007" speak up about it in the comment to the JSDT 2.0 Webinar video - https://www.youtube.com/watch?v=UxGwu2adzIc . So, please if there is smth. irritable - let us know - bugzilla, mailing list, stack overflow, utube etc. We do know that there are dozens of problem in JSDT, but we are ready to hear about them and ready to fix them