Skip to content

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

@petr-tik

Description

@petr-tik

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions