The Trunk: Morphic-eem.1340.mcz

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

The Trunk: Morphic-eem.1340.mcz

commits-2
Eliot Miranda uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-eem.1340.mcz

==================== Summary ====================

Name: Morphic-eem.1340
Author: eem
Time: 1 June 2017, 1:21:49.04056 pm
UUID: 6117ed97-d114-454b-a38c-b35edc306c14
Ancestors: Morphic-eem.1339

Fix browseIt so that accesses to a selected inst var are browsed, not just senders of the accessor.  Needs alternateBrowseIt preference disabled.

=============== Diff against Morphic-eem.1339 ===============

Item was changed:
  ----- Method: TextEditor>>browseIt (in category 'menu messages') -----
  browseIt
  "Launch a browser for the current selection, if appropriate"
 
+ | aSymbol anEntry brow maybeBrowseInstVar |
- | aSymbol anEntry brow |
 
  Preferences alternativeBrowseIt ifTrue: [^ self browseClassFromIt].
 
  self lineSelectAndEmptyCheck: [^ self].
- (aSymbol := self selectedSymbol) isNil ifTrue: [^ morph flash].
 
+ maybeBrowseInstVar :=
+ [| selectionString |
+ selectionString := self selection asString.
+ ([model selectedClass] on: Error do: [:ex|]) ifNotNil:
+ [:class|
+ (class allInstVarNames includes: selectionString) ifTrue:
+ [self systemNavigation
+ browseAllAccessesTo: selectionString
+ from: (class classThatDefinesInstanceVariable: selectionString).
+ ^nil]]].
+
+ (aSymbol := self selectedSymbol) ifNil:
+ [maybeBrowseInstVar value.
+ ^morph flash].
+
  aSymbol first isUppercase
  ifTrue:
  [anEntry := (model environment
  valueOf: aSymbol
  ifAbsent:
  [ self systemNavigation browseAllImplementorsOf: aSymbol.
  ^ nil]).
  anEntry ifNil: [^ morph flash].
+ (anEntry isBehavior and: [anEntry name == aSymbol]) ifFalse: "When is this ever false?"
+ [anEntry := anEntry class].
- (anEntry isKindOf: Class)
- ifFalse: [anEntry := anEntry class].
  brow := SystemBrowser default new.
  brow setClass: anEntry selector: nil.
  brow class
  openBrowserView: (brow openEditString: nil)
  label: 'System Browser']
  ifFalse:
+ [self systemNavigation browseAllImplementorsOf: aSymbol.
+ maybeBrowseInstVar value]!
- [self systemNavigation browseAllImplementorsOf: aSymbol]!


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-eem.1340.mcz

Chris Muller-3
Hey Eliot,

"Senders" refers to message-sends only, where as variable references are
browsed using the "browse references" command, (Command+Shift+N), which
does work for browsing references to inst-vars.

Best.

On Thu, Jun 1, 2017 at 3:22 PM,  <[hidden email]> wrote:

> Eliot Miranda uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-eem.1340.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-eem.1340
> Author: eem
> Time: 1 June 2017, 1:21:49.04056 pm
> UUID: 6117ed97-d114-454b-a38c-b35edc306c14
> Ancestors: Morphic-eem.1339
>
> Fix browseIt so that accesses to a selected inst var are browsed, not just senders of the accessor.  Needs alternateBrowseIt preference disabled.
>
> =============== Diff against Morphic-eem.1339 ===============
>
> Item was changed:
>   ----- Method: TextEditor>>browseIt (in category 'menu messages') -----
>   browseIt
>         "Launch a browser for the current selection, if appropriate"
>
> +       | aSymbol anEntry brow maybeBrowseInstVar |
> -       | aSymbol anEntry brow |
>
>         Preferences alternativeBrowseIt ifTrue: [^ self browseClassFromIt].
>
>         self lineSelectAndEmptyCheck: [^ self].
> -       (aSymbol := self selectedSymbol) isNil ifTrue: [^ morph flash].
>
> +       maybeBrowseInstVar :=
> +               [| selectionString |
> +               selectionString := self selection asString.
> +                ([model selectedClass] on: Error do: [:ex|]) ifNotNil:
> +                       [:class|
> +                       (class allInstVarNames includes: selectionString) ifTrue:
> +                               [self systemNavigation
> +                                       browseAllAccessesTo: selectionString
> +                                       from: (class classThatDefinesInstanceVariable: selectionString).
> +                                ^nil]]].
> +
> +       (aSymbol := self selectedSymbol) ifNil:
> +               [maybeBrowseInstVar value.
> +                ^morph flash].
> +
>         aSymbol first isUppercase
>                 ifTrue:
>                         [anEntry := (model environment
>                                 valueOf: aSymbol
>                                 ifAbsent:
>                                         [ self systemNavigation browseAllImplementorsOf: aSymbol.
>                                         ^ nil]).
>                         anEntry ifNil: [^ morph flash].
> +                       (anEntry isBehavior and: [anEntry name == aSymbol]) ifFalse: "When is this ever false?"
> +                               [anEntry := anEntry class].
> -                       (anEntry isKindOf: Class)
> -                               ifFalse:        [anEntry := anEntry class].
>                         brow := SystemBrowser default new.
>                         brow setClass: anEntry selector: nil.
>                         brow class
>                                 openBrowserView: (brow openEditString: nil)
>                                 label: 'System Browser']
>                 ifFalse:
> +                       [self systemNavigation browseAllImplementorsOf: aSymbol.
> +                        maybeBrowseInstVar value]!
> -                       [self systemNavigation browseAllImplementorsOf: aSymbol]!
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-eem.1340.mcz

