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

cmp.lua failed to index field 'cmp' (a nil value) #700

Closed
2 tasks done
csyJoy opened this issue May 2, 2023 · 2 comments
Closed
2 tasks done

cmp.lua failed to index field 'cmp' (a nil value) #700

csyJoy opened this issue May 2, 2023 · 2 comments
Labels
duplicate This issue or pull request already exists

Comments

@csyJoy
Copy link
Contributor

csyJoy commented May 2, 2023

Version confirmation

  • Confirm

Following prerequisites

  • Confirm

Neovim version

NVIM v0.10.0-dev-134+gab2811746

Operating system/version

macOS 13.3.1

Terminal name/version

iTerms2 Build 3.4.18

$TERM environment variable

No response

Branch info

main (Default/Latest)

Fetch Preferences

SSH (use_ssh = true)

How to reproduce the issue

  1. switch to the insert mode and type a character
  2. the error occurs

image

Expected behavior

this error doesn't occur

Actual behavior

No response

Additional information

I find that this problem is caused by a filter callback function in cmp.setup added in #697.

entry_filter = function(entry)
 	local ignore_list = {
 		"Error",
 		"Comment",
 	}
 	local kind = entry:get_completion_item().cmp.kind_text
 	return not vim.tbl_contains(ignore_list, kind)
 end,

I changed one line code from local kind = entry:get_completion_item().cmp.kind_text to local kind = entry:get_completion_item().kind and this error disappeared.
but I still wonder whether such a change will have some other side effects since I don't find the document of the function get_completion_item and its return value, I would be grateful if someone could give me the location this document and tell me whether my change is correct or not.

@csyJoy csyJoy added the bug Something isn't working label May 2, 2023
@CharlesChiuGit
Copy link
Collaborator

CharlesChiuGit commented May 2, 2023

do a lazy sync, your cmp is not up-to-date.

@CharlesChiuGit CharlesChiuGit added duplicate This issue or pull request already exists and removed bug Something isn't working labels May 2, 2023
@csyJoy
Copy link
Contributor Author

csyJoy commented May 2, 2023

sorry for the mistake, I should do lazy sync at once.

@csyJoy csyJoy closed this as completed May 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue or pull request already exists
Projects
None yet
Development

No branches or pull requests

2 participants