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 CompletionResult
s. 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 !
marijn
April 10, 2023, 7:24pm
3
It seems reasonable to replace the entire selection when picking a completion. This patch changes @codemirror /autocomplete to work that way.
committed 07:23PM - 10 Apr 23 UTC
FIX: Replace the entire selected range when picking a completion with a non-curs… or
selection active.
See https://discuss.codemirror.net/t/autocompleting-the-expressions-of-a-snippet/6226
1 Like
Hi! Seems it doesn’t work with snippet, that was created with snippetCompletion
function. In that case apply
is not a string and insertCompletionText
is not called. autocomplete/src/state.ts at c323263146e4f8262d59f420256580b25428f276 · codemirror/autocomplete · GitHub
Is there workaround for it?
P.S. may be I should create new topic
marijn
December 5, 2024, 12:51pm
5
This patch should fix that.
committed 12:51PM - 05 Dec 24 UTC
FIX: Align the behavior of snippet completions with text completions in that the… y
overwrite the selected text.
See https://discuss.codemirror.net/t/autocompleting-the-expressions-of-a-snippet/6226/4