5 ms·
for neovim with lspconfig: formatting code: `lua vim.lsp.buf.formatting_sync()` go to definition: `lua vim.lsp.buf.definition()` rename variable: `lua vim.ls
by bern4444 4y ago
for neovim with lspconfig:
formatting code: `lua vim.lsp.buf.formatting_sync()`
go to definition: `lua vim.lsp.buf.definition()`
rename variable: `lua vim.lsp.buf.rename()`
type information: `lua vim.lsp.buf.hover()`
find references: `lua vim.lsp.buf.references()`
code actions (add missing import etc): `lua vim.lsp.buf.code_action()`
For more commands `:h vim.lsp.buf`.
There is plenty available through LSP today supported by all editors. IDEs provide a better debugging experience (with breakpoints and variable values) though that too can be done with vim/neovim using the debug adapter protocol and plugins built on it (similar to language server protocol but for debugging).
- 9dev 4y agoSo, am I supposed to type all that cruft? Instead of just pressing alt-enter to bring up the suggestions menu, choose the obvious first item by pressing enter again, and have everything you have to remember several arcane incantations for done automatically..? I never got the command line purist crowd. I prefer spending time on solving business domain problems…
- spoils19 4y agoWhat if the suggestions menu crashes? Have you considered the extra RAM that is being used that could go further towards solving business problems? What if the curated menu of autosuggestions doesn't contain what you need?
- kaba0 4y agoI’m not sure whether you are sarcastic or not, but come on.. what if the LSP crashes, or you know, that also eats more RAM (and I am sure that someone with a 128GB laptop doesn’t get more work done than someone with only a 16GB one..).
- bern4444 4y agoYou can but it’s a lot a nicer to set key bindings. For example I hit ,gd which I have mapped to the go to definition. I also have ,fr mapped to find references. You can come up with whatever mappings you want. I have K (so shift + k) to show the type information. Etc etc. Vim and neovim let you customize all this and anything else.