-
-
Notifications
You must be signed in to change notification settings - Fork 247
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 clojure-sort-ns with comments in the end #646
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
74550a9
Fix clojure-sort-ns with comments in the end
p4v4n b53c714
Add another test for clojure-sort-ns
p4v4n 4c81348
Add more tests for clojure-sort-ns
p4v4n 4e5cc6b
Replace \n with linebreaks
p4v4n 357cfc2
Merge branch 'master' into fix-clojure-sort-ns
p4v4n 3d4fc8e
Update Changelog
p4v4n File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The resulting formatting for this (fairly pathological) case aren't spectacular, although I'm willing to merge this in as-is.
Note that
clojure--sort-following-sexps
is a private function with a single usage in clojure-mode.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't understood you completely.
Is it about additional linebreak or the sorting order itself?
The linebreak issue is not exactly related to this function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In either case it will be better to handle it in a separate PR.
Will be happy to discuss it with you further on slack.
I have merged the master and added a Changelog entry.Please feel free to squash the commits as you see it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The order of
Middle comment
andThe first comment
get swappedIf you'd be wiliing to work on it please create an issue, else we can let it slip.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah. But that is the expected behaviour currently.
Comments at the start of a line are considered part of the following sexp.
The sorting happens only based on what is inside the import. The comments are moved along with the sexp.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah but that's a private function, we could change it as desired!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it.
IMHO the comments should be moved along with the imports instead of being sorted separately. So I feel the current behaviour makes some sense. Whether the comments should be placed below or above the sexp is up for debate.
Also if we make any changes to the sorting order it will break the current user experience. So a discussion + new ticket is necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again for the review and the merge. :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cheers 🍻 tbh it's no big deal, after all there are many competing formatters for ns-sorting functionality. Something that doesn't loop forever probably satisfies this project's scope.