Zend Studio 9 array formatting annoyance

General discussion on Zend Studio

Moderator: natalia_b_zend

Zend Studio 9 array formatting annoyance

Postby davidjam on Sat Dec 31, 2011 6:41 pm

Since updating to Zend Studio 9, arrays now auto-indent 8 spaces (on hitting enter OR pasting elements into an array()). Changes to PHP > Code Style > Formatter have no affect -- in particular Line Wrapping / Indentation Policy (last tab)

To get this:
Code: Select all
$variable = array(
    'foo' => 'bar',
    'baz' => 'bop'
)


You must do this:
  1. $variable = array(
  2. hit enter
  3. hit enter to move the parenthesis down
  4. hit backspace 8 times
  5. go up one
  6. hit delete 4 times to get rid of extra space
  7. move to desired position to begin entering array elements
  8. (finally!) enter your first element
  9. hit enter
  10. hit backspace 4 times to get to the right position
  11. enter next element.. etc

You SHOULD be able to do simply this:
  1. $variable = array(
  2. hit enter NOTE: at this point closing parenthesis should automatically go down two lines, be left aligned and the cursor should be set 4 spaces in on first element line
  3. enter element
  4. hit enter, enter element, etc
davidjam
 
Posts: 21
Joined: Mon Jun 15, 2009 8:16 pm

Re: Zend Studio 9 array formatting annoyance

Postby ypqeudxy on Wed Apr 18, 2012 2:35 am

*bump*
This is a source of daily aggravation for me too, any fixes? It seems like the autoindent is trying to do a bit too much and ends up just getting in the way.
Similar thing happens with copy-pasting.

Code: Select all
         $variable = array(
               'foo' => 'bar',
               'baz' => 'bop'
         )

Say you want to add an item to that array. So you copy-paste a line. Pretty standard thing to do.
First paste (copy first line, paste it over itself. I mostly do this because it's convenient but this would also happen if you were replacing a line):
Code: Select all
         $variable = array(
               'foo' => 'bar',
                              'baz' => 'bop'
         )

Second paste (this actually looks right!):
Code: Select all

         $variable = array(
               'foo' => 'bar',
               'foo' => 'bar',
               'baz' => 'bop'
         )

Third paste (and subsequent ones):
Code: Select all

         $variable = array(
               'foo' => 'bar',
               'foo' => 'bar',
                              'foo' => 'bar',
               'baz' => 'bop'
         )


Thanks
ypqeudxy
 
Posts: 3
Joined: Mon Feb 20, 2012 1:18 am

Re: Zend Studio 9 array formatting annoyance

Postby wimgzd on Sun Apr 22, 2012 11:49 pm

I'm having exactly the same issue.
For me this is a very annoying bug, which bothers me hundreds of times every day. It's enough to consider switching to a different IDE.
wimgzd
 
Posts: 1
Joined: Sun Apr 22, 2012 11:48 pm

Re: Zend Studio 9 array formatting annoyance

Postby bate23 on Mon Apr 23, 2012 11:57 am

I have this issue too, @zend please fix this .. instantly ..
bate23
 
Posts: 6
Joined: Thu May 07, 2009 1:23 pm

Re: Zend Studio 9 array formatting annoyance

Postby webghost9000 on Tue Apr 24, 2012 12:22 am

Agreed. This bug exists on the latest ZS9 and is very annoying as it doesn't take into account the editor tab/line spacing preference.
webghost9000
 
Posts: 14
Joined: Sun Nov 13, 2011 7:26 pm

Re: Zend Studio 9 array formatting annoyance

Postby douya on Tue Apr 24, 2012 2:42 am

Hi,

Not sure if I understand you,if you do not want those indentations,you can change it:
In the studio main menu,Window->Preferences->PHP->Code Style->Formatter,and then edit the current profile on the right half window,then go to the "Line Wrapping" tab,then you can change the value of "Default indentation for array initializers" to 0,default is 2.
douya
 
Posts: 13
Joined: Sun Oct 17, 2010 11:24 am

Re: Zend Studio 9 array formatting annoyance

Postby lbgjhobbs on Thu Jan 31, 2013 3:09 pm

Brilliant solution! I set mine to 1, such that it will now indent logically.

I have to admit that I never would have found this, as I did not consider it Line Wrapping at all. Thanks for posting!
lbgjhobbs
 
Posts: 1
Joined: Thu Jan 31, 2013 3:08 pm

Re: Zend Studio 9 array formatting annoyance

Postby imre8105 on Tue Jun 25, 2013 10:51 am

Thanx i have been having same problem for over year.. what was driving me mad sometimes. Finally i googled and found solotion from here.
imre8105
 
Posts: 2
Joined: Tue Jun 25, 2013 10:50 am


Return to Zend Studio

Who is online

Users browsing this forum: No registered users and 8 guests