Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(view): add api get_selected_index #1986

Merged
merged 1 commit into from
Jul 15, 2024

Conversation

uga-rosa
Copy link
Contributor

API to get the number of the currently selected candidate, which can be combined with get_entries to find out "what are the entries above and below".

@uga-rosa uga-rosa changed the title feat(view): add api get_cursor feat(view): add api get_selected_index Jul 15, 2024
@hrsh7th
Copy link
Owner

hrsh7th commented Jul 15, 2024

LGTM.

@hrsh7th hrsh7th merged commit e1757ae into hrsh7th:main Jul 15, 2024
2 checks passed
@monheimx9
Copy link

monheimx9 commented Jul 15, 2024

LGTM.

Error  19:23:09 msg_show.emsg E5108: Error executing lua: .../nvim/lazy/nvim-cmp/lua/cmp/view/custom_entries_view.lua:328: attempt to perform arithmetic on local 'cursor' (a nil value)
stack traceback:
	.../nvim/lazy/nvim-cmp/lua/cmp/view/custom_entries_view.lua:328: in function 'select_next_item'
	...monheim/.local/share/nvim/lazy/nvim-cmp/lua/cmp/view.lua:224: in function 'select_next_item'
	...monheim/.local/share/nvim/lazy/nvim-cmp/lua/cmp/init.lua:146: in function 'select_next_item'
	...ocal/share/nvim/lazy/nvim-cmp/lua/cmp/config/mapping.lua:48: in function 'on_keymap'
	...monheim/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:145: in function 'callback'
	....local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/keymap.lua:133: in function <....local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/keymap.lua:127>

While performing <C-n> on the selection
Do you think this is related to this PR or I am looking at the wrong place?

Should I open an issue or can I keep commenting on this thread?

Edit:
I'm using LazyVim distro and haven't changed anything related to cmp on my config

Edit2:
Confirmation: reverting back to 7e348da cleared the issue

@curiousignite
Copy link

LGTM.

Error  19:23:09 msg_show.emsg E5108: Error executing lua: .../nvim/lazy/nvim-cmp/lua/cmp/view/custom_entries_view.lua:328: attempt to perform arithmetic on local 'cursor' (a nil value)
stack traceback:
	.../nvim/lazy/nvim-cmp/lua/cmp/view/custom_entries_view.lua:328: in function 'select_next_item'
	...monheim/.local/share/nvim/lazy/nvim-cmp/lua/cmp/view.lua:224: in function 'select_next_item'
	...monheim/.local/share/nvim/lazy/nvim-cmp/lua/cmp/init.lua:146: in function 'select_next_item'
	...ocal/share/nvim/lazy/nvim-cmp/lua/cmp/config/mapping.lua:48: in function 'on_keymap'
	...monheim/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:145: in function 'callback'
	....local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/keymap.lua:133: in function <....local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/keymap.lua:127>

While performing on the selection Do you think this is related to this PR or I am looking at the wrong place?

Should I open an issue or can I keep commenting on this thread?

Edit: I'm using LazyVim distro and haven't changed anything related to cmp on my config

Edit2: Confirmation: reverting back to 7e348da cleared the issue

I was just editing my config and trying to figure out where did I f up. This saved hours, thank you.

@0xDmtri
Copy link

0xDmtri commented Jul 15, 2024

LGTM.

Error  19:23:09 msg_show.emsg E5108: Error executing lua: .../nvim/lazy/nvim-cmp/lua/cmp/view/custom_entries_view.lua:328: attempt to perform arithmetic on local 'cursor' (a nil value)
stack traceback:
	.../nvim/lazy/nvim-cmp/lua/cmp/view/custom_entries_view.lua:328: in function 'select_next_item'
	...monheim/.local/share/nvim/lazy/nvim-cmp/lua/cmp/view.lua:224: in function 'select_next_item'
	...monheim/.local/share/nvim/lazy/nvim-cmp/lua/cmp/init.lua:146: in function 'select_next_item'
	...ocal/share/nvim/lazy/nvim-cmp/lua/cmp/config/mapping.lua:48: in function 'on_keymap'
	...monheim/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:145: in function 'callback'
	....local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/keymap.lua:133: in function <....local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/keymap.lua:127>

While performing on the selection Do you think this is related to this PR or I am looking at the wrong place?
Should I open an issue or can I keep commenting on this thread?
Edit: I'm using LazyVim distro and haven't changed anything related to cmp on my config
Edit2: Confirmation: reverting back to 7e348da cleared the issue

I was just editing my config and trying to figure out where did I f up. This saved hours, thank you.

same, still broken ((

@Shougo
Copy link

Shougo commented Jul 15, 2024

Can you upload your configuration?

@MichFe
Copy link

MichFe commented Jul 16, 2024

LGTM.

Error  19:23:09 msg_show.emsg E5108: Error executing lua: .../nvim/lazy/nvim-cmp/lua/cmp/view/custom_entries_view.lua:328: attempt to perform arithmetic on local 'cursor' (a nil value)
stack traceback:
	.../nvim/lazy/nvim-cmp/lua/cmp/view/custom_entries_view.lua:328: in function 'select_next_item'
	...monheim/.local/share/nvim/lazy/nvim-cmp/lua/cmp/view.lua:224: in function 'select_next_item'
	...monheim/.local/share/nvim/lazy/nvim-cmp/lua/cmp/init.lua:146: in function 'select_next_item'
	...ocal/share/nvim/lazy/nvim-cmp/lua/cmp/config/mapping.lua:48: in function 'on_keymap'
	...monheim/.local/share/nvim/lazy/nvim-cmp/lua/cmp/core.lua:145: in function 'callback'
	....local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/keymap.lua:133: in function <....local/share/nvim/lazy/nvim-cmp/lua/cmp/utils/keymap.lua:127>

While performing on the selection Do you think this is related to this PR or I am looking at the wrong place?

Should I open an issue or can I keep commenting on this thread?

Edit: I'm using LazyVim distro and haven't changed anything related to cmp on my config

Edit2: Confirmation: reverting back to 7e348da cleared the issue

Same issue, after updating nvim-cmp. Solved with a rollback to the mentioned commit, ty for the time saved!

Seems like there may be an issue on the last commit:
e1757ae feat(view): add api get_selected_index (#1986) (8 hours ago)

@uga-rosa uga-rosa deleted the feat/view-get-cursor branch July 16, 2024 00:10
@Shougo
Copy link

Shougo commented Jul 16, 2024

@MichFe Please test #1993.

@MichFe
Copy link

MichFe commented Jul 16, 2024

@MichFe Please test #1993.

It is working for me 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants