Skip to content

Commit

Permalink
format timer delay improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
kohnish committed Mar 27, 2023
1 parent 3fb01af commit c7a0105
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion autoload/lsc/common.vim
Original file line number Diff line number Diff line change
Expand Up @@ -527,8 +527,13 @@ def FormatCb(bnr: number, text_edits: list<dict<any>>): void
setpos('.', orig_cursor_pos)
enddef

def Reset_format_delay(arg: any): void
g_format_delay = false
enddef

def Format_(arg: any): void
g_format_delay = true
timer_start(1000, Reset_format_delay)
lsc#file#flushChanges()
var params: dict<any>
params = { 'textDocument': { 'uri': Uri() } }
Expand All @@ -540,7 +545,6 @@ enddef

export def Format(): void
if g_format_delay
g_format_delay = false
timer_start(1000, Format_)
else
Format_(0)
Expand Down

0 comments on commit c7a0105

Please sign in to comment.