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

Share data with other plugins #642

Open
ray-x opened this issue Mar 12, 2021 · 4 comments
Open

Share data with other plugins #642

ray-x opened this issue Mar 12, 2021 · 4 comments
Labels
enhancement Enhancement to performance, inner workings or existent features

Comments

@ray-x
Copy link

ray-x commented Mar 12, 2021

Is your feature request related to a problem? Please describe.
I need to push data from other plugin/handler. e.g. treesitter symble name for all the project files. make or ALE error reports, lsp diagnostic for all project files.

Describe the solution you'd like
A data store shared between plugins and telescope, or a pipe/queue.

Describe alternatives you've considered
Temporary file

Additional context

@ray-x ray-x added the enhancement Enhancement to performance, inner workings or existent features label Mar 12, 2021
@kkharji
Copy link
Member

kkharji commented Mar 12, 2021

Not sure If I understand what you mean here @ray-x , but if you want the content of the current picker send somewhere, I'd look to actions send to qflist or whatever is mapped to <c-q>. Then create a custom action to send the picker content to something.

@ray-x
Copy link
Author

ray-x commented Mar 12, 2021

Yes. But issue is that qflist is shared by plugins. Let say if I have a neomake and lsp-diagnostic and ALE running at same time. the qflist could be messy.
If the plugin is synchroise. it can cleanup what wrote into qflist and restore it back. But for async plugin, there might be issue.

@oberblastmeister
Copy link
Contributor

Well, if you look at actions.send_to_qflist, you can see that all it does is get the manager of a picker and iterate over the entries. You can do whatever you want with the entries. If you want it to persist them without using the quickfix list you can serialize the entries with vim.fn.msgpackdump or vim.fn.json_encode. Then when you want to use them again you can deserialize them and then set entry_maker to function(...) return ... end because we already have the entries.

@ray-x
Copy link
Author

ray-x commented Mar 12, 2021

Thanks. The issue is that all plugins and handlers are calling vim.fn.setqflist to push their data. When picker read data from qf, there might be data you do not want to show in the picker. And what make thing worse is other plugin may reset qf list.
Ideally, the plugin should register with a datalist and a handler to telescope. When datalist changed, use the handler to notify telescope to fetch the list again and filtered with the current filter.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement to performance, inner workings or existent features
Projects
None yet
Development

No branches or pull requests

3 participants