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

refactor(codegen): generate most functions on LanguageKind with a macro #3380

Conversation

dyc3
Copy link
Contributor

@dyc3 dyc3 commented Jul 8, 2024

Summary

This refactors how most of the functions on LanguageKind are defined to be generated from a macro. The purpose is to make it less tedious, and reduce the potential for merge conflicts when implementing new languages. Since we'll likely be implementing a few new languages for HTML-ish language support (#1726), I figured this would be useful. Ideally, simply adding an entry to enum LanguageKind should be enough, but doing that requires a proc macro.

Test Plan

Everything compiles, and inlining the macros with rust analyzer produces the same output as before the refactor

@github-actions github-actions bot added the A-Tooling Area: internal tools label Jul 8, 2024
@dyc3 dyc3 marked this pull request as draft July 8, 2024 12:44
@dyc3 dyc3 force-pushed the 07-08-refactor_codegen_generate_most_functions_on_languagekind_with_a_macro branch from 0c94a24 to 6be41ea Compare July 8, 2024 13:27
@dyc3 dyc3 marked this pull request as ready for review July 8, 2024 13:27
@dyc3 dyc3 force-pushed the 07-08-refactor_codegen_generate_most_functions_on_languagekind_with_a_macro branch from 6be41ea to f59511f Compare July 8, 2024 17:07
Copy link
Contributor

@arendjr arendjr left a comment

Choose a reason for hiding this comment

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

Nice work!

@arendjr arendjr merged commit 1b15286 into biomejs:main Jul 8, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Tooling Area: internal tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants