Fix alignment of structs and enums. #1789
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
This PR fixes the alignment of (typedef) enums and structs declarations. Since these were being detected wrongly, the new changes just ignore them when running
verilog-pretty-declarations
. However, fields inside a struct still get aligned properly.For example, considering the following example from #1752 discussion:
After indenting and executing
verilog-pretty-declarations
this is the result before the PR:And this is the result after these changes:
Regarding typedef structs, considering the already indented piece of code:
This is the result before running
verilog-pretty-declarations
at typedef struct line before PR changes:After these changes, there would be no effect if running
verilog-pretty-declarations
at typedef struct line. However, if running it over one of the field's lines they get properly aligned inside the struct:I also added a couple of tests. One of them still needs some indentation fixes (with
verilog-indent-lists
set to t), but that will come in a different PR.Thanks!