Eliot Miranda-2
Hi Chris,

On Fri, Jun 2, 2017 at 2:12 PM, Chris Muller <[hidden email]> wrote:
Hey Eliot,

"Senders" refers to message-sends only, where as variable references are
browsed using the "browse references" command, (Command+Shift+N), which
does work for browsing references to inst-vars.

Some users prefer the "browse it" (Apple-b,Alt-b) command, which is achieved by disabling "alternate browse it", in which case the below is operative.
 

Best.

On Thu, Jun 1, 2017 at 3:22 PM,  <[hidden email]> wrote:
> Eliot Miranda uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-eem.1340.mcz
>
> ==================== Summary ====================
>
> Name: Morphic-eem.1340
> Author: eem
> Time: 1 June 2017, 1:21:49.04056 pm
> UUID: 6117ed97-d114-454b-a38c-b35edc306c14
> Ancestors: Morphic-eem.1339
>
> Fix browseIt so that accesses to a selected inst var are browsed, not just senders of the accessor.  Needs alternateBrowseIt preference disabled.
>
> =============== Diff against Morphic-eem.1339 ===============
>
> Item was changed:
>   ----- Method: TextEditor>>browseIt (in category 'menu messages') -----
>   browseIt
>         "Launch a browser for the current selection, if appropriate"
>
> +       | aSymbol anEntry brow maybeBrowseInstVar |
> -       | aSymbol anEntry brow |
>
>         Preferences alternativeBrowseIt ifTrue: [^ self browseClassFromIt].
>
>         self lineSelectAndEmptyCheck: [^ self].
> -       (aSymbol := self selectedSymbol) isNil ifTrue: [^ morph flash].
>
> +       maybeBrowseInstVar :=
> +               [| selectionString |
> +               selectionString := self selection asString.
> +                ([model selectedClass] on: Error do: [:ex|]) ifNotNil:
> +                       [:class|
> +                       (class allInstVarNames includes: selectionString) ifTrue:
> +                               [self systemNavigation
> +                                       browseAllAccessesTo: selectionString
> +                                       from: (class classThatDefinesInstanceVariable: selectionString).
> +                                ^nil]]].
> +
> +       (aSymbol := self selectedSymbol) ifNil:
> +               [maybeBrowseInstVar value.
> +                ^morph flash].
> +
>         aSymbol first isUppercase
>                 ifTrue:
>                         [anEntry := (model environment
>                                 valueOf: aSymbol
>                                 ifAbsent:
>                                         [ self systemNavigation browseAllImplementorsOf: aSymbol.
>                                         ^ nil]).
>                         anEntry ifNil: [^ morph flash].
> +                       (anEntry isBehavior and: [anEntry name == aSymbol]) ifFalse: "When is this ever false?"
> +                               [anEntry := anEntry class].
> -                       (anEntry isKindOf: Class)
> -                               ifFalse:        [anEntry := anEntry class].
>                         brow := SystemBrowser default new.
>                         brow setClass: anEntry selector: nil.
>                         brow class
>                                 openBrowserView: (brow openEditString: nil)
>                                 label: 'System Browser']
>                 ifFalse:
> +                       [self systemNavigation browseAllImplementorsOf: aSymbol.
> +                        maybeBrowseInstVar value]!
> -                       [self systemNavigation browseAllImplementorsOf: aSymbol]!
>
>




