Operator_Lookup Auto-Complete?

The IDE does not auto-complete once operator_lookup is used (within a line). Is it a bug or just very hard to implement in the IDE?
Example:

Class myClass1 has operator_lookup implemented as follows:

Function operator_lookup(name as string) As myClass2 return new myClass2 End Function

Class myClass2 has a method called Alert:

Sub Alert(msg as String) MsgBox msg End Sub

Now in a button, we could write:

[code] dim c as new myClass1

c.anyname.Alert(“test”) //.Alert does not auto-complete![/code]

Obviously, anyname wouldn’t be auto-completed, that’s entirely clear to me. However, the code following thereafter could be auto-completed as there’s no ambiguity (only one function and returning an instance of myClass2).

Auto-complete has never worked properly (just look at the count of issues in Feedback).

Indeed, I have experienced that too. Just wondering about that particular case, hence the question.

Sometimes, autocomplete becomes flaky and works in certains places, others not, or ceases to work and comes back after restarts.

Given the probable complexity of the feature, not quite surprising…

Michel, yep that’s what I often experienced last year. Fortunately, 2015r4 seems to fix many of those instances.

The case outlined in my original posting, however, can reliably be reproduced – even across different operating systems. Hence my guess that this simply isn’t implemented.

I have reported it meanwhile: <https://xojo.com/issue/42387>

Still curious, though, if this is by design.

Autocomplete nerver looks at operator_lookup as it would then also have to read & parse, and maybe actually RUN, the code that is implemented in operator lookup

Its unlikely to ever do so

Basically, once Operator_Lookup is implemented, nearly anything becomes valid at compile time. So autocomplete can’t suggest anything because it could suggest ANYTHING.

If you look at the OP, it is defined what will be returned. So auto-complete should show myClass2 members:

Function Operator_Lookup(name as string) As myClass2

But you can have multiple lookup operators. At least in theory according to the docs. I’ve never tried it though. Operator_Lookup is generally a bad idea.