hrsh7th / nvim-cmp

A completion plugin for neovim coded in Lua.
MIT License
7.9k stars 394 forks source link

inline ghost text emulation for older neovim versions(v0.8.0-v0.10.0) #1742

Closed Sam-programs closed 7 months ago

Sam-programs commented 11 months ago

the emulation is working fine with treesitter and lsp but for the built-in syntax it might not be that accurate so i made it as an option and off by default until i figure out the issues with syntax

Sam-programs commented 11 months ago

the issue with syntax is it crashes neovim whenever i check if the highlight for it is cleared with hl_iscleared so i picked the last highlight which seems to work best and i can't even minimally reproduce this outside of cmp

Sam-programs commented 10 months ago

never mind using syntax crashes noevim with error 139 regardless if i am checking it or not

Sam-programs commented 10 months ago

Turns out the issue is inspect_pos is calling synstack inside on_line which causes neovim to crash, probably because of this:

Note: doing anything other than setting extmarks is consideredg other than setting experimental.

I could use InsertCharPre to get the highlights for the line right before cmp starts, but is there a better way to run code before cmp starts?

Sam-programs commented 7 months ago

This was a bad idea. I only did it because I wasn't on nightly, at the time of making this pr.