You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I edit text, I do it in a sequence of multiple actions, that I execute rapidly after each other.
For example, I delete a word (daw), change a word (caw, after that typing and exiting insert mode), insert the deleted word two lines below.
With the current implementation that would save up to 4 times (TextChanged, TextChanged, InsertLeave, TextChanged), depending on my typing speed and debounce_delay.
This triggers any external service like Webpack up to 4 times, once per action.
I want it to be only triggered 1 time, once per sequence.
Idea:
Add 3 types of events: ImmediateSave, DeferSave and CancelDeferedSave
when DeferSave event (TextChanged, InsertLeave, ...) happens, start a timer t, which will save the file if it finishes
when CancelDeferedSave event (InsertEnter, TextChanged, enter, ...) happens, cancel all not yet called timers
when ImmediateSave events (BufferLeave, VimClose, ...) happen, save immediately
This makes it so, that actions that occur fast after another will cancel each other out and only the last action gets saved.
The Timer would have to be something like 2 seconds.
Sometimes however we need to save immediately, for example when closing/leaving a buffer or closing nvim.
So we need another set of events called ImmediateSave.
The text was updated successfully, but these errors were encountered:
Problem:
When I edit text, I do it in a
sequence
of multipleactions
, that I execute rapidly after each other.For example, I delete a word (
daw
), change a word (caw
, after that typing and exiting insert mode), insert the deleted word two lines below.With the current implementation that would save up to 4 times (
TextChanged
,TextChanged
,InsertLeave
,TextChanged
), depending on my typing speed anddebounce_delay
.This triggers any external service like Webpack up to 4 times, once per
action
.I want it to be only triggered 1 time, once per
sequence
.Idea:
Add 3 types of events:
ImmediateSave
,DeferSave
andCancelDeferedSave
DeferSave
event (TextChanged
,InsertLeave
, ...) happens, start a timert
, which will save the file if it finishesCancelDeferedSave
event (InsertEnter
,TextChanged
, enter, ...) happens, cancel all not yet called timersImmediateSave
events (BufferLeave, VimClose, ...) happen, save immediatelyThis makes it so, that
actions
that occur fast after another will cancel each other out and only the last action gets saved.The Timer would have to be something like 2 seconds.
Sometimes however we need to save immediately, for example when closing/leaving a buffer or closing nvim.
So we need another set of events called
ImmediateSave
.The text was updated successfully, but these errors were encountered: