-
-
Notifications
You must be signed in to change notification settings - Fork 278
boxes: Improve trigger sequence for generic_autocomplete #542
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Adding some test cases would be a good idea to ensure that something isn't amiss. :)
f05e100
to
3e38fda
Compare
@kaustubh-nair Thanks for the review. I have pushed the amended tests now. |
3e38fda
to
76a403e
Compare
Update: I have added a refactor commit to make |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@preetmishra This looks fairly straightforward and much more consistent. The changes LGTM!
minor: Looks like the only place we are hard-coding the prefix string now is these group_typeaheads
. Maybe we can do something along the same lines there as well.
76a403e
to
f6bb8cd
Compare
@sumanthvrao Thanks. I have pushed a new commit to address the latter point. |
f6bb8cd
to
c2e4ed3
Compare
The Travis CI build is failing with 'An error occurred while generating the build script.' for |
@preetmishra thanks for addressing the minor feedback quickly. The additional commit LGTM! @neiljp FYI :) |
c2e4ed3
to
b8b0779
Compare
Update: Rebased to include |
@preetmishra Sorry for not getting back to this; could you rebase? |
b8b0779
to
7b45033
Compare
@neiljp No problem; I have rebased the PR. :) The first commit was a suggestion from @sumanthvrao to improve consistency. The next two are self-explanatory refactor commits that facilitate the new change. |
@preetmishra I just noticed that you recently pushed a07c87d for refactoring I'd recommend holding off refactors to autocomplete methods for a while, since there are already so many of them in the footer PR. Adding them in different PRs will cause a lot of confusion. |
7b45033
to
a887796
Compare
@kaustubh-nair Thanks for taking a look. 👍 I see what you're suggesting. While keeping the refactors in the same PR sounds valid, the fact that this PR is comparatively small and easier to review makes it likely to be merged quickly. If that's the case, you can always rebase against I have updated the commit to make |
@preetmishra Sorry I did not make myself more clear - One of the major reasons to avoid the refactors at different places was so that both of us don't waste our time working on the same thing. I have a similar commit here which is used for the footer PR |
0dbfdc9
to
27398fb
Compare
27398fb
to
3731747
Compare
I have rebased the PR against the recent refactors that were pushed in #540. This should be independent and comparatively smaller to review now. |
@preetmishra Could you rebase? Also, the first commit is small now? I'll be interested to confirm how the code works for silent group mentions (which don't exist, by my understanding), and whether there are any strange cases where |
3731747
to
8da62cc
Compare
@neiljp Thanks for the review. I have rebased the changes and shelved the first commit (see #542 (comment)). Re strange cases, I didn't come across any strange case while testing it manually or analyzing its logic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@preetmishra This certainly remains an improvement in terms of where we can perform autocomplete, but at minimum we might want to consider if we want to treat the following and similar examples more consistently:
This updates generic_autocomplete to trigger autocomplete functions even when there are some other characters before their autocomplete prefixes. The prefix lookup is done in a reversed order to find the last autocomplete prefix used in the text. This is particularly useful in cases where the text has more than one autocomplete prefix (e.g. @#stream). Tests amended. Fixes zulip#541.
8da62cc
to
0fad671
Compare
@neiljp Thanks for catching that out! I have reworked the approach to find the last autocomplete prefix using a reverse lookup. This should fix the inconsistencies that you reported (test cases are added) and should be more reliable. |
@preetmishra This looks good - and if we refactor the code later the tests should ensure things keep working 👍 Merging this now 🎉 We could maybe make the code simpler and without the specific case for the silent mention, but we have a limited subset of autocomplete so this is fine for now. I'm not sure if eg. a sorted rfind of prefixes might work? |
Thanks for the merge! The sorted rfind of prefixes sounds appealing for refactoring. 🙌 |
Updated generic_autocomplete along with its autocomplete_mentions/streams to provide typeahead even when there are some characters before their respective trigger character.
Fixes #541 and #448 (partially).