vicoapp / vico

Mac Programmers Text Editor
http://www.vicoapp.com/
657 stars 89 forks source link

Tab to complete interferes with snippet expansion. #74

Open jordwalke opened 10 years ago

jordwalke commented 10 years ago

In the following document (JavaScript syntax):

iftest
if<cursor>

If the completion window is open, iftest is the first selected item. Hitting tab completes when the user likely wishes to expand the if() snippet. People who use snippets usually use <CR> to select a completion because it interferes with the snippet expansion (<tab>).

jordwalke commented 10 years ago

I see two simple options:

  1. Allow for the disabling of tab to select a completion - possibly by default.
  2. (More difficult) - give priority to snippet expansion on tab. (Maybe customize the priority?)
Shadowfiend commented 10 years ago

I think (using the modulate-demodulate branch) you can just do ((ViMap completionMap) unmap:"<tab>") and simply disable tab as a completion selector.

Priority to snippet expansion should also be doable by mapping <tab> in the completion map to some function that invokes accept_completion_or_complete_partially: on the text view conditionally based on whether a snippet corresponds or not.

The most intrusive approach would move that logic into accept_completion_or_complete_partially:, and decide based on whether this is an autocomplete popup and whether there's an available snippet to do the right thing. I'm a little more hesitant to hardcode that if there are user-scriptable solutions, however. That brings up the question of what the default should be (tab selecting a completion vs not), and that's something we can discuss on Discourse.