[Pharo-project] syntax highlighting for (stateful) traits (non-local methods)

Toon Verwaest toon.verwaest at gmail.com
Sat Apr 2 22:34:28 CEST 2011

Ok, found it out by myself. I just hooked into OB directly:

shouldBeStyledBy: aPluggableShoutMorph
     aPluggableShoutMorph classOrMetaClass: (theClass 
traitOrClassOfSelector: self selector).
     ^ true


On 04/02/2011 09:10 PM, Toon Verwaest wrote:
> Hi all,
> as you know I'm working on stateful traits using my new classbuilder 
> etc... Now I noticed that methods are highlighted always inside of the 
> context of the class that's active in the class browser. How can I 
> change this? There is already a useful method around to figure out 
> which object it belongs to:
> SomeClass traitOrClassOfSelector: #aMethod
> This actually will tell me which trait it comes from. So now I could 
> apply syntax coloring in the context of the trait rather than the 
> class. Since in my implementation state is all private to the trait / 
> class, they should be able to access their own state but not see the 
> state of the other class. This obviously also means that coloring 
> should happen in the correct scope, rather than always in the scope of 
> the class.
> At the moment the coloring doesn't really make sense ... but then it 
> didn't really matter that much until now. Although if you try to 
> access state in a method coming from a trait, while coding in your IDE 
> you'll probably have the impression you can access your local 
> instvars. I don't really know what the semantics are there... but it 
> seems a bit broken :)
> cheers,
> Toon

More information about the Pharo-project mailing list