-
Notifications
You must be signed in to change notification settings - Fork 27
Fix up the reflow behavior of MD lists, a bunch of comment styles, and ascii email inclusions #45
Conversation
- Fixed reflow of lists with '-' line prefix - Added test - Fixed reflow of '/*' block comments - Added test - Added support for reflow of '%' single line comments - Added test - Added support for reflow of ';;' single line comments - Added test - Added support for reflow of '>' ascii email inclusions - Added test - Added test for '#' single line comments - Added test for '//' single line comments
Any thoughts on getting this reviewed? |
Unfortunately there's more open PRs than the Atom team can review, so there's currently a long backup. It might take some time until someone can give this a thorough review. |
lib/autoflow.coffee
Outdated
@@ -68,11 +68,22 @@ module.exports = | |||
currentLine = [] | |||
currentLineLength = linePrefixTabExpanded.length | |||
|
|||
notFirstLine = false |
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 think it would be easier to understand if this was switched: firstLine = true
Ping? |
Thank you satchm0h. This patch is relevant to my activity, I am happy to help however I can with the review process. |
I would love to see this get in. I looked over the changes and they look great. If you can tell me how to test this locally, I'd love to do it. |
@mstanleyjones |
It's ... stunning ... that this simple fix has been under needs-review for a year and a half. How does one get approved to do reviews? Meanwhile I'm trying package magic-reflow. |
I've just given up on it being accepted at this point.
…On Tue, Sep 19, 2017 at 3:57 PM, A. Lloyd Flanagan ***@***.*** > wrote:
It's ... stunning ... that this simple fix has been under needs-review for
a year and a half. How does one get approved to do reviews? Meanwhile I'm
trying package magic-reflow <https://atom.io/packages/magic-reflow>.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#45 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ABt3t4UVHg_fdcYXGyAvjCk1XAF8HsE3ks5skByYgaJpZM4Hr3Jf>
.
|
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.
Sorry that it took forever for us to get to this. I left a couple of comments.
spec/autoflow-spec.coffee
Outdated
@@ -311,3 +311,145 @@ describe "Autoflow package", -> | |||
''' | |||
|
|||
expect(autoflow.reflow(text, wrapColumn: 2)).toEqual res | |||
|
|||
it 'properly reflows // comments ', -> | |||
# Because there're known problems with this character in major regex engines |
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.
Does this comment apply to this example? It seems like it was copied over from a different test, but I don't think regex engines have problems with /
characters.
lib/autoflow.coffee
Outdated
linePrefix = linePrefix.replace(/^(\s*)\/\*/, '$1 ') | ||
# Handle - list items | ||
else if linePrefix.search(/^\s*-/) isnt -1 | ||
linePrefix = linePrefix.replace(/^(\s*)[\/#*-]/, '$1 ') |
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.
-
It looks like this processing of
linePrefix
could be moved outside of the loop; it doesn't depend on the loop variablesegment
. It looks like you've done it here because you need a different line prefix for the first line than for the remainder of the lines. Maybe before the loop you could define a second variable calledwrappedLinePrefix
. -
I don't think it's necessary to first check that
linePrefix
matches a regex before callingreplace
on it with that regex. It's ok to callreplace
with a non-matching regex; it will just return the string unchanged.
Maybe something like this?
wrappedLinePrefix = linePrefix
.replace(/^(\s*)\/\*/, '$1 ')
.replace(/^(\s*)-/, '$1 ')
firstLine = true
for segment in @segmentText(blockLines.join(' '))
if @wrapSegment(segment, currentLineLength, wrapColumn)
if firstLine
# use `linePrefix`
else
# use `wrappedLinePrefix`
@satchm0h are you interested in addressing @maxbrunsfeld's comments? |
Thanks @satchm0h! Nice work! |
OMG! 🎉 |
This will go out in Atom 1.25. |
Wonders never cease ;) |
Hmm, I just identified some minor issues with this PR, specifically regarding the addition of the |
Changes to address issues #4, #36, #39, #43