|
A fault of modern source editors?A fault of modern source editors?Posted Mar 19, 2008 1:32 UTC (Wed) by nix (subscriber, #2304)In reply to: A fault of modern source editors? by dw Parent article: Who maintains dpkg?
A lot of your points have merit, but one thing you mentioned is less useful than it might at first appear: the `code template' stuff, where you type 'for ' and the editor types in (;;) and sticks you after the opening bracket. This is problematical for several reasons: Firstly, the editor is making your cursor jump around without your having commanded it to move, and both the point it left and the place it moved to is essentially arbitrary (does your editor's template matcher fire after space? Bracket? Which section of the for does it move you to? Perhaps it moves you to the loop body...) Secondly, once you're there, there's no way the editor can automatically tell that you've finished typing in one section and want to move to the next, so you'll have to tell it. Had the template not been there, you could have indicated this by pressing the semicolon; but with the template in place, you have to hit the right cursor key some number of times, or have a right-one-language-token key -- which is still no more convenient than hitting ; would have been! Everyone always uses for loops as an example of where syntactically-aware editing would be useful, but to be honest I've never found anything more elaborate than autoindenting and automatic closing brace/bracket insertion to be any help at all. Those identifier autocompletion dialogs are even worse, because unless you have a hyper-high-end system they make the editor stall for an instant, they tend to dump a dialog box up on top of your typing (why not open a pane at the bottom of the screen and fill it up?) and they invariably don't contain the identifier I'm actually *looking* for anyway. So the result is a juddery, flickery, annoying mess, like browing an advert-laden site with animation enabled and flash installed. :)
(Log in to post comments)
A fault of modern source editors? Posted Mar 22, 2008 4:32 UTC (Sat) by kevinbsmith (subscriber, #4778) [Link]
Actually, the Java editor in eclipse has solved this pretty nicely. Type in "for" and hit
Ctrl-Space (their auto-complete trigger). Choose which kind of for loop you want, and it
creates a skeleton. It's even smart enough to look at what arrays are in scope and guess which
one you wanted to iterate over.
It places your cursor in the first "field", which is the iterator variable name ("i"). If you
modify it, all other references to i are updated to your new name. Hit tab to advance to the
second field, which is the terminating condition. Tab again gets you to the body of the if,
inside the curly braces.
Or at any point you can bail out by hitting an arrow key or mouse-clicking elsewhere. You're
not locked into just editing those fields. It takes a bit of practice, but is really quite
effective. More so for iterating collections classes and other Java-isms.
I don't really like Java, and eclipse is bloated and has a clumsy UI. But it is a really
powerful tool that manages to make programming faster and less error-prone in many ways. I
miss it when coding in other languages.
|
Copyright © 2008, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds
Powered by Rackspace Managed Hosting.