Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit b609b3b

Browse files
committed
Checker ghc-mod: attempt to fix filename encodings.
ghc-mod will always use UTF-8 encoding on output, regardless of the current encoding. This is a problem for syntastic because it mangles the filenames. The commit below is a (perhaps misguided) attempt to fix that, by calling iconv() to re-encode output from ghc-mod to Vim's encoding.
1 parent 84b4da7 commit b609b3b

3 files changed

Lines changed: 9 additions & 1 deletion

File tree

autoload/syntastic/preprocess.vim

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ endfunction " }}}2
128128
" @vimlint(EVL102, 0, l:false)
129129
" @vimlint(EVL102, 0, l:null)
130130

131+
function! syntastic#preprocess#iconv(errors) abort " {{{2
132+
return
133+
\ (has('iconv') || has('iconv/dyn')) && &encoding !=# '' && &encoding !=# 'utf-8' ?
134+
\ map(a:errors, 'iconv(v:val, "utf-8", &encoding)') :
135+
\ a:errors
136+
endfunction " }}}2
137+
131138
function! syntastic#preprocess#killEmpty(errors) abort " {{{2
132139
return filter(copy(a:errors), 'v:val !=# ""')
133140
endfunction " }}}2

plugin/syntastic.vim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ if has('reltime')
1919
lockvar! g:_SYNTASTIC_START
2020
endif
2121

22-
let g:_SYNTASTIC_VERSION = '3.6.0-93'
22+
let g:_SYNTASTIC_VERSION = '3.6.0-96'
2323
lockvar g:_SYNTASTIC_VERSION
2424

2525
" Sanity checks {{{1

syntax_checkers/haskell/ghc-mod.vim

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ function! SyntaxCheckers_haskell_ghc_mod_GetLocList() dict
6868
return SyntasticMake({
6969
\ 'makeprg': makeprg,
7070
\ 'errorformat': errorformat,
71+
\ 'preprocess': 'iconv',
7172
\ 'postprocess': ['compressWhitespace'],
7273
\ 'returns': [0] })
7374
endfunction

0 commit comments

Comments
 (0)