pharo icon indicating copy to clipboard operation
pharo copied to clipboard

Context menu Source code - Browse does not work correctly

Open pavel-krivanek opened this issue 2 years ago • 3 comments

Bug description The context menu "Source code - Browse" in the source code editor related to a given AST does not do what is expected. It opens the class to which the method belongs, not the class that is selected.

To Reproduce Steps to reproduce the behavior:

  1. go to AIGraphAlgorithm>>#initialize
  2. move the text cursor into the class name SortedCollection in the source code
  3. RMB
  4. Select context menu Source code - Browse
  5. it opens a browser on the class AIGraphAlgorithm, not SortedCollection

Note: the next menu item "Source code - Class refs." correctly words with the selected class. Version information:

  • Pharo Version: Pharo 12.0.0 Build information: Pharo-12.0.0+build.616.sha.785370b5e81788061d5130e43565d1d9beef1731 (64 Bit)

pavel-krivanek avatar Jul 31 '23 08:07 pavel-krivanek

One possible solution is:

SycBrowseClassCommand>>#prepareFullExecutionInContext: aToolContext

    super prepareFullExecutionInContext: aToolContext.

    targetClass := (Smalltalk classOrTraitNamed: aToolContext selectedSourceNode name) ifNil: [ aToolContext lastSelectedClass ]

However, maybe it is worth to consider to convert the class to inherit from SycClassCommand instead of SycSingleClassCommand and follow the implementation of ClyShowClassRefCommand that for a similar operation works as expected.

pavel-krivanek avatar Jan 04 '24 16:01 pavel-krivanek

Thanks Pavel. I should say that I'm super frustrated with Pharo and the shortcut. Most of the time I want to see a browser on the class of the method and most of time I get Undefined or something like that. I looks like that nobody interact with the system the way I do not it and I just lose my time. it looks like nobody cares and each time I propose something it is not good. I was planning to create my own keybindings and say fuckoff to Pharo and I think that I will do it and do not care.

Ducasse avatar Jan 04 '24 17:01 Ducasse

I will turn my notes that I took about this and make a presentation, then we can discuss much easier.

T problem is that CMD-B used to be "do-it and browse the class of the result". And as we eval first, it is very hard to add any intelligence to this mechanism... we need to really re-think it, we can not just patch it a little to reach what we want (and we need to define what we want exactly, too).

MarcusDenker avatar Jan 08 '24 10:01 MarcusDenker