rustaceanvim
rustaceanvim copied to clipboard
feat: cargo expand integration?
Feature description
hi @mrcjkb !
Premise: long time no see :) Haskell was a dead end for me, now I am learning Rust! I am so glad you are making this tooling!
Feature request:
rustaceanvim supports expand macro under cursor, I was wondering if it could expand all macros in current file, otherwise adding support to https://github.com/dtolnay/cargo-expand/ would be nice to have?
Thus
As a coder, I want to check all macros in current file, so that I can have a complete view.
Currently this is possible by running https://github.com/dtolnay/cargo-expand/ in a terminal.
Would it be easy enough/possible to integrate it into rustaceanvim?
Hey 👋
Sad to hear that about Haskell.
rust-analyzer/expandMacro is a LSP method.
While it technically would be possible to run it on all macros in the current file, doing so would require the client (rustaceanvim) to search for all macros in the file (e.g. using tree-sitter).
Something like that would be feasible, but I believe such a task would be better suited for rust-analyzer itself (e.g. with a rust-analyzer/expandAllMacros method, or with the existing rust-analyzer/expandMacro method when passing null as the position parameters).
So I would suggest asking there first.
Currently this is possible by running https://github.com/dtolnay/cargo-expand/ in a terminal.
Would it be easy enough/possible to integrate it into rustaceanvim?
I don't think it would be the right place (for the reasons above). rust-analyzer could possibly integrate with it (as it does with clippy), but it likely also wouldn't be necessary. For rustaceanvim, tree-sitter would probably be a better choice (if such a feature doesn't get added to rust-analyzer).
Hey @mrcjkb 👋
I see. I am going to try upstream and see what they think.
Cheers :)
ps: I love Rust!