Autocomplete hinders definition of userfunctions

Issue #584 closed
Pol Welter created an issue

Enter the following expression: f(x)=5*x

Press ENTER.

The expression will autocomplete to f(x)=5*xor().

The autocomplete should also take care of the arguments of a user function.

Comments (9)

  1. Helder Correia repo owner

    Not specific to user functions. I know about this annoyance, but I'm also not sure what the best behavior would be. Open for feedback ( @Teyut @fk @thadrien ). I'm not sure, but there may be a separate issue for the user function argument completion already.

  2. Pol Welter reporter

    Can you expand on which other features provoke this behaviour? I was only aware of user function arguments.

    (Also note that my PR includes a solution to this; I only posted this issue now that I wrote a complete write-up of what we did in the PR.)

  3. Helder Correia repo owner

    I meant that if you simpy write "5 * x<ENTER>" it will have the same behavior, not specific to user functions. Unless I misunderstood what your point. Are you referring to pull request #18 ?

  4. Pol Welter reporter

    Your example is not really an issue. If the variable x is not defined, then summoning the autocompleter will indeed spit out xor. If x is properly defined though, it will suggest that one instead.

    Yes, I am referring to PR #18. I put a note about it on the bottom on the description.

  5. Tey'

    If x is defined as a user variable or a user function, typing 5 * x<ENTER> will have the correct behavior (x not being replaced if it's a user variable, or else, x being replaced by the user function). Otherwise, the auto-completion will replace x by xor() which is also the expected behavior as x does not exist anyway.

    I believe the only use case when this is not the correct behavior is the one given by Pol, when defining a user function and x is one of the argument of that function. Pol fixed it at this line so that the autocompletion algorithm is aware of the user function argument names when defining a user function. I can't check it work yet but the code looks correct.

  6. Log in to comment