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

Fix a bug when formatting consecutive -define directives with single-quoted macro names. #106

Merged
merged 2 commits into from
Aug 26, 2024

Conversation

sile
Copy link
Owner

@sile sile commented Aug 26, 2024

Fixes #105

Copilot Summary

This pull request includes changes to improve the handling of macro definitions in the FormatState struct and updates to the corresponding test data. The most important changes include modifying the way macro name lengths are calculated and adding new test cases for macro definitions.

Improvements to macro definition handling:

  • efmt_core/src/items/module.rs: Modified the calculation of macro name lengths to use the start and end positions of the macro name token. This ensures more accurate length calculation.

Updates to test data:

  • tests/testdata/aligned_macro.erl: Added new test cases for macro definitions with different lengths and special characters to ensure the updated length calculation works correctly.

@sile sile merged commit 078fa1f into master Aug 26, 2024
10 checks passed
@sile sile deleted the fix-macros-format branch August 26, 2024 09:03
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.

Formatting fails to include define enclosed in single quotes.
1 participant