vim-syntastic / syntastic

Syntax checking hacks for vim
Do What The F*ck You Want To Public License
11.31k stars 1.14k forks source link

Issues linting on Windows #1892

Closed theamazingfedex closed 8 years ago

theamazingfedex commented 8 years ago

I've dug around for a few days, and haven't found any solutions that worked for me, so I'm making an issue outlining my problem.

System information

Windows 7 Cmder/ConE`mu terminal emulator

Relevant .vimrc

  let g:syntastic_debug = 3
  let g:syntastic_debug_file = "C:/Users/daniwood/.vim/syntastic.log"
  let g:syntastic_always_populate_loc_list = 1
  let g:syntastic_auto_loc_list = 1
  let g:syntastic_check_on_open = 1
  let g:syntastic_check_on_wq = 1
  let g:syntastic_javascript_checkers = ['eslint']

:SyntasticInfo shows no checkers enabled. :SyntasticCheck doesn't do the thing :SyntasticCheck eslint tells me that checker eslint is not available

the version of Vim you are using (run :ver to find out);

VIM 8.0 (gVIM)

the version of syntastic you are using (see :SyntasticInfo).

Syntastic 3.7.0-234

For syntax checker bugs also state the version of the checker executable that you are using. Adding debugging information is typically useful too:

ESLint 1.10.3

open a file handled by your checker; set g:syntastic_debug to 1 or 3; run the checker; (:SyntasticCheck)

copy the output of :mes;

syntastic: 40.917501: g:syntastic_version = '3.7.0-234 (Vim 800, Windows, GUI)'
syntastic: 40.925838: &shell = 'C:\Windows\system32\cmd' (!), &shellcmdflag = '/c', &shellpipe = '>%s 2>&1', &shellquote = '', &shellredir = '>%s 2>&1', &shelltemp = 1, &shellxquote = '', &autochdir = 0, &shellslash = 0, &shellxescape = '"&|<>()@^'
syntastic: 40.937700: UpdateErrors: default checkers
syntastic: 40.948412: CacheErrors: default checkers
syntastic: 40.955654: g:syntastic_aggregate_errors = 0
syntastic: 40.960961: getcwd() = 'C:\Users\daniwood\Workspace\one-exchange'
syntastic: 40.966949: CacheErrors: Checker javascript/eslint is not available
syntastic: 40.972562: CacheErrors: no checkers available for javascript
syntastic: 40.977308: aggregated: {'_sorted': 0, '_name': '', '_owner': 3, '_columns': 1, '_rawLoclist': []}
lcd047 commented 8 years ago

syntastic: 40.925838: &shell = 'C:\Windows\system32\cmd' (!)

Does anything change if you leave shell unset in your vimrc? Did you read the first item in the FAQ?

theamazingfedex commented 8 years ago

Yes, I did read and go through and try the things in the FAQ. Nope, commenting out set shell=cmd doesn't change a thing

syntastic: 616.130142: g:syntastic_version = '3.7.0-234 (Vim 800, Windows, GUI)'
syntastic: 616.139857: &shell = 'C:\Windows\system32\cmd.exe', &shellcmdflag = '/c', &shellpipe = '>%s 2>&1', &shellquote = '', &shellredir = '>%s 2>&1', &shelltemp = 1, &shellxquote = '(', &autochdir = 0, &shellslash = 0, &shellxescape = '"&|<>()@^'
syntastic: 616.154014: UpdateErrors: default checkers
syntastic: 616.164592: CacheErrors: default checkers
syntastic: 616.177883: g:syntastic_aggregate_errors = 0
syntastic: 616.187832: getcwd() = 'C:\Users\daniwood\Workspace\one-exchange'
syntastic: 616.194019: CacheErrors: Checker javascript/eslint is not available
syntastic: 616.200110: CacheErrors: no checkers available for javascript
syntastic: 616.205230: aggregated: {'_sorted': 0, '_name': '', '_owner': 3, '_columns': 1, '_rawLoclist': []}
lcd047 commented 8 years ago

To get a useful trace of eslint detection please quit Vim, comment out g:syntastic_check_on_open and the debug lines in your vimrc, open a JavaScript file, set g:syntastic_debug to 33, run :SyntasticInfo (don't do anything else), and post the output.

theamazingfedex commented 8 years ago
  1. Comment out g:syntastic_check_on_open
  2. Comment out g:syntastic_debug
  3. Comment out g:syntastic_debug_file
  4. Exit Vim
  5. Open vim src/../BasicAlert.js
  6. Enter vim :command let g:syntastic_debug=33
  7. Enter vim :command SyntasticInfo
  8. Paste results:
Error detected while processing C:\Users\daniwood\.vim\dein\.dein\ftplugin\javascript.vim:
line    3:
E484: Can't open file C:\Users\daniwood\.tmp\VIo2030.tmp
Syntastic version: 3.7.0-234 (Vim 800, Windows)
Info for filetype: javascript
Global mode: active
Filetype javascript is active
The current file will be checked automatically
syntastic: 15.610783: javascript/closurecompiler: g:syntastic_javascript_closurecompiler_path = ''
syntastic: 15.611486: javascript/closurecompiler: filereadable('') = 0
Available checkers: -
Currently enabled checkers: -
syntastic: 15.651121: &shell = 'C:\Windows\system32\cmd.exe', &shellcmdflag = '/c', &shellpipe = '>%s 2>&1', &shellquote = '', &shellredir = '>%s 2>&1', &shelltemp = 1, &shellxquote = '(', &autochdir = 0, &shellslash = 0, &shellxescape = '"&|<>()@^'
lcd047 commented 8 years ago

Error detected while processing C:\Users\daniwood\.vim\dein\.dein\ftplugin\javascript.vim:

You're running dein with Vim. As far as I know dein only works with Neovim. You need to fix that.

E484: Can't open file C:\Users\daniwood\.tmp\VIo2030.tmp

Your Vim can't run external programs with system(). You need to fix that too.

theamazingfedex commented 8 years ago
  1. On the Dein.vim repository, Shougo mentions in the README about how it does indeed support the Vim8 asynchronous API.
  2. :call syntastic#util#system('which eslint') shows me the path to my current eslint executable, leading me to believe that system() calls are working.
lcd047 commented 8 years ago

Please post the output of:

:echo syntastic#util#system('eslint --version')
theamazingfedex commented 8 years ago

Command:

:echo syntastic#util#system('eslint --version')

Output:

v1.10.3

lcd047 commented 8 years ago

Then please post the output of:

:echo executable('eslint')
theamazingfedex commented 8 years ago

Command:

:echo executable('eslint')

Output:

1

lcd047 commented 8 years ago

Well, then either your package manager is broken, or there is some other plugin that disables syntastic. shrug

Please quit Vim, disable all plugins aside from syntastic, open a JavaScript file, run :SyntasticInfo, run :scriptnames, and post the output.

theamazingfedex commented 8 years ago

:SyntasticInfo output:

Syntastic version: 3.7.0-235 (Vim 800, Windows)
Info for filetype: javascript
Global mode: active
Filetype javascript is active
The current file will be checked automatically
syntastic: 6.277716: system: command run in 0.393742s
syntastic: 6.280554: javascript/eslint: getVersion: 'eslint --version': ['v1.10.3', '']
syntastic: 6.283572: javascript/eslint: eslint version = [1, 10, 3]
syntastic: 6.304374: javascript/closurecompiler: g:syntastic_javascript_closurecompiler_path = ''
syntastic: 6.307900: javascript/closurecompiler: filereadable('') = 0
Available checker: eslint
Currently enabled checker: eslint
syntastic: 6.337676: &shell = 'C:\Windows\system32\cmd.exe', &shellcmdflag = '/c', &shellpipe = '>%s 2>&1', &shellquote = '', &shellredir = '>%s 2>&1', &shelltemp = 1, &shellxquote = '(', &autochdir = 0, &shellslash = 0, &shellxescape = '"&|<>()@^'

:scriptnames output:

  1: ~\oss\vim_setup\.vimrcsyn
  2: ~\.vim\dein2\repos\github.com\Shougo\dein.vim\autoload\dein.vim
  3: ~\.vim\dein2\repos\github.com\Shougo\dein.vim\autoload\dein\util.vim
  4: ~\.vim\dein2\repos\github.com\Shougo\dein.vim\autoload\dein\autoload.vim
  5: ~\.vim\dein2\repos\github.com\Shougo\dein.vim\autoload\dein\parse.vim
  6: ~\.vim\dein2\repos\github.com\Shougo\dein.vim\autoload\dein\types\git.vim
  7: C:\Program Files (x86)\Vim\vim80\filetype.vim
  8: ~\.vim\dein2\.dein\ftplugin.vim
  9: C:\Program Files (x86)\Vim\vim80\ftplugin.vim
 10: C:\Program Files (x86)\Vim\vim80\indent.vim
 11: C:\Program Files (x86)\Vim\vim80\syntax\syntax.vim
 12: C:\Program Files (x86)\Vim\vim80\syntax\synload.vim
 13: C:\Program Files (x86)\Vim\vim80\syntax\syncolor.vim
 14: ~\.vim\dein2\.dein\plugin\syntastic\autoloclist.vim
 15: ~\.vim\dein2\.dein\plugin\syntastic\balloons.vim
 16: ~\.vim\dein2\.dein\plugin\syntastic\checker.vim
 17: ~\.vim\dein2\.dein\plugin\syntastic\cursor.vim
 18: ~\.vim\dein2\.dein\plugin\syntastic\highlighting.vim
 19: ~\.vim\dein2\.dein\plugin\syntastic\loclist.vim
 20: ~\.vim\dein2\.dein\plugin\syntastic\modemap.vim
 21: ~\.vim\dein2\.dein\plugin\syntastic\notifiers.vim
 22: ~\.vim\dein2\.dein\plugin\syntastic\registry.vim
 23: ~\.vim\dein2\.dein\plugin\syntastic\signs.vim
 24: ~\.vim\dein2\.dein\plugin\syntastic.vim
 25: ~\.vim\dein2\.dein\autoload\syntastic\util.vim
 26: C:\Program Files (x86)\Vim\vim80\plugin\getscriptPlugin.vim
 27: C:\Program Files (x86)\Vim\vim80\plugin\gzip.vim
 28: C:\Program Files (x86)\Vim\vim80\plugin\logiPat.vim
 29: C:\Program Files (x86)\Vim\vim80\plugin\manpager.vim
 30: C:\Program Files (x86)\Vim\vim80\plugin\matchparen.vim
 31: C:\Program Files (x86)\Vim\vim80\plugin\netrwPlugin.vim
 32: C:\Program Files (x86)\Vim\vim80\plugin\rrhelper.vim
 33: C:\Program Files (x86)\Vim\vim80\plugin\spellfile.vim
 34: C:\Program Files (x86)\Vim\vim80\plugin\tarPlugin.vim
 35: C:\Program Files (x86)\Vim\vim80\plugin\tohtml.vim
 36: C:\Program Files (x86)\Vim\vim80\plugin\vimballPlugin.vim
 37: C:\Program Files (x86)\Vim\vim80\plugin\zipPlugin.vim
 38: C:\Program Files (x86)\Vim\vim80\ftplugin\javascript.vim
 39: C:\Program Files (x86)\Vim\vim80\indent\javascript.vim
 40: C:\Program Files (x86)\Vim\vim80\syntax\javascript.vim
 41: ~\.vim\dein2\.dein\autoload\syntastic\log.vim
 42: ~\.vim\dein2\.dein\syntax_checkers\javascript\closurecompiler.vim
 43: ~\.vim\dein2\.dein\syntax_checkers\javascript\eslint.vim
 44: ~\.vim\dein2\.dein\syntax_checkers\javascript\flow.vim
 45: ~\.vim\dein2\.dein\syntax_checkers\javascript\gjslint.vim
 46: ~\.vim\dein2\.dein\syntax_checkers\javascript\jscs.vim
 47: ~\.vim\dein2\.dein\syntax_checkers\javascript\jshint.vim
 48: ~\.vim\dein2\.dein\syntax_checkers\javascript\jsl.vim
 49: ~\.vim\dein2\.dein\syntax_checkers\javascript\jslint.vim
 50: ~\.vim\dein2\.dein\syntax_checkers\javascript\jsxhint.vim
 51: ~\.vim\dein2\.dein\syntax_checkers\javascript\mixedindentlint.vim
 52: ~\.vim\dein2\.dein\syntax_checkers\javascript\standard.vim
 53: ~\.vim\dein2\.dein\syntax_checkers\javascript\tern_lint.vim

Then:

I tried :SyntasticCheck eslint after doing those things, and got this result:

syntastic: 79.579869: g:syntastic_version = '3.7.0-235 (Vim 800, Windows)'
syntastic: 79.588564: &shell = 'C:\Windows\system32\cmd.exe', &shellcmdflag = '/c', &shellpipe = '>%s 2>&1', &shellquote = '', &shellredir = '>%s 2>&1', &shelltemp = 1, &shellxquote = '(', &autochdir = 0, &shellslash = 0, &shellxescape = '"&|<>()@^'
syntastic: 79.601234: UpdateErrors: eslint
syntastic: 79.608209: CacheErrors: eslint
syntastic: 79.614469: g:syntastic_aggregate_errors = 0
syntastic: 79.620959: $TERM = 'cygwin'
syntastic: 79.626699: $PATH = 'C:\Users\daniwood\Downloads\cmder\bin;C:\Users\daniwood\Downloads\cmder\vendor\conemu-maximus5\ConEmu\Scripts;C:\Users\daniwood\Downloads\cmder\vendor\conemu-maximus5;C:\Users\daniwood\Downloads\cmder\vendor\conemu-maximus5\ConEmu;C:\Python27\;C:\Python27\Scripts;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\CCM;C:\Windows\CCM;C:\Windows\CCM;C:\Windows\CCM;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files\nodejs\;%USERPROFILE%\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\ProgramData\chocolatey\bin;C:\Users\daniwood\.cargo\bin;C:\Users\daniwood\AppData\Local\Programs\Python\Python35-32\Scripts\;C:\Users\daniwood\AppData\Local\Programs\Python\Python35-32\;C:\Ruby193\bin;C:\Users\daniwood\AppData\Local\atom\bin;C:\Users\daniwood\AppData\Local\Programs\Git\cmd;C:\Users\daniwood\AppData\Roaming\npm;C:\Users\daniwood\Perforce;C:\Users\daniwood\Perforce\DVCS\;C:\Users\daniwood\Downloads\Neovim\Neovim\bin;C:\Program Files\PostgreSQL\9.5\bin;C:\Program Files\PostgreSQL\9.5\lib;;C:\Users\daniwood\AppData\Local\Programs\Git\usr\bin;C:\Users\daniwood\AppData\Local\Programs\Git\usr\share\vim\vim74;C:\Users\daniwood\Downloads\cmder\;C:/Users/daniwood/.cargo/bin/;C:\Program Files (x86)\Vim\vim80'
syntastic: 79.636906: getcwd() = 'C:\Users\daniwood\oss\vim_setup'
syntastic: 79.641987: CacheErrors: Invoking checker: javascript/eslint
syntastic: 79.646936: SyntasticMake: called with options: {'postprocess': ['guards'], 'errorformat': '%E%f: line %l\, col %c\, Error - %m,%W%f: line %l\, col %c\, Warning - %m', 'makeprg': 'eslint -f compact "..\..\Workspace\one-exchange\BasicAlert.js"'}
syntastic: 80.160321: system: command run in 0.497386s
syntastic: 80.165807: getLocList: checker javascript/eslint returned 1
syntastic: 80.170407: getLocList: checker javascript/eslint run in 0.523990s

I would think that I would be able to :Errors at this point and see the error in the loclist, but no, nothing happens when calling :Errors

theamazingfedex commented 8 years ago

It seems that vim -u .vimrcsyn ./file.js then :SyntasticCheck works normally in terminal vim, but does not at all in gVim.

Here's my current .vimrcsyn

 " Note: Skip initialization for vim-tiny or vim-small.
if 0 | endif

if &compatible
  set nocompatible
endif

set encoding=utf-8

set runtimepath^=%USERPROFILE%/.vim/dein2/repos/github.com/Shougo/dein.vim/

" Required:
call dein#begin(expand('~/.vim/dein2/'))

call dein#add('Shougo/dein.vim')
call dein#add( 'scrooloose/syntastic' )

call dein#end()

  let g:syntastic_debug = 33
  let g:syntastic_debug_file = "C:/Users/daniwood/.vim/syntastic.log"
  let g:syntastic_always_populate_loc_list = 1
  let g:syntastic_auto_loc_list = 1
  "let g:syntastic_check_on_open = 1
  let g:syntastic_check_on_wq = 1
  let g:syntastic_javascript_checkers = ['eslint']

let mapleader=","
noremap       ;               :
vnoremap   <silent>    <leader><leader> <esc>
noremap <leader><leader> <esc>
inoremap   <leader><leader> <esc>
inoremap <C-v>      <C-r>*
cnoremap <C-v>      <C-r>*

filetype plugin indent on
syntax enable
theamazingfedex commented 8 years ago

wtf... after running it a handful of times without making any changes, gVim is now showing the appropriate :Errors loclist.. Idk what changed, buuut, that .vimrcsyn in my previous comment now works in both gVim and terminalVim. I'll re-add plugins one by one to see if I can pinpoint what the crap is going on, and post my results here.

@lcd047 thanks for your patience going through this shizz with me :grin: