Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Id really love to do this, but there are a few things that would slow me down

* no autocomplete... On huge projects that are not based on some predefined framework structure (think rails) this results in a lot of "what was the parameter order of that function again or how was it even called ?"

* no easy refactoring. In VS i love how i can just hit F2 on a method name, rename it, VS shows me all the places where it will rename it and pressing OK. This works flawless everytime and makes refactoring so much more painless than working with a scripting language and a text-editor only

+ numerous other things like looking up where certain methods get called, where they are defined etc.



For autocomplete, I don't know enough about vi or vim, but emacs has it:

http://stackoverflow.com/questions/1616753/make-emacs-semant...

For refactoring, that's just an advanced text across many files manipulation feature, and emacs certainly can do it, but you might have to work on your .emacs file.

The numerous other things sound like either things you can do in gdb or valgrind, or again just advanced text search/editing.

Now all of this is not elegantly pulled together. You need to create this for yourself, make all these tools work together by developing a development environment for yourself. But once you do, you may be surprised just how elegantly everything works together.


> For refactoring, that's just an advanced text across many files manipulation feature, and emacs certainly can do it, but you might have to work on your .emacs file.

Re-factoring is text editing, if you consider parsing to be advanced text editing(which it is not). Consider a class Foo implementing method foo, and a class Bar implementing a method of the same name foo. When I am renaming Foo.foo to Foo.bar, a refactoring tool will rename based on the semantics.

Renaming manually will always require looking through all occurrences, compared to clicking a couple of buttons in Eclipse and being assured it renamed all occurrences without any false positives or negatives.

Also, the nature of dynamic languages make it harder to refactor:

    class Foo:
        def foo():
            pass

    class Bar:
        def foo():
            pass

    def a_func(arg):
        arg.foo()
Now, in arg.foo, arg can be an instance of Foo, or Bar, or Baz...In a large codebase, manually doing it will be a night mare.

I mostly use vim, linux and dynamic languages. But that doesn't change the fact that Eclipse/Java is leaps and bounds ahead when we are talking re-factoring.

Also, I use rope for Python. Though it mitigates most of the warts, it can't mitigate the issue in the snippet above. There is an `unsure` mode which renames when unsure, but that's not a smart thing to do on a large codebase.


You can have all of that in Emacs and probably in vim as well.

See ctags/etags, cedet, ropemacs (refactoring Python), xrefactory (refactoring C and C++), wrangler (refactoring Erlang), etc.


True, but that could be argued to be Emacs-as-IDE. Cscope enables a better solution to this problem (with a clumsy interface) but solving it for good would require solving the structured-data-on-the-Unix-streams-model problem and I've yet to see a good solution to that.

People kludge them to fit all the time—look how older ctags implementations worked, after all—but it reminds me of a guy I who would write paragraphs so that each sentence had its own "line" and relied on implicit word wrap in LaTeX, HTML and the like to format it for human consumption. He did this so it would work better with tools like diff, patch, and version control in general. I thought "hey, worth a shot", tried it, and found it too clumsy for me during the writing process and abandoned it soon after.


> He did this so it would work better with tools like diff, patch, and version control in general.

git supports a --color-words option which is quite handy for text.

> I thought "hey, worth a shot", tried it, and found it too clumsy for me during the writing process and abandoned it soon after.

use auto fill and don't manually break lines :)


You NEED those things in VS in order to keep track of the 20K+ objects, code, libraries, etc. to code for Windows and .NET. You don't need all that in Unix.


"* no easy refactoring. In VS i love how i can just hit F2 on a method name, rename it, VS shows me all the places where it will rename it and pressing OK. This works flawless everytime and makes refactoring so much more painless than working with a scripting language and a text-editor only"

Using vim (or sed for whole directories of files) you can do the same thing using a search and replace regex.

    in vim:
    :%s/<find>/<replace>/gc


...which works great until you have to rename a field with the name 'value' in one particular highly-used class in a system with ten-thousand classes, many of which will also have fields named 'value'. That's where actual IDE knowledge of the language semantics is more or less required, to be able to track the actual object being referenced based on the particular imports, inheritance hierarchy, etc.


Well, one way to do it would simply be to rename the field, then make/ant/maven, and then visit the error lines, especially if you can feed the compiler error messages back into your editor to auto-navigate. Not instant, but not intolerable.


The thought of doing global search and replace across an entire codebase (or even a section thereof) gives me a knot in my stomach.

Hope you have very good unit tests.


That's not at all equivalent.


How so? I haven't used VS since a couple of versions ago and never got to know it very well, so I based my above comment on the OPs description; if there's more to the feature than I could easily be wrong.


Global search and replace casts a wide net, makes tons of mistakes, requires you to inspect every change to ensure it was correct; automated refactorings don't make any mistakes no matter the size of the code base. These two things are vastly different.


You don't review automated refactorings?


Actually in jetbrains IDEs you preview your automated refactoring, before it happens. It will show you which files will be affected and how, and then you can choose whether to exclude specific instances or not.

Code review happens anyway, automated refactor or not


You certainly can; however, you'll stop after a while when you realize it actually works.


The vim command is doing a search and replace over all text - Rename in Visual Studio will restrict the change to class/method/.... name definitions and calls to them.


Ah, so instead of having to hand-roll your own really complex regex that would limit the scope every time, VS automatically limits the scope of the renaming for you. That is pretty nice.


It isn't about limiting scope, it's about parsing and understanding the language. A refactor can change every file in your project (for example, renaming a global variable named 'i').

And, yes, it is very nice. Eclipse comes close with Java but, last I tried Vim and Emacs refactoring plugins, they were nowhere near as good or even very discoverable/usable).


No, you operate on different levels. A regex replace works on the text of your source files, a refactoring rename in Visual Studio or Eclipse works on the symbol.


thats works for some cases but can by no means be described as "works flawless everytime" like the refactoring features of modern IDEs!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: