ShinKage / idris2-nvim

Simple configuration and extra tools for NVIM + LSP + Idris2
MIT License
46 stars 8 forks source link

No autocomplete #25

Open Tylerwbrown opened 1 year ago

Tylerwbrown commented 1 year ago

I'm not getting any autocomplete when I use this plugin, but everything else seems to work (code actions, inline errors, etc.)

vscode has the same functionality but also have autocompletion working.

I see textDocument/completion responses coming through in my log when I type in nvim, so the LSP seems to be receiving requests and responding properly, they're just not showing up in neovim.

Running 0.8.3 nvim

ShinKage commented 1 year ago

Auto completion should work out-of-the-box with any code-completion engine, refer to https://github.com/neovim/nvim-lspconfig/wiki/Autocompletion

SlayerOfTheBad commented 1 year ago

I think this is caused by Idris-LSP's requirement for the buffer to be saved to disk, not idris2-nvim.

It's not that auto-complete isn't working, it's that the LSP reads the data from the file, rather than the buffer, so it doesn't actually have access to what you are typing, and therefor can not suggest anything.

This can be seen with a fairly minimal file

createEmpties : {n : _} -> Vect n (Vect 0 elem_0)
createEmpties = 

if you start typing replicate, it will not give completion suggestions. However, if you type repli, write to disk (:w) and then continue typing, it will give the suggestion.

image image

Being able to handle files not on disk is planned for Idris2-LSP, but not currently present.