Skip to content

Add proc-macro related config and tests#3958

Merged
bors[bot] merged 6 commits into
rust-lang:masterfrom
edwin0cheng:add-install-script
Apr 16, 2020
Merged

Add proc-macro related config and tests#3958
bors[bot] merged 6 commits into
rust-lang:masterfrom
edwin0cheng:add-install-script

Conversation

@edwin0cheng

@edwin0cheng edwin0cheng commented Apr 12, 2020

Copy link
Copy Markdown
Contributor

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.

Comment thread crates/rust-analyzer/tests/heavy_tests/main.rs
@lnicola

lnicola commented Apr 12, 2020

Copy link
Copy Markdown
Member

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()))
};
}

@edwin0cheng edwin0cheng Apr 12, 2020

Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Contributor 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

matklad commented Apr 15, 2020

Copy link
Copy Markdown
Contributor

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

edwin0cheng commented Apr 16, 2020

Copy link
Copy Markdown
Contributor Author

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

Comment thread .github/workflows/ci.yaml Outdated
Comment thread crates/ra_proc_macro/src/process.rs Outdated
@matklad

matklad commented Apr 16, 2020

Copy link
Copy Markdown
Contributor

bors r+

@bors

bors Bot commented Apr 16, 2020

Copy link
Copy Markdown
Contributor

@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