Please give me a short feedback on whether you agree with the idea of this change (PackageInfo scripts are no longer instances of StringHolder). If there is no objection, I will try to merge this into the Trunk after a week or so. :-)
["stylePackageScripts.png"]
Best, Christoph
=============== Summary ===============
Change Set: stylePackageScripts Date: 22 November 2021 Author: Christoph Thiede
This change set enables syntax highlighting for package scripts ({preamble,postscript}{, of removal}). To achieve this, the instance variables in PackageInfo are converted to hold plain strings or texts rather than StringHolders, and the client (Monticello) is reponsible itself for displaying them to the user and storing them back into the package. Note the postscript which converts all PackageInfo instances in the image.
=============== Postscript ===============
"Postscript: Eliminate StringHolder script in PackageInfos" PackageInfo allSubInstancesDo: [:packageInfo | #(preamble postscript preambleOfRemoval postscriptOfRemoval) do: [:sel | (packageInfo instVarNamed: sel) ifNotNil: [:stringHolder | packageInfo instVarNamed: sel put: stringHolder contents]]].
=============== Diff ===============
MCWorkingCopyBrowser>>editLoadScripts {morphic ui} · ct 11/22/2021 16:05 (changed) editLoadScripts
| arg | self hasWorkingCopy ifFalse: [^self]. arg := UIManager default - chooseFrom: #('edit preamble' 'edit postscript' 'edit preambleOfRemoval' 'edit postscriptOfRemoval') + chooseFrom: {'edit preamble' translated. 'edit postscript' translated. 'edit preambleOfRemoval' translated. 'edit postscriptOfRemoval' translated} values: #(#preamble #postscript #preambleOfRemoval #postscriptOfRemoval).
arg ifNotNil: [ self editScript: arg].
MCWorkingCopyBrowser>>editScript: {morphic ui} · ct 11/22/2021 15:59 (changed) editScript: scriptSymbol
- | script | - script := workingCopy packageInfo perform: scriptSymbol. - script openLabel: scriptSymbol asString, ' of the Package ', workingCopy package name. + | script | + script := workingCopy packageInfo perform: scriptSymbol. + Project uiManager + edit: script + label: ('{1} of the Package {2}' translated format: {scriptSymbol asString capitalized. workingCopy package name}) + shouldStyle: true + accept: [:result | workingCopy packageInfo + perform: scriptSymbol asSimpleSetter + with: result]
PackageInfo>>isScript:not: {preamble/postscript} · ct 11/22/2021 15:53 (changed) isScript: script not: default ^ script notNil and: [ | contents | - contents := script contents asString withBlanksTrimmed. + contents := script asString withBlanksTrimmed. contents notEmpty and: [contents ~= default and: [contents ~= 'nil']]]
PackageInfo>>postscript {preamble/postscript} · ct 11/22/2021 15:53 (changed) postscript + ^ postscript ifNil: [ - postscript := StringHolder new contents: self postscriptDefault] + postscript := self postscriptDefault]
PackageInfo>>postscript: {preamble/postscript} · ct 11/22/2021 15:57 (changed) postscript: aString
- postscript := StringHolder new contents: aString + postscript := aString
PackageInfo>>postscriptOfRemoval {preamble/postscript} · ct 11/22/2021 15:53 (changed) postscriptOfRemoval ^ postscriptOfRemoval ifNil: [ - postscriptOfRemoval := StringHolder new contents: self postscriptOfRemovalDefault] + postscriptOfRemoval := self postscriptOfRemovalDefault]
PackageInfo>>postscriptOfRemoval: {preamble/postscript} · ct 11/22/2021 15:57 (changed) postscriptOfRemoval: aString
- postscriptOfRemoval := StringHolder new contents: aString + postscriptOfRemoval := aString
PackageInfo>>preamble {preamble/postscript} · ct 11/22/2021 15:54 (changed) preamble ^ preamble ifNil: [ - preamble := StringHolder new contents: self preambleDefault] + preamble := self preambleDefault]
PackageInfo>>preamble: {preamble/postscript} · ct 11/22/2021 15:56 (changed) preamble: aString
- preamble := StringHolder new contents: aString + preamble := aString
PackageInfo>>preambleOfRemoval {preamble/postscript} · ct 11/22/2021 15:54 (changed) preambleOfRemoval ^ preambleOfRemoval ifNil: [ - preambleOfRemoval := StringHolder new contents: self preambleOfRemovalDefault] + preambleOfRemoval := self preambleOfRemovalDefault]
PackageInfo>>preambleOfRemoval: {preamble/postscript} · ct 11/22/2021 15:56 (changed) preambleOfRemoval: aString
- preambleOfRemoval := StringHolder new contents: aString + preambleOfRemoval := aString ["stylePackageScripts.2.cs"]
So, preamble and postscript would now be regular Strings instead? Sounds good to me, given that they are stored as strings on the server anyway.
Please double-check to not upload texts (or their serialized form) to the server.
Best, Marcel Am 22.11.2021 16:17:43 schrieb christoph.thiede@student.hpi.uni-potsdam.de christoph.thiede@student.hpi.uni-potsdam.de: Please give me a short feedback on whether you agree with the idea of this change (PackageInfo scripts are no longer instances of StringHolder). If there is no objection, I will try to merge this into the Trunk after a week or so. :-)
["stylePackageScripts.png"]
Best, Christoph
=============== Summary ===============
Change Set: stylePackageScripts Date: 22 November 2021 Author: Christoph Thiede
This change set enables syntax highlighting for package scripts ({preamble,postscript}{, of removal}). To achieve this, the instance variables in PackageInfo are converted to hold plain strings or texts rather than StringHolders, and the client (Monticello) is reponsible itself for displaying them to the user and storing them back into the package. Note the postscript which converts all PackageInfo instances in the image.
=============== Postscript ===============
"Postscript: Eliminate StringHolder script in PackageInfos" PackageInfo allSubInstancesDo: [:packageInfo | #(preamble postscript preambleOfRemoval postscriptOfRemoval) do: [:sel | (packageInfo instVarNamed: sel) ifNotNil: [:stringHolder | packageInfo instVarNamed: sel put: stringHolder contents]]].
=============== Diff ===============
MCWorkingCopyBrowser>>editLoadScripts {morphic ui} · ct 11/22/2021 16:05 (changed) editLoadScripts
| arg | self hasWorkingCopy ifFalse: [^self]. arg := UIManager default - chooseFrom: #('edit preamble' 'edit postscript' 'edit preambleOfRemoval' 'edit postscriptOfRemoval') + chooseFrom: {'edit preamble' translated. 'edit postscript' translated. 'edit preambleOfRemoval' translated. 'edit postscriptOfRemoval' translated} values: #(#preamble #postscript #preambleOfRemoval #postscriptOfRemoval).
arg ifNotNil: [ self editScript: arg].
MCWorkingCopyBrowser>>editScript: {morphic ui} · ct 11/22/2021 15:59 (changed) editScript: scriptSymbol
- | script | - script := workingCopy packageInfo perform: scriptSymbol. - script openLabel: scriptSymbol asString, ' of the Package ', workingCopy package name. + | script | + script := workingCopy packageInfo perform: scriptSymbol. + Project uiManager + edit: script + label: ('{1} of the Package {2}' translated format: {scriptSymbol asString capitalized. workingCopy package name}) + shouldStyle: true + accept: [:result | workingCopy packageInfo + perform: scriptSymbol asSimpleSetter + with: result]
PackageInfo>>isScript:not: {preamble/postscript} · ct 11/22/2021 15:53 (changed) isScript: script not: default ^ script notNil and: [ | contents | - contents := script contents asString withBlanksTrimmed. + contents := script asString withBlanksTrimmed. contents notEmpty and: [contents ~= default and: [contents ~= 'nil']]]
PackageInfo>>postscript {preamble/postscript} · ct 11/22/2021 15:53 (changed) postscript + ^ postscript ifNil: [ - postscript := StringHolder new contents: self postscriptDefault] + postscript := self postscriptDefault]
PackageInfo>>postscript: {preamble/postscript} · ct 11/22/2021 15:57 (changed) postscript: aString
- postscript := StringHolder new contents: aString + postscript := aString
PackageInfo>>postscriptOfRemoval {preamble/postscript} · ct 11/22/2021 15:53 (changed) postscriptOfRemoval ^ postscriptOfRemoval ifNil: [ - postscriptOfRemoval := StringHolder new contents: self postscriptOfRemovalDefault] + postscriptOfRemoval := self postscriptOfRemovalDefault]
PackageInfo>>postscriptOfRemoval: {preamble/postscript} · ct 11/22/2021 15:57 (changed) postscriptOfRemoval: aString
- postscriptOfRemoval := StringHolder new contents: aString + postscriptOfRemoval := aString
PackageInfo>>preamble {preamble/postscript} · ct 11/22/2021 15:54 (changed) preamble ^ preamble ifNil: [ - preamble := StringHolder new contents: self preambleDefault] + preamble := self preambleDefault]
PackageInfo>>preamble: {preamble/postscript} · ct 11/22/2021 15:56 (changed) preamble: aString
- preamble := StringHolder new contents: aString + preamble := aString
PackageInfo>>preambleOfRemoval {preamble/postscript} · ct 11/22/2021 15:54 (changed) preambleOfRemoval ^ preambleOfRemoval ifNil: [ - preambleOfRemoval := StringHolder new contents: self preambleOfRemovalDefault] + preambleOfRemoval := self preambleOfRemovalDefault]
PackageInfo>>preambleOfRemoval: {preamble/postscript} · ct 11/22/2021 15:56 (changed) preambleOfRemoval: aString
- preambleOfRemoval := StringHolder new contents: aString + preambleOfRemoval := aString ["stylePackageScripts.2.cs"]
Hi Marcel,
thanks for the fast feedback!
Please double-check to not upload texts (or their serialized form) to the server.
Good catch! ["stylePackageScripts.3.cs"] resolves this by converting the script to a string prior to serialization (see MCStWriter >> #writeScriptDefinition:). Updated diff is below. Addressing this issue in the writer seems to be the safest way to me, and you will not loose your formatting prior to exporting the package, which aligns to the behavior of class comments and method comments.
(However, I would actually love to finally be able to serialize formatted comments via Monticello - but that should be stuff for its own debate.)
So can I go ahead and merge this? :-)
Best, Christoph
=============== Summary ===============
Change Set: stylePackageScripts Date: 22 November 2021 Author: Christoph Thiede
This change set enables syntax highlighting for package scripts ({preamble,postscript}{, of removal}). To achieve this, the instance variables in PackageInfo are converted to hold plain strings or texts rather than StringHolders, and the client (Monticello) is reponsible itself for displaying them to the user and storing them back into the package. Note the postscript which converts all PackageInfo instances in the image.
=============== Postscript ===============
"Postscript: Eliminate StringHolder script in PackageInfos" PackageInfo allSubInstancesDo: [:packageInfo | #(preamble postscript preambleOfRemoval postscriptOfRemoval) do: [:sel | (packageInfo instVarNamed: sel) ifNotNil: [:stringHolder | packageInfo instVarNamed: sel put: stringHolder contents]]].
=============== Diff ===============
MCStWriter>>writeScriptDefinition: {writing} · ct 11/22/2021 16:34 (changed) writeScriptDefinition: definition stream nextChunkPut: ( '(PackageInfo named: {1}) {2}: {3}' format: { "{1}" definition packageName printString. "{2}" definition scriptSelector. - "{3}" definition script printString + "{3}" definition script asString printString }); cr
MCWorkingCopyBrowser>>editLoadScripts {morphic ui} · ct 11/22/2021 16:05 (changed) editLoadScripts
| arg | self hasWorkingCopy ifFalse: [^self]. arg := UIManager default - chooseFrom: #('edit preamble' 'edit postscript' 'edit preambleOfRemoval' 'edit postscriptOfRemoval') + chooseFrom: {'edit preamble' translated. 'edit postscript' translated. 'edit preambleOfRemoval' translated. 'edit postscriptOfRemoval' translated} values: #(#preamble #postscript #preambleOfRemoval #postscriptOfRemoval).
arg ifNotNil: [ self editScript: arg].
MCWorkingCopyBrowser>>editScript: {morphic ui} · ct 11/22/2021 15:59 (changed) editScript: scriptSymbol
- | script | - script := workingCopy packageInfo perform: scriptSymbol. - script openLabel: scriptSymbol asString, ' of the Package ', workingCopy package name. + | script | + script := workingCopy packageInfo perform: scriptSymbol. + Project uiManager + edit: script + label: ('{1} of the Package {2}' translated format: {scriptSymbol asString capitalized. workingCopy package name}) + shouldStyle: true + accept: [:result | workingCopy packageInfo + perform: scriptSymbol asSimpleSetter + with: result]
PackageInfo>>isScript:not: {preamble/postscript} · ct 11/22/2021 15:53 (changed) isScript: script not: default ^ script notNil and: [ | contents | - contents := script contents asString withBlanksTrimmed. + contents := script asString withBlanksTrimmed. contents notEmpty and: [contents ~= default and: [contents ~= 'nil']]]
PackageInfo>>postscript {preamble/postscript} · ct 11/22/2021 15:53 (changed) postscript + ^ postscript ifNil: [ - postscript := StringHolder new contents: self postscriptDefault] + postscript := self postscriptDefault]
PackageInfo>>postscript: {preamble/postscript} · ct 11/22/2021 15:57 (changed) postscript: aString
- postscript := StringHolder new contents: aString + postscript := aString
PackageInfo>>postscriptOfRemoval {preamble/postscript} · ct 11/22/2021 15:53 (changed) postscriptOfRemoval ^ postscriptOfRemoval ifNil: [ - postscriptOfRemoval := StringHolder new contents: self postscriptOfRemovalDefault] + postscriptOfRemoval := self postscriptOfRemovalDefault]
PackageInfo>>postscriptOfRemoval: {preamble/postscript} · ct 11/22/2021 15:57 (changed) postscriptOfRemoval: aString
- postscriptOfRemoval := StringHolder new contents: aString + postscriptOfRemoval := aString
PackageInfo>>preamble {preamble/postscript} · ct 11/22/2021 15:54 (changed) preamble ^ preamble ifNil: [ - preamble := StringHolder new contents: self preambleDefault] + preamble := self preambleDefault]
PackageInfo>>preamble: {preamble/postscript} · ct 11/22/2021 15:56 (changed) preamble: aString
- preamble := StringHolder new contents: aString + preamble := aString
PackageInfo>>preambleOfRemoval {preamble/postscript} · ct 11/22/2021 15:54 (changed) preambleOfRemoval ^ preambleOfRemoval ifNil: [ - preambleOfRemoval := StringHolder new contents: self preambleOfRemovalDefault] + preambleOfRemoval := self preambleOfRemovalDefault]
PackageInfo>>preambleOfRemoval: {preamble/postscript} · ct 11/22/2021 15:56 (changed) preambleOfRemoval: aString
- preambleOfRemoval := StringHolder new contents: aString + preambleOfRemoval := aString
--- Sent from Squeak Inbox Talk
On 2021-11-22T16:22:02+01:00, marcel.taeumel@hpi.de wrote:
So, preamble and postscript would now be regular Strings instead? Sounds good to me, given that they are stored as strings on the server anyway.
Please double-check to not upload texts (or their serialized form) to the server.
Best, Marcel Am 22.11.2021 16:17:43 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>: Please give me a short feedback on whether you agree with the idea of this change (PackageInfo scripts are no longer instances of StringHolder). If there is no objection, I will try to merge this into the Trunk after a week or so. :-)
["stylePackageScripts.png"]
Best, Christoph
=============== Summary ===============
Change Set: stylePackageScripts Date: 22 November 2021 Author: Christoph Thiede
This change set enables syntax highlighting for package scripts ({preamble,postscript}{, of removal}). To achieve this, the instance variables in PackageInfo are converted to hold plain strings or texts rather than StringHolders, and the client (Monticello) is reponsible itself for displaying them to the user and storing them back into the package. Note the postscript which converts all PackageInfo instances in the image.
=============== Postscript ===============
"Postscript: Eliminate StringHolder script in PackageInfos" PackageInfo allSubInstancesDo: [:packageInfo | #(preamble postscript preambleOfRemoval postscriptOfRemoval) do: [:sel | (packageInfo instVarNamed: sel) ifNotNil: [:stringHolder | packageInfo instVarNamed: sel put: stringHolder contents]]].
=============== Diff ===============
MCWorkingCopyBrowser>>editLoadScripts {morphic ui} · ct 11/22/2021 16:05 (changed) editLoadScripts
| arg | self hasWorkingCopy ifFalse: [^self]. arg := UIManager default
- chooseFrom: #('edit preamble' 'edit postscript' 'edit preambleOfRemoval' 'edit postscriptOfRemoval')
- chooseFrom: {'edit preamble' translated. 'edit postscript' translated. 'edit preambleOfRemoval' translated. 'edit postscriptOfRemoval' translated}
values: #(#preamble #postscript #preambleOfRemoval #postscriptOfRemoval).
arg ifNotNil: [ self editScript: arg].
MCWorkingCopyBrowser>>editScript: {morphic ui} · ct 11/22/2021 15:59 (changed) editScript: scriptSymbol
- | script |
- script := workingCopy packageInfo perform: scriptSymbol.
- script openLabel: scriptSymbol asString, ' of the Package ', workingCopy package name.
- | script |
- script := workingCopy packageInfo perform: scriptSymbol.
- Project uiManager
- edit: script
- label: ('{1} of the Package {2}' translated format: {scriptSymbol asString capitalized. workingCopy package name})
- shouldStyle: true
- accept: [:result | workingCopy packageInfo
- perform: scriptSymbol asSimpleSetter
- with: result]
PackageInfo>>isScript:not: {preamble/postscript} · ct 11/22/2021 15:53 (changed) isScript: script not: default ^ script notNil and: [ | contents |
- contents := script contents asString withBlanksTrimmed.
- contents := script asString withBlanksTrimmed.
contents notEmpty and: [contents ~= default and: [contents ~= 'nil']]]
PackageInfo>>postscript {preamble/postscript} · ct 11/22/2021 15:53 (changed) postscript
^ postscript ifNil: [
- postscript := StringHolder new contents: self postscriptDefault]
- postscript := self postscriptDefault]
PackageInfo>>postscript: {preamble/postscript} · ct 11/22/2021 15:57 (changed) postscript: aString
- postscript := StringHolder new contents: aString
- postscript := aString
PackageInfo>>postscriptOfRemoval {preamble/postscript} · ct 11/22/2021 15:53 (changed) postscriptOfRemoval ^ postscriptOfRemoval ifNil: [
- postscriptOfRemoval := StringHolder new contents: self postscriptOfRemovalDefault]
- postscriptOfRemoval := self postscriptOfRemovalDefault]
PackageInfo>>postscriptOfRemoval: {preamble/postscript} · ct 11/22/2021 15:57 (changed) postscriptOfRemoval: aString
- postscriptOfRemoval := StringHolder new contents: aString
- postscriptOfRemoval := aString
PackageInfo>>preamble {preamble/postscript} · ct 11/22/2021 15:54 (changed) preamble ^ preamble ifNil: [
- preamble := StringHolder new contents: self preambleDefault]
- preamble := self preambleDefault]
PackageInfo>>preamble: {preamble/postscript} · ct 11/22/2021 15:56 (changed) preamble: aString
- preamble := StringHolder new contents: aString
- preamble := aString
PackageInfo>>preambleOfRemoval {preamble/postscript} · ct 11/22/2021 15:54 (changed) preambleOfRemoval ^ preambleOfRemoval ifNil: [
- preambleOfRemoval := StringHolder new contents: self preambleOfRemovalDefault]
- preambleOfRemoval := self preambleOfRemovalDefault]
PackageInfo>>preambleOfRemoval: {preamble/postscript} · ct 11/22/2021 15:56 (changed) preambleOfRemoval: aString
- preambleOfRemoval := StringHolder new contents: aString
- preambleOfRemoval := aString
["stylePackageScripts.2.cs"]
Hi Christoph --
So can I go ahead and merge this? :-)
Could you figure out a reason why this has been a StringHolder until now? Was it because String itself is considered "immutable" and StringHolder was its "mutable" container?
Maybe something listening (addDependent/change/update) to "aPackageInfo preamble"? A StringHolder has a custom collection of dependents...
Best, Marcel Am 22.11.2021 16:38:31 schrieb christoph.thiede@student.hpi.uni-potsdam.de christoph.thiede@student.hpi.uni-potsdam.de: Hi Marcel,
thanks for the fast feedback!
Please double-check to not upload texts (or their serialized form) to the server.
Good catch! ["stylePackageScripts.3.cs"] resolves this by converting the script to a string prior to serialization (see MCStWriter >> #writeScriptDefinition:). Updated diff is below. Addressing this issue in the writer seems to be the safest way to me, and you will not loose your formatting prior to exporting the package, which aligns to the behavior of class comments and method comments.
(However, I would actually love to finally be able to serialize formatted comments via Monticello - but that should be stuff for its own debate.)
So can I go ahead and merge this? :-)
Best, Christoph
=============== Summary ===============
Change Set: stylePackageScripts Date: 22 November 2021 Author: Christoph Thiede
This change set enables syntax highlighting for package scripts ({preamble,postscript}{, of removal}). To achieve this, the instance variables in PackageInfo are converted to hold plain strings or texts rather than StringHolders, and the client (Monticello) is reponsible itself for displaying them to the user and storing them back into the package. Note the postscript which converts all PackageInfo instances in the image.
=============== Postscript ===============
"Postscript: Eliminate StringHolder script in PackageInfos" PackageInfo allSubInstancesDo: [:packageInfo | #(preamble postscript preambleOfRemoval postscriptOfRemoval) do: [:sel | (packageInfo instVarNamed: sel) ifNotNil: [:stringHolder | packageInfo instVarNamed: sel put: stringHolder contents]]].
=============== Diff ===============
MCStWriter>>writeScriptDefinition: {writing} · ct 11/22/2021 16:34 (changed) writeScriptDefinition: definition stream nextChunkPut: ( '(PackageInfo named: {1}) {2}: {3}' format: { "{1}" definition packageName printString. "{2}" definition scriptSelector. - "{3}" definition script printString + "{3}" definition script asString printString }); cr
MCWorkingCopyBrowser>>editLoadScripts {morphic ui} · ct 11/22/2021 16:05 (changed) editLoadScripts
| arg | self hasWorkingCopy ifFalse: [^self]. arg := UIManager default - chooseFrom: #('edit preamble' 'edit postscript' 'edit preambleOfRemoval' 'edit postscriptOfRemoval') + chooseFrom: {'edit preamble' translated. 'edit postscript' translated. 'edit preambleOfRemoval' translated. 'edit postscriptOfRemoval' translated} values: #(#preamble #postscript #preambleOfRemoval #postscriptOfRemoval).
arg ifNotNil: [ self editScript: arg].
MCWorkingCopyBrowser>>editScript: {morphic ui} · ct 11/22/2021 15:59 (changed) editScript: scriptSymbol
- | script | - script := workingCopy packageInfo perform: scriptSymbol. - script openLabel: scriptSymbol asString, ' of the Package ', workingCopy package name. + | script | + script := workingCopy packageInfo perform: scriptSymbol. + Project uiManager + edit: script + label: ('{1} of the Package {2}' translated format: {scriptSymbol asString capitalized. workingCopy package name}) + shouldStyle: true + accept: [:result | workingCopy packageInfo + perform: scriptSymbol asSimpleSetter + with: result]
PackageInfo>>isScript:not: {preamble/postscript} · ct 11/22/2021 15:53 (changed) isScript: script not: default ^ script notNil and: [ | contents | - contents := script contents asString withBlanksTrimmed. + contents := script asString withBlanksTrimmed. contents notEmpty and: [contents ~= default and: [contents ~= 'nil']]]
PackageInfo>>postscript {preamble/postscript} · ct 11/22/2021 15:53 (changed) postscript + ^ postscript ifNil: [ - postscript := StringHolder new contents: self postscriptDefault] + postscript := self postscriptDefault]
PackageInfo>>postscript: {preamble/postscript} · ct 11/22/2021 15:57 (changed) postscript: aString
- postscript := StringHolder new contents: aString + postscript := aString
PackageInfo>>postscriptOfRemoval {preamble/postscript} · ct 11/22/2021 15:53 (changed) postscriptOfRemoval ^ postscriptOfRemoval ifNil: [ - postscriptOfRemoval := StringHolder new contents: self postscriptOfRemovalDefault] + postscriptOfRemoval := self postscriptOfRemovalDefault]
PackageInfo>>postscriptOfRemoval: {preamble/postscript} · ct 11/22/2021 15:57 (changed) postscriptOfRemoval: aString
- postscriptOfRemoval := StringHolder new contents: aString + postscriptOfRemoval := aString
PackageInfo>>preamble {preamble/postscript} · ct 11/22/2021 15:54 (changed) preamble ^ preamble ifNil: [ - preamble := StringHolder new contents: self preambleDefault] + preamble := self preambleDefault]
PackageInfo>>preamble: {preamble/postscript} · ct 11/22/2021 15:56 (changed) preamble: aString
- preamble := StringHolder new contents: aString + preamble := aString
PackageInfo>>preambleOfRemoval {preamble/postscript} · ct 11/22/2021 15:54 (changed) preambleOfRemoval ^ preambleOfRemoval ifNil: [ - preambleOfRemoval := StringHolder new contents: self preambleOfRemovalDefault] + preambleOfRemoval := self preambleOfRemovalDefault]
PackageInfo>>preambleOfRemoval: {preamble/postscript} · ct 11/22/2021 15:56 (changed) preambleOfRemoval: aString
- preambleOfRemoval := StringHolder new contents: aString + preambleOfRemoval := aString
--- Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk]
On 2021-11-22T16:22:02+01:00, marcel.taeumel@hpi.de wrote:
So, preamble and postscript would now be regular Strings instead? Sounds good to me, given that they are stored as strings on the server anyway.
Please double-check to not upload texts (or their serialized form) to the server.
Best, Marcel Am 22.11.2021 16:17:43 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>: Please give me a short feedback on whether you agree with the idea of this change (PackageInfo scripts are no longer instances of StringHolder). If there is no objection, I will try to merge this into the Trunk after a week or so. :-)
["stylePackageScripts.png"]
Best, Christoph
=============== Summary ===============
Change Set: stylePackageScripts Date: 22 November 2021 Author: Christoph Thiede
This change set enables syntax highlighting for package scripts ({preamble,postscript}{, of removal}). To achieve this, the instance variables in PackageInfo are converted to hold plain strings or texts rather than StringHolders, and the client (Monticello) is reponsible itself for displaying them to the user and storing them back into the package. Note the postscript which converts all PackageInfo instances in the image.
=============== Postscript ===============
"Postscript: Eliminate StringHolder script in PackageInfos" PackageInfo allSubInstancesDo: [:packageInfo | #(preamble postscript preambleOfRemoval postscriptOfRemoval) do: [:sel | (packageInfo instVarNamed: sel) ifNotNil: [:stringHolder | packageInfo instVarNamed: sel put: stringHolder contents]]].
=============== Diff ===============
MCWorkingCopyBrowser>>editLoadScripts {morphic ui} · ct 11/22/2021 16:05 (changed) editLoadScripts
| arg | self hasWorkingCopy ifFalse: [^self]. arg := UIManager default
- chooseFrom: #('edit preamble' 'edit postscript' 'edit preambleOfRemoval' 'edit postscriptOfRemoval')
- chooseFrom: {'edit preamble' translated. 'edit postscript' translated. 'edit preambleOfRemoval' translated. 'edit postscriptOfRemoval' translated}
values: #(#preamble #postscript #preambleOfRemoval #postscriptOfRemoval).
arg ifNotNil: [ self editScript: arg].
MCWorkingCopyBrowser>>editScript: {morphic ui} · ct 11/22/2021 15:59 (changed) editScript: scriptSymbol
- | script |
- script := workingCopy packageInfo perform: scriptSymbol.
- script openLabel: scriptSymbol asString, ' of the Package ', workingCopy package name.
- | script |
- script := workingCopy packageInfo perform: scriptSymbol.
- Project uiManager
- edit: script
- label: ('{1} of the Package {2}' translated format: {scriptSymbol asString capitalized. workingCopy package name})
- shouldStyle: true
- accept: [:result | workingCopy packageInfo
- perform: scriptSymbol asSimpleSetter
- with: result]
PackageInfo>>isScript:not: {preamble/postscript} · ct 11/22/2021 15:53 (changed) isScript: script not: default ^ script notNil and: [ | contents |
- contents := script contents asString withBlanksTrimmed.
- contents := script asString withBlanksTrimmed.
contents notEmpty and: [contents ~= default and: [contents ~= 'nil']]]
PackageInfo>>postscript {preamble/postscript} · ct 11/22/2021 15:53 (changed) postscript
^ postscript ifNil: [
- postscript := StringHolder new contents: self postscriptDefault]
- postscript := self postscriptDefault]
PackageInfo>>postscript: {preamble/postscript} · ct 11/22/2021 15:57 (changed) postscript: aString
- postscript := StringHolder new contents: aString
- postscript := aString
PackageInfo>>postscriptOfRemoval {preamble/postscript} · ct 11/22/2021 15:53 (changed) postscriptOfRemoval ^ postscriptOfRemoval ifNil: [
- postscriptOfRemoval := StringHolder new contents: self postscriptOfRemovalDefault]
- postscriptOfRemoval := self postscriptOfRemovalDefault]
PackageInfo>>postscriptOfRemoval: {preamble/postscript} · ct 11/22/2021 15:57 (changed) postscriptOfRemoval: aString
- postscriptOfRemoval := StringHolder new contents: aString
- postscriptOfRemoval := aString
PackageInfo>>preamble {preamble/postscript} · ct 11/22/2021 15:54 (changed) preamble ^ preamble ifNil: [
- preamble := StringHolder new contents: self preambleDefault]
- preamble := self preambleDefault]
PackageInfo>>preamble: {preamble/postscript} · ct 11/22/2021 15:56 (changed) preamble: aString
- preamble := StringHolder new contents: aString
- preamble := aString
PackageInfo>>preambleOfRemoval {preamble/postscript} · ct 11/22/2021 15:54 (changed) preambleOfRemoval ^ preambleOfRemoval ifNil: [
- preambleOfRemoval := StringHolder new contents: self preambleOfRemovalDefault]
- preambleOfRemoval := self preambleOfRemovalDefault]
PackageInfo>>preambleOfRemoval: {preamble/postscript} · ct 11/22/2021 15:56 (changed) preambleOfRemoval: aString
- preambleOfRemoval := StringHolder new contents: aString
- preambleOfRemoval := aString
["stylePackageScripts.2.cs"]
Hi Marcel,
Could you figure out a reason why this has been a StringHolder until now?
Unfortunately, I have no idea. I saw the same pattern for the do-it list (see Utilities class>>#editCommonRequestStrings), maybe it was just a cheap hack in a time where workspaces did not yet have an accept selector?
Maybe something listening (addDependent/change/update) to "aPackageInfo preamble"? A StringHolder has a custom collection of dependents...
When I edit a package script (or also edit my do-it list), the dependents list only consists of Morphic views ...
Best, Christoph
--- Sent from Squeak Inbox Talk
On 2021-11-22T17:42:31+01:00, marcel.taeumel@hpi.de wrote:
Hi Christoph --
So can I go ahead and merge this? :-)
Could you figure out a reason why this has been a StringHolder until now? Was it because String itself is considered "immutable" and StringHolder was its "mutable" container?
Maybe something listening (addDependent/change/update) to "aPackageInfo preamble"? A StringHolder has a custom collection of dependents...
Best, Marcel Am 22.11.2021 16:38:31 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>: Hi Marcel,
thanks for the fast feedback!
Please double-check to not upload texts (or their serialized form) to the server.
Good catch! ["stylePackageScripts.3.cs"] resolves this by converting the script to a string prior to serialization (see MCStWriter >> #writeScriptDefinition:). Updated diff is below. Addressing this issue in the writer seems to be the safest way to me, and you will not loose your formatting prior to exporting the package, which aligns to the behavior of class comments and method comments.
(However, I would actually love to finally be able to serialize formatted comments via Monticello - but that should be stuff for its own debate.)
So can I go ahead and merge this? :-)
Best, Christoph
=============== Summary ===============
Change Set: stylePackageScripts Date: 22 November 2021 Author: Christoph Thiede
This change set enables syntax highlighting for package scripts ({preamble,postscript}{, of removal}). To achieve this, the instance variables in PackageInfo are converted to hold plain strings or texts rather than StringHolders, and the client (Monticello) is reponsible itself for displaying them to the user and storing them back into the package. Note the postscript which converts all PackageInfo instances in the image.
=============== Postscript ===============
"Postscript: Eliminate StringHolder script in PackageInfos" PackageInfo allSubInstancesDo: [:packageInfo | #(preamble postscript preambleOfRemoval postscriptOfRemoval) do: [:sel | (packageInfo instVarNamed: sel) ifNotNil: [:stringHolder | packageInfo instVarNamed: sel put: stringHolder contents]]].
=============== Diff ===============
MCStWriter>>writeScriptDefinition: {writing} · ct 11/22/2021 16:34 (changed) writeScriptDefinition: definition stream nextChunkPut: ( '(PackageInfo named: {1}) {2}: {3}' format: { "{1}" definition packageName printString. "{2}" definition scriptSelector.
- "{3}" definition script printString
- "{3}" definition script asString printString
}); cr
MCWorkingCopyBrowser>>editLoadScripts {morphic ui} · ct 11/22/2021 16:05 (changed) editLoadScripts
| arg | self hasWorkingCopy ifFalse: [^self]. arg := UIManager default
- chooseFrom: #('edit preamble' 'edit postscript' 'edit preambleOfRemoval' 'edit postscriptOfRemoval')
- chooseFrom: {'edit preamble' translated. 'edit postscript' translated. 'edit preambleOfRemoval' translated. 'edit postscriptOfRemoval' translated}
values: #(#preamble #postscript #preambleOfRemoval #postscriptOfRemoval).
arg ifNotNil: [ self editScript: arg].
MCWorkingCopyBrowser>>editScript: {morphic ui} · ct 11/22/2021 15:59 (changed) editScript: scriptSymbol
- | script |
- script := workingCopy packageInfo perform: scriptSymbol.
- script openLabel: scriptSymbol asString, ' of the Package ', workingCopy package name.
- | script |
- script := workingCopy packageInfo perform: scriptSymbol.
- Project uiManager
- edit: script
- label: ('{1} of the Package {2}' translated format: {scriptSymbol asString capitalized. workingCopy package name})
- shouldStyle: true
- accept: [:result | workingCopy packageInfo
- perform: scriptSymbol asSimpleSetter
- with: result]
PackageInfo>>isScript:not: {preamble/postscript} · ct 11/22/2021 15:53 (changed) isScript: script not: default ^ script notNil and: [ | contents |
- contents := script contents asString withBlanksTrimmed.
- contents := script asString withBlanksTrimmed.
contents notEmpty and: [contents ~= default and: [contents ~= 'nil']]]
PackageInfo>>postscript {preamble/postscript} · ct 11/22/2021 15:53 (changed) postscript
^ postscript ifNil: [
- postscript := StringHolder new contents: self postscriptDefault]
- postscript := self postscriptDefault]
PackageInfo>>postscript: {preamble/postscript} · ct 11/22/2021 15:57 (changed) postscript: aString
- postscript := StringHolder new contents: aString
- postscript := aString
PackageInfo>>postscriptOfRemoval {preamble/postscript} · ct 11/22/2021 15:53 (changed) postscriptOfRemoval ^ postscriptOfRemoval ifNil: [
- postscriptOfRemoval := StringHolder new contents: self postscriptOfRemovalDefault]
- postscriptOfRemoval := self postscriptOfRemovalDefault]
PackageInfo>>postscriptOfRemoval: {preamble/postscript} · ct 11/22/2021 15:57 (changed) postscriptOfRemoval: aString
- postscriptOfRemoval := StringHolder new contents: aString
- postscriptOfRemoval := aString
PackageInfo>>preamble {preamble/postscript} · ct 11/22/2021 15:54 (changed) preamble ^ preamble ifNil: [
- preamble := StringHolder new contents: self preambleDefault]
- preamble := self preambleDefault]
PackageInfo>>preamble: {preamble/postscript} · ct 11/22/2021 15:56 (changed) preamble: aString
- preamble := StringHolder new contents: aString
- preamble := aString
PackageInfo>>preambleOfRemoval {preamble/postscript} · ct 11/22/2021 15:54 (changed) preambleOfRemoval ^ preambleOfRemoval ifNil: [
- preambleOfRemoval := StringHolder new contents: self preambleOfRemovalDefault]
- preambleOfRemoval := self preambleOfRemovalDefault]
PackageInfo>>preambleOfRemoval: {preamble/postscript} · ct 11/22/2021 15:56 (changed) preambleOfRemoval: aString
- preambleOfRemoval := StringHolder new contents: aString
- preambleOfRemoval := aString
Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk]
On 2021-11-22T16:22:02+01:00, marcel.taeumel at hpi.de wrote:
So, preamble and postscript would now be regular Strings instead? Sounds good to me, given that they are stored as strings on the server anyway.
Please double-check to not upload texts (or their serialized form) to the server.
Best, Marcel Am 22.11.2021 16:17:43 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>: Please give me a short feedback on whether you agree with the idea of this change (PackageInfo scripts are no longer instances of StringHolder). If there is no objection, I will try to merge this into the Trunk after a week or so. :-)
["stylePackageScripts.png"]
Best, Christoph
=============== Summary ===============
Change Set: stylePackageScripts Date: 22 November 2021 Author: Christoph Thiede
This change set enables syntax highlighting for package scripts ({preamble,postscript}{, of removal}). To achieve this, the instance variables in PackageInfo are converted to hold plain strings or texts rather than StringHolders, and the client (Monticello) is reponsible itself for displaying them to the user and storing them back into the package. Note the postscript which converts all PackageInfo instances in the image.
=============== Postscript ===============
"Postscript: Eliminate StringHolder script in PackageInfos" PackageInfo allSubInstancesDo: [:packageInfo | #(preamble postscript preambleOfRemoval postscriptOfRemoval) do: [:sel | (packageInfo instVarNamed: sel) ifNotNil: [:stringHolder | packageInfo instVarNamed: sel put: stringHolder contents]]].
=============== Diff ===============
MCWorkingCopyBrowser>>editLoadScripts {morphic ui} · ct 11/22/2021 16:05 (changed) editLoadScripts
| arg | self hasWorkingCopy ifFalse: [^self]. arg := UIManager default
- chooseFrom: #('edit preamble' 'edit postscript' 'edit preambleOfRemoval' 'edit postscriptOfRemoval')
- chooseFrom: {'edit preamble' translated. 'edit postscript' translated. 'edit preambleOfRemoval' translated. 'edit postscriptOfRemoval' translated}
values: #(#preamble #postscript #preambleOfRemoval #postscriptOfRemoval).
arg ifNotNil: [ self editScript: arg].
MCWorkingCopyBrowser>>editScript: {morphic ui} · ct 11/22/2021 15:59 (changed) editScript: scriptSymbol
- | script |
- script := workingCopy packageInfo perform: scriptSymbol.
- script openLabel: scriptSymbol asString, ' of the Package ', workingCopy package name.
- | script |
- script := workingCopy packageInfo perform: scriptSymbol.
- Project uiManager
- edit: script
- label: ('{1} of the Package {2}' translated format: {scriptSymbol asString capitalized. workingCopy package name})
- shouldStyle: true
- accept: [:result | workingCopy packageInfo
- perform: scriptSymbol asSimpleSetter
- with: result]
PackageInfo>>isScript:not: {preamble/postscript} · ct 11/22/2021 15:53 (changed) isScript: script not: default ^ script notNil and: [ | contents |
- contents := script contents asString withBlanksTrimmed.
- contents := script asString withBlanksTrimmed.
contents notEmpty and: [contents ~= default and: [contents ~= 'nil']]]
PackageInfo>>postscript {preamble/postscript} · ct 11/22/2021 15:53 (changed) postscript
^ postscript ifNil: [
- postscript := StringHolder new contents: self postscriptDefault]
- postscript := self postscriptDefault]
PackageInfo>>postscript: {preamble/postscript} · ct 11/22/2021 15:57 (changed) postscript: aString
- postscript := StringHolder new contents: aString
- postscript := aString
PackageInfo>>postscriptOfRemoval {preamble/postscript} · ct 11/22/2021 15:53 (changed) postscriptOfRemoval ^ postscriptOfRemoval ifNil: [
- postscriptOfRemoval := StringHolder new contents: self postscriptOfRemovalDefault]
- postscriptOfRemoval := self postscriptOfRemovalDefault]
PackageInfo>>postscriptOfRemoval: {preamble/postscript} · ct 11/22/2021 15:57 (changed) postscriptOfRemoval: aString
- postscriptOfRemoval := StringHolder new contents: aString
- postscriptOfRemoval := aString
PackageInfo>>preamble {preamble/postscript} · ct 11/22/2021 15:54 (changed) preamble ^ preamble ifNil: [
- preamble := StringHolder new contents: self preambleDefault]
- preamble := self preambleDefault]
PackageInfo>>preamble: {preamble/postscript} · ct 11/22/2021 15:56 (changed) preamble: aString
- preamble := StringHolder new contents: aString
- preamble := aString
PackageInfo>>preambleOfRemoval {preamble/postscript} · ct 11/22/2021 15:54 (changed) preambleOfRemoval ^ preambleOfRemoval ifNil: [
- preambleOfRemoval := StringHolder new contents: self preambleOfRemovalDefault]
- preambleOfRemoval := self preambleOfRemovalDefault]
PackageInfo>>preambleOfRemoval: {preamble/postscript} · ct 11/22/2021 15:56 (changed) preambleOfRemoval: aString
- preambleOfRemoval := StringHolder new contents: aString
- preambleOfRemoval := aString
["stylePackageScripts.2.cs"]
Hi Marcel,
quick bump. :-)
Regarding your previous question:
Could you figure out a reason why this has been a StringHolder until now?
I noticed that ChangeSet>>#assurePreambleExists et al. contain obsolete commentary that indicate that *change sets* have represented their scripts through StringHolders in the past. But apparently, that was changed almost 20 years ago. Here is a statement from the original author of Monticello scripts from 2005 [1]:
Nasty. We should definitely use Strings. Michal, was there a reason for the StringHolders?
I suspect it was just thoughtless copying of code from ChangeSet.
Not entirely thoughtless (in fact strings were the first thing I used), but taken from ChangeSet yes. Doing it this way allowed both a cleaner interface with PackageInfo and a trivial editing method.
But sure, we can easily switch back, add a series of methods of the #preambleString: type to PackageInfo (I think I deleted them from the version I sent out - I don't have an image here to check), and build a different editor for the preambles/postscripts.
tl;dr: Apparently, no one ever had a strong opinion on this, and the model for this design decision has been discarded in the meantime. Given that, do you see any other reason not to merge this? :-)
Best, Christoph
[1] https://lists.squeakfoundation.org/archives/list/squeak-dev@lists.squeakfoun...
On 2022-02-25T12:48:20+01:00, christoph.thiede@student.hpi.uni-potsdam.de wrote:
Hi Marcel,
Could you figure out a reason why this has been a StringHolder until now?
Unfortunately, I have no idea. I saw the same pattern for the do-it list (see Utilities class>>#editCommonRequestStrings), maybe it was just a cheap hack in a time where workspaces did not yet have an accept selector?
Maybe something listening (addDependent/change/update) to "aPackageInfo preamble"? A StringHolder has a custom collection of dependents...
When I edit a package script (or also edit my do-it list), the dependents list only consists of Morphic views ...
Best, Christoph
Sent from Squeak Inbox Talk
On 2021-11-22T17:42:31+01:00, marcel.taeumel(a)hpi.de wrote:
Hi Christoph --
So can I go ahead and merge this? :-)
Could you figure out a reason why this has been a StringHolder until now? Was it because String itself is considered "immutable" and StringHolder was its "mutable" container?
Maybe something listening (addDependent/change/update) to "aPackageInfo preamble"? A StringHolder has a custom collection of dependents...
Best, Marcel Am 22.11.2021 16:38:31 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>: Hi Marcel,
thanks for the fast feedback!
Please double-check to not upload texts (or their serialized form) to the server.
Good catch! ["stylePackageScripts.3.cs"] resolves this by converting the script to a string prior to serialization (see MCStWriter >> #writeScriptDefinition:). Updated diff is below. Addressing this issue in the writer seems to be the safest way to me, and you will not loose your formatting prior to exporting the package, which aligns to the behavior of class comments and method comments.
(However, I would actually love to finally be able to serialize formatted comments via Monticello - but that should be stuff for its own debate.)
So can I go ahead and merge this? :-)
Best, Christoph
=============== Summary ===============
Change Set: stylePackageScripts Date: 22 November 2021 Author: Christoph Thiede
This change set enables syntax highlighting for package scripts ({preamble,postscript}{, of removal}). To achieve this, the instance variables in PackageInfo are converted to hold plain strings or texts rather than StringHolders, and the client (Monticello) is reponsible itself for displaying them to the user and storing them back into the package. Note the postscript which converts all PackageInfo instances in the image.
=============== Postscript ===============
"Postscript: Eliminate StringHolder script in PackageInfos" PackageInfo allSubInstancesDo: [:packageInfo | #(preamble postscript preambleOfRemoval postscriptOfRemoval) do: [:sel | (packageInfo instVarNamed: sel) ifNotNil: [:stringHolder | packageInfo instVarNamed: sel put: stringHolder contents]]].
=============== Diff ===============
MCStWriter>>writeScriptDefinition: {writing} · ct 11/22/2021 16:34 (changed) writeScriptDefinition: definition stream nextChunkPut: ( '(PackageInfo named: {1}) {2}: {3}' format: { "{1}" definition packageName printString. "{2}" definition scriptSelector.
- "{3}" definition script printString
- "{3}" definition script asString printString
}); cr
MCWorkingCopyBrowser>>editLoadScripts {morphic ui} · ct 11/22/2021 16:05 (changed) editLoadScripts
| arg | self hasWorkingCopy ifFalse: [^self]. arg := UIManager default
- chooseFrom: #('edit preamble' 'edit postscript' 'edit preambleOfRemoval' 'edit postscriptOfRemoval')
- chooseFrom: {'edit preamble' translated. 'edit postscript' translated. 'edit preambleOfRemoval' translated. 'edit postscriptOfRemoval' translated}
values: #(#preamble #postscript #preambleOfRemoval #postscriptOfRemoval).
arg ifNotNil: [ self editScript: arg].
MCWorkingCopyBrowser>>editScript: {morphic ui} · ct 11/22/2021 15:59 (changed) editScript: scriptSymbol
- | script |
- script := workingCopy packageInfo perform: scriptSymbol.
- script openLabel: scriptSymbol asString, ' of the Package ', workingCopy package name.
- | script |
- script := workingCopy packageInfo perform: scriptSymbol.
- Project uiManager
- edit: script
- label: ('{1} of the Package {2}' translated format: {scriptSymbol asString capitalized. workingCopy package name})
- shouldStyle: true
- accept: [:result | workingCopy packageInfo
- perform: scriptSymbol asSimpleSetter
- with: result]
PackageInfo>>isScript:not: {preamble/postscript} · ct 11/22/2021 15:53 (changed) isScript: script not: default ^ script notNil and: [ | contents |
- contents := script contents asString withBlanksTrimmed.
- contents := script asString withBlanksTrimmed.
contents notEmpty and: [contents ~= default and: [contents ~= 'nil']]]
PackageInfo>>postscript {preamble/postscript} · ct 11/22/2021 15:53 (changed) postscript
^ postscript ifNil: [
- postscript := StringHolder new contents: self postscriptDefault]
- postscript := self postscriptDefault]
PackageInfo>>postscript: {preamble/postscript} · ct 11/22/2021 15:57 (changed) postscript: aString
- postscript := StringHolder new contents: aString
- postscript := aString
PackageInfo>>postscriptOfRemoval {preamble/postscript} · ct 11/22/2021 15:53 (changed) postscriptOfRemoval ^ postscriptOfRemoval ifNil: [
- postscriptOfRemoval := StringHolder new contents: self postscriptOfRemovalDefault]
- postscriptOfRemoval := self postscriptOfRemovalDefault]
PackageInfo>>postscriptOfRemoval: {preamble/postscript} · ct 11/22/2021 15:57 (changed) postscriptOfRemoval: aString
- postscriptOfRemoval := StringHolder new contents: aString
- postscriptOfRemoval := aString
PackageInfo>>preamble {preamble/postscript} · ct 11/22/2021 15:54 (changed) preamble ^ preamble ifNil: [
- preamble := StringHolder new contents: self preambleDefault]
- preamble := self preambleDefault]
PackageInfo>>preamble: {preamble/postscript} · ct 11/22/2021 15:56 (changed) preamble: aString
- preamble := StringHolder new contents: aString
- preamble := aString
PackageInfo>>preambleOfRemoval {preamble/postscript} · ct 11/22/2021 15:54 (changed) preambleOfRemoval ^ preambleOfRemoval ifNil: [
- preambleOfRemoval := StringHolder new contents: self preambleOfRemovalDefault]
- preambleOfRemoval := self preambleOfRemovalDefault]
PackageInfo>>preambleOfRemoval: {preamble/postscript} · ct 11/22/2021 15:56 (changed) preambleOfRemoval: aString
- preambleOfRemoval := StringHolder new contents: aString
- preambleOfRemoval := aString
Sent from Squeak Inbox Talk [https://github.com/hpi-swa-lab/squeak-inbox-talk]
On 2021-11-22T16:22:02+01:00, marcel.taeumel at hpi.de wrote:
So, preamble and postscript would now be regular Strings instead? Sounds good to me, given that they are stored as strings on the server anyway.
Please double-check to not upload texts (or their serialized form) to the server.
Best, Marcel Am 22.11.2021 16:17:43 schrieb christoph.thiede at student.hpi.uni-potsdam.de <christoph.thiede at student.hpi.uni-potsdam.de>: Please give me a short feedback on whether you agree with the idea of this change (PackageInfo scripts are no longer instances of StringHolder). If there is no objection, I will try to merge this into the Trunk after a week or so. :-)
["stylePackageScripts.png"]
Best, Christoph
=============== Summary ===============
Change Set: stylePackageScripts Date: 22 November 2021 Author: Christoph Thiede
This change set enables syntax highlighting for package scripts ({preamble,postscript}{, of removal}). To achieve this, the instance variables in PackageInfo are converted to hold plain strings or texts rather than StringHolders, and the client (Monticello) is reponsible itself for displaying them to the user and storing them back into the package. Note the postscript which converts all PackageInfo instances in the image.
=============== Postscript ===============
"Postscript: Eliminate StringHolder script in PackageInfos" PackageInfo allSubInstancesDo: [:packageInfo | #(preamble postscript preambleOfRemoval postscriptOfRemoval) do: [:sel | (packageInfo instVarNamed: sel) ifNotNil: [:stringHolder | packageInfo instVarNamed: sel put: stringHolder contents]]].
=============== Diff ===============
MCWorkingCopyBrowser>>editLoadScripts {morphic ui} · ct 11/22/2021 16:05 (changed) editLoadScripts
| arg | self hasWorkingCopy ifFalse: [^self]. arg := UIManager default
- chooseFrom: #('edit preamble' 'edit postscript' 'edit preambleOfRemoval' 'edit postscriptOfRemoval')
- chooseFrom: {'edit preamble' translated. 'edit postscript' translated. 'edit preambleOfRemoval' translated. 'edit postscriptOfRemoval' translated}
values: #(#preamble #postscript #preambleOfRemoval #postscriptOfRemoval).
arg ifNotNil: [ self editScript: arg].
MCWorkingCopyBrowser>>editScript: {morphic ui} · ct 11/22/2021 15:59 (changed) editScript: scriptSymbol
- | script |
- script := workingCopy packageInfo perform: scriptSymbol.
- script openLabel: scriptSymbol asString, ' of the Package ', workingCopy package name.
- | script |
- script := workingCopy packageInfo perform: scriptSymbol.
- Project uiManager
- edit: script
- label: ('{1} of the Package {2}' translated format: {scriptSymbol asString capitalized. workingCopy package name})
- shouldStyle: true
- accept: [:result | workingCopy packageInfo
- perform: scriptSymbol asSimpleSetter
- with: result]
PackageInfo>>isScript:not: {preamble/postscript} · ct 11/22/2021 15:53 (changed) isScript: script not: default ^ script notNil and: [ | contents |
- contents := script contents asString withBlanksTrimmed.
- contents := script asString withBlanksTrimmed.
contents notEmpty and: [contents ~= default and: [contents ~= 'nil']]]
PackageInfo>>postscript {preamble/postscript} · ct 11/22/2021 15:53 (changed) postscript
^ postscript ifNil: [
- postscript := StringHolder new contents: self postscriptDefault]
- postscript := self postscriptDefault]
PackageInfo>>postscript: {preamble/postscript} · ct 11/22/2021 15:57 (changed) postscript: aString
- postscript := StringHolder new contents: aString
- postscript := aString
PackageInfo>>postscriptOfRemoval {preamble/postscript} · ct 11/22/2021 15:53 (changed) postscriptOfRemoval ^ postscriptOfRemoval ifNil: [
- postscriptOfRemoval := StringHolder new contents: self postscriptOfRemovalDefault]
- postscriptOfRemoval := self postscriptOfRemovalDefault]
PackageInfo>>postscriptOfRemoval: {preamble/postscript} · ct 11/22/2021 15:57 (changed) postscriptOfRemoval: aString
- postscriptOfRemoval := StringHolder new contents: aString
- postscriptOfRemoval := aString
PackageInfo>>preamble {preamble/postscript} · ct 11/22/2021 15:54 (changed) preamble ^ preamble ifNil: [
- preamble := StringHolder new contents: self preambleDefault]
- preamble := self preambleDefault]
PackageInfo>>preamble: {preamble/postscript} · ct 11/22/2021 15:56 (changed) preamble: aString
- preamble := StringHolder new contents: aString
- preamble := aString
PackageInfo>>preambleOfRemoval {preamble/postscript} · ct 11/22/2021 15:54 (changed) preambleOfRemoval ^ preambleOfRemoval ifNil: [
- preambleOfRemoval := StringHolder new contents: self preambleOfRemovalDefault]
- preambleOfRemoval := self preambleOfRemovalDefault]
PackageInfo>>preambleOfRemoval: {preamble/postscript} · ct 11/22/2021 15:56 (changed) preambleOfRemoval: aString
- preambleOfRemoval := StringHolder new contents: aString
- preambleOfRemoval := aString
["stylePackageScripts.2.cs"]
squeak-dev@lists.squeakfoundation.org