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

Implement C-SPC preview in lsp-rust-analyzer--select-related-test #34

Open
petr-tik opened this issue May 7, 2021 · 0 comments
Open

Comments

@petr-tik
Copy link

petr-tik commented May 7, 2021

Use the power of ivy preview (as i got used to it in doom emacs) to overload an interactive runner function with preview functionality.

This PR adds an lsp-rust-analyzer extension to find related tests, which offloads the heavy lifting and user interaction to the helper method mentioned in the issue heaing.

https://github.com/emacs-lsp/lsp-mode/pull/2776/files#diff-c8c9a652e719bd23b565da5b6f417aa8c0d55a256e176e0772bfe850a680c37eR975-R982

This is the lambda that extracts the label from each runnable and discards everything else, including file and location
https://github.com/emacs-lsp/lsp-mode/pull/2776/files#diff-c8c9a652e719bd23b565da5b6f417aa8c0d55a256e176e0772bfe850a680c37eR982

Instead of discarding it, we could use the location to jump to the start of the related test function definition before running it as a preview. I believe the C-SPC is bound to ivy-call-and-recenter in doom-emacs.

Implementation

I am hand wavy about the implementation, but I imagine one could implement some sort of advice to override lsp-rust-analyzer--select-related-test with an ivy-specific extension that binds C-SPC (or a non-doom binding) to a preview function.

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

No branches or pull requests

1 participant