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

Add proc-macro related config and tests #3958

Merged
merged 6 commits into from
Apr 16, 2020

Conversation

edwin0cheng
Copy link
Member

@edwin0cheng edwin0cheng commented Apr 12, 2020

This PR do the following things:

  1. Add cli argument proc-macro for running proc-macro server.
  2. Added support for proc-macro in bench and analysis-stats
  3. Added typescript config for proc-macros
  4. Added an heavy test for proc-macros.

To test it out:

  1. add "rust-analyzer.cargo.loadOutDirsFromCheck": true" and "rust-analyzer.procMacro.enabled": true" in vs code config.

[Edit] Change to use rust-analyzer proc-macro for running proc-macro standalone process.

@lnicola
Copy link
Member

lnicola commented Apr 12, 2020

Maybe it doesn't make sense, but could we put the functionality in the same binary to simplify deployment (e.g. rust-analyzer proc-macro-server)?

Comment on lines +667 to +677
macro_rules! t {
($n:literal) => {
TokenTree::from(Ident::new($n, Span::call_site()))
};
({}) => {
TokenTree::from(Group::new(Delimiter::Brace, TokenStream::new()))
};
(()) => {
TokenTree::from(Group::new(Delimiter::Parenthesis, TokenStream::new()))
};
}
Copy link
Member Author

@edwin0cheng edwin0cheng Apr 12, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Writing proc-macro without syn and proc-macro2 crates is fun !!

@edwin0cheng
Copy link
Member Author

Maybe it doesn't make sense, but could we put the functionality in the same binary to simplify deployment (e.g. rust-analyzer proc-macro-server)?

Oh... sounds possible ? I like this idea and could simplify some code too. but I have to check whether it is possible in Windows.

@matklad
Copy link
Member

matklad commented Apr 15, 2020

Maybe it doesn't make sense, but could we put the functionality in the same binary to simplify deployment (e.g. rust-analyzer proc-macro-server)?

Yeah, I'd probably go with this way as well. Just let rust-analyzer spawn another rust-analyzer, and be careful not to create a fork-bomb accidentally :)

@edwin0cheng
Copy link
Member Author

edwin0cheng commented Apr 16, 2020

Changed to use rust-analyzer proc-macro for running proc-macro standalone process.

.github/workflows/ci.yaml Outdated Show resolved Hide resolved
@matklad
Copy link
Member

matklad commented Apr 16, 2020

bors r+

@bors
Copy link
Contributor

bors bot commented Apr 16, 2020

@bors bors bot merged commit 10d8cb9 into rust-lang:master Apr 16, 2020
@edwin0cheng edwin0cheng deleted the add-install-script branch April 16, 2020 20:36
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

Successfully merging this pull request may close these issues.

3 participants