Skip to content

Commit

Permalink
fix comments bug in styler:sort directive
Browse files Browse the repository at this point in the history
  • Loading branch information
novaugust committed Jan 15, 2025
1 parent 88d3334 commit 9b0207b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
they can and will change without that change being reflected in Styler's semantic version.
## main

### Fixes

- fix a bug in comment-movement when multiple `# styler:sort` directives are added to a file at the same time

## 1.3.2

### Improvements
Expand Down
3 changes: 1 addition & 2 deletions lib/style/comment_directives.ex
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ defmodule Styler.Style.CommentDirectives do
end)

if found do
{node, _} = found
{sorted, comments} = sort(node, ctx.comments)
{sorted, comments} = found |> Zipper.node() |> sort(comments)
{Zipper.replace(found, sorted), comments}
else
{zipper, comments}
Expand Down

0 comments on commit 9b0207b

Please sign in to comment.