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

make inline comments stay inline #14

Merged
merged 1 commit into from
Apr 29, 2023
Merged

make inline comments stay inline #14

merged 1 commit into from
Apr 29, 2023

Conversation

jvllmr
Copy link
Contributor

@jvllmr jvllmr commented Apr 18, 2023

2nd attempt inspired by your idea in #9

  • comment nodes are now positioned after and not before the nodes in the same line

comment nodes are now positioned after and not before the nodes in the same line
@@ -72,7 +77,7 @@ def _enrich(source: Union[str, bytes], tree: ast.AST) -> None:

attr = getattr(target_node, target_attr)
attr.append(c_node)
attr.sort(key=lambda x: (x.end_lineno, not isinstance(x, Comment)))
attr.sort(key=lambda x: (x.end_lineno, isinstance(x, Comment)))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

breaking change: Comments are no longer sorted before other nodes in the same line

@t3rn0
Copy link
Owner

t3rn0 commented Apr 29, 2023

Thank you @jvllmr for the PR. Merging it

@t3rn0 t3rn0 merged commit e1b0751 into t3rn0:master Apr 29, 2023
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.

2 participants