by nickjj · 5y ago · 0 comments
I've always been a big fan of using snippets and auto-completing based on open buffers in a project instead of using LSPs.
I haven't used ST in a while but decided to install ST4 to try it out.
I opened a Flask application that uses SQLAlchemy. I opened a Python file and typed User. and then it showed me a list of fields and methods on my User model without having the User model open in a buffer.
I did the same thing in an Elixir project and after installing the Elixir package it worked for project specific "things" in my app. Like after typing UserView. it showed me only functions available in that view. Likewise it did the same thing with context modules, it picked up all functions inside of a specific module.
In both cases as I started typing "User" it showed me options to pick from. In both cases it also listed out the number of definitions for a specific "thing" and lets you quickly jump to a specific one. If you mouse over a function it brings up the list to pick a definition / reference. There's also key binds to bring up a CTRL+p'ish feeling menu to see and preview the file where something is being used.
It's not as good as a LSP but it's definitely a few notches above what I've seen in other editors and the best part about it is not needing to configure multiple LSPs and it's lightning fast.
I haven't gone crazy testing ST4 btw, I played with it for like 20 minutes. It felt like it was maybe 65% between ST3's auto-complete and what you'd get with a LSP back-end using VSCode. Meaning it's closer to VSCode than it is than ST3, but not as good as a LSP, but there's also no effort to get it set up so it's a reasonable trade off if you're someone like me who just wants pretty good auto complete without configuring a million tools to run in the background.
It is coming with LSP support so that will work as well.
How does it compare to YouCompleteMe or TabNine?
YCM feels more like a LSP client than buffer / project level auto-complete. AFAIK it requires you to have a language's runtime specifically installed which is a deal breaker for me. Most of my apps run in Docker and I don't have local copies of any runtimes installed.
ST4 works wonderfully in this case because it parses everything out based on syntax highlighting rules.