Package question re: reformatting

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Package question re: reformatting

Phil B
Any suggestions for a quick way to mass-reformat everything in a package? I'd like to get everything pretty printed to strip out the cr's etc. without needing to edit every method/comment in the package.

Thanks,
Phil
_______________________________________________
Cuis mailing list
[hidden email]
http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
Reply | Threaded
Open this post in threaded view
|

Re: Package question re: reformatting

David Graham
Hi Phil,
After digging around, I found the following method fixes line endings
for the entire system:

(SystemDictionary new) fixSourceCodeLineEndings

Not sure if this is the official way, but it worked for fixing my ported
packages.  I was thinking of adding a method to install/fileIn, since
this is a common issue while porting squeak/pharo code.


On 6/2/12 9:04 PM, Phil (list) wrote:
> Any suggestions for a quick way to mass-reformat everything in a package? I'd like to get everything pretty printed to strip out the cr's etc. without needing to edit every method/comment in the package.
>
> Thanks,
> Phil
> _______________________________________________
> Cuis mailing list
> [hidden email]
> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org


_______________________________________________
Cuis mailing list
[hidden email]
http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
Reply | Threaded
Open this post in threaded view
|

Re: Package question re: reformatting

Phil B
David,

On Jun 4, 2012, at 11:16 AM, David Graham wrote:

> Hi Phil,
> After digging around, I found the following method fixes line endings for the entire system:
>
> (SystemDictionary new) fixSourceCodeLineEndings
>
> Not sure if this is the official way, but it worked for fixing my ported packages.  I was thinking of adding a method to install/fileIn, since this is a common issue while porting squeak/pharo code.
>

I'll give that a shot.  It would definitely be nice if this were an option (not sure you'd always want it done since there might be legitimate cases when you actually want cr's in the loaded file) when loading code since it is such a common issue.  Assuming that this behaves the same as the pretty print functionality one thing it doesn't do is eliminate the cr's from comments which it would be nice if it did.

Thanks,
Phil
_______________________________________________
Cuis mailing list
[hidden email]
http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
Reply | Threaded
Open this post in threaded view
|

Re: Package question re: reformatting

Juan Vuletich-4
In reply to this post by David Graham
Hi Folks,

There's no "official" way... What I usually do is to select the package
file in the FileList, do cmd-a (select all) and cmd-shift-u (fix line
endings), and then save the file. #fixSourceCodeLineEndings is ok too.
Note that we usually don't create instances of SystemDictionary, but use
the existing one: Smalltalk.

In any case, having a command for pretty-printing the whole package
sounds useful. Doing that will also fix line endings. So, just do it!

Cheers,
Juan Vuletich

David Graham wrote:

> Hi Phil,
> After digging around, I found the following method fixes line endings
> for the entire system:
>
> (SystemDictionary new) fixSourceCodeLineEndings
>
> Not sure if this is the official way, but it worked for fixing my
> ported packages.  I was thinking of adding a method to install/fileIn,
> since this is a common issue while porting squeak/pharo code.
>
>
> On 6/2/12 9:04 PM, Phil (list) wrote:
>> Any suggestions for a quick way to mass-reformat everything in a
>> package? I'd like to get everything pretty printed to strip out the
>> cr's etc. without needing to edit every method/comment in the package.
>>
>> Thanks,
>> Phil
>> _______________________________________________
>> Cuis mailing list
>> [hidden email]
>> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
>
>
> _______________________________________________
> Cuis mailing list
> [hidden email]
> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
>
>
> -----
> Se certifico que el correo no contiene virus.
> Comprobada por AVG - www.avg.es
> Version: 2012.0.1913 / Base de datos de virus: 2425/5033 - Fecha de la
> version: 30/05/2012
>
>


_______________________________________________
Cuis mailing list
[hidden email]
http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
Reply | Threaded
Open this post in threaded view
|

Re: Package question re: reformatting

Juan Vuletich-4
In reply to this post by Phil B
Phil (list) wrote:

> David,
>
> On Jun 4, 2012, at 11:16 AM, David Graham wrote:
>
>  
>> Hi Phil,
>> After digging around, I found the following method fixes line endings for the entire system:
>>
>> (SystemDictionary new) fixSourceCodeLineEndings
>>
>> Not sure if this is the official way, but it worked for fixing my ported packages.  I was thinking of adding a method to install/fileIn, since this is a common issue while porting squeak/pharo code.
>>
>>    
>
> I'll give that a shot.  It would definitely be nice if this were an option (not sure you'd always want it done since there might be legitimate cases when you actually want cr's in the loaded file) when loading code since it is such a common issue.  Assuming that this behaves the same as the pretty print functionality one thing it doesn't do is eliminate the cr's from comments which it would be nice if it did.
>
>  

Oh, that's easy. Just add 'withCuisLineEndings' at the end of MethodNode
 >> decompileString. Will be in the updates soon.

Cheers,
Juan Vuletich

> Thanks,
> Phil
> _______________________________________________
> Cuis mailing list
> [hidden email]
> http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org
>
>
> -----
> Se certifico que el correo no contiene virus.
> Comprobada por AVG - www.avg.es
> Version: 2012.0.1913 / Base de datos de virus: 2425/5033 - Fecha de la version: 30/05/2012
>
>
>  


_______________________________________________
Cuis mailing list
[hidden email]
http://jvuletich.org/mailman/listinfo/cuis_jvuletich.org