Hi there, I want to implement AI code suggestions for Refact because our clients ask for it.
The behavior I’m looking for:
-
Complete the current line until the end, using a grey (or ghost, or inline) text. Tab accepts it, Esc hides.
-
Write several lines of grey text when the current line is empty, most likely after the user hits Enter.
What I found so far:
-
I can easily implement a LSP server, add items to the completions popup.
-
The “mini_auto_complete” option disables popup, writes grey text instead. Popup is still available using Option+Space.
It’s almost a usable solution, but there is no way to show multiline grey text suggestions. Here is what is shows if I set “label” to “line1\nline2\nline3”:
And when I press Tab, it accepts the suggestion correctly.
Possible solutions I can think of:
-
Make “mini_auto_complete” show multiline suggestions as well,
-
Make popup show a multiline label, such as function body, might be bigger than the popup itself,
-
Write a plugin that will produce a custom popup, but popups can be distracting, and it’s not clear which popup to show at any given point.
I personally like option (1) the most, any thoughts?