From a570e200a6b7552dd4a0d2be09c7b87885107be5 Mon Sep 17 00:00:00 2001 From: Janis Wehen Date: Thu, 30 Jun 2022 18:54:37 +0200 Subject: [PATCH 01/15] add personalizedConfig and packageConfig getter to PPFormatterConfig --- .../PPFormatterConfig.class/class/default.st | 2 +- .../class/getClassMethodsWithPragma.inClasses..st | 9 +++++++++ .../class/packageConfigForMethod..st | 11 +++++++++++ .../class/personalizedConfig.st | 5 +++++ .../PPFormatterConfig.class/methodProperties.json | 5 ++++- 5 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/getClassMethodsWithPragma.inClasses..st create mode 100644 packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForMethod..st create mode 100644 packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/personalizedConfig.st diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/default.st b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/default.st index 5ea7219..7f2e8fd 100644 --- a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/default.st +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/default.st @@ -1,4 +1,4 @@ -as yet unclassified +configs default "Default is lazy initialized" diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/getClassMethodsWithPragma.inClasses..st b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/getClassMethodsWithPragma.inClasses..st new file mode 100644 index 0000000..a95a7fc --- /dev/null +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/getClassMethodsWithPragma.inClasses..st @@ -0,0 +1,9 @@ +helpers +getClassMethodsWithPragma: aSymbol inClasses: aClassList + + | stream methodsWithPragma | + stream := WriteStream with: #(). + (aClassList collect: [:methodClass | Pragma allNamed: aSymbol in: (methodClass class)]) do: [:listOfMethods | stream nextPutAll: listOfMethods]. + methodsWithPragma := stream contents. + methodsWithPragma := methodsWithPragma collect: [:aPragma | aPragma method]. + ^ methodsWithPragma \ No newline at end of file diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForMethod..st b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForMethod..st new file mode 100644 index 0000000..af7ed0e --- /dev/null +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForMethod..st @@ -0,0 +1,11 @@ +configs +packageConfigForMethod: aCompiledMethod + + | classesInPackage ppConfigMethods config | + classesInPackage := aCompiledMethod methodClass package classes. + ppConfigMethods := self getClassMethodsWithPragma: #ppProjectConfig inClasses: classesInPackage. + ppConfigMethods size = 0 ifTrue: [^ self default]. + ppConfigMethods size = 1 ifFalse: [self error: 'More than one Config found in Package: ', aCompiledMethod methodClass package asString]. + config := ppConfigMethods first methodClass soleInstance perform: ppConfigMethods first selector with: aCompiledMethod. + config class = PPFormatterConfig ifFalse: [self error: 'Config returned by ', ppConfigMethods first selector asString,' is not of Type PPFormatterConfig.']. + ^ config \ No newline at end of file diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/personalizedConfig.st b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/personalizedConfig.st new file mode 100644 index 0000000..c1cc963 --- /dev/null +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/personalizedConfig.st @@ -0,0 +1,5 @@ +configs +personalizedConfig + "The Personalized Config is the Default Config for now. In later Issues we want this Method to return the Config specified in the Prefrence Browser." + + ^ self default \ No newline at end of file diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json index d1250b6..3a8f06c 100644 --- a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json @@ -1,6 +1,9 @@ { "class" : { - "default" : "KD 6/15/2022 16:11" }, + "default" : "KD 6/15/2022 16:11", + "getClassMethodsWithPragma:inClasses:" : "JW 6/30/2022 18:08", + "packageConfigForMethod:" : "JW 6/30/2022 18:28", + "personalizedConfig" : "JW 6/29/2022 21:59" }, "instance" : { "spaceBeforeComma" : "KD 6/15/2022 16:07", "spaceBeforeComma:" : "YH 6/2/2022 14:16", From 9aa95084445ce8fa2ca977b52326e003164721a8 Mon Sep 17 00:00:00 2001 From: Janis Wehen Date: Sat, 23 Jul 2022 12:23:51 +0200 Subject: [PATCH 02/15] Implementing packageConfigForClass: and packageConfigForPackage: --- .../class/packageConfigForClass..st | 4 ++++ .../class/packageConfigForPackage..st | 11 +++++++++++ .../PPFormatterConfig.class/methodProperties.json | 4 +++- 3 files changed, 18 insertions(+), 1 deletion(-) create mode 100644 packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForClass..st create mode 100644 packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForPackage..st diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForClass..st b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForClass..st new file mode 100644 index 0000000..97575c4 --- /dev/null +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForClass..st @@ -0,0 +1,4 @@ +configs +packageConfigForClass: aClass + + ^ self packageConfigForPackage: aClass package \ No newline at end of file diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForPackage..st b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForPackage..st new file mode 100644 index 0000000..234de7f --- /dev/null +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForPackage..st @@ -0,0 +1,11 @@ +configs +packageConfigForPackage: aPackage + + | classesInPackage ppConfigMethods config | + classesInPackage := aPackage classes. + ppConfigMethods := self getClassMethodsWithPragma: #ppProjectConfig inClasses: classesInPackage. + ppConfigMethods size = 0 ifTrue: [^ self default]. + ppConfigMethods size = 1 ifFalse: [self error: 'More than one Config found in Package: ', aPackage asString]. + config := ppConfigMethods first methodClass soleInstance perform: ppConfigMethods first selector with: nil. + config class = PPFormatterConfig ifFalse: [self error: 'Config returned by ', ppConfigMethods first selector asString,' is not of Type PPFormatterConfig.']. + ^ config \ No newline at end of file diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json index 3a8f06c..6b5ce6b 100644 --- a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json @@ -2,10 +2,12 @@ "class" : { "default" : "KD 6/15/2022 16:11", "getClassMethodsWithPragma:inClasses:" : "JW 6/30/2022 18:08", + "packageConfigForClass:" : "JW 7/23/2022 11:51", "packageConfigForMethod:" : "JW 6/30/2022 18:28", + "packageConfigForPackage:" : "JW 7/23/2022 11:50", "personalizedConfig" : "JW 6/29/2022 21:59" }, "instance" : { - "spaceBeforeComma" : "KD 6/15/2022 16:07", + "spaceBeforeComma" : "JW 7/21/2022 17:40", "spaceBeforeComma:" : "YH 6/2/2022 14:16", "spaceBeforePointInArray" : "Alexander Ungefug 6/1/2022 15:59", "spaceBeforePointInArray:" : "YH 6/2/2022 14:17" } } From 3dbf2346df442ed69c68ea521caa21ca2c66103a Mon Sep 17 00:00:00 2001 From: Janis Wehen Date: Sat, 23 Jul 2022 12:40:39 +0200 Subject: [PATCH 03/15] format sorce with project config and shown sorce with personalized Config --- .../instance/acceptTextInModel.st | 35 +++++++++++++++++++ .../methodProperties.json | 5 +++ .../properties.json | 2 ++ 3 files changed, 42 insertions(+) create mode 100644 packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/acceptTextInModel.st create mode 100644 packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/methodProperties.json create mode 100644 packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/properties.json diff --git a/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/acceptTextInModel.st b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/acceptTextInModel.st new file mode 100644 index 0000000..85799a8 --- /dev/null +++ b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/acceptTextInModel.st @@ -0,0 +1,35 @@ +*PoppyPrint-Core-override +acceptTextInModel + + | text | + self okToStyle ifFalse:[^super acceptTextInModel]. + "#correctFrom:to:with: is sent when the method source is + manipulated during compilation (removing unused temps, + changing selectors etc). But #correctFrom:to:with: operates + on the textMorph's text, and we may be saving an unstyled + copy of the text. This means that these corrections will be lost + unless we also apply the corrections to the unstyled copy that we are saving. + So remember the unstyled copy in unstyledAcceptText, so + that when #correctFrom:to:with: is received we can also apply + the correction to it" + text := textMorph asText. + model ifNotNil: [ + model contentsSymbol = #prettyPrint ifTrue: [ + model editSelection = #newMessage ifTrue: [ + text := PPFormatter + formatString: text asString + class: model selectedClass + noPattern: false + with: (PPFormatterConfig packageConfigForClass: model selectedClass)]. + model editSelection = #editMessage ifTrue: [ + text := PPFormatter + formatString: text asString + class: model selectedClass + noPattern: false + with: (PPFormatterConfig packageConfigForMethod: model selectedClass >> model selectedMessageName)]]]. + unstyledAcceptText := styler unstyledTextFrom: text asText. + [^setTextSelector isNil or: + [setTextSelector numArgs = 2 + ifTrue: [model perform: setTextSelector with: unstyledAcceptText with: self] + ifFalse: [model perform: setTextSelector with: unstyledAcceptText]] + ] ensure:[unstyledAcceptText := nil] \ No newline at end of file diff --git a/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/methodProperties.json b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/methodProperties.json new file mode 100644 index 0000000..8e7196f --- /dev/null +++ b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + }, + "instance" : { + "acceptTextInModel" : "JW 7/23/2022 12:38" } } diff --git a/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/properties.json b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/properties.json new file mode 100644 index 0000000..6056c54 --- /dev/null +++ b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/properties.json @@ -0,0 +1,2 @@ +{ + "name" : "PluggableTextMorphPlus" } From 2658af16957964dcb66be77514d90ac41562de39 Mon Sep 17 00:00:00 2001 From: Janis Wehen Date: Sat, 23 Jul 2022 13:43:55 +0200 Subject: [PATCH 04/15] refactoring acceptTextInModel --- .../instance/acceptTextInModel.st | 19 ++++++------------- .../instance/getProjectConfig.st | 10 ++++++++++ .../methodProperties.json | 3 ++- 3 files changed, 18 insertions(+), 14 deletions(-) create mode 100644 packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/getProjectConfig.st diff --git a/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/acceptTextInModel.st b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/acceptTextInModel.st index 85799a8..16d632b 100644 --- a/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/acceptTextInModel.st +++ b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/acceptTextInModel.st @@ -14,19 +14,12 @@ acceptTextInModel the correction to it" text := textMorph asText. model ifNotNil: [ - model contentsSymbol = #prettyPrint ifTrue: [ - model editSelection = #newMessage ifTrue: [ - text := PPFormatter - formatString: text asString - class: model selectedClass - noPattern: false - with: (PPFormatterConfig packageConfigForClass: model selectedClass)]. - model editSelection = #editMessage ifTrue: [ - text := PPFormatter - formatString: text asString - class: model selectedClass - noPattern: false - with: (PPFormatterConfig packageConfigForMethod: model selectedClass >> model selectedMessageName)]]]. + (model contentsSymbol = #prettyPrint and: [model editSelection = #newMessage or: [model editSelection = #editMessage]]) ifTrue: [ + text := PPFormatter + formatString: text asString + class: model selectedClass + noPattern: false + with: self getProjectConfig]]. unstyledAcceptText := styler unstyledTextFrom: text asText. [^setTextSelector isNil or: [setTextSelector numArgs = 2 diff --git a/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/getProjectConfig.st b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/getProjectConfig.st new file mode 100644 index 0000000..8454698 --- /dev/null +++ b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/getProjectConfig.st @@ -0,0 +1,10 @@ +*PoppyPrint-Core-override +getProjectConfig + + model ifNil: [^ PPFormatterConfig default]. + model editSelection = #newMessage ifTrue: [^ PPFormatterConfig packageConfigForClass: model selectedClass]. + model editSelection = #editMessage ifTrue: [ + model metaClassIndicated + ifTrue: [^ PPFormatterConfig packageConfigForMethod: model selectedClass class >> model selectedMessageName] + ifFalse: [^ PPFormatterConfig packageConfigForMethod: model selectedClass >> model selectedMessageName]]. + ^ PPFormatterConfig default. \ No newline at end of file diff --git a/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/methodProperties.json b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/methodProperties.json index 8e7196f..5c30336 100644 --- a/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/methodProperties.json +++ b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/methodProperties.json @@ -2,4 +2,5 @@ "class" : { }, "instance" : { - "acceptTextInModel" : "JW 7/23/2022 12:38" } } + "acceptTextInModel" : "JW 7/23/2022 13:30", + "getProjectConfig" : "JW 7/23/2022 13:25" } } From ea487d5f704902a74d986506862459da2f87dc83 Mon Sep 17 00:00:00 2001 From: Janis Wehen Date: Sat, 23 Jul 2022 13:49:40 +0200 Subject: [PATCH 05/15] personalizedConfig ist now used to Format Methods --- .../class/formatString.class.noPattern.notifying..st | 2 +- .../PPFormatter.class/methodProperties.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/PoppyPrint-Core.package/PPFormatter.class/class/formatString.class.noPattern.notifying..st b/packages/PoppyPrint-Core.package/PPFormatter.class/class/formatString.class.noPattern.notifying..st index cff8798..3746e76 100644 --- a/packages/PoppyPrint-Core.package/PPFormatter.class/class/formatString.class.noPattern.notifying..st +++ b/packages/PoppyPrint-Core.package/PPFormatter.class/class/formatString.class.noPattern.notifying..st @@ -6,4 +6,4 @@ formatString: aString class: aClass noPattern: aBoolean notifying: anObject class: aClass noPattern: aBoolean notifying: anObject - with: PPFormatterConfig default \ No newline at end of file + with: PPFormatterConfig personalizedConfig \ No newline at end of file diff --git a/packages/PoppyPrint-Core.package/PPFormatter.class/methodProperties.json b/packages/PoppyPrint-Core.package/PPFormatter.class/methodProperties.json index 2c71224..1dc4c36 100644 --- a/packages/PoppyPrint-Core.package/PPFormatter.class/methodProperties.json +++ b/packages/PoppyPrint-Core.package/PPFormatter.class/methodProperties.json @@ -8,7 +8,7 @@ "formatMethod:" : "tobe 3/10/2021 13:32", "formatPackage:" : "tobe 3/10/2021 14:59", "formatString:class:noPattern:" : "tobe 3/10/2021 15:47", - "formatString:class:noPattern:notifying:" : "KD 6/15/2022 16:11", + "formatString:class:noPattern:notifying:" : "JW 7/23/2022 13:48", "formatString:class:noPattern:notifying:with:" : "KD 6/15/2022 16:11", "formatString:class:noPattern:with:" : "Alexander Ungefug 6/1/2022 16:06", "stripMethodPattern:" : "tobe 3/19/2021 18:51" }, From 4e9818a84edd3fe92bf69aeffb2f1874fee1109c Mon Sep 17 00:00:00 2001 From: Janis Wehen Date: Sat, 23 Jul 2022 13:58:10 +0200 Subject: [PATCH 06/15] rename personalizedConfig to preferenceConfig --- .../class/formatString.class.noPattern.notifying..st | 2 +- .../PPFormatter.class/methodProperties.json | 2 +- .../class/{personalizedConfig.st => preferenceConfig.st} | 4 ++-- .../PPFormatterConfig.class/methodProperties.json | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) rename packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/{personalizedConfig.st => preferenceConfig.st} (89%) diff --git a/packages/PoppyPrint-Core.package/PPFormatter.class/class/formatString.class.noPattern.notifying..st b/packages/PoppyPrint-Core.package/PPFormatter.class/class/formatString.class.noPattern.notifying..st index 3746e76..8383212 100644 --- a/packages/PoppyPrint-Core.package/PPFormatter.class/class/formatString.class.noPattern.notifying..st +++ b/packages/PoppyPrint-Core.package/PPFormatter.class/class/formatString.class.noPattern.notifying..st @@ -6,4 +6,4 @@ formatString: aString class: aClass noPattern: aBoolean notifying: anObject class: aClass noPattern: aBoolean notifying: anObject - with: PPFormatterConfig personalizedConfig \ No newline at end of file + with: PPFormatterConfig preferenceConfig \ No newline at end of file diff --git a/packages/PoppyPrint-Core.package/PPFormatter.class/methodProperties.json b/packages/PoppyPrint-Core.package/PPFormatter.class/methodProperties.json index 1dc4c36..fd002b6 100644 --- a/packages/PoppyPrint-Core.package/PPFormatter.class/methodProperties.json +++ b/packages/PoppyPrint-Core.package/PPFormatter.class/methodProperties.json @@ -8,7 +8,7 @@ "formatMethod:" : "tobe 3/10/2021 13:32", "formatPackage:" : "tobe 3/10/2021 14:59", "formatString:class:noPattern:" : "tobe 3/10/2021 15:47", - "formatString:class:noPattern:notifying:" : "JW 7/23/2022 13:48", + "formatString:class:noPattern:notifying:" : "JW 7/23/2022 13:57", "formatString:class:noPattern:notifying:with:" : "KD 6/15/2022 16:11", "formatString:class:noPattern:with:" : "Alexander Ungefug 6/1/2022 16:06", "stripMethodPattern:" : "tobe 3/19/2021 18:51" }, diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/personalizedConfig.st b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/preferenceConfig.st similarity index 89% rename from packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/personalizedConfig.st rename to packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/preferenceConfig.st index c1cc963..0d67e6d 100644 --- a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/personalizedConfig.st +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/preferenceConfig.st @@ -1,5 +1,5 @@ configs -personalizedConfig +preferenceConfig "The Personalized Config is the Default Config for now. In later Issues we want this Method to return the Config specified in the Prefrence Browser." - + ^ self default \ No newline at end of file diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json index 6b5ce6b..8dc7073 100644 --- a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json @@ -5,7 +5,7 @@ "packageConfigForClass:" : "JW 7/23/2022 11:51", "packageConfigForMethod:" : "JW 6/30/2022 18:28", "packageConfigForPackage:" : "JW 7/23/2022 11:50", - "personalizedConfig" : "JW 6/29/2022 21:59" }, + "preferenceConfig" : "JW 7/23/2022 13:56" }, "instance" : { "spaceBeforeComma" : "JW 7/21/2022 17:40", "spaceBeforeComma:" : "YH 6/2/2022 14:16", From 3b65be854062e208a11e99f6f87caa2e90f2fef9 Mon Sep 17 00:00:00 2001 From: Janis Wehen Date: Sun, 24 Jul 2022 20:13:40 +0200 Subject: [PATCH 07/15] added test that simulate a Browser --- .../PPFormatter.class/methodProperties.json | 2 +- .../class/preferenceConfig.st | 5 +++-- .../class/shouldUseDefaultAsPreferenceConfig..st | 4 ++++ .../class/shouldUseDefaultAsPreferenceConfig.st | 4 ++++ .../PPFormatterConfig.class/methodProperties.json | 4 +++- .../PPFormatterConfig.class/properties.json | 2 +- .../instance/getProjectConfig.st | 5 +---- .../methodProperties.json | 2 +- .../PPSimulationExample.class/README.md | 0 .../class/poppyConfig..st | 7 +++++++ .../PPSimulationExample.class/instance/example.st | 4 ++++ .../methodProperties.json | 5 +++++ .../PPSimulationExample.class/properties.json | 14 ++++++++++++++ .../PPSimulationTest.class/README.md | 0 .../accepting.expectingSorce.andPretty..st | 13 +++++++++++++ .../PPSimulationTest.class/instance/close..st | 9 +++++++++ .../PPSimulationTest.class/instance/getBrowser.st | 8 ++++++++ .../instance/getPrettyContentOf..st | 6 ++++++ .../instance/getSourceContentOf..st | 6 ++++++ .../instance/setMethodContentsTo.of.using..st | 7 +++++++ .../instance/testProjectVsPersonalizedConfig1.st | 10 ++++++++++ .../instance/testProjectVsPersonalizedConfig2.st | 10 ++++++++++ .../PPSimulationTest.class/methodProperties.json | 12 ++++++++++++ .../PPSimulationTest.class/properties.json | 14 ++++++++++++++ 24 files changed, 143 insertions(+), 10 deletions(-) create mode 100644 packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/shouldUseDefaultAsPreferenceConfig..st create mode 100644 packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/shouldUseDefaultAsPreferenceConfig.st create mode 100644 packages/PoppyPrint-Tests.package/PPSimulationExample.class/README.md create mode 100644 packages/PoppyPrint-Tests.package/PPSimulationExample.class/class/poppyConfig..st create mode 100644 packages/PoppyPrint-Tests.package/PPSimulationExample.class/instance/example.st create mode 100644 packages/PoppyPrint-Tests.package/PPSimulationExample.class/methodProperties.json create mode 100644 packages/PoppyPrint-Tests.package/PPSimulationExample.class/properties.json create mode 100644 packages/PoppyPrint-Tests.package/PPSimulationTest.class/README.md create mode 100644 packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/accepting.expectingSorce.andPretty..st create mode 100644 packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/close..st create mode 100644 packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/getBrowser.st create mode 100644 packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/getPrettyContentOf..st create mode 100644 packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/getSourceContentOf..st create mode 100644 packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/setMethodContentsTo.of.using..st create mode 100644 packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/testProjectVsPersonalizedConfig1.st create mode 100644 packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/testProjectVsPersonalizedConfig2.st create mode 100644 packages/PoppyPrint-Tests.package/PPSimulationTest.class/methodProperties.json create mode 100644 packages/PoppyPrint-Tests.package/PPSimulationTest.class/properties.json diff --git a/packages/PoppyPrint-Core.package/PPFormatter.class/methodProperties.json b/packages/PoppyPrint-Core.package/PPFormatter.class/methodProperties.json index fd002b6..60ccaca 100644 --- a/packages/PoppyPrint-Core.package/PPFormatter.class/methodProperties.json +++ b/packages/PoppyPrint-Core.package/PPFormatter.class/methodProperties.json @@ -8,7 +8,7 @@ "formatMethod:" : "tobe 3/10/2021 13:32", "formatPackage:" : "tobe 3/10/2021 14:59", "formatString:class:noPattern:" : "tobe 3/10/2021 15:47", - "formatString:class:noPattern:notifying:" : "JW 7/23/2022 13:57", + "formatString:class:noPattern:notifying:" : "JW 7/24/2022 19:43", "formatString:class:noPattern:notifying:with:" : "KD 6/15/2022 16:11", "formatString:class:noPattern:with:" : "Alexander Ungefug 6/1/2022 16:06", "stripMethodPattern:" : "tobe 3/19/2021 18:51" }, diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/preferenceConfig.st b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/preferenceConfig.st index 0d67e6d..0351dce 100644 --- a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/preferenceConfig.st +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/preferenceConfig.st @@ -1,5 +1,6 @@ configs preferenceConfig - "The Personalized Config is the Default Config for now. In later Issues we want this Method to return the Config specified in the Prefrence Browser." - ^ self default \ No newline at end of file + self shouldUseDefaultAsPreferenceConfig ifTrue: [^ PPFormatterConfig default]. + "The Personalized Config is the Default Config for now. In later Issues we want this Method to return the Config specified in the Prefrence Browser." + ^ PPFormatterConfig default \ No newline at end of file diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/shouldUseDefaultAsPreferenceConfig..st b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/shouldUseDefaultAsPreferenceConfig..st new file mode 100644 index 0000000..969c7f8 --- /dev/null +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/shouldUseDefaultAsPreferenceConfig..st @@ -0,0 +1,4 @@ +accessing +shouldUseDefaultAsPreferenceConfig: aBoolean + + ShouldUseDefaultAsPreferenceConfig := aBoolean \ No newline at end of file diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/shouldUseDefaultAsPreferenceConfig.st b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/shouldUseDefaultAsPreferenceConfig.st new file mode 100644 index 0000000..db9de1a --- /dev/null +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/shouldUseDefaultAsPreferenceConfig.st @@ -0,0 +1,4 @@ +accessing +shouldUseDefaultAsPreferenceConfig + + ^ ShouldUseDefaultAsPreferenceConfig ifNil: [ShouldUseDefaultAsPreferenceConfig := false] \ No newline at end of file diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json index 8dc7073..747e95e 100644 --- a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json @@ -5,7 +5,9 @@ "packageConfigForClass:" : "JW 7/23/2022 11:51", "packageConfigForMethod:" : "JW 6/30/2022 18:28", "packageConfigForPackage:" : "JW 7/23/2022 11:50", - "preferenceConfig" : "JW 7/23/2022 13:56" }, + "preferenceConfig" : "JW 7/24/2022 19:51", + "shouldUseDefaultAsPreferenceConfig" : "JW 7/24/2022 19:48", + "shouldUseDefaultAsPreferenceConfig:" : "JW 7/24/2022 19:49" }, "instance" : { "spaceBeforeComma" : "JW 7/21/2022 17:40", "spaceBeforeComma:" : "YH 6/2/2022 14:16", diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/properties.json b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/properties.json index 8d7bee4..487c959 100644 --- a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/properties.json +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/properties.json @@ -3,7 +3,7 @@ "classinstvars" : [ ], "classvars" : [ - ], + "ShouldUseDefaultAsPreferenceConfig" ], "commentStamp" : "", "instvars" : [ "spaceBeforeComma", diff --git a/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/getProjectConfig.st b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/getProjectConfig.st index 8454698..8ef5698 100644 --- a/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/getProjectConfig.st +++ b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/getProjectConfig.st @@ -3,8 +3,5 @@ getProjectConfig model ifNil: [^ PPFormatterConfig default]. model editSelection = #newMessage ifTrue: [^ PPFormatterConfig packageConfigForClass: model selectedClass]. - model editSelection = #editMessage ifTrue: [ - model metaClassIndicated - ifTrue: [^ PPFormatterConfig packageConfigForMethod: model selectedClass class >> model selectedMessageName] - ifFalse: [^ PPFormatterConfig packageConfigForMethod: model selectedClass >> model selectedMessageName]]. + model editSelection = #editMessage ifTrue: [^ PPFormatterConfig packageConfigForMethod: model selectedClassOrMetaClass >> model selectedMessageName]. ^ PPFormatterConfig default. \ No newline at end of file diff --git a/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/methodProperties.json b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/methodProperties.json index 5c30336..4becf79 100644 --- a/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/methodProperties.json +++ b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/methodProperties.json @@ -3,4 +3,4 @@ }, "instance" : { "acceptTextInModel" : "JW 7/23/2022 13:30", - "getProjectConfig" : "JW 7/23/2022 13:25" } } + "getProjectConfig" : "JW 7/24/2022 18:52" } } diff --git a/packages/PoppyPrint-Tests.package/PPSimulationExample.class/README.md b/packages/PoppyPrint-Tests.package/PPSimulationExample.class/README.md new file mode 100644 index 0000000..e69de29 diff --git a/packages/PoppyPrint-Tests.package/PPSimulationExample.class/class/poppyConfig..st b/packages/PoppyPrint-Tests.package/PPSimulationExample.class/class/poppyConfig..st new file mode 100644 index 0000000..a379d0e --- /dev/null +++ b/packages/PoppyPrint-Tests.package/PPSimulationExample.class/class/poppyConfig..st @@ -0,0 +1,7 @@ +config +poppyConfig: aMethod + + + ^ PPFormatterConfig default + spaceBeforePointInArray: true; + spaceBeforeComma: true \ No newline at end of file diff --git a/packages/PoppyPrint-Tests.package/PPSimulationExample.class/instance/example.st b/packages/PoppyPrint-Tests.package/PPSimulationExample.class/instance/example.st new file mode 100644 index 0000000..0154ab5 --- /dev/null +++ b/packages/PoppyPrint-Tests.package/PPSimulationExample.class/instance/example.st @@ -0,0 +1,4 @@ +examples +example + + "This Method will be rewritten in PPSimulationTest" \ No newline at end of file diff --git a/packages/PoppyPrint-Tests.package/PPSimulationExample.class/methodProperties.json b/packages/PoppyPrint-Tests.package/PPSimulationExample.class/methodProperties.json new file mode 100644 index 0000000..2271c0a --- /dev/null +++ b/packages/PoppyPrint-Tests.package/PPSimulationExample.class/methodProperties.json @@ -0,0 +1,5 @@ +{ + "class" : { + "poppyConfig:" : "JW 7/24/2022 18:47" }, + "instance" : { + "example" : "JW 7/24/2022 19:58" } } diff --git a/packages/PoppyPrint-Tests.package/PPSimulationExample.class/properties.json b/packages/PoppyPrint-Tests.package/PPSimulationExample.class/properties.json new file mode 100644 index 0000000..9e452c6 --- /dev/null +++ b/packages/PoppyPrint-Tests.package/PPSimulationExample.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "PoppyPrint-Tests", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PPSimulationExample", + "pools" : [ + ], + "super" : "Object", + "type" : "normal" } diff --git a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/README.md b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/README.md new file mode 100644 index 0000000..e69de29 diff --git a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/accepting.expectingSorce.andPretty..st b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/accepting.expectingSorce.andPretty..st new file mode 100644 index 0000000..2250a78 --- /dev/null +++ b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/accepting.expectingSorce.andPretty..st @@ -0,0 +1,13 @@ +helper +accepting: aString expectingSorce: aSourceString andPretty: aPrettyString + + | browser source pretty | + PPFormatterConfig shouldUseDefaultAsPreferenceConfig: true. + browser := self getBrowser. + self setMethodContentsTo: aString of: browser using: #prettyPrint. + source := self getSourceContentOf: browser. + pretty := self getPrettyContentOf: browser. + self close: browser. + PPFormatterConfig shouldUseDefaultAsPreferenceConfig: false. + self assert: aSourceString equals: source. + self assert: aPrettyString equals: pretty \ No newline at end of file diff --git a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/close..st b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/close..st new file mode 100644 index 0000000..99dc378 --- /dev/null +++ b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/close..st @@ -0,0 +1,9 @@ +helper +close: aBrowser + + self setMethodContentsTo: 'example + + "This Method will be rewritten in PPSimulationTest"' + of: aBrowser + using: #source. + (aBrowser dependents at: 1) delete \ No newline at end of file diff --git a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/getBrowser.st b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/getBrowser.st new file mode 100644 index 0000000..62b7be3 --- /dev/null +++ b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/getBrowser.st @@ -0,0 +1,8 @@ +helper +getBrowser + + | browser | + browser := SystemBrowser default open. + browser selectClass: PPSimulationExample. + browser selectMessageNamed: #example. + ^ browser \ No newline at end of file diff --git a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/getPrettyContentOf..st b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/getPrettyContentOf..st new file mode 100644 index 0000000..cce4b76 --- /dev/null +++ b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/getPrettyContentOf..st @@ -0,0 +1,6 @@ +helper +getPrettyContentOf: aBrowser + + aBrowser contentsSymbol: #prettyPrint. + aBrowser contents: nil. + ^ aBrowser contents asString \ No newline at end of file diff --git a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/getSourceContentOf..st b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/getSourceContentOf..st new file mode 100644 index 0000000..3e88d46 --- /dev/null +++ b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/getSourceContentOf..st @@ -0,0 +1,6 @@ +helper +getSourceContentOf: aBrowser + + aBrowser contentsSymbol: #source. + aBrowser contents: nil. + ^ aBrowser contents asString \ No newline at end of file diff --git a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/setMethodContentsTo.of.using..st b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/setMethodContentsTo.of.using..st new file mode 100644 index 0000000..cfb701d --- /dev/null +++ b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/setMethodContentsTo.of.using..st @@ -0,0 +1,7 @@ +helper +setMethodContentsTo: aString of: aBrowser using: aSymbol + + aBrowser contentsSymbol: aSymbol. + (aBrowser dependents at: 18) textMorph contents: aString. + (aBrowser dependents at: 18) hasUnacceptedEdits: true. + (aBrowser dependents at: 18) accept \ No newline at end of file diff --git a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/testProjectVsPersonalizedConfig1.st b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/testProjectVsPersonalizedConfig1.st new file mode 100644 index 0000000..f2fefa3 --- /dev/null +++ b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/testProjectVsPersonalizedConfig1.st @@ -0,0 +1,10 @@ +tests +testProjectVsPersonalizedConfig1 + + self accepting: 'example + + {#a.#b.#c}' expectingSorce: 'example + + {#a . #b . #c}' andPretty: 'example + + {#a. #b. #c}' \ No newline at end of file diff --git a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/testProjectVsPersonalizedConfig2.st b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/testProjectVsPersonalizedConfig2.st new file mode 100644 index 0000000..87f1cd4 --- /dev/null +++ b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/testProjectVsPersonalizedConfig2.st @@ -0,0 +1,10 @@ +tests +testProjectVsPersonalizedConfig2 + + self accepting: 'example + + ''a'',''b'',''c''' expectingSorce: 'example + + ''a'' , ''b'' , ''c''' andPretty: 'example + + ''a'', ''b'', ''c''' \ No newline at end of file diff --git a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/methodProperties.json b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/methodProperties.json new file mode 100644 index 0000000..c2f1a64 --- /dev/null +++ b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/methodProperties.json @@ -0,0 +1,12 @@ +{ + "class" : { + }, + "instance" : { + "accepting:expectingSorce:andPretty:" : "JW 7/24/2022 19:52", + "close:" : "JW 7/24/2022 19:57", + "getBrowser" : "JW 7/24/2022 19:00", + "getPrettyContentOf:" : "JW 7/24/2022 19:31", + "getSourceContentOf:" : "JW 7/24/2022 19:31", + "setMethodContentsTo:of:using:" : "JW 7/24/2022 19:33", + "testProjectVsPersonalizedConfig1" : "JW 7/24/2022 19:35", + "testProjectVsPersonalizedConfig2" : "JW 7/24/2022 19:54" } } diff --git a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/properties.json b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/properties.json new file mode 100644 index 0000000..be94abc --- /dev/null +++ b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/properties.json @@ -0,0 +1,14 @@ +{ + "category" : "PoppyPrint-Tests", + "classinstvars" : [ + ], + "classvars" : [ + ], + "commentStamp" : "", + "instvars" : [ + ], + "name" : "PPSimulationTest", + "pools" : [ + ], + "super" : "TestCase", + "type" : "normal" } From ac4b07367168ef2c591c10baff165a82b7d9abca Mon Sep 17 00:00:00 2001 From: Janis Wehen Date: Sun, 24 Jul 2022 20:54:49 +0200 Subject: [PATCH 08/15] rename category --- .../PPFormatterConfig.class/class/default.st | 2 +- .../PPFormatterConfig.class/class/packageConfigForClass..st | 2 +- .../PPFormatterConfig.class/class/packageConfigForMethod..st | 2 +- .../PPFormatterConfig.class/class/packageConfigForPackage..st | 2 +- .../PPFormatterConfig.class/class/preferenceConfig.st | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/default.st b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/default.st index 7f2e8fd..50c1600 100644 --- a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/default.st +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/default.st @@ -1,4 +1,4 @@ -configs +config default "Default is lazy initialized" diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForClass..st b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForClass..st index 97575c4..0f992db 100644 --- a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForClass..st +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForClass..st @@ -1,4 +1,4 @@ -configs +config packageConfigForClass: aClass ^ self packageConfigForPackage: aClass package \ No newline at end of file diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForMethod..st b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForMethod..st index af7ed0e..814cacf 100644 --- a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForMethod..st +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForMethod..st @@ -1,4 +1,4 @@ -configs +config packageConfigForMethod: aCompiledMethod | classesInPackage ppConfigMethods config | diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForPackage..st b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForPackage..st index 234de7f..a7198c5 100644 --- a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForPackage..st +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForPackage..st @@ -1,4 +1,4 @@ -configs +config packageConfigForPackage: aPackage | classesInPackage ppConfigMethods config | diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/preferenceConfig.st b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/preferenceConfig.st index 0351dce..d5da779 100644 --- a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/preferenceConfig.st +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/preferenceConfig.st @@ -1,4 +1,4 @@ -configs +config preferenceConfig self shouldUseDefaultAsPreferenceConfig ifTrue: [^ PPFormatterConfig default]. From 24543b9ccda0c107196d26f5466cd7db8aba9020 Mon Sep 17 00:00:00 2001 From: Janis Wehen Date: Sun, 24 Jul 2022 22:28:20 +0200 Subject: [PATCH 09/15] added Config getter test --- .../instance/testGetProjectConfigOfMethod.st | 6 ++++++ .../PPFormatterTest.class/methodProperties.json | 1 + 2 files changed, 7 insertions(+) create mode 100644 packages/PoppyPrint-Tests.package/PPFormatterTest.class/instance/testGetProjectConfigOfMethod.st diff --git a/packages/PoppyPrint-Tests.package/PPFormatterTest.class/instance/testGetProjectConfigOfMethod.st b/packages/PoppyPrint-Tests.package/PPFormatterTest.class/instance/testGetProjectConfigOfMethod.st new file mode 100644 index 0000000..91fa397 --- /dev/null +++ b/packages/PoppyPrint-Tests.package/PPFormatterTest.class/instance/testGetProjectConfigOfMethod.st @@ -0,0 +1,6 @@ +tests - projectConfig +testGetProjectConfigOfMethod + + self + assert: (PPSimulationExample poppyConfig: PPSimulationExample >> #example) instanceVariableValues + equals: (PPFormatterConfig packageConfigForMethod: PPSimulationExample >> #example) instanceVariableValues \ No newline at end of file diff --git a/packages/PoppyPrint-Tests.package/PPFormatterTest.class/methodProperties.json b/packages/PoppyPrint-Tests.package/PPFormatterTest.class/methodProperties.json index 07e86b5..cdb7100 100644 --- a/packages/PoppyPrint-Tests.package/PPFormatterTest.class/methodProperties.json +++ b/packages/PoppyPrint-Tests.package/PPFormatterTest.class/methodProperties.json @@ -23,6 +23,7 @@ "testEmptyLineInCaseOf" : "tobe 3/11/2021 10:54", "testEmptyLinesBetweenComments" : "tobe 3/11/2021 11:35", "testEmptyMethod" : "tobe 3/10/2021 14:58", + "testGetProjectConfigOfMethod" : "JW 7/24/2022 22:27", "testGithubIssue7" : "tobe 3/11/2021 11:15", "testInlineCommentWithNewline" : "KD 6/15/2022 16:11", "testKeepEmptyLines" : "tobe 3/10/2021 14:58", From fff3fc38857155a9039e381c8a1b72d8d68ee12c Mon Sep 17 00:00:00 2001 From: Janis Wehen Date: Mon, 25 Jul 2022 00:12:14 +0200 Subject: [PATCH 10/15] now using packageInfo (implemented in default Squeak) instead of package (implemented in Squot) to avoid having Squot as an extra dependency --- .../PPFormatterConfig.class/class/packageConfigForClass..st | 2 +- .../PPFormatterConfig.class/class/packageConfigForMethod..st | 4 ++-- .../PPFormatterConfig.class/methodProperties.json | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForClass..st b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForClass..st index 0f992db..210366a 100644 --- a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForClass..st +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForClass..st @@ -1,4 +1,4 @@ config packageConfigForClass: aClass - ^ self packageConfigForPackage: aClass package \ No newline at end of file + ^ self packageConfigForPackage: aClass packageInfo \ No newline at end of file diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForMethod..st b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForMethod..st index 814cacf..3a8c534 100644 --- a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForMethod..st +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForMethod..st @@ -2,10 +2,10 @@ config packageConfigForMethod: aCompiledMethod | classesInPackage ppConfigMethods config | - classesInPackage := aCompiledMethod methodClass package classes. + classesInPackage := aCompiledMethod methodClass packageInfo classes. ppConfigMethods := self getClassMethodsWithPragma: #ppProjectConfig inClasses: classesInPackage. ppConfigMethods size = 0 ifTrue: [^ self default]. - ppConfigMethods size = 1 ifFalse: [self error: 'More than one Config found in Package: ', aCompiledMethod methodClass package asString]. + ppConfigMethods size = 1 ifFalse: [self error: 'More than one Config found in Package: ', aCompiledMethod methodClass packageInfo asString]. config := ppConfigMethods first methodClass soleInstance perform: ppConfigMethods first selector with: aCompiledMethod. config class = PPFormatterConfig ifFalse: [self error: 'Config returned by ', ppConfigMethods first selector asString,' is not of Type PPFormatterConfig.']. ^ config \ No newline at end of file diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json index 747e95e..20e9296 100644 --- a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json @@ -2,8 +2,8 @@ "class" : { "default" : "KD 6/15/2022 16:11", "getClassMethodsWithPragma:inClasses:" : "JW 6/30/2022 18:08", - "packageConfigForClass:" : "JW 7/23/2022 11:51", - "packageConfigForMethod:" : "JW 6/30/2022 18:28", + "packageConfigForClass:" : "JW 7/25/2022 00:08", + "packageConfigForMethod:" : "JW 7/25/2022 00:09", "packageConfigForPackage:" : "JW 7/23/2022 11:50", "preferenceConfig" : "JW 7/24/2022 19:51", "shouldUseDefaultAsPreferenceConfig" : "JW 7/24/2022 19:48", From 93cc0511c35114116efbfec399980b4b35b569a4 Mon Sep 17 00:00:00 2001 From: Janis Wehen Date: Mon, 25 Jul 2022 01:23:52 +0200 Subject: [PATCH 11/15] the simulationTest will now use PoppyPrint by calling 'Behavior compile: 'prettyPrinterClass ^ PPFormatter' and then undo --- .../PPSimulationExample.class/methodProperties.json | 2 +- .../instance/accepting.expectingSorce.andPretty..st | 5 ++++- .../PPSimulationTest.class/methodProperties.json | 2 +- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/packages/PoppyPrint-Tests.package/PPSimulationExample.class/methodProperties.json b/packages/PoppyPrint-Tests.package/PPSimulationExample.class/methodProperties.json index 2271c0a..3b6e02f 100644 --- a/packages/PoppyPrint-Tests.package/PPSimulationExample.class/methodProperties.json +++ b/packages/PoppyPrint-Tests.package/PPSimulationExample.class/methodProperties.json @@ -2,4 +2,4 @@ "class" : { "poppyConfig:" : "JW 7/24/2022 18:47" }, "instance" : { - "example" : "JW 7/24/2022 19:58" } } + "example" : "JW 7/25/2022 01:19" } } diff --git a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/accepting.expectingSorce.andPretty..st b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/accepting.expectingSorce.andPretty..st index 2250a78..b5ee9a4 100644 --- a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/accepting.expectingSorce.andPretty..st +++ b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/accepting.expectingSorce.andPretty..st @@ -1,7 +1,9 @@ helper accepting: aString expectingSorce: aSourceString andPretty: aPrettyString - | browser source pretty | + | browser source pretty prettyPrinterClassSorce | + prettyPrinterClassSorce := (Behavior >> #prettyPrinterClass) getSourceFromFile string. + Behavior compile: 'prettyPrinterClass ^ PPFormatter'. PPFormatterConfig shouldUseDefaultAsPreferenceConfig: true. browser := self getBrowser. self setMethodContentsTo: aString of: browser using: #prettyPrint. @@ -9,5 +11,6 @@ accepting: aString expectingSorce: aSourceString andPretty: aPrettyString pretty := self getPrettyContentOf: browser. self close: browser. PPFormatterConfig shouldUseDefaultAsPreferenceConfig: false. + Behavior compile: prettyPrinterClassSorce. self assert: aSourceString equals: source. self assert: aPrettyString equals: pretty \ No newline at end of file diff --git a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/methodProperties.json b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/methodProperties.json index c2f1a64..babd2e0 100644 --- a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/methodProperties.json +++ b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/methodProperties.json @@ -2,7 +2,7 @@ "class" : { }, "instance" : { - "accepting:expectingSorce:andPretty:" : "JW 7/24/2022 19:52", + "accepting:expectingSorce:andPretty:" : "JW 7/25/2022 01:19", "close:" : "JW 7/24/2022 19:57", "getBrowser" : "JW 7/24/2022 19:00", "getPrettyContentOf:" : "JW 7/24/2022 19:31", From 64ae762c95a677c928c5271ad2d4ceb9c89ffbae Mon Sep 17 00:00:00 2001 From: Janis Wehen Date: Mon, 25 Jul 2022 13:46:13 +0200 Subject: [PATCH 12/15] more elegant solution for getClassMethodsWithPragma:inClasses:. Implementing checks for if model responds to messages. Fixing Typo sorce -> source --- .../class/getClassMethodsWithPragma.inClasses..st | 8 ++------ .../PPFormatterConfig.class/methodProperties.json | 2 +- .../instance/acceptTextInModel.st | 2 +- .../instance/getProjectConfig.st | 2 +- .../methodProperties.json | 4 ++-- ...Pretty..st => accepting.expectingSource.andPretty..st} | 2 +- .../instance/testProjectVsPersonalizedConfig1.st | 2 +- .../instance/testProjectVsPersonalizedConfig2.st | 2 +- .../PPSimulationTest.class/methodProperties.json | 6 +++--- 9 files changed, 13 insertions(+), 17 deletions(-) rename packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/{accepting.expectingSorce.andPretty..st => accepting.expectingSource.andPretty..st} (89%) diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/getClassMethodsWithPragma.inClasses..st b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/getClassMethodsWithPragma.inClasses..st index a95a7fc..76b050c 100644 --- a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/getClassMethodsWithPragma.inClasses..st +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/getClassMethodsWithPragma.inClasses..st @@ -1,9 +1,5 @@ helpers getClassMethodsWithPragma: aSymbol inClasses: aClassList - | stream methodsWithPragma | - stream := WriteStream with: #(). - (aClassList collect: [:methodClass | Pragma allNamed: aSymbol in: (methodClass class)]) do: [:listOfMethods | stream nextPutAll: listOfMethods]. - methodsWithPragma := stream contents. - methodsWithPragma := methodsWithPragma collect: [:aPragma | aPragma method]. - ^ methodsWithPragma \ No newline at end of file + ^ (aClassList gather: [:methodClass | Pragma allNamed: aSymbol in: methodClass class]) + collect: [:pragma | pragma method] \ No newline at end of file diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json index 20e9296..12afca0 100644 --- a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json @@ -1,7 +1,7 @@ { "class" : { "default" : "KD 6/15/2022 16:11", - "getClassMethodsWithPragma:inClasses:" : "JW 6/30/2022 18:08", + "getClassMethodsWithPragma:inClasses:" : "JW 7/25/2022 13:43", "packageConfigForClass:" : "JW 7/25/2022 00:08", "packageConfigForMethod:" : "JW 7/25/2022 00:09", "packageConfigForPackage:" : "JW 7/23/2022 11:50", diff --git a/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/acceptTextInModel.st b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/acceptTextInModel.st index 16d632b..741ecd2 100644 --- a/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/acceptTextInModel.st +++ b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/acceptTextInModel.st @@ -13,7 +13,7 @@ acceptTextInModel that when #correctFrom:to:with: is received we can also apply the correction to it" text := textMorph asText. - model ifNotNil: [ + (model isNil not and: [(model respondsTo: #contentsSymbol) and: [model respondsTo: #editSelection]]) ifTrue: [ (model contentsSymbol = #prettyPrint and: [model editSelection = #newMessage or: [model editSelection = #editMessage]]) ifTrue: [ text := PPFormatter formatString: text asString diff --git a/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/getProjectConfig.st b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/getProjectConfig.st index 8ef5698..40f2475 100644 --- a/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/getProjectConfig.st +++ b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/getProjectConfig.st @@ -1,7 +1,7 @@ *PoppyPrint-Core-override getProjectConfig - model ifNil: [^ PPFormatterConfig default]. + (model isNil or: [(model respondsTo: #editSelection) not]) ifTrue: [^ PPFormatterConfig default]. model editSelection = #newMessage ifTrue: [^ PPFormatterConfig packageConfigForClass: model selectedClass]. model editSelection = #editMessage ifTrue: [^ PPFormatterConfig packageConfigForMethod: model selectedClassOrMetaClass >> model selectedMessageName]. ^ PPFormatterConfig default. \ No newline at end of file diff --git a/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/methodProperties.json b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/methodProperties.json index 4becf79..28da518 100644 --- a/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/methodProperties.json +++ b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/methodProperties.json @@ -2,5 +2,5 @@ "class" : { }, "instance" : { - "acceptTextInModel" : "JW 7/23/2022 13:30", - "getProjectConfig" : "JW 7/24/2022 18:52" } } + "acceptTextInModel" : "JW 7/25/2022 13:35", + "getProjectConfig" : "JW 7/25/2022 13:37" } } diff --git a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/accepting.expectingSorce.andPretty..st b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/accepting.expectingSource.andPretty..st similarity index 89% rename from packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/accepting.expectingSorce.andPretty..st rename to packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/accepting.expectingSource.andPretty..st index b5ee9a4..c3c5967 100644 --- a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/accepting.expectingSorce.andPretty..st +++ b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/accepting.expectingSource.andPretty..st @@ -1,5 +1,5 @@ helper -accepting: aString expectingSorce: aSourceString andPretty: aPrettyString +accepting: aString expectingSource: aSourceString andPretty: aPrettyString | browser source pretty prettyPrinterClassSorce | prettyPrinterClassSorce := (Behavior >> #prettyPrinterClass) getSourceFromFile string. diff --git a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/testProjectVsPersonalizedConfig1.st b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/testProjectVsPersonalizedConfig1.st index f2fefa3..df0484d 100644 --- a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/testProjectVsPersonalizedConfig1.st +++ b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/testProjectVsPersonalizedConfig1.st @@ -3,7 +3,7 @@ testProjectVsPersonalizedConfig1 self accepting: 'example - {#a.#b.#c}' expectingSorce: 'example + {#a.#b.#c}' expectingSource: 'example {#a . #b . #c}' andPretty: 'example diff --git a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/testProjectVsPersonalizedConfig2.st b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/testProjectVsPersonalizedConfig2.st index 87f1cd4..851f9b5 100644 --- a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/testProjectVsPersonalizedConfig2.st +++ b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/testProjectVsPersonalizedConfig2.st @@ -3,7 +3,7 @@ testProjectVsPersonalizedConfig2 self accepting: 'example - ''a'',''b'',''c''' expectingSorce: 'example + ''a'',''b'',''c''' expectingSource: 'example ''a'' , ''b'' , ''c''' andPretty: 'example diff --git a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/methodProperties.json b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/methodProperties.json index babd2e0..5f0ecd7 100644 --- a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/methodProperties.json +++ b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/methodProperties.json @@ -2,11 +2,11 @@ "class" : { }, "instance" : { - "accepting:expectingSorce:andPretty:" : "JW 7/25/2022 01:19", + "accepting:expectingSource:andPretty:" : "JW 7/25/2022 13:40", "close:" : "JW 7/24/2022 19:57", "getBrowser" : "JW 7/24/2022 19:00", "getPrettyContentOf:" : "JW 7/24/2022 19:31", "getSourceContentOf:" : "JW 7/24/2022 19:31", "setMethodContentsTo:of:using:" : "JW 7/24/2022 19:33", - "testProjectVsPersonalizedConfig1" : "JW 7/24/2022 19:35", - "testProjectVsPersonalizedConfig2" : "JW 7/24/2022 19:54" } } + "testProjectVsPersonalizedConfig1" : "JW 7/25/2022 13:40", + "testProjectVsPersonalizedConfig2" : "JW 7/25/2022 13:40" } } From 1cd8bbae942dd5ad68f159fa07addad1728c6625 Mon Sep 17 00:00:00 2001 From: Janis Wehen Date: Mon, 25 Jul 2022 14:55:50 +0200 Subject: [PATCH 13/15] removeing model notNil test, because nil respondsTo: #respondsTo: --- .../instance/acceptTextInModel.st | 2 +- .../instance/getProjectConfig.st | 2 +- .../PluggableTextMorphPlus.extension/methodProperties.json | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/acceptTextInModel.st b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/acceptTextInModel.st index 741ecd2..dc6fa40 100644 --- a/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/acceptTextInModel.st +++ b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/acceptTextInModel.st @@ -13,7 +13,7 @@ acceptTextInModel that when #correctFrom:to:with: is received we can also apply the correction to it" text := textMorph asText. - (model isNil not and: [(model respondsTo: #contentsSymbol) and: [model respondsTo: #editSelection]]) ifTrue: [ + ((model respondsTo: #contentsSymbol) and: [model respondsTo: #editSelection]) ifTrue: [ (model contentsSymbol = #prettyPrint and: [model editSelection = #newMessage or: [model editSelection = #editMessage]]) ifTrue: [ text := PPFormatter formatString: text asString diff --git a/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/getProjectConfig.st b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/getProjectConfig.st index 40f2475..19f5fa5 100644 --- a/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/getProjectConfig.st +++ b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/instance/getProjectConfig.st @@ -1,7 +1,7 @@ *PoppyPrint-Core-override getProjectConfig - (model isNil or: [(model respondsTo: #editSelection) not]) ifTrue: [^ PPFormatterConfig default]. + (model respondsTo: #editSelection) ifFalse: [^ PPFormatterConfig default]. model editSelection = #newMessage ifTrue: [^ PPFormatterConfig packageConfigForClass: model selectedClass]. model editSelection = #editMessage ifTrue: [^ PPFormatterConfig packageConfigForMethod: model selectedClassOrMetaClass >> model selectedMessageName]. ^ PPFormatterConfig default. \ No newline at end of file diff --git a/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/methodProperties.json b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/methodProperties.json index 28da518..835c67e 100644 --- a/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/methodProperties.json +++ b/packages/PoppyPrint-Core.package/PluggableTextMorphPlus.extension/methodProperties.json @@ -2,5 +2,5 @@ "class" : { }, "instance" : { - "acceptTextInModel" : "JW 7/25/2022 13:35", - "getProjectConfig" : "JW 7/25/2022 13:37" } } + "acceptTextInModel" : "JW 7/25/2022 14:53", + "getProjectConfig" : "JW 7/25/2022 14:53" } } From ee95746a6866d3e129760523d9a2d3cde570ef60 Mon Sep 17 00:00:00 2001 From: Janis Wehen Date: Mon, 25 Jul 2022 18:27:47 +0200 Subject: [PATCH 14/15] adding setUp and tearDown for simulation tests --- .../PPSimulationExample.class/methodProperties.json | 2 +- .../instance/accepting.expectingSource.andPretty..st | 7 +------ .../PPSimulationTest.class/instance/setUp.st | 7 +++++++ .../PPSimulationTest.class/instance/tearDown.st | 5 +++++ .../PPSimulationTest.class/methodProperties.json | 4 +++- .../PPSimulationTest.class/properties.json | 2 +- 6 files changed, 18 insertions(+), 9 deletions(-) create mode 100644 packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/setUp.st create mode 100644 packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/tearDown.st diff --git a/packages/PoppyPrint-Tests.package/PPSimulationExample.class/methodProperties.json b/packages/PoppyPrint-Tests.package/PPSimulationExample.class/methodProperties.json index 3b6e02f..cae478c 100644 --- a/packages/PoppyPrint-Tests.package/PPSimulationExample.class/methodProperties.json +++ b/packages/PoppyPrint-Tests.package/PPSimulationExample.class/methodProperties.json @@ -2,4 +2,4 @@ "class" : { "poppyConfig:" : "JW 7/24/2022 18:47" }, "instance" : { - "example" : "JW 7/25/2022 01:19" } } + "example" : "JW 7/25/2022 18:24" } } diff --git a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/accepting.expectingSource.andPretty..st b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/accepting.expectingSource.andPretty..st index c3c5967..710e0a0 100644 --- a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/accepting.expectingSource.andPretty..st +++ b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/accepting.expectingSource.andPretty..st @@ -1,16 +1,11 @@ helper accepting: aString expectingSource: aSourceString andPretty: aPrettyString - | browser source pretty prettyPrinterClassSorce | - prettyPrinterClassSorce := (Behavior >> #prettyPrinterClass) getSourceFromFile string. - Behavior compile: 'prettyPrinterClass ^ PPFormatter'. - PPFormatterConfig shouldUseDefaultAsPreferenceConfig: true. + | browser source pretty | browser := self getBrowser. self setMethodContentsTo: aString of: browser using: #prettyPrint. source := self getSourceContentOf: browser. pretty := self getPrettyContentOf: browser. self close: browser. - PPFormatterConfig shouldUseDefaultAsPreferenceConfig: false. - Behavior compile: prettyPrinterClassSorce. self assert: aSourceString equals: source. self assert: aPrettyString equals: pretty \ No newline at end of file diff --git a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/setUp.st b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/setUp.st new file mode 100644 index 0000000..d257be4 --- /dev/null +++ b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/setUp.st @@ -0,0 +1,7 @@ +setUp-tearDown +setUp + + super setUp. + PPFormatterConfig shouldUseDefaultAsPreferenceConfig: true. + prettyPrinterClassSource := (Behavior >> #prettyPrinterClass) getSourceFromFile string. + Behavior compile: 'prettyPrinterClass ^ PPFormatter'. \ No newline at end of file diff --git a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/tearDown.st b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/tearDown.st new file mode 100644 index 0000000..2106106 --- /dev/null +++ b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/instance/tearDown.st @@ -0,0 +1,5 @@ +setUp-tearDown +tearDown + + [PPFormatterConfig shouldUseDefaultAsPreferenceConfig: false. + Behavior compile: prettyPrinterClassSource] ensure: [super tearDown] \ No newline at end of file diff --git a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/methodProperties.json b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/methodProperties.json index 5f0ecd7..4461b1d 100644 --- a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/methodProperties.json +++ b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/methodProperties.json @@ -2,11 +2,13 @@ "class" : { }, "instance" : { - "accepting:expectingSource:andPretty:" : "JW 7/25/2022 13:40", + "accepting:expectingSource:andPretty:" : "JW 7/25/2022 18:24", "close:" : "JW 7/24/2022 19:57", "getBrowser" : "JW 7/24/2022 19:00", "getPrettyContentOf:" : "JW 7/24/2022 19:31", "getSourceContentOf:" : "JW 7/24/2022 19:31", "setMethodContentsTo:of:using:" : "JW 7/24/2022 19:33", + "setUp" : "JW 7/25/2022 18:23", + "tearDown" : "JW 7/25/2022 18:24", "testProjectVsPersonalizedConfig1" : "JW 7/25/2022 13:40", "testProjectVsPersonalizedConfig2" : "JW 7/25/2022 13:40" } } diff --git a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/properties.json b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/properties.json index be94abc..2f6f2a9 100644 --- a/packages/PoppyPrint-Tests.package/PPSimulationTest.class/properties.json +++ b/packages/PoppyPrint-Tests.package/PPSimulationTest.class/properties.json @@ -6,7 +6,7 @@ ], "commentStamp" : "", "instvars" : [ - ], + "prettyPrinterClassSource" ], "name" : "PPSimulationTest", "pools" : [ ], From aae6f3160c9f6ff4bac6e2e029ec84fb9239ba04 Mon Sep 17 00:00:00 2001 From: Janis Wehen Date: Wed, 27 Jul 2022 11:11:06 +0200 Subject: [PATCH 15/15] extracting Method from packageConfigForPackage: and packageConfigForMethod: --- .../class/packageConfigForMethod..st | 9 +-------- .../class/packageConfigForMethod.in..st | 11 +++++++++++ .../class/packageConfigForPackage..st | 9 +-------- .../PPFormatterConfig.class/methodProperties.json | 5 +++-- 4 files changed, 16 insertions(+), 18 deletions(-) create mode 100644 packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForMethod.in..st diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForMethod..st b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForMethod..st index 3a8c534..072a3f9 100644 --- a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForMethod..st +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForMethod..st @@ -1,11 +1,4 @@ config packageConfigForMethod: aCompiledMethod - | classesInPackage ppConfigMethods config | - classesInPackage := aCompiledMethod methodClass packageInfo classes. - ppConfigMethods := self getClassMethodsWithPragma: #ppProjectConfig inClasses: classesInPackage. - ppConfigMethods size = 0 ifTrue: [^ self default]. - ppConfigMethods size = 1 ifFalse: [self error: 'More than one Config found in Package: ', aCompiledMethod methodClass packageInfo asString]. - config := ppConfigMethods first methodClass soleInstance perform: ppConfigMethods first selector with: aCompiledMethod. - config class = PPFormatterConfig ifFalse: [self error: 'Config returned by ', ppConfigMethods first selector asString,' is not of Type PPFormatterConfig.']. - ^ config \ No newline at end of file + ^ self packageConfigForMethod: aCompiledMethod in: aCompiledMethod methodClass packageInfo \ No newline at end of file diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForMethod.in..st b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForMethod.in..st new file mode 100644 index 0000000..f0c8757 --- /dev/null +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForMethod.in..st @@ -0,0 +1,11 @@ +config +packageConfigForMethod: aCompiledMethod in: aPackage + + | classesInPackage ppConfigMethods config | + classesInPackage := aPackage classes. + ppConfigMethods := self getClassMethodsWithPragma: #ppProjectConfig inClasses: classesInPackage. + ppConfigMethods size = 0 ifTrue: [^ self default]. + ppConfigMethods size = 1 ifFalse: [self error: 'More than one Config found in Package: ', aPackage asString]. + config := ppConfigMethods first methodClass soleInstance perform: ppConfigMethods first selector with: aCompiledMethod. + config class = PPFormatterConfig ifFalse: [self error: 'Config returned by ', ppConfigMethods first selector asString,' is not of Type PPFormatterConfig.']. + ^ config \ No newline at end of file diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForPackage..st b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForPackage..st index a7198c5..f47ad93 100644 --- a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForPackage..st +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/class/packageConfigForPackage..st @@ -1,11 +1,4 @@ config packageConfigForPackage: aPackage - | classesInPackage ppConfigMethods config | - classesInPackage := aPackage classes. - ppConfigMethods := self getClassMethodsWithPragma: #ppProjectConfig inClasses: classesInPackage. - ppConfigMethods size = 0 ifTrue: [^ self default]. - ppConfigMethods size = 1 ifFalse: [self error: 'More than one Config found in Package: ', aPackage asString]. - config := ppConfigMethods first methodClass soleInstance perform: ppConfigMethods first selector with: nil. - config class = PPFormatterConfig ifFalse: [self error: 'Config returned by ', ppConfigMethods first selector asString,' is not of Type PPFormatterConfig.']. - ^ config \ No newline at end of file + ^ self packageConfigForMethod: nil in: aPackage \ No newline at end of file diff --git a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json index 12afca0..8354780 100644 --- a/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json +++ b/packages/PoppyPrint-Core.package/PPFormatterConfig.class/methodProperties.json @@ -3,8 +3,9 @@ "default" : "KD 6/15/2022 16:11", "getClassMethodsWithPragma:inClasses:" : "JW 7/25/2022 13:43", "packageConfigForClass:" : "JW 7/25/2022 00:08", - "packageConfigForMethod:" : "JW 7/25/2022 00:09", - "packageConfigForPackage:" : "JW 7/23/2022 11:50", + "packageConfigForMethod:" : "JW 7/27/2022 11:07", + "packageConfigForMethod:in:" : "JW 7/27/2022 11:07", + "packageConfigForPackage:" : "JW 7/27/2022 11:08", "preferenceConfig" : "JW 7/24/2022 19:51", "shouldUseDefaultAsPreferenceConfig" : "JW 7/24/2022 19:48", "shouldUseDefaultAsPreferenceConfig:" : "JW 7/24/2022 19:49" },