summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2020-11-14 10:17:02 +0000
committerw0rp <devw0rp@gmail.com>2020-11-14 10:17:02 +0000
commite9140c740b8deee05c10aab92fb23c7a5747569e (patch)
treebb9ad5fdb28845a75b690041276db195da789194 /autoload
parent01800a23addb52788265e0349f519556dab41301 (diff)
downloadale-e9140c740b8deee05c10aab92fb23c7a5747569e.zip
cmp forwards, and reverse the code actions
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/code_action.vim18
1 files changed, 9 insertions, 9 deletions
diff --git a/autoload/ale/code_action.vim b/autoload/ale/code_action.vim
index 4dbb2d08..fe6b175f 100644
--- a/autoload/ale/code_action.vim
+++ b/autoload/ale/code_action.vim
@@ -33,35 +33,35 @@ endfunction
function! s:ChangeCmp(left, right) abort
if a:left.start.line < a:right.start.line
- return 1
+ return -1
endif
if a:left.start.line > a:right.start.line
- return -1
+ return 1
endif
if a:left.start.offset < a:right.start.offset
- return 1
+ return -1
endif
if a:left.start.offset > a:right.start.offset
- return -1
+ return 1
endif
if a:left.end.line < a:right.end.line
- return 1
+ return -1
endif
if a:left.end.line > a:right.end.line
- return -1
+ return 1
endif
if a:left.end.offset < a:right.end.offset
- return 1
+ return -1
endif
if a:left.end.offset > a:right.end.offset
- return -1
+ return 1
endif
return 0
@@ -86,7 +86,7 @@ function! ale#code_action#ApplyChanges(filename, changes, should_save) abort
endif
" 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:column = l:code_edit.start.offset
let l:end_line = l:code_edit.end.line