-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fixes to line length estimation, provide preformat with some (still i…
…ncomplete) info on how long the output already is
- Loading branch information
Showing
8 changed files
with
16 additions
and
21 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
packages/PoppyPrint-Core.package/PPFormatter.class/instance/currentLineLength.st
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
helper | ||
currentLineLength | ||
|
||
^ stream contents size - (stream contents lastIndexOf: Character cr) |
7 changes: 3 additions & 4 deletions
7
packages/PoppyPrint-Core.package/PPFormatter.class/instance/isMultiLineMessage..st
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
helper | ||
isMultiLineMessage: aNode | ||
|
||
| relevantParts | | ||
| relevantParts partsWithReceiver | | ||
relevantParts := aNode originalArguments. | ||
" if our last argument spreads over multiple lines, we don't consider it " | ||
(self willBeMultiLine: relevantParts last) ifTrue: [relevantParts := relevantParts allButLast]. | ||
partsWithReceiver := aNode originalReceiver ifNotNil: [relevantParts copyWithFirst: aNode originalReceiver] ifNil: [relevantParts]. | ||
|
||
aNode originalReceiver ifNotNil: [relevantParts := relevantParts copyWithFirst: aNode originalReceiver]. | ||
|
||
^ aNode originalArguments size > 1 and: [(relevantParts anySatisfy: [:arg | self willBeMultiLine: arg]) or: [aNode originalSelector size + (relevantParts inject: 0 into: [:sum :arg | sum + (self preFormat: arg) size]) > self remainingLineLength]] | ||
^ (aNode originalArguments size > 1 and: [partsWithReceiver anySatisfy: [:arg | self willBeMultiLine: arg]]) or: [aNode originalSelector size + (relevantParts inject: 0 into: [:sum :arg | sum + (self preFormat: arg) size]) > self remainingLineLength] |
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
2 changes: 1 addition & 1 deletion
2
packages/PoppyPrint-Core.package/PPFormatter.class/instance/remainingLineLength.st
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
helper | ||
remainingLineLength | ||
|
||
^ self maxLineLength - (stream contents size - (stream contents lastIndexOf: Character cr)) | ||
^ self maxLineLength - self currentLineLength |
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 was deleted.
Oops, something went wrong.