Returned completion item does not show in list
FAQ
- [X] I have checked the FAQ and it didn't resolve my problem.
Announcement
- [X] I have checked Breaking change announcement.
Minimal reproducible full config
call plug#begin('~/.config/bundles')
Plug 'hrsh7th/nvim-cmp'
Plug 'PhilRunninger/cmp-rpncalc'
call plug#end()
set completeopt=menu,menuone,noselect
lua <<EOF
local cmp = require "cmp"
cmp.setup({
sources = { { name = "rpncalc" } }
})
EOF
Description
Thanks for your work on this hobby project. Great work!
I am working on a completion plugin - cmp-rpncalc - similar to your nvim-calc, but instead, it uses RPN. I have run into an issue that I think could be a bug in nvim-cmp. My intention is to return these two items for completion:
- The result of the RPN expression. It could be a single number, or the stack if the expression is incomplete.
- The RPN expression followed by the result of that expression.
| If I type... | I want to see these completion items: |
|---|---|
5 |
5 and 5 ▶ 5 |
5 2 |
5 2 and 5 2 ▶ 5 2 |
5 2 * |
10 and 5 2 * ▶ 10 |
pi |
3.1415926535898 and pi ▶ 3.1415926535898 |
Everything works except the last one. The only completion item it shows is: pi ▶ 3.1415926535898
Steps to reproduce
- Start neovim with the included minimal setup.
- Start insert mode.
- Type
piand you will see only one item in the completion list. - I have debug statements in my plug-in. Enter the
:messagescommand and scroll to the bottom. You will see both items, but only the second is displayed.{ items = { { label = "3.1415926535898", textEdit = { newText = "3.1415926535898", range = { end = { character = 2, line = 0 }, start = { character = 0, line = 0 } } }, word = "pi" }, { label = "pi ▶ 3.1415926535898", textEdit = { newText = "pi ▶ 3.1415926535898", range = { end = { character = 2, line = 0 }, start = { character = 0, line = 0 } } }, word = "pi ▶ 3.1415926535898" } } } - The same behavior can be seen by typing a number with many digits. In insert mode, type a number -
1.234...for instance. Keep adding digits to the end of the string. It starts out well with two completion items shown, but at some point, the introduction of the next digit causes the first completion item to be dropped.
Expected behavior
I expect both completion items to always be displayed.
Actual behavior
The first completion item is sometimes dropped from the list. I've looked through both my code and yours, but since I'm relatively new to lua, I can't say that I understand all that's going on. The issue could very well be in my code, but I thought I'd run this by you in case there was something obvious that you can think of.
Thanks!
Additional context
No response