completion-nvim icon indicating copy to clipboard operation
completion-nvim copied to clipboard

Support completionItem/resolve for additional text edits

Open CalinLeafshade opened this issue 4 years ago • 1 comments

A small change to allow additional text changes from completionItem/resolve.

CalinLeafshade avatar Jan 29 '21 22:01 CalinLeafshade

I think you also want to change https://github.com/nvim-lua/completion-nvim/blob/bd4f21f35e1b6d6f4a79ff4bb8a89d812bd912a0/lua/completion.lua#L110 to

if next(item.additionalTextEdits) then

This handles the subtle case when item.additionalTextEdits is {}, because if {} then x else y end evaluates to x in lua (rust-analyzer does this when I do a completion and expect to receive an auto-import - it needs to hit the else case added by this PR to get the additionalTextEdit but doesn't because of this). Note that it is not sufficient to compare item.additionalTextEdits ~= {} because it's not true that {} == {} (lua compares these by pointers).

NickHu avatar Mar 30 '21 21:03 NickHu