Autocompleting the expressions of a snippet

Have this situation.

  • First I autocomplete a snipped : SELECT * FROM ${table}
  • Then table variable is selected, I press my autocomplete keys again to fill it with a second autocompletion (without typing anything in between)

What I want now:

  • all completion sources are NOT filtered by table
  • but inserting the autocompletion should overwrite table

With setting from and to I can only achieve one or the other.
Any hints on how to best achieve both ?

Think I found a solution. If I detect a selected range, I simply set filter to false on the CompletionResults. That way - with from/to set properly - the autocomplete will show every completion without filtering on table but once I start writing the filtering will kick in! Exactly how I want it !

It seems reasonable to replace the entire selection when picking a completion. This patch changes @codemirror/autocomplete to work that way.

1 Like