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

Formatting #321

Merged
merged 102 commits into from
Jul 28, 2024
Merged

Formatting #321

merged 102 commits into from
Jul 28, 2024

Conversation

Schottkyc137
Copy link
Contributor

@Schottkyc137 Schottkyc137 commented Jul 21, 2024

This commit adds the initial infrastructure for formatting a VHDL file.

What the formatter is capable of

  • Format any language element with a fixed configuration
  • Preserve comments
  • Preserve whitespaces in certain situations

What is still lacking for a feature complete formatter

  • Configurations / settings for different styles
  • integration into the language server

In this PR, the vhdl_lang binary file has been extended to allow for the --format flag. When vhdl_lang is called like

$ vhdl_lang --format my_file.vhd

the tool will print the formatted content of my_file.vhd into standard out. It will also check that the code is syntactically equivalent before and after.
Formatting is tested using unit tests as well as integration test; checking that every VHDL file of the example project is formatted in a way that retains the syntax.

The initial skeleton is basically done. I want to do some more tests and smaller refactoring (e.g., to remove duplicated code and make some things more flexible), but other than that, the formatter is ready to be used.

@Schottkyc137 Schottkyc137 marked this pull request as ready for review July 28, 2024 14:17
@Schottkyc137 Schottkyc137 merged commit 86eb38e into VHDL-LS:master Jul 28, 2024
10 checks passed
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.

1 participant