--
_,,,^..^,,,_
best, Eliot


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-eem.1340.mcz

Chris Muller-3
Ah, for a moment I thought you added it to "senders".


On Fri, Jun 2, 2017 at 5:04 PM, Eliot Miranda <[hidden email]> wrote:

> Hi Chris,
>
> On Fri, Jun 2, 2017 at 2:12 PM, Chris Muller <[hidden email]> wrote:
>>
>> Hey Eliot,
>>
>> "Senders" refers to message-sends only, where as variable references are
>> browsed using the "browse references" command, (Command+Shift+N), which
>> does work for browsing references to inst-vars.
>
>
> Some users prefer the "browse it" (Apple-b,Alt-b) command, which is achieved
> by disabling "alternate browse it", in which case the below is operative.
>
>>
>>
>> Best.
>>
>> On Thu, Jun 1, 2017 at 3:22 PM,  <[hidden email]> wrote:
>> > Eliot Miranda uploaded a new version of Morphic to project The Trunk:
>> > http://source.squeak.org/trunk/Morphic-eem.1340.mcz
>> >
>> > ==================== Summary ====================
>> >
>> > Name: Morphic-eem.1340
>> > Author: eem
>> > Time: 1 June 2017, 1:21:49.04056 pm
>> > UUID: 6117ed97-d114-454b-a38c-b35edc306c14
>> > Ancestors: Morphic-eem.1339
>> >
>> > Fix browseIt so that accesses to a selected inst var are browsed, not
>> > just senders of the accessor.  Needs alternateBrowseIt preference disabled.
>> >
>> > =============== Diff against Morphic-eem.1339 ===============
>> >
>> > Item was changed:
>> >   ----- Method: TextEditor>>browseIt (in category 'menu messages') -----
>> >   browseIt
>> >         "Launch a browser for the current selection, if appropriate"
>> >
>> > +       | aSymbol anEntry brow maybeBrowseInstVar |
>> > -       | aSymbol anEntry brow |
>> >
>> >         Preferences alternativeBrowseIt ifTrue: [^ self
>> > browseClassFromIt].
>> >
>> >         self lineSelectAndEmptyCheck: [^ self].
>> > -       (aSymbol := self selectedSymbol) isNil ifTrue: [^ morph flash].
>> >
>> > +       maybeBrowseInstVar :=
>> > +               [| selectionString |
>> > +               selectionString := self selection asString.
>> > +                ([model selectedClass] on: Error do: [:ex|]) ifNotNil:
>> > +                       [:class|
>> > +                       (class allInstVarNames includes:
>> > selectionString) ifTrue:
>> > +                               [self systemNavigation
>> > +                                       browseAllAccessesTo:
>> > selectionString
>> > +                                       from: (class
>> > classThatDefinesInstanceVariable: selectionString).
>> > +                                ^nil]]].
>> > +
>> > +       (aSymbol := self selectedSymbol) ifNil:
>> > +               [maybeBrowseInstVar value.
>> > +                ^morph flash].
>> > +
>> >         aSymbol first isUppercase
>> >                 ifTrue:
>> >                         [anEntry := (model environment
>> >                                 valueOf: aSymbol
>> >                                 ifAbsent:
>> >                                         [ self systemNavigation
>> > browseAllImplementorsOf: aSymbol.
>> >                                         ^ nil]).
>> >                         anEntry ifNil: [^ morph flash].
>> > +                       (anEntry isBehavior and: [anEntry name ==
>> > aSymbol]) ifFalse: "When is this ever false?"
>> > +                               [anEntry := anEntry class].
>> > -                       (anEntry isKindOf: Class)
>> > -                               ifFalse:        [anEntry := anEntry
>> > class].
>> >                         brow := SystemBrowser default new.
>> >                         brow setClass: anEntry selector: nil.
>> >                         brow class
>> >                                 openBrowserView: (brow openEditString:
>> > nil)
>> >                                 label: 'System Browser']
>> >                 ifFalse:
>> > +                       [self systemNavigation browseAllImplementorsOf:
>> > aSymbol.
>> > +                        maybeBrowseInstVar value]!
>> > -                       [self systemNavigation browseAllImplementorsOf:
>> > aSymbol]!
>> >
>> >
>>
>
>
>
> --
> _,,,^..^,,,_
> best, Eliot
>
>
>

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-eem.1340.mcz

