Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly autocomplete continued parts of keyword selectors #55

Open
LinqLover opened this issue Jan 9, 2024 · 1 comment
Open

Correctly autocomplete continued parts of keyword selectors #55

LinqLover opened this issue Jan 9, 2024 · 1 comment

Comments

@LinqLover
Copy link
Contributor

Example:

image

becomes:

image

instead of:

image

Would be very useful!

@LeonMatthes
Copy link
Owner

This is one of the parts of Autocompletion I find most annoying. Totally agree this is an issue.

The reasons that this is hard to solve are unfortunately many-fold:

  • The receiver in this case isn't actually the #yourself symbol that type-inference thinks it is.
  • In fact, the receiver could be either the #yourself, or the #(), depending on what symbol to suggest

This makes it very hard to figure out correctly, as we'd need to:

  1. Find all possible receivers
    • For continuation of existing selectors
    • Depending on precedence (Receivers for n-ary functions can be different than for binary functions or unary functions *)
  2. For each potential receiver, inject the valid selectors (and only those valid in this context) into the suggestions
  3. When completing, only inject the missing parts of the selector

In this case the selector do: displayingProgress: is actually even inserted correctly. #yourself is a collection, so you can indeed call do: displayingProgress on it!
The correct solution here would probably actually be to suggest both: do:displayingProgress: on #yourself and then inserting parentheses:

#() do: (#yourself do: ___ displayingProgress: ___) 

and also suggest displayingProgress: separately.

* Determining the receiver for a common comparison is actually stupidly difficult

conditions addLast: 1 > 5 "| <--- CURSOR"
"                       ^ receiver for unary messages (e.g. negated) or maybe n-ary messages when adding parens"
"                   ^^^^^ receiver for binary messages (e.g. &) or maybe n-ary messages (e.g. and:), when adding parens"
"^^^^^^^^^ receiver for certain n-ary messages due to continuation (e.g. addLast:times:)"

Any suggestions to handle this in a sane way are highly welcome 🙈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants