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

Format implementation of files #40

Open
kdorsel opened this issue Jul 13, 2020 · 3 comments
Open

Format implementation of files #40

kdorsel opened this issue Jul 13, 2020 · 3 comments
Labels
core Issues related to TcBlackCore enhancement New feature or request

Comments

@kdorsel
Copy link
Contributor

kdorsel commented Jul 13, 2020

Currently only looks like the Declaration part of files are formatted. I'd like to look at getting the Implementation part of files included. Did you have any specific ideas/ways you were thinking of doing this?

@Roald87
Copy link
Owner

Roald87 commented Jul 13, 2020

I haven't thought about it a lot, but it is probably going to be challenging since statements are often spread out over multiple lines. It will be quite challenging to format with taking the line length into account. That is why I didn't plan to implement the line length based formatting until the version 0.5. So for the implementation part it is maybe a good idea to focus on the correct identification of statements first. After correct identification you could implement some simple formatting, like indentation and spacing around the equal sings.

Do you have any ideas on how to approach this?

@kdorsel
Copy link
Contributor Author

kdorsel commented Jul 14, 2020

I'm thinking recursive parsing approach. Initially loop through the full implementation and create blocks with start line(s), content and end line.

Start line examples:
If mybool1 and mybool2 then
case state of

content anything in between

End line:
end_case
end_if`

Then recursively call the same function with the body content. Each block would be associated with a number defining the level of indent.

As you said first step would be to correctly find the start/end of these blocks. I'll start something up and make a WIP PR so you can give your input.

@Roald87
Copy link
Owner

Roald87 commented Jul 14, 2020

Sounds good. This should be easy to implement with the current composite design pattern which is used.

@Roald87 Roald87 added the enhancement New feature or request label Jul 26, 2020
@Roald87 Roald87 added this to the Version 0.3 milestone Jul 26, 2020
@Roald87 Roald87 added the core Issues related to TcBlackCore label Apr 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Issues related to TcBlackCore enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants