Page MenuHomePhabricator

Provide a "magic" UX mode
Open, LowestPublic


Introduce a mode that guesses what mode you are currently typing for and switches automatically.

The exact working of the magic mode will depend a bit on what other modes will be available at that time, but here is a first sketch:

  • We start with knowing the expected type.
  • Magic mode starts always with a combo box with an empty, freely editable single-line text field and a drop down box with choices
  • Return selects the first choice
  • The choices are pre-filled on the beginning with the persistent objects of the expected type, the "empty literal" of the expected type (if any), the result of the parse of that type of the empty string (if not an error), and functions whose return type correspond to the expected type. This list needs to be ranked.
  • When the contributor starts typing, we update the choices with the persistent object with the expected type or functions with the return type of the expected type whose labels or aliases match the user input most closely, and with the result of the parse of what the user has entered (if not an error). Again, this list needs to be ranked.
  • Pressing return selects the top choice.
  • Pressing an opening bracket or brace (any of (, {, [, < or similar) on an empty input switches to a mode for entering a literal (preferably the bespoke component if available, or else the generic mode)

This sketch of how magic mode may be changed dramatically.