Create new trait in Browser

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

Create new trait in Browser

Jakob Reschke
Hello,

When I want to create a new Trait, I currently search and type the trait template myself. You know, Trait named: #foo uses: ...

Should there not be a context menu item that fills the browser code pane with the template?

I see there is Browser>>newTrait and Browser>>addSpecialMenu: but the latter has no senders in my Trunk image.

Kind regards
Jakob


Reply | Threaded
Open this post in threaded view
|

Re: Create new trait in Browser

Christoph Thiede

Nice idea! I have been using Traits for only one time in my Squeak life so far, but they surely can be helpful in certain cases.


Would this maybe be rather a job for a good autocompletion?

If I'm creating code, I will not search in any menus. I would like to type "Trait" into the class definition field and be proposed "Trait named: ___ uses: ___". Same for "Morph" ("Morph subclass: ___ instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'xyz'", and also the version with #uses:).
The autocompletion could detect that you are typing into a class definition field and then first suggest selectors from a whitelist of the ones mentioned above.

This whitelist could be defined by certain message categories (Class: #'subclass creation', Trait: #'instance creation').
I'm not familiar with the OCompletion implementation, but a bit with Autocompletion, where the latter allows specifying custom completion controllers, so this should be possible without huge design changes. Does someone know about OCompletion?

Best,
Christoph

Von: Squeak-dev <[hidden email]> im Auftrag von Jakob Reschke <[hidden email]>
Gesendet: Sonntag, 8. Dezember 2019 16:39:57
An: [hidden email]
Betreff: [squeak-dev] Create new trait in Browser
 
Hello,

When I want to create a new Trait, I currently search and type the trait template myself. You know, Trait named: #foo uses: ...

Should there not be a context menu item that fills the browser code pane with the template?

I see there is Browser>>newTrait and Browser>>addSpecialMenu: but the latter has no senders in my Trunk image.

Kind regards
Jakob


Carpe Squeak!
Reply | Threaded
Open this post in threaded view
|

Re: Create new trait in Browser

Jakob Reschke
That might be nice. But I think this is too many steps ahead for now.
   
Today the templates are invoked either
- via empty selection (for a new class deriving from Object), or
- the class menu (to make subclasses of the selected class).
The trait template should be available somewhere similar.

Hooking into the menus is probably much easier than extending the auto-completion. The unsent method addSpecialMenu: looks like it was already done or considered at some point, but then got dropped or was overlooked and forgotten.

Am So., 8. Dez. 2019 um 17:32 Uhr schrieb Thiede, Christoph <[hidden email]>:

Nice idea! I have been using Traits for only one time in my Squeak life so far, but they surely can be helpful in certain cases.


Would this maybe be rather a job for a good autocompletion?

If I'm creating code, I will not search in any menus. I would like to type "Trait" into the class definition field and be proposed "Trait named: ___ uses: ___". Same for "Morph" ("Morph subclass: ___ instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'xyz'", and also the version with #uses:).
The autocompletion could detect that you are typing into a class definition field and then first suggest selectors from a whitelist of the ones mentioned above.

This whitelist could be defined by certain message categories (Class: #'subclass creation', Trait: #'instance creation').
I'm not familiar with the OCompletion implementation, but a bit with Autocompletion, where the latter allows specifying custom completion controllers, so this should be possible without huge design changes. Does someone know about OCompletion?

Best,
Christoph

Von: Squeak-dev <[hidden email]> im Auftrag von Jakob Reschke <[hidden email]>
Gesendet: Sonntag, 8. Dezember 2019 16:39:57
An: [hidden email]
Betreff: [squeak-dev] Create new trait in Browser
 
Hello,

When I want to create a new Trait, I currently search and type the trait template myself. You know, Trait named: #foo uses: ...

Should there not be a context menu item that fills the browser code pane with the template?

I see there is Browser>>newTrait and Browser>>addSpecialMenu: but the latter has no senders in my Trunk image.

Kind regards
Jakob



Reply | Threaded
Open this post in threaded view
|

Re: Create new trait in Browser

Christoph Thiede

Ah cool, I actually was not aware of that class menu :-)


Yes, adding more templates there via a submenu sounds reasonable to me. +1!


Von: Squeak-dev <[hidden email]> im Auftrag von Jakob Reschke <[hidden email]>
Gesendet: Sonntag, 8. Dezember 2019 17:46:07
An: The general-purpose Squeak developers list
Betreff: Re: [squeak-dev] Create new trait in Browser
 
That might be nice. But I think this is too many steps ahead for now.
   
Today the templates are invoked either
- via empty selection (for a new class deriving from Object), or
- the class menu (to make subclasses of the selected class).
The trait template should be available somewhere similar.

Hooking into the menus is probably much easier than extending the auto-completion. The unsent method addSpecialMenu: looks like it was already done or considered at some point, but then got dropped or was overlooked and forgotten.

Am So., 8. Dez. 2019 um 17:32 Uhr schrieb Thiede, Christoph <[hidden email]>:

Nice idea! I have been using Traits for only one time in my Squeak life so far, but they surely can be helpful in certain cases.


Would this maybe be rather a job for a good autocompletion?

If I'm creating code, I will not search in any menus. I would like to type "Trait" into the class definition field and be proposed "Trait named: ___ uses: ___". Same for "Morph" ("Morph subclass: ___ instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'xyz'", and also the version with #uses:).
The autocompletion could detect that you are typing into a class definition field and then first suggest selectors from a whitelist of the ones mentioned above.

This whitelist could be defined by certain message categories (Class: #'subclass creation', Trait: #'instance creation').
I'm not familiar with the OCompletion implementation, but a bit with Autocompletion, where the latter allows specifying custom completion controllers, so this should be possible without huge design changes. Does someone know about OCompletion?

Best,
Christoph

Von: Squeak-dev <[hidden email]> im Auftrag von Jakob Reschke <[hidden email]>
Gesendet: Sonntag, 8. Dezember 2019 16:39:57
An: [hidden email]
Betreff: [squeak-dev] Create new trait in Browser
 
Hello,

When I want to create a new Trait, I currently search and type the trait template myself. You know, Trait named: #foo uses: ...

Should there not be a context menu item that fills the browser code pane with the template?

I see there is Browser>>newTrait and Browser>>addSpecialMenu: but the latter has no senders in my Trunk image.

Kind regards
Jakob



Carpe Squeak!