summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autoload/ale/engine.vim4
-rw-r--r--test/test_loclist_corrections.vader21
2 files changed, 25 insertions, 0 deletions
diff --git a/autoload/ale/engine.vim b/autoload/ale/engine.vim
index f2553b2a..e08de16c 100644
--- a/autoload/ale/engine.vim
+++ b/autoload/ale/engine.vim
@@ -374,6 +374,10 @@ function! ale#engine#FixLocList(buffer, linter_name, loclist) abort
\ 'linter_name': a:linter_name,
\}
+ if has_key(l:old_item, 'code')
+ let l:item.code = l:old_item.code
+ endif
+
if has_key(l:old_item, 'filename')
\&& !ale#path#IsTempName(l:old_item.filename)
" Use the filename given.
diff --git a/test/test_loclist_corrections.vader b/test/test_loclist_corrections.vader
index e6844d8e..6224d608 100644
--- a/test/test_loclist_corrections.vader
+++ b/test/test_loclist_corrections.vader
@@ -327,3 +327,24 @@ Execute(FixLocList should interpret temporary filenames as being the current buf
\ {'text': 'a', 'lnum': 3, 'filename': b:temp_name},
\ ],
\ )
+
+Execute(The error code should be passed on):
+ AssertEqual
+ \ [
+ \ {
+ \ 'text': 'a',
+ \ 'lnum': 10,
+ \ 'col': 0,
+ \ 'bufnr': bufnr('%'),
+ \ 'vcol': 0,
+ \ 'type': 'E',
+ \ 'nr': -1,
+ \ 'linter_name': 'foobar',
+ \ 'code': 'some-code'
+ \ },
+ \],
+ \ ale#engine#FixLocList(
+ \ bufnr('%'),
+ \ 'foobar',
+ \ [{'text': 'a', 'lnum': 11, 'code': 'some-code'}],
+ \ )