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 for handling empty code block in doc comments #4902

Conversation

davidBar-On
Copy link
Contributor

Suggested fix for issue #4793 for handling empty code block in doc comments (replacing PR #4895). If the doc comments code block includes only empty lines than the output is one line with empty code (///). If no code line was included between the two ///''' then the output also does not include any code line.

A simpler solution could be to add trim() here, i.e to make it _ if self.code_block_buffer.trim().is_empty() =>.... however it seem that changing format_code_block() is more robust.

@ytmimi
Copy link
Contributor

ytmimi commented Nov 11, 2022

@davidBar-On sorry that this has been sitting around in the backlog for so long. I took a look at this and I like your second proposed fix of adding .trim() to the guard clause. I think it's fine to remove all lines from an empty code block if the user has specified format_code_in_doc_comments=true.

I'm noticing that this PR is against the stbu branch instead of master. Maybe you could close this and open up a new PR against master with the simplified implementation. The code in master is slightly different, but the simplified fix you described above should be the same!

@davidBar-On
Copy link
Contributor Author

davidBar-On commented Nov 13, 2022

Created PR #5601 that trims the empty code block as discussed, and closing this PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants