Sublime Text 2 Beta released with Auto-complete and Improved UI
sublimetext.com
sublimetext.com
http://wbond.net/sublime_packages/package_control
It's fantastic and gives you a simple in-editor way to add/remove other plugins, direct from their github repos, without needing to leave or restart the editor. It also automatically keeps them all up to date.
Once it's installed, you can just use the command palette (ctrl+shift+p) to install any of these plugins: http://wbond.net/sublime_packages/community, plus any others that you add via their github repo.
This is certainly a pretty editor. But at its heart, it's still a text editor. And what I do for a living is edit code.
Code has a lot more information about it than text. I can imagine looking at a line such as:
item.hide()
in this editor, knowing that my codebase has half a dozen classes that expose a .hide member. I hesitate even to ctrl+click on it in this editor, because I know it'll either do nothing or take me to the wrong definition.In a perfect world (and in IDEs for statically typed languages since 1998), the editor would know exactly which .hide we were talking about. And it could gracefully send me there with a single click or keystroke.
I'm still waiting for something equivalent to appear for the Ruby/Python/Javascript portion of my world. But years keep ticking by and the best we get is text editors that try to guess by looking at text.
Maybe next year.
def spam(eggs):
eggs.<TAB>
Should autocompletion go find all callers of spam() and see what they are passing in in order to determine what should be available at that point?The same kind of global dataflow analysis would have to be approximate in a dynamic language, but I'd still expect it to be better than nothing.
Instead, you have to open the file in question and go find the method using one of the fiddly text-based methods that the article mentions.
So no, we're in agreement that the entire codebase belongs in your head. It's just nice to have your IDE also have the entire codebase in its head, in the actual configuration it is, rather than just knowing about a bunch of text files containing words that have no meaning to it.
>knowing that my codebase has half a dozen classes that expose a .hide member. I hesitate even to ctrl+click on it in this editor, because I know it'll either do nothing or take me to the wrong definition.
to mean you were relying on your IDE to tell you which .hide() method you were calling.
As others have pointed out elsewhere, I think giving that functionality to ST2 would push it too far into the realm of IDE.
class A(object): def read(): return 'A'
class B(object): def read(): return 'B'
def doit(i):
if i==1: obj = A()
else: obj = B()
return obj.read()
When you put your cursor over the .read() in obj.read(), where does it point to?The same function can get called a 1000 times and take different paths each time. Which method is your hypothetical rewinding debugger going to show? (Leaving aside the big gaping hole of how your program is executing while you are typing it out).
The problem of deciding which method actually gets called by static analysis in a text editor (and it would have to be static analysis) is literally impossible for dynamic languages - pretty much by definition.
I see this type of situation as something that shouldn't happen very frequently.
Also, you could take this one step further and have it split screen the methods in multiple files if you like.
This is very convenient and not having this was the reason for still having TextMate around.
:w !sudo tee %cmap w!! w !sudo tee % >/dev/null
This is always the killer for me.
- ExpanDrive, which uses MacFUSE to mount remote volumes over SSH, but with lots of metadata caching smarts to make it fast and reliable
- My hacky remote textmate script, which gives you a "mate" command on the remote machine via ssh tunneling (https://github.com/jaylevitt/textmate_remote)
to work well with TextMate. I've been meaning to try it on ST2 but haven't yet; as long as ST2 doesn't do the horrible thing TextMate used to do and continuously rescan the project directory in a blocking thread, you'll be cool.
https://github.com/epall/dripbox
I use it every day, editing files locally in Sublime Text 2, and then cmd-tabbing to Terminal to run tests. It's fast enough that I never even think about the delay.
Definitely a 'why don't all apps work like this?' feature.
I wrote an indexer for Objective-J code last year, that scans a set of folders (which can include the Cappuccino frameworks if you like) and creates a completion index of all the class names, methods, functions, etc. It was trivial to make an ST2 plugin that completes using that data.
The abilitity to write your own autocompletion plugins for the freaky/obscure kinds of files you use really rocks. Even without heavy-duty semantic analysis of the code, you can get 90% of the way there and it is really useful.
The main problem right now is that the UI is still too narrow. Voting this issue up could help get that fixed:
http://sublimetext.userecho.com/topic/85632-need-the-complet...
There's some commented-out logic in the 'official' Cappuccino plugin for ST, that takes into account the scope and then works backwards to try to figure out what type of object you are messaging.
https://github.com/aparajita/Cappuccino-Sublime
But I think the reason that's commented out is that it is easy to get some parts working, but to do it right you need to analyze the whole code base, with a real parser, be able to follow the map of import/include statements back to know what code elements are actually available in the current scope, etc etc. And that's a lot of work.
Still, there's a lot of value in doing a good job with a simpler kind of completion -- and it is way easier, as long as the editor is extensible to the extent that ST is.
I know other languages of course, but it just feels like a hassle to code without Intellisense these days :p
I think to eventually get there, though, we need open-source solutions to get as good as JetBrains, Microsoft, and Apple. Otherwise you get Apple's great (for Obj-C only) CodeSense, but you have to use their horrible, auto-corrupting, fucking disgrace of an IDE. Or to get RubyMine's absolutely unparalleled Ruby code introspection and completion, you have to use their gut-wrenchingly horrible Java monstrosity.
When the indexing and completion are decoupled from the editing environment, that's the magic sauce that will make the open source solutions fork and flourish, and good completion will finally be like toilet paper and hot water.
That's why I am really happy with editors ilk ST2 which provide good infrastructure to make things like SublimeCodeIntel possible.
I'm 37, I program a lot, and my finger joints are wearing out. Typing every single fucking character of code is insane.
I hope Jetbrains makes their own kick-ass C# coder-style environment. I don't care if it's Java and IntelliJ as the shell.
There are loads of things VS2010 does that I simply don't need, I just need Speed, Solutions, Projects, Building, Running, Debugging, Version Control and the things Resharper already does.
Cmon Jetbrains, you can do it!!! Please?
edit: minimap exists! (Obviously only in GUI Emacs)
Animated sub-line scrolling probably requires hacking the Emacs source. Indent guides might be possible just in elisp, but I don't know how good they would look.
you can't implement minimap in CLI. It's a GUI concept.
http://stackoverflow.com/a/4160949
http://www.emacswiki.org/emacs/SmoothScrolling
http://zwell.net/content/emacs.html
https://emacs.wordpress.com/2007/09/10/smooth-scrolling/
Yes, trying to do fancy things in Elisp can be a bit kludgy.
Edit: installing Soda theme[1] solved it!
I've been working in XCode so much lately that I've gotten really used to this style of autocomplete, so this update is very welcome.
I do wonder if the arrival of Sublime Text 2 was the impetus for TextMate 2 development after so many years.
The best split-screen implementation is E-Text Editor. In E, you can drag the tab to create a new split, then "Cmd T" in ANY tab will bring you to the previously opened file in the split. Basically I don't have to remember where the file is opened, as long as I know its name, I can just jump by typing the name. That is how quick jump should be. Also, you can arrange the windows by dragging-and-dropping to another split. I stop using E after version 1 because I made the switch Mac and I have to use Textmate, which does not support split-screen at all (what a shame!). And I miss E dearly.
Currently Sublime Text quick jump is still bad, because it still requires a context switch (switch to the group that has the file opened, then Cmd T), or worse, complete loss of current context (Cmd T would open the file in current group, thus you lose the view of the current file you're working on).
So as long as split-view doesn't get implemented properly, Sublime Text is still just another editor.
I've found/modified a little plug-in to simulate it, but it's not ideal.
I love Sublime, and I'm sure it seems trivial to most folks, but as a developer with poor eyesight, this is the one feature I want the most.
At least fonts can be larger now.
When you start writing #in... Sublime will suggest you #include ... pressing Enter will actually double the pound sign. You end up with something like ##include ....
I've noticed the same pattern for int m... the suggested completion was main(). Pressing Enter ends up repeating the return type of the main function, something like:
int int main(int argc, char *argv[]) ...
Maybe this a Mac only bug or it has something to do with the way the C++ syntax is parsed by the Auto-complete algorithm.
Thanks.
Now, after having been using Vim for about 8 years now, after a few weeks of trying Sublime, I'm pretty much ready to pony up for SublimeText 2 whenever the final version is released.
Loving the mini-map and package manager particularly. The vim emulation seems to cover most of the key ones I use too. Nice work!
I've always avoided IDEs that offered this because they seemed to be terribly slow -- pleasantly surprised so far.
I've had this on for about a week now, and although it was initially very disorienting, it's very easy to get used to it. I'd certainly recommend it, since it allows you to add a new line even if a suggestion is there.
I did a search/replace of [a-z] to 0 in a 50 meg text file before as a comparison between Sublime Text 2, UltraEdit, and gVim. UltraEdit was slower than I would have liked, gVim was < 10 seconds, and Sublime crashed. That's a deal breaker.
I've tried the SFTP plug-in, but find it really clumsy. Ideally I'd just love to be able to add a remote folder over SFTP the same way you do local ones.
they create a mapped drive to a location of your choosing and you edit files as if they were local.
i stopped worrying about the remote editing functionality in editors since. before that i used winscp, which detects changes and re-uploads automatically, but it's not as convenient.
The new autocomplete even has lorem ipsum in it :)
Anyone know if it's possible to change the default tab background color for themes that don't support it?
It's just based on your work pattern to decide which one to use. For me, all 3 of them are all very useful everyday.
I hope the developer is able to live comfortably while working full time on his own endeavors, rather than relegate them to a hobby, and himself into wage slavery.
once those get addressed more fully, i'm ready to cough up the cash.
1) Jump the the function/method definition (even if it's in a different file) when I press Ctrl and click on the function name. Eclipse does this.
2) Quick find of the function/method definition across the whole project. Eclipse does this as well (Ctrl + R).
I don't use Eclipse that much, because it's ridiculously slow, but it has cool features.
I also use cscope: https://github.com/ameyp/CscopeSublime
for scripting languages, define a function as concatenated string in eval(), how could you find the function definition, without actually run the script for once?
Even if you run the script once, what if there is a delete_file() function you accidently called?
So do we need to implement a sandboxed VM in order to find definition, theoretical perfectly speaking?
Try getting your editor to find that definition of method "accept_language" or "cache_control". :-)
Use case involves a class wrapping python's xml-rpc stuff to talk to Drupal.
Drupal's xml-rpc interface is not the most pleasant thing to work with, as you have to pass in a session id and auth token on every request, and then all the "actual" parameters go in as an array.
My wrapper class would query the remote interface for available methods, and then dynamically generate, via eval, a function object that used a closure to store the sess/auth tokens, and that took a variable number of arguments to pass as the 3rd array argument to the function. The eval'd function object was then bound as a method to the connection object.
It also did a bit more magic, such as on error logging the arguments to a file. ALl in all it made writing web-service clients a lot more pleasant.
None of the normal (you come to expect) keybindings work. It was slow/sluggish.
At the time when I checked out (I have no reason to believe why it would be much different today) Wing seemed infinitely more awesome. - The ability to split screens, the amount of time the UI actions take. The F1 and F2 that provide more screen real estate felt far more interesting than Komodo, which almost felt the opposite. Komodo didn't have the deep Python integration like wing does. The goto definition etc are far more better in Wing.
Take a look: https://github.com/Kronuz/SublimeCodeIntel
Supports all the languages Komodo Editor supports for
Code Intelligence (CIX, CodeIntel2):
PHP, Python, RHTML, JavaScript, Smarty, Mason, Node.js,
XBL, Tcl, HTML, HTML5, TemplateToolkit, XUL, Django,
Perl, Ruby, Python3.
Where's C? Where's C++? Where's Java? That's disappointing.EDIT: Now that I look at your two requirements, that's not at all hard for a language like C or java. I recall having this in 1993 on the OS/2 version of SlickEdit. vim or emacs will handle this no problem. If you want a GUI, Visual SlickEdit will do it, and for a whole bunch of languages on every OS.
Moreover, at least in Python (perhaps others?), you can jump to definitions in any included lib that aren't even part of your project's source code--e.g., import something from django & it'll jump you right to Django's source for any imported method, class, etc.
It's totally pathetic yet oddly endearing at the same time.
My order number was something around 5000. So Odgaard had grossed $.25MM already. (At some point a couple years later I bought it again, and the order number was like 48000. It's no wonder he disappeared for years on end.)
ST2 seems to be on that same trajectory.
(And the grandparent comment is idiotic, of course; a truly good text editor repeatedly makes the news here just as a uniquely novel hammer would undoubtedly be a prominent theme on carpenternews.com.)
Edit: and Microsoft IDEs