Extends

Language reference shows an example of the “extends” that seems not working

Defining the method as global in a Module name StringExtension

Public Function Contains(Extends Container as string, contained as string) as Boolean return container.InStr(Contained)>0 End Function

Then defining Var s as string
if s. in the dot options don’t appear contains

InStr seems to be deprecated, so I changed to IndexOf, neither works

Missing something?
(in fact it works if you write down the name method, is that do not appears as an option on the dots options)

You are right, Enric: using version 2019r3 you don’t see the extension method, while using 2019r1.1 you can see it.

Did you remember to assign the boolean or you only see results on the auto-complete that don’t return anything:

Var s As String Var b As Boolean b=s.<TAB>

I also see it here:

Var s As String If s.<TAB>

It works here in 2019r3.1, what version are you using?

I made a request about this a long time ago <https://xojo.com/issue/51057> but I assume someone at Xojo likes it this way, which I personally find it a horrible feature and seems totally one sided in that it completes when you assign even if a match has nothing returned.

Meh, I give up on testing that, I just got it into the exact state you described. I then cut and pate the module and it all started working again.

As a temporary fix, move the module a bit in the navigator.

<https://xojo.com/issue/60024> currently testers only due to a feedback bug, I’ve asked for it to be make public.

Thanks all,

  • moving the module as Julian said, most times works
  • closing the project and reopen, sometimes also works
    so while is not fixed