Page MenuHomePhabricator

Deactivate the remarkup autosuggest once text can't match "[[" or "((" rules
ClosedPublic

Authored by epriestley on Mon, Apr 1, 9:18 PM.

Details

Summary

See PHI1185, which reports a performance issue with "(" in remarkup in certain contexts.

I can't reproduce the performance issue, but I can reproduce the autosuggester incorrectly remaining active and swallowing return characters.

When the user types ( or [, we wait for a prefix for the (( (Phurl) or [[ (Phriction) rules. We currently continue looking for that prefix until a character is entered that explicitly interrupts the search.

For example, typing (xxx<return> does not insert a return character, because we're stuck on matching the prefix.

Instead, as soon as the user has entered text that we know won't ever match the prefix, deactivate the autocomplete. We can slightly cheat through this by just looking for at least one character of text, since all prefixes are exactly one character long. If we eventually have some kind of ~~@(xyz) rule we might need to add a more complicated piece of rejection logic.

Test Plan

Typed (xxx<return>, got a return. Used (( and [[ autosuggest rules normally. Used JX.log() to sanity check that nothing too crazy seems to be happening.

Diff Detail

Repository
rP Phabricator
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

epriestley created this revision.Mon, Apr 1, 9:18 PM
epriestley edited the summary of this revision. (Show Details)Mon, Apr 1, 9:20 PM
epriestley requested review of this revision.Mon, Apr 1, 9:20 PM
amckinley accepted this revision.Mon, Apr 1, 10:06 PM
This revision is now accepted and ready to land.Mon, Apr 1, 10:06 PM
This revision was automatically updated to reflect the committed changes.