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

internal: Add SyntaxFactory to ease generating nodes with syntax mappings #18196

Merged
merged 2 commits into from
Sep 27, 2024

Conversation

DropDemBits
Copy link
Contributor

@DropDemBits DropDemBits commented Sep 26, 2024

Part of #​15710

Instead of requiring passing a &mut SyntaxEditor to every make constructor to generate mappings, we instead wrap that logic in SyntaxFactory, and afterwards add all the mappings to the SyntaxEditor.

Includes an example of using SyntaxEditor & SyntaxFactory in the extract_variable assist.

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 26, 2024
@Veykril
Copy link
Member

Veykril commented Sep 27, 2024

@bors r+

@bors
Copy link
Contributor

bors commented Sep 27, 2024

📌 Commit f9ad9a0 has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Sep 27, 2024

⌛ Testing commit f9ad9a0 with merge 233b1ac...

@bors
Copy link
Contributor

bors commented Sep 27, 2024

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 233b1ac to master...

@bors bors merged commit 233b1ac into rust-lang:master Sep 27, 2024
11 checks passed
@Veykril
Copy link
Member

Veykril commented Sep 30, 2024

Not really the place to discuss but I wonder how this could play into having quasi quoting #2227. I guess that could take a factory as an extra input or return something that needs to go through the factory to be "registered"

@DropDemBits
Copy link
Contributor Author

@Veykril Having an extra input to the quasi quoting macro(s) would probably be best, as doing something like post-registering with the factory would mean that we'd always need to generate SyntaxMappings, even if we don't need it.

@DropDemBits DropDemBits deleted the sed-syntax-factory branch October 4, 2024 23:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants