Microdown icon indicating copy to clipboard operation
Microdown copied to clipboard

Add package tags as a semantic entity

Open iglosiggio opened this issue 1 year ago • 3 comments

This way we can quickly reference and navigate to a given package tag.

Made during the pharo sprint with @matijakljajic

iglosiggio avatar Jan 31 '25 16:01 iglosiggio

Thanks I will have a look. Would be good to have tests and getXXX is not that idiomatic of Pharo. I will have a look.

Ducasse avatar Feb 02 '25 18:02 Ducasse

I know that the existing code is using this getX stuff.

Ducasse avatar Feb 02 '25 18:02 Ducasse

Yes, we continued the code following what was already there. Now it's probably time to improve it.

OTOH there's no test on this PR and we are adding a new feature. That's not right :P

My rewrite would be:

  • Remove the object mutation from the getX methods
  • Add a field containing the list of supported "entity providers" (an entity provider is something that respondsTo #value: and expects the token list as argument)
  • Make the initial value of this list something like: { [ :tokens | self maybeGetClass ]. [ :tokens | self maybeGetPackage ]. [ :tokens | self maybeGetTag ] } (if we put a bit more work we can migrate the whole computeEntity method to a series of calls like that)
  • Then the implementation of computeEntity is just entity := providers detect: [ :provider | provider value: tokens ].

iglosiggio avatar Feb 02 '25 21:02 iglosiggio

I checked and it looks ok for now. So I will integrate it.

Ducasse avatar Aug 02 '25 15:08 Ducasse