+638
Germán M. Bravo 4 years ago • updated by XimXim 4 days ago 36
It'd be great to have intellisense or a more smarter more customizable autocomplete and be able to use some kind of source code introspection to show tooltips and autocompletes
+6
FYI if you're coding in C/C++/ObjectiveC/ObjectiveC++ there's the SublimeClang plugin which does autocompletion: http://www.github.com/quarnster/SublimeClang
+5
Checkout the SublimeCodeIntel plugin. It's a code intelligence plugin ported from Open Komodo Editor.


As of this comment, supports: PHP, Python, RHTML, JavaScript, Smarty, Mason, Node.js, XBL, Tcl, HTML, HTML5, TemplateToolkit, XUL, Django, Perl, Ruby, Python3


https://github.com/Kronuz/SublimeCodeIntel#readme

+81
The guy who wrote Sublime-CodeIntel is the same guy who posted this suggestion.  You sent him to his own project. :D
+4
I'd love to see .Net intellisense myself. I'd even consider it as a full editor replacement if that was the case.
+2
As much as I'd like to see SublimeCodeIntel work, it just doesn't for a huge chunk of people and although they're developing v2, it doesn't seem like they're efforts are going towards making it function for that huge chunk.

ST2's lack of autocomplete is easily the biggest downside to ST2 and it sucks it isn't core. I know there's a core version, but it sucks. :(

Really hope CodeIntel pulls through and v2 works for everyone but I'm not holding my breath.
Try SublimeClang - it does auto-completion, hinting, and static code analysis while it's at it too. It requires a tiny hack to get it working on first install though (unless you're on OS X), which involves installing python2.6 and making a symlink to sublime's lib folder from it, giving it access to many more modules from it's plugin system.
+3
It is a great editor, I have used it in php, pascal, ruby, perl, java, and c.  I still keep going back to my old editors.  I don't even really care about library completion just within a project would be enough.
-1
Intellij PhpStorp and WedIde have one of the best intellisense I've used.
Autocomplete is for a multitude of reasons *not* a builtin feature. It requires a *lot* processing for every key press, and that processing only works for 1 language - it's a whole other system that needs to be fired up for other languages. Builtin support would make Sublime a beast. However, try with SublimeCodeIntel or SublimeClang. They both provide what you need. SublimeClang works for me, but requires some manual install steps. CodeIntel should work out of the box, but I haven't really used it. Anyway, due to the reasons noted above (extreme bloat, lack of portability, and the fact that the plugin system is designed for stuff like this), despite liking the functionality itself, I'm down voting this. I hope you understand.
+2
I agree, I guess I really should knuckle down fork SublimeCodeIntel and help work out the issues.
Note the creator of SublimeCodeIntel is the creator of this request.
Eric: HAHAH! Oh god, didn't know that. Then try with SublimeClang! It's actually pretty good. (Just uses LLVM clangs analytic abilities for C, C++, ObjC and ObjC++. Won't help you with python and others, though... But where there is support, it provides completions, warning/error highlighting as you type, clang static analysis for things like potential memory leaks, and all those goodies. I modified it a bit to save some cpu cycles, though, as well as fix some annoyances... Haven't forked and made a pull request (yet), though)

I'm still certain about my original statement - A universal editor should not bundle more than syntax highlighting and some snippets. It's fine for IDE's that aren't designed to be extensible, and *only* support what it was designed to be thrown at, but even there it leaves a handicap, as the builtin versions usually have lots of holes (Visual Studio "Intellisense" or what it was called, can't find head or tail of the source tree at work for example, when I need to debug something on Windows)

Last note: I might pull down codeintel and see what should be wrong with it as well, but my time available for hobby-stuff is limited... So I can't guarantee progress in any near future

Any chance your tweaks are documented/posted/pastebinned anywhere? I love sublimeclang but it does seriously bog things down sometimes. I haven't really looked in to the choke points myself, though.

+2

Auto-complete certainly isn't trivial, but it doesn't necessarily have to be inefficient either.


The problem with the current status quo is that there are multiple plugins (as you pointed out) with different behavior, using different mechanisms, and which aren't particularly easy to extend for new use cases.


What Sublime Text needs is a well designed API that will make adding proper completion possible. It _is_ possible to do this. You don't even necessarily need an IDE-level of integration. For example, Chocolat.app, a new text editor in the vein of Textmate/Sublime Text provides such an API here:


https://github.com/chocolat/completion

+1
If only SublimeClang had Ruby and Rails support!
Heh, yeah... Well, there's the fundemental issue there of clang being for C languages. :P
+1
I know, I just want something that does completion and error checking for Ruby and Rails and works properly :)
+1
Oh yes, I agree - those features are nice. I was just jokingly making a pretty obvious statement!
(CAPTAIN OBVIOUS STRIKES AGAIN!)
... I'm commenting too much on Userecho.
+3

