Closed Leguu closed 5 years ago
Thanks for your idea.
Instead of expanding the macros, why not keep them and instead autocomplete directly from them?
But then, how we should parse the macro? It's difficult to treat it as a normal Rust code snippet, since we use compiler's parser.
It could be that instead of autocompleting from them directly, to just expand it once and reuse that expansion every time the macro is reused. If not that, then couldn't we extract the needed needed code (Like the struct) from inside the macro?
I didn't know it was based on the compiler's parser - I'll look at how that works too to get a better idea.
to just expand it once and reuse that expansion every time the macro is reused.
It can be very slow and... personally I'm against supporting macro expansion or so. It's really difficult even for other newer tools like rust-analyzer or so and, our code base is too crafty to add such a complex feature.
All right - you probably know the project better than me, so I'll be closing the issue now. Thanks~
Before beginning, I'd just like to say that racer is the best rust crate I've ever used. I'm not exactly great at coding, so please tell me if anything I say is not possible.
A short example, where
ba~
would be autocompleted tobar
.One proposed solution was to expand the macro. In the past, concerns have been raised about expanding macros, saying that they may be performance-unfriendly. Instead of expanding the macros, why not keep them and instead autocomplete directly from them?
Thus the macro is equivalent to:
Where
Zed
is now anIdentifier
. After looking through the source code of racer, this solution might need a newMatchType
- but I'm not sure. Anyway...Zed
can autocomplete fromName
, but because it is not aName
, it can be allowed to autocomplete fromimpl
s too:Thus:
create_class!(Tut);
create_class!(Ohn);
create_class!(Arr);
Generates 3 new identifiers. All autocomplete from the same structName
, instead of 3 different structs being generated. Perhaps, instead of even generating the structName
, the Identifiers can autocomplete directly from the macro, no generation required.Thoughts? I would want to help implement it, but I would need help - since I'm not extremely familiar this.
Thank you