mirror of
https://github.com/dense-analysis/ale
synced 2025-01-05 05:29:40 +00:00
cmp forwards, and reverse the code actions
This commit is contained in:
parent
01800a23ad
commit
e9140c740b
@ -33,37 +33,37 @@ endfunction
|
|||||||
|
|
||||||
function! s:ChangeCmp(left, right) abort
|
function! s:ChangeCmp(left, right) abort
|
||||||
if a:left.start.line < a:right.start.line
|
if a:left.start.line < a:right.start.line
|
||||||
return 1
|
return -1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if a:left.start.line > a:right.start.line
|
if a:left.start.line > a:right.start.line
|
||||||
return -1
|
return 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if a:left.start.offset < a:right.start.offset
|
if a:left.start.offset < a:right.start.offset
|
||||||
return 1
|
return -1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if a:left.start.offset > a:right.start.offset
|
if a:left.start.offset > a:right.start.offset
|
||||||
return -1
|
return 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if a:left.end.line < a:right.end.line
|
if a:left.end.line < a:right.end.line
|
||||||
return 1
|
return -1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if a:left.end.line > a:right.end.line
|
if a:left.end.line > a:right.end.line
|
||||||
return -1
|
|
||||||
endif
|
|
||||||
|
|
||||||
if a:left.end.offset < a:right.end.offset
|
|
||||||
return 1
|
return 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if a:left.end.offset > a:right.end.offset
|
if a:left.end.offset < a:right.end.offset
|
||||||
return -1
|
return -1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if a:left.end.offset > a:right.end.offset
|
||||||
|
return 1
|
||||||
|
endif
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ function! ale#code_action#ApplyChanges(filename, changes, should_save) abort
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
" Changes have to be sorted so we apply them from bottom-to-top
|
" Changes have to be sorted so we apply them from bottom-to-top
|
||||||
for l:code_edit in sort(copy(a:changes), function('s:ChangeCmp'))
|
for l:code_edit in reverse(sort(copy(a:changes), function('s:ChangeCmp')))
|
||||||
let l:line = l:code_edit.start.line
|
let l:line = l:code_edit.start.line
|
||||||
let l:column = l:code_edit.start.offset
|
let l:column = l:code_edit.start.offset
|
||||||
let l:end_line = l:code_edit.end.line
|
let l:end_line = l:code_edit.end.line
|
||||||
|
Loading…
Reference in New Issue
Block a user