I would love to see a generic API in Sublime Text for this. That way, people can write their own completion engines. That is, a project indexer should go into ST2. The Indexer should call out to 3rd party indexing engines that are available to figure out how to parse all the files. SublimeCodeIntel is a nice idea, but it doesn't seem to work for me anymore (using it for PHP, Javascript, CSS, and HTML).

+1

This great plugin gives proper introspective autocomplete  for Python https://github.com/svaiter/SublimeJEDI


+6

To help the developer implement this efficiently, it would be helpful for us to show some mockups of how we want this to look and exactly what/how the tooltip should contain inside of it in what contexts.


Also, the ability to have plugins provide the autocompletion text and do the parsing like SublimeJEDI posted above sounds excellent so that Sublime can do this correctly on a language-specific plugin parser basis.








+1
Maybe there is a compromise to be made between a fully featured code intellisense and just plain nothing? Here is the idea:

Most of the time I don't need autocompletion to be 100% correct, instead I just want it to give me suggestions for methods and properties I intend to call anyway. If there are mismatches in the list, I don't care (in fact, at the moment Sublime provides me with the complete php function list, which is a huge 100% mismatch). It would be useful whenever I don't want to type the full method name each and every time I need it (90% of the time) or I don't know, how to write the method right (5% of the time).

Sublime Text already has a superfast File Indexing, which also comes into play when using the "Go To Definition" command. Although (especially for namespaced frameworks) there may be cases, when there are 2 or more file/class matches, I really wouldn't care, if Sublime would provide me with everything it finds in those files - much like invoking Quick File Search (Ctrl+P) immediately followed by a goto symbol (@) command.

The Plugin https://github.com/alienhard/SublimeAllAutocomplet... does provide similar functionality, with the difference, that it uses all opened files for autocompletion. I don't need the target files to be opened in the editor, but instead Sublime could just use all matching "Go to Definition" Files for autocompletion.

I know, there still are a lot of cases where autocompletion would fail (for example directly invoking methods upon other methods return values), but I think this scenario would cover most needs.
What about using SourceKit on OSX?
+2
I would pay more for a proper auto complete plugin than for Sublime Text. I install Sublime Text once a year to see if there are any new plugins doing the trick. Every time I fall in love with the editor, again. And every time I have to close it down and return to some Java-monstrosity of an IDE, as I'm 100% depending on auto completion. There are simply too many libraries to remember all namespaces, methods and variables. Without completion I just have no chance of beeing even half as effective as in a proper IDE. It's sad, because when I don't need the auto completion working with ST3 is blazingly fast, and I love how the keyboard shortcuts just work for me.
-4
Dont forget that SublimeText is a text editor. Its not an IDE and its not meant to be a replacement for one. Its great to have a strong IDE like Jetbrains IntelliJ and a strong editor like SublimeText together on a system.

Please stop trying to make SublimeText something it is not meant to be and it is not capable of!
+3
I'm sorry but I don't understand why people argue about optional functionality. If you don't like it, don't install it, isn't that one of the fundamentals with Sublime Text? That way the purists who want a text editor can have a text editor, and those who want an IDE with highlighting, completion, correction, GIT, debugging, etc can have an IDE.

If the worry is that it will take development time that could be spent on other features then voice your concerns about it, I would be more than happy to pay multiple ST license values to have this plugin developed through crowdfunding or similar.

