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

50 keep new lines in arrays #85

Open
wants to merge 33 commits into
base: master
Choose a base branch
from

Conversation

Yannis-Hofmann
Copy link
Contributor

Solve Issue 50. (Contains changes from Issue 49)

racerX4004 and others added 30 commits June 1, 2022 11:24
The PPWindowFormatter formats Strings so that in one line there are no more than maxLineWidth Characters. One exeption to this is if you have a Word which has more Characters than maxLineWidth.
Test Case for Space before Comma in Array added
fully solving issue 66 option to set space before comma and space before dot in Array
Rebase Release_Branch onto master
…ndard-browser-window

49 set row length to standard browser window
@Yannis-Hofmann Yannis-Hofmann requested a review from tom95 June 28, 2022 12:10
Copy link
Collaborator

@tom95 tom95 left a comment

Choose a reason for hiding this comment

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

Functionality works as expected, great stuff! I added a couple style comments.

I specifically tried to ignore all changes related to the windowformatting. Would be great to have this separated so that it doesn't end up in master prematurely, but since it won't actually be used I'm also okay with merging as-is.

braceNodeHasMultiLineParts: aNode

^ (aNode elements anySatisfy: [:node |
(self willBeMultiLine: node) or: (self isTypeOfNewLineMarker: node)]) or: [self isCaseOf: (self parentFor: aNode)]
Copy link
Collaborator

Choose a reason for hiding this comment

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

missing square brackets around the or:

Comment on lines +22 to +28
result := aBoolean
ifTrue: [self stripMethodPattern: formatter contents]
ifFalse: [formatter contents].
aPPFormatterConfig formatToMaxLineWidth ifTrue: [result := PPWindowFormatter new format: result withWindowWidth: aPPFormatterConfig maxLineWidth].

^ result
Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess this was used during debugging only? or is there a reason to keep the temp var around?

Copy link
Contributor

Choose a reason for hiding this comment

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

no, this is actually needed for the LineWidth

((self isEmptyLineMarker: element) or: [self isOptionalEmptyLineMarker: element])
ifTrue: [self newLine]
ifFalse: [
(self isOptionalNewLineMarker: element) ifFalse: [
Copy link
Collaborator

Choose a reason for hiding this comment

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

could be that I'm reading this wrong, but isn't this always false because if it were true, control flow would have gone into the upper ifTrue branch?

One suggestion, to help clarify the method, could be to create a separate printBraceElement:multiLine: method and make use of early returns.

helper
isTypeOfNewLineMarker: aNode

^ ((self isOptionalEmptyLineMarker: aNode) or: (self isOptionalNewLineMarker: aNode) or: (self isEmptyLineMarker: aNode))
Copy link
Collaborator

Choose a reason for hiding this comment

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

missing square brackets around or

@@ -3,23 +3,39 @@ codeWithEmptyLineMarkersStartingAt: aNumber
" insert #ppEmptyLine symbols where double newlines are found, for later use by e.g. a formatter. Insert no markers earlier than aNumber "
Copy link
Collaborator

Choose a reason for hiding this comment

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

consider also updating the method comment

Konstantin Dauer and others added 2 commits July 21, 2022 16:10
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.

7 participants