zulip / zulip-mobile

Zulip mobile apps for Android and iOS.
https://zulip.com/apps/
Apache License 2.0
1.3k stars 655 forks source link

Clarify and improve autocomplete-parsing logic #3345

Open gnprice opened 5 years ago

gnprice commented 5 years ago

The function getAutocompleteFilter controls when we show an autocomplete popup in composing message content. It's currently pretty convoluted and hard to follow, as highlighted in #3290. I see that as the root cause of issue #3289, and I think there are more issues lurking in that logic that are hard to see because of the complexity of the code. So I'd love to see a followup to make it simpler and clearer.

Concretely: There are a lot of conditionals in it that are various special cases. Also it's not at all clear what the various pieces are supposed to mean. (lastWordPrefix doesn't really have anything to do with a word, let alone a last word. And lastIndex isn't particularly the last index of anything.)

To fix it, I think the main steps are:

AB261 commented 5 years ago

Is someone working on this? If not can I work on this?

AB261 commented 5 years ago

@zulipbot claim