I also fail to see why it's good to have an IDE + Sublime Text. For my workflow jumping between applications just sound messy. I have tried, but I end up sitting beeing annoyed at ST3 that can't complete namespaces, and beeing annoyed at my IDE for not feeling as smooth as ST3. It might just be me though.
+1
Agree.

I primarily use ST as an IDE, even though it's syntax highlighting and auto-completion are limited in comparison to fully-clang-integrated IDEs like Xcode. (Yes, I have both running, with the same file open in both, it's messy.)

I'd really love to see a libclang-based syntax highlighting and project parsing plugin for C-like languages. It should improve things quite nicely. And make ST a much better IDE!
+2
That's why I think he suggested it as a plugin where the functionality would be optional for those that want it and for those that don't.
-2
I hate to use such phrases, but thats like using a hammer to drive a screw!
Its like if you say MS Word cant manage and send your emails, but it has an API so just make it manage and send those mails, even if there is Outlook. But who cares?
I don't think that's a fair statement.  In your example, yes a person could switch to Outlook, but you're leaving out the disruption to work flow by doing so.  It also leaves out the advantages to be had where customized and time saving features can be used when functionality is integrated into the same tool and data can be passed back and forth.
+1
I love the idea of an API for an internalized code inspection engine, then the plugin authors can adapt it however they need.  Having said that, ST3 is more than capable of being adapted to support these features, and to do so without any slowdown.

At our company, we have a very customized scripting language based off of SCHEME / LISP that is highly macro heavy (meaning there's no set standard way to analyze the code and automatically extract information like with C++).  We've written custom libraries for ST in Python that allow us to rapidly parse source files and extract data.  With that, we were able to write full code inspection with autocomplete, intelligence, and code hinting.  Basically every script file has an import(s) definition at the top, so we just recursively capture the contents of all imports, and then scrub that data into dictionaries for completion.  Everything is in memory and therefore super fast to access and customize  We've even got PyQT working inside of ST so we can do better multi threading, along with some custom input boxes.

As an example, it can scrub 45 files and compile all necessary data dictionaries in about 4-10 seconds (depending on the network as all files are not local).  It just keeps it in memory, so it never needs to scrub those files again unless they've changed.  From there, I put in an analyzer that listens per keystroke / per specific characters. It can call up customized lists of the stored analyzed data instantly with no slowdown.  There's even cases where I scrub the contents of the current file to generate a list of data from within that file on the fly at the time of the keystroke, and it does it instantly (you press the trigger key, and the autocomplete list shows up instantly)

It also does code analysis to see when a function has been started.  When it does, it pops up a panel at the bottom that shows the intellisense information (what the arguments are, what data type the argument is expecting, what argument are you on).  It also fills the autocomplete box by the cursor with the information needed for the current argument, as well as any custom hints or structs for that argument if available.

Also something to note is that ST3 has an internal indexer that you can tap into with your plugins.  It's all dependent upon your syntax highlighting definition, based on the class names you assign to capture groups.  There are reserved class names for functions and such, so as long as you setup the regex to properly highlight functions, then the ST indexer will store it.  This allows you to use go to definition internally within ST3.  From a plugin, you can then query this index and it will return you a file and a location within that file.  I used this so I could do a code inspection where it takes the current word the cursor is on, and if it's a function I grab the actual function definition, along with any comments above it, and then pop that up in a panel along the bottom so the user can see the definition without having to jump to the actual file it's in.

Another cool thing is we used the code search indexer that Google released for free, and my coworker created an interface for it within ST.  So basically we have indexed, immediate code searching a la Entrain style that's multithreaded via PyQT.  You can click on a result and it will jump to that file and line.

So it's all doable and fast, but you have to adapt your plugin to the specific language (hence having an API would be a lot easier).
Still waiting on this. I'm working on C/C++ code for ARM microcontrollers and I would love to have a plugin that would give me intellisense that some of the big IDEs would give me. I love the usability of ST3 as a text editor, but intellisense features give a huge boost in productivity.
+1
Try installing https://github.com/quarnster/completion/wiki/Insta...

I just tried and it seems to "work" but I cannot tell to which extent it is good. Found definitions 1 time out of 3, and completion seems not fully correct, but I think that will be the best plugin for ST that could provide good completion without stalling the editor.
Willl quarnster/completion work on Windows?