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 unable to detect type on javascript file. #2389

Closed fizzy123 closed 2 years ago

fizzy123 commented 2 years ago

Hi! I've been using Syntastic for many years now and have enjoyed it. On this newest computer, I am encountering a strange new error. Syntastic doesn't seem to be able to identify the language on a javascript file.

When i open a javascript file and type :SyntasticInfo, I get the following:

Syntastic version: 3.10.0-32 (Vim 802, Darwin)
Info for filetype:
Global mode: active
Filetype  is active
The current file will be checked automatically
Available checkers: -
Currently enabled checkers: -
syntastic: 12.572107: &shell = '/bin/zsh', &shellcmdflag = '-c', &shellpipe = '2>&1| tee', &shellquote = '', &shellredir = '>%s 2>&1', &shelltemp = 1, &shellxquote = '', &autochdir = 0, &shellxescape = ''

When I check :SyntasticInfo javascript, I get the following:

Syntastic version: 3.10.0-32 (Vim 802, Darwin)
Info for filetype: javascript
Global mode: active
Filetype javascript is active
syntastic: 88.255584: system: command run in 0.590837s
syntastic: 88.255995: javascript/eslint: getVersion: 'eslint --version': ['v8.4.1', '']
syntastic: 88.256318: javascript/eslint: eslint version = [8, 4, 1]
syntastic: 88.257367: javascript/closurecompiler: g:syntastic_javascript_closurecompiler_path = ''
syntastic: 88.257674: javascript/closurecompiler: filereadable('') = 0
Available checkers: eslint jslint
Currently enabled checker: eslint
syntastic: 88.259054: &shell = '/bin/zsh', &shellcmdflag = '-c', &shellpipe = '2>&1| tee', &shellquote = '', &shellredir = '>%s 2>&1', &shelltemp = 1, &shellxquote = '', &autochdir = 0, &shellxescape = ''

which implies to me that syntastic is successfully finding checkers for javascript.

Here is the output of :ver:

VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Sep  6 2021 01:30:12)
macOS version
Included patches: 1-2029
Compiled by root@apple.com
Normal version without GUI.  Features included (+) or not (-):
+acl               +byte_offset       -conceal           -ebcdic            +folding           +jumplist          -lua               -mouse_netterm     +num64             +python/dyn        -sound             -tcl               -toolbar           +wildignore        -xterm_clipboard
-arabic            +channel           +cryptv            -emacs_tags        -footer            -keymap            +menu              +mouse_sgr         +packages          -python3           +spell             -termguicolors     +user_commands     +wildmenu          -xterm_save
+autocmd           +cindent           +cscope            +eval              +fork()            +lambda            +mksession         -mouse_sysmouse    +path_extra        +quickfix          +startuptime       +terminal          -vartabs           +windows
+autochdir         -clientserver      +cursorbind        +ex_extra          -gettext           -langmap           +modify_fname      -mouse_urxvt       -perl              +reltime           +statusline        +terminfo          +vertsplit         +writebackup
-autoservername    +clipboard         +cursorshape       +extra_search      -hangul_input      +libcall           +mouse             +mouse_xterm       +persistent_undo   -rightleft         -sun_workshop      +termresponse      +virtualedit       -X11
-balloon_eval      +cmdline_compl     +dialog_con        -farsi             +iconv             +linebreak         -mouseshape        +multi_byte        +popupwin          +ruby/dyn          +syntax            +textobjects       +visual            -xfontset
-balloon_eval_term +cmdline_hist      +diff              +file_in_path      +insert_expand     +lispindent        -mouse_dec         +multi_lang        +postscript        +scrollbind        +tag_binary        +textprop          +visualextra       -xim
-browse            +cmdline_info      +digraphs          +find_in_path      -ipv6              +listcmds          -mouse_gpm         -mzscheme          +printer           +signs             -tag_old_static    +timers            +viminfo           -xpm
+builtin_terms     +comments          -dnd               +float             +job               +localmap          -mouse_jsbterm     +netbeans_intg     -profile           +smartindent       -tag_any_white     +title             +vreplace          -xsmp
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L/usr/local/lib -o vim        -lm -lncurses  -liconv -framework Cocoa

And here are more detailed logs:

syntastic: 0.038789: g:syntastic_version = '3.10.0-32 (Vim 802, Darwin)'
syntastic: 0.039325: &shell = '/bin/zsh', &shellcmdflag = '-c', &shellpipe = '2>&1| tee', &shellquote = '', &shellredir = '>%s 2>&1', &shelltemp = 1, &shellxquote = '', &autochdir = 0, &shellxescape = ''
syntastic: 0.040170: UpdateErrors (auto): default checkers
syntastic: 0.041047: CacheErrors: default checkers
syntastic: 0.042237: g:syntastic_aggregate_errors = 0
syntastic: 0.042605: $TERM = 'xterm-256color'
syntastic: 0.042908: $TMPDIR = '/var/folders/n4/vzyk38y14gx7ct45tfr7_0yw0000gn/T/'
syntastic: 0.043225: $PATH = '/usr/local/sbin:/Users/nobelyoo/.nvm/versions/node/v14.17.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin'
syntastic: 0.043661: getcwd() = '/Users/nobelyoo/digit'
syntastic: 0.044253: CacheErrors: no checkers available for

Any ideas on what else i could try? Thanks!

lcd047 commented 2 years ago

Syntastic doesn't seem to be able to identify the language on a javascript file.

That's Vim's job, not syntastic's. It's up to you to make sure all files have the proper filetype set before being checked by syntastic. One way to do it if Vim's autodetection fails is to put something like vim: filetype=javascript in a comment, near the top or bottom of the relevant files (cf. :h modeline).

fizzy123 commented 2 years ago

That helped my issue. Seems like some versions of OSX don't have filetype enabled by default? I added the following to my vimrc:

filetype plugin indent on

And that fixed it. Thanks!