4 ms·
There are language servers for Vim that take you much closer to IDEs than you give it credit for. Goto definitions, intelligent autocomplete, inline diagnostic
by lawn 6y ago
There are language servers for Vim that take you much closer to IDEs than you give it credit for.
Goto definitions, intelligent autocomplete, inline diagnostics, smart renamers, type hints and more are all available.
All with very little configuration and it works the same no matter the language (as long as it as SLP support).
- dmitryminkovsky 6y agoClose but not close enough. For example: in VSCode you can select/hover over any expression and it’ll tell you the computed TypeScript type. None of the current language server tools for Vim (eg ALE) give you that information [0]. Why would I live without this useful feature just to use Vim? I love Vim, but I love knowing the type the TS compiler thinks an expression is even more, especially when good enough Vim emulation is available. [0] https://github.com/dense-analysis/ale/issues/3206 https://github.com/dense-analysis/ale/issues/3206
- andreypopp 6y ago:ALEHover
- dmitryminkovsky 6y agoCan that issue be closed? I can visually select an arbitrary expression and :ALEHover?
- sweeneyrod 6y agoAll LSP clients for vim will give you that; it is whatever command calls `hover` on the language server (e.g. ALEHover for ALE or LanguageClient_textDocument_hover for LanguageClient-neovim). Obviously you should bind these to some convenient command like <leader>t.
- dmitryminkovsky 6y agoDo you know if it’s possible in vim to show hover for an arbitrary selection? A visual selection?
- JNRowe 6y agoLike many things in vim it depends on whether you wish to write it ;) You can define your own popup(:h bexpr) however you feel, including per-filetype or buffer. Instead of simply operating on the variables it defines to you can also work upon the selection by querying the register(:h quotestar) instead. As an example, I like displaying wordnet¹ popups when writing prose. Occasionally, I'll also dump diction² output in to a popup too. However, I do think that using messages(:h :messages) might make more sense for selection info in general. That way you can select a text, call a map to display information, and still easily recall that data when you're in another place via :messages at a later time. Depends entirely on your use case, and once again how interested in writing the functionality you are. ¹ http://wordnet.princeton.edu/ http://wordnet.princeton.edu/ ² http://www.gnu.org/software/diction/diction.html http://www.gnu.org/software/diction/diction.html
- dmitryminkovsky 6y agoThank you! Will add this to my Vim to-do.
- billylindeman 6y agoi use coc-nvim with tsserver and i'm pretty sure it supports this https://github.com/neoclide/coc-tsserver https://github.com/neoclide/coc-tsserver