Eliot Miranda-2


On Fri, Jun 2, 2017 at 3:34 PM, Chris Muller <[hidden email]> wrote:
Ah, for a moment I thought you added it to "senders".

It's specifically there so that inst var accesses are browsed as well as senders of the accessor, not just the accessor.  What used to happen is that if you selected an inst var and did "browse it" you;d only get senders of the inst var if it was a message selector.  Not that useful given "senders". 


On Fri, Jun 2, 2017 at 5:04 PM, Eliot Miranda <[hidden email]> wrote:
> Hi Chris,
>
> On Fri, Jun 2, 2017 at 2:12 PM, Chris Muller <[hidden email]> wrote:
>>
>> Hey Eliot,
>>
>> "Senders" refers to message-sends only, where as variable references are
>> browsed using the "browse references" command, (Command+Shift+N), which
>> does work for browsing references to inst-vars.
>
>
> Some users prefer the "browse it" (Apple-b,Alt-b) command, which is achieved
> by disabling "alternate browse it", in which case the below is operative.
>
>>
>>
>> Best.
>>
>> On Thu, Jun 1, 2017 at 3:22 PM,  <[hidden email]> wrote:
>> > Eliot Miranda uploaded a new version of Morphic to project The Trunk:
>> > http://source.squeak.org/trunk/Morphic-eem.1340.mcz
>> >
>> > ==================== Summary ====================
>> >
>> > Name: Morphic-eem.1340
>> > Author: eem
>> > Time: 1 June 2017, 1:21:49.04056 pm
>> > UUID: 6117ed97-d114-454b-a38c-b35edc306c14
>> > Ancestors: Morphic-eem.1339
>> >
>> > Fix browseIt so that accesses to a selected inst var are browsed, not
>> > just senders of the accessor.  Needs alternateBrowseIt preference disabled.
>> >
>> > =============== Diff against Morphic-eem.1339 ===============
>> >
>> > Item was changed:
>> >   ----- Method: TextEditor>>browseIt (in category 'menu messages') -----
>> >   browseIt
>> >         "Launch a browser for the current selection, if appropriate"
>> >
>> > +       | aSymbol anEntry brow maybeBrowseInstVar |
>> > -       | aSymbol anEntry brow |
>> >
>> >         Preferences alternativeBrowseIt ifTrue: [^ self
>> > browseClassFromIt].
>> >
>> >         self lineSelectAndEmptyCheck: [^ self].
>> > -       (aSymbol := self selectedSymbol) isNil ifTrue: [^ morph flash].
>> >
>> > +       maybeBrowseInstVar :=
>> > +               [| selectionString |
>> > +               selectionString := self selection asString.
>> > +                ([model selectedClass] on: Error do: [:ex|]) ifNotNil:
>> > +                       [:class|
>> > +                       (class allInstVarNames includes:
>> > selectionString) ifTrue:
>> > +                               [self systemNavigation
>> > +                                       browseAllAccessesTo:
>> > selectionString
>> > +                                       from: (class
>> > classThatDefinesInstanceVariable: selectionString).
>> > +                                ^nil]]].
>> > +
>> > +       (aSymbol := self selectedSymbol) ifNil:
>> > +               [maybeBrowseInstVar value.
>> > +                ^morph flash].
>> > +
>> >         aSymbol first isUppercase
>> >                 ifTrue:
>> >                         [anEntry := (model environment
>> >                                 valueOf: aSymbol
>> >                                 ifAbsent:
>> >                                         [ self systemNavigation
>> > browseAllImplementorsOf: aSymbol.
>> >                                         ^ nil]).
>> >                         anEntry ifNil: [^ morph flash].
>> > +                       (anEntry isBehavior and: [anEntry name ==
>> > aSymbol]) ifFalse: "When is this ever false?"
>> > +                               [anEntry := anEntry class].
>> > -                       (anEntry isKindOf: Class)
>> > -                               ifFalse:        [anEntry := anEntry
>> > class].
>> >                         brow := SystemBrowser default new.
>> >                         brow setClass: anEntry selector: nil.
>> >                         brow class
>> >                                 openBrowserView: (brow openEditString:
>> > nil)
>> >                                 label: 'System Browser']
>> >                 ifFalse:
>> > +                       [self systemNavigation browseAllImplementorsOf:
>> > aSymbol.
>> > +                        maybeBrowseInstVar value]!
>> > -                       [self systemNavigation browseAllImplementorsOf:
>> > aSymbol]!
>> >
>> >
>>
>
>
>
> --
> _,,,^..^,,,_
> best, Eliot
>
>
>




