forked from dpelle/vim-LanguageTool
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Print stderr output of LanguageTool command if it fails to help
diagnose why LanguageTool command line may fail.
- Loading branch information
Showing
1 changed file
with
9 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,8 +2,8 @@ | |
" Maintainer: Dominique Pellé <[email protected]> | ||
" Screenshots: http://dominique.pelle.free.fr/pic/LanguageToolVimPlugin_en.png | ||
" http://dominique.pelle.free.fr/pic/LanguageToolVimPlugin_fr.png | ||
" Last Change: 2013/08/10 | ||
" Version: 1.25 | ||
" Last Change: 2013/10/24 | ||
" Version: 1.27 | ||
" | ||
" Long Description: {{{1 | ||
" | ||
|
@@ -230,6 +230,7 @@ function s:LanguageToolCheck(line1, line2) "{{{1 | |
" reading from stdin so we need to use a temporary file to get | ||
" correct results. | ||
let l:tmpfilename = tempname() | ||
let l:tmperror = tempname() | ||
|
||
let l:range = a:line1 . ',' . a:line2 | ||
silent exe l:range . 'w!' . l:tmpfilename | ||
|
@@ -240,16 +241,22 @@ function s:LanguageToolCheck(line1, line2) "{{{1 | |
\ . ' -d ' . s:languagetool_disable_rules | ||
\ . ' -l ' . s:languagetool_lang | ||
\ . ' --api ' . l:tmpfilename | ||
\ . ' 2> ' . l:tmperror | ||
|
||
sil exe '%!' . l:languagetool_cmd | ||
call delete(l:tmpfilename) | ||
|
||
if v:shell_error | ||
echoerr 'Command [' . l:languagetool_cmd . '] failed with error: ' | ||
\ . v:shell_error | ||
if filereadable(l:tmperror) | ||
echoerr string(readfile(l:tmperror)) | ||
endif | ||
call delete(l:tmperror) | ||
call s:LanguageToolClear() | ||
return -1 | ||
endif | ||
call delete(l:tmperror) | ||
|
||
" Loop on all errors in XML output of LanguageTool and | ||
" collect information about all errors in list s:errors | ||
|