supermaven-inc / supermaven-nvim

The official Neovim plugin for Supermaven
https://supermaven.com/
MIT License
679 stars 36 forks source link

Insert in the middle of a line overwrites the rest of the line #80

Open iamim opened 2 months ago

iamim commented 2 months ago

First of all, love the product!

I recently had to work in VSCode instead of neovim (both run supermaven). It seems like VSCode experience is vastly better when it comes to getting virtual text suggestions in the middle of a string.

To illustrate, suppose I have a .ts file with line

console.log(response)

If I put the cursor right after ( in both cases supermaven will suggest something like (| for the cursor position): console.log(|"Got response: ", response).

Now, in VSCode the entire line keeps it's highlights and only "Got response: ", is shown as virtual text. In neovim the whole line after cursor is grey which makes it really difficult to understand which part of the code is added by supermaven. Just recently I had a case where I let supermaven to complete a string like that and it substituted (hallucinated) one letter in a string encoded GUID which made for a very fun 3 hour debugging session. In VSCode I would be able to easily spot this error (the letter it was trying to substitute would be grey).

Perhaps even more annoying is that if in the example above I decide to complete one word, in VSCode I end up with console.log("Got|, response), which is exactly what I would expect. In neovim I end up with console.log("Got| (a lot of the text is wiped).

The product page shows the same behavior as I observed in VSCode.

Is it something wrong in my setup, or is it a limitation of neovim, or is it an oversight in the plugin?

sm-victorw commented 1 month ago

Sorry for the late response - when the logic for rendering text was initially written I believe I had been running into some compatibility issues with the "inline" option for virt_text_pos when calling nvim_buf_set_extmark. This is something that will be looked at, after the transition to the rust binary and (optional) jump/delete completions are finished.