vim-syntastic / syntastic

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

Syntastic should maybe warn on some errors #1946

Closed ezmiller closed 7 years ago

ezmiller commented 7 years ago

I just discovered that syntastic was failing to run my eslint checker for javascript because it couldn't find one of the plugins specified in my .eslintrc. I only discovered this after enabling g:syntastic_debug, and wading through the output. This is just a suggestion, but maybe a good enhancement for syntastic would be to give warnings more readily on certain errors, rather than failing silently? In this case, for example, where syntastic is unable to locate a plugin, it seems that a message is in order, and could save a lot of time.

lcd047 commented 7 years ago

This has been requested a few times in the past. It isn't really feasible. eslint has a plugin architecture, and its (non-linting) error messages can be essentially anything. Worse yet, there are other checkers masquerading as eslint, with different sets of error messages. Trying to parse something meaningful out of all possible junk eslint can produce is a losing battle.

What syntastic does instead is look at the exit codes from the linters. If a linter reliably returns different exit codes for "finished ok" / "finished ok with linting errors", and "not ok" (OS errors, plugins not found, and the like), then syntastic can print the full output of the linter, presumably containing the relevant complaints. This works reasonably well. However, not all checkers exit with discriminating codes. Also, finding out whether one can rely on the exit code of a given linter like this typically involves digging through said linter's sources. A while ago I requested input from people about which linters return useful error codes. I got zero answers. shrug

ezmiller commented 7 years ago

Sounds like a weakness in vim then? I mean shouldn't plugins have a reliable mechanism for reporting errors? Thanks for the response.

lcd047 commented 7 years ago

This has nothing to do with Vim, or with Vim plugins. eslint is not a Vim plugin.