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

fix: use (lnum, 0) for telescope item without col #524

Merged
merged 1 commit into from
Jun 29, 2024
Merged

Conversation

FeiyouG
Copy link
Contributor

@FeiyouG FeiyouG commented Jun 29, 2024

When sending telescope result to trouble, if there is no col field in the item (e.g. telescope builtin.current_buffer_fuzzy_find), the operation will fail with the following error:

E5108: Error executing lua: ...m/plugins/trouble.nvim/lua/trouble/sources/telescope.lua:55: bad argument #1 to 'sub' (number expected, got nil)
stack traceback:
        [C]: in function 'sub'
        ...m/plugins/trouble.nvim/lua/trouble/sources/telescope.lua:55: in function 'item'
        ...m/plugins/trouble.nvim/lua/trouble/sources/telescope.lua:99: in function 'add'
        ...m/plugins/trouble.nvim/lua/trouble/sources/telescope.lua:120: in function 'key_func'
        ...e/nvim/plugins/telescope.nvim/lua/telescope/mappings.lua:293: in function <...e/nvim/plugins/telescope.nvim/lua/telescope/mappings.lua:292>

This PR will make trouble gracefully accept items from telescope that doesn't have col field by setting word = nil and pos = {lnum, 0}.

@folke folke merged commit 25204b7 into folke:main Jun 29, 2024
@folke
Copy link
Owner

folke commented Jun 29, 2024

Thanks!

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.

2 participants