Jessica Posted August 17, 2012 Share Posted August 17, 2012 I just went through a 700 line tpl line by line adding indentation. It had none. Gee, I wonder why the previous developer couldn't find his bugs? :'( :'( It took me 45 minutes to figure out where the loop was that he was messing up. So yes, I'm grumpy today. Quote Link to comment https://forums.phpfreaks.com/topic/267234-psa-indent-your-code-dammit/ Share on other sites More sharing options...
xyph Posted August 17, 2012 Share Posted August 17, 2012 Netbeans - Get parser for tpl language - > Right click - > Format code Agreed though. If someone posts non-indented code here, I usually don't even bother. Quote Link to comment https://forums.phpfreaks.com/topic/267234-psa-indent-your-code-dammit/#findComment-1370210 Share on other sites More sharing options...
Jessica Posted August 17, 2012 Author Share Posted August 17, 2012 I know there's probably more than one tool that can do it for me, but by the time I was a quarter done I decided it would take longer to install those tools. For next time though definitely. Quote Link to comment https://forums.phpfreaks.com/topic/267234-psa-indent-your-code-dammit/#findComment-1370211 Share on other sites More sharing options...
Maq Posted August 17, 2012 Share Posted August 17, 2012 I know there's probably more than one tool that can do it for me, but by the time I was a quarter done I decided it would take longer to install those tools. For next time though definitely. Any decent IDE should come with this feature. You can even customize how the format looks. Anyway, that's one of my pet peeves.... Quote Link to comment https://forums.phpfreaks.com/topic/267234-psa-indent-your-code-dammit/#findComment-1370213 Share on other sites More sharing options...
Jessica Posted August 17, 2012 Author Share Posted August 17, 2012 I'm using jEdit, we tried setting up Eclipse and Netbeans in the past and could not get either to work with connecting to the repositories. I personally don't like a huge IDE with a ton of features, I'm used to Textpad. I like syntax highlighting and auto indent - meaning when I type if(){ it indents the next line. But I've never seen one that can take a non-indented file and fix it. I checked jEdit and can't find it, even as a plugin. Quote Link to comment https://forums.phpfreaks.com/topic/267234-psa-indent-your-code-dammit/#findComment-1370219 Share on other sites More sharing options...
Pikachu2000 Posted August 17, 2012 Share Posted August 17, 2012 It's far from a 'light' IDE, but Zend Studio will indent non-indented code quite well. I use that feature all the time. Quote Link to comment https://forums.phpfreaks.com/topic/267234-psa-indent-your-code-dammit/#findComment-1370220 Share on other sites More sharing options...
xyph Posted August 17, 2012 Share Posted August 17, 2012 It's far from a 'light' IDE, but Zend Studio will indent non-indented code quite well. I use that feature all the time. It SHOULD for $300!! Quote Link to comment https://forums.phpfreaks.com/topic/267234-psa-indent-your-code-dammit/#findComment-1370225 Share on other sites More sharing options...
Christian F. Posted August 17, 2012 Share Posted August 17, 2012 Oh, I know what you're talking about, Jesi. Trust me. Been cursing people who didn't indent properly for a long time, and when I Zend Studio implemented the format code function it was as if was sent from heaven! Nowadays, I just hit CTRL + SHIFT + F and grin. Quote Link to comment https://forums.phpfreaks.com/topic/267234-psa-indent-your-code-dammit/#findComment-1370339 Share on other sites More sharing options...
Adam Posted August 18, 2012 Share Posted August 18, 2012 I'm using jEdit, we tried setting up Eclipse and Netbeans in the past and could not get either to work with connecting to the repositories. I personally don't like a huge IDE with a ton of features, I'm used to Textpad. I like syntax highlighting and auto indent - meaning when I type if(){ it indents the next line. But I've never seen one that can take a non-indented file and fix it. I checked jEdit and can't find it, even as a plugin. In vim, just select the text and press "=" Quote Link to comment https://forums.phpfreaks.com/topic/267234-psa-indent-your-code-dammit/#findComment-1370418 Share on other sites More sharing options...
salathe Posted August 18, 2012 Share Posted August 18, 2012 Visual Studio has Ctrl+K, Ctrl+D to format the document. .NET, it's the future! Quote Link to comment https://forums.phpfreaks.com/topic/267234-psa-indent-your-code-dammit/#findComment-1370421 Share on other sites More sharing options...
Jessica Posted August 18, 2012 Author Share Posted August 18, 2012 I'm using jEdit, we tried setting up Eclipse and Netbeans in the past and could not get either to work with connecting to the repositories. I personally don't like a huge IDE with a ton of features, I'm used to Textpad. I like syntax highlighting and auto indent - meaning when I type if(){ it indents the next line. But I've never seen one that can take a non-indented file and fix it. I checked jEdit and can't find it, even as a plugin. In vim, just select the text and press "=" Yeaaaaah. There's a reason I'm the only person on my team using Windows. I just can't adapt to vim. *hangs head* Quote Link to comment https://forums.phpfreaks.com/topic/267234-psa-indent-your-code-dammit/#findComment-1370555 Share on other sites More sharing options...
teng84 Posted August 19, 2012 Share Posted August 19, 2012 I'm using jEdit, we tried setting up Eclipse and Netbeans in the past and could not get either to work with connecting to the repositories. I personally don't like a huge IDE with a ton of features, I'm used to Textpad. I like syntax highlighting and auto indent - meaning when I type if(){ it indents the next line. But I've never seen one that can take a non-indented file and fix it. I checked jEdit and can't find it, even as a plugin. In vim, just select the text and press "=" Yeaaaaah. There's a reason I'm the only person on my team using Windows. I just can't adapt to vim. *hangs head* the problem when using vim and windows editor is the tab vs spaces if you forgot to edit the settings of your windows editor to 4 space it will be a night mare of vim user lol Quote Link to comment https://forums.phpfreaks.com/topic/267234-psa-indent-your-code-dammit/#findComment-1370629 Share on other sites More sharing options...
The Little Guy Posted August 19, 2012 Share Posted August 19, 2012 Here is what I look for in an editor: - Auto Indent - Auto Close: Brace, Bracket, Quote, Apostrophe, Parenthesis Netbeans formats fairly well not 100% perfect I noticed though Before formatting: <?php class C{ private $v1 = ""; public $superman = array(); protected $batman = 1234; public function __construct($thing){ $this->thing = $thing; $cat = "Dog"; echo $cat; } public function something(){ $longvariablecounter = 0; for($i=0;$i<10;$i++){ echo "Hello"; $longvariablecounter++; } } } $frenchFry = "10"; $bans = "123"; $c = new C($frenchFry); $c->something(); echo "<br />"; echo $bans; ?> After formatting: <?php class C{ private $v1 = ""; public $superman = array(); protected $batman = 1234; public function __construct($thing){ $this->thing = $thing; $cat = "Dog"; echo $cat; } public function something(){ $longvariablecounter = 0; for($i = 0; $i < 10; $i++){ echo "Hello"; $longvariablecounter++; } } } $frenchFry = "10"; $bans = "123"; $c = new C($frenchFry); $c->something(); echo "<br />"; echo $bans; ?> As you can see the alignment on variables in the for loop, are strange, and the equal signs don't line up that well some variables such as ones with arrays. But it does do everything else quite nice! Quote Link to comment https://forums.phpfreaks.com/topic/267234-psa-indent-your-code-dammit/#findComment-1370662 Share on other sites More sharing options...
Mahngiel Posted August 19, 2012 Share Posted August 19, 2012 Here is what I look for in an editor: - Auto Indent - Auto Close: Brace, Bracket, Quote, Apostrophe, Parenthesis - A good editor permits back-tabbing, too. - Auto closing is a nightmare if the editor doesn't allow you to 'insert' through it. Nothing is worse than auto closing and you have to cursor through containing punctuation! Quote Link to comment https://forums.phpfreaks.com/topic/267234-psa-indent-your-code-dammit/#findComment-1370693 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.