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

[Feature Request] Call custom function when navigating the CocList #5093

Open
MahdiNazemi opened this issue Jul 20, 2024 · 6 comments · Fixed by #5098
Open

[Feature Request] Call custom function when navigating the CocList #5093

MahdiNazemi opened this issue Jul 20, 2024 · 6 comments · Fixed by #5098

Comments

@MahdiNazemi
Copy link

MahdiNazemi commented Jul 20, 2024

I use context.vim to show some context (class name, function name, loop information, etc.) at the top of the buffer. When using coc-references and navigating the results opened in the lower split, the context on the upper split does not get updated.

To solve this issue, I assume I should call context#update('BufEnter') (or one of the other triggers mentioned here) on the upper split where the actual file contents are shown. It would be nice to have some trigger I can use in an autocmd to know a new item in the lower split is selected and call the said function in the upper split.

Ideally, this should work with j, k, arrow keys, CocNext, and all other keys or mappings used to navigate the list.

The requested feature may exist already, but I was not able to find it.

@fannheyward
Copy link
Member

Something like CocListMoved autocmd is enough for this case?

@MahdiNazemi
Copy link
Author

Yes, it should be.

@niexin-dev
Copy link

Yes, it should be.

Can you please refer to your autocmd? Mine will give an error.

@MahdiNazemi
Copy link
Author

Yes, it should be.

Can you please refer to your autocmd? Mine will give an error.

Can you please be more specific? What kind of error are you getting? I am currently on the release branch, so I cannot test the newly added autocmd trigger.

@fannheyward
Copy link
Member

The release branch has been updated with this event.

@MahdiNazemi
Copy link
Author

The release branch has been updated with this event.

Thank you. I defined autocmd User CocListMoved * echom 'User CocListMoved', but do not see any :messages after moving up and down on coc-references results.

@fannheyward fannheyward reopened this Aug 1, 2024
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 a pull request may close this issue.

3 participants