--
_,,,^..^,,,_
best, Eliot


Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-eem.1340.mcz

Jakob Reschke-2
In reply to this post by commits-2
2017-06-01 22:22 GMT+02:00 [hidden email]
<[hidden email]>:
> Eliot Miranda uploaded a new version of Morphic to project The Trunk:
> http://source.squeak.org/trunk/Morphic-eem.1340.mcz
>
> =============== Diff against Morphic-eem.1339 ===============
>
> +                       (anEntry isBehavior and: [anEntry name == aSymbol]) ifFalse: "When is this ever false?"
> +                               [anEntry := anEntry class].
> -                       (anEntry isKindOf: Class)
> -                               ifFalse:        [anEntry := anEntry class].

How nice, this saves me a tour to the inbox. Now you can hassle-freely
go to traits mentioned in a uses: clause via browseIt, instead of
being taken to the class Trait.

The condition is false for globals such as Smalltalk and SystemOrganization.

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-eem.1340.mcz

Eliot Miranda-2
Hi Jacob,

> On Jun 3, 2017, at 2:32 AM, Jakob Reschke <[hidden email]> wrote:
>
> 2017-06-01 22:22 GMT+02:00 [hidden email]
> <[hidden email]>:
>> Eliot Miranda uploaded a new version of Morphic to project The Trunk:
>> http://source.squeak.org/trunk/Morphic-eem.1340.mcz
>>
>> =============== Diff against Morphic-eem.1339 ===============
>>
>> +                       (anEntry isBehavior and: [anEntry name == aSymbol]) ifFalse: "When is this ever false?"
>> +                               [anEntry := anEntry class].
>> -                       (anEntry isKindOf: Class)
>> -                               ifFalse:        [anEntry := anEntry class].
>
> How nice, this saves me a tour to the inbox. Now you can hassle-freely
> go to traits mentioned in a uses: clause via browseIt, instead of
> being taken to the class Trait.

Good!

>
> The condition is false for globals such as Smalltalk and SystemOrganization.

Right.  I meant when is anEntry name == aSymbol false.  Smalltalk and SystemOrganization are not classes so no issue.  So the issue is traits.  Do you  want to update the comment here?

Reply | Threaded
Open this post in threaded view
|

Re: The Trunk: Morphic-eem.1340.mcz

Jakob Reschke-2
In reply to this post by Jakob Reschke-2
Am 03.06.2017 7:18 nachm. schrieb "Eliot Miranda" <[hidden email]>:
> On Jun 3, 2017, at 2:32 AM, Jakob Reschke <[hidden email]> wrote:
>
> 2017-06-01 22:22 GMT+02:00 [hidden email]
> <[hidden email]>:
>> Eliot Miranda uploaded a new version of Morphic to project The Trunk:
>> http://source.squeak.org/trunk/Morphic-eem.1340.mcz
>>
>> =============== Diff against Morphic-eem.1339 ===============
>>
>> +                       (anEntry isBehavior and: [anEntry name == aSymbol]) ifFalse: "When is this ever false?"
>> +                               [anEntry := anEntry class].
>> -                       (anEntry isKindOf: Class)
>> -                               ifFalse:        [anEntry := anEntry class].
>
> The condition is false for globals such as Smalltalk and SystemOrganization.

Right.  I meant when is anEntry name == aSymbol false.

The only thing that comes to my mind is a renaming import from another environment, an Alias value. But it does not make sense to browse the class of it just because of the name, or does it? Could the name check be left out?

Smalltalk and SystemOrganization are not classes so no issue.  So the issue is traits.  Do you  want to update the comment here?


I would have to go via the Inbox, so it would be faster if a core committer did it. And thanks to your change of using isBehavior, traits are no longer an issue for this piece of code.