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

Syntasticnot working for Coffeescript 1.6.0+ #694

Closed
diranl opened this issue Jun 18, 2013 · 8 comments
Closed

Syntasticnot working for Coffeescript 1.6.0+ #694

diranl opened this issue Jun 18, 2013 · 8 comments

Comments

@diranl
Copy link

diranl commented Jun 18, 2013

When I have coffeescript installed to 1.6.0+ (i.e. npm install -g [email protected]) syntastic doesn't seem able to detect any compilation errors, even though both coffee file.coffee and coffeelint file.coffee displays the error fine.

Inside .vimrc:

"------------SYNTASTIC-----------
let g:syntastic_enable_signs=1
let g:syntastic_mode_map={ 'mode': 'active',
\ 'active_filetypes': [],
\ 'passive_filetypes': ['html', 'java'] }
let g:syntastic_coffee_checkers = ['coffeelint', 'coffee']
let g:syntastic_coffee_coffeelint_args = "--file [absolute path to]/coffeelint.json"
let g:syntastic_enable_signs=1
let g:syntastic_error_symbol='✗'
let g:syntastic_warning_symbol='⚠'

  • I ran :SyntasticCheck then :messages and no debug error surfaced.
  • I've also made sure that npm is part of the PATH: PATH="/usr/local/share/npm/bin:$PATH"

On the other hand, when coffeescript is installed at [email protected] the errors DO in fact surface (everything works!), except that it doesn't pick up the coffeelint_args. This behavior might be expect from https://github.com/scrooloose/syntastic/wiki/CoffeeScript%3A---coffee

Do I need to do something special to get syntastic working w/ coffeescript 1.6.0+?

System settings:

  • mac, OS X 10.8.4
  • iterm2
  • vim 7.3
@lcd047
Copy link
Collaborator

lcd047 commented Jun 18, 2013

The coffeelint part is clear, you are overriding the default argument --csv, and that breaks syntastic. You should try something like this:

let g:syntastic_coffee_coffeelint_args = "--csv --file [absolute path to]/coffeelint.json"

Basically you need to keep the formatting arguments, or things will break. Yes, things should be simpler than that, but for now they aren't (see also the discussion at #414).

The coffee-script part is more involved, as the error format of coffee-script seems to vary with the weather outside. Still, last time I massaged that particular errorformat (and that was less than two weeks ago), I had node v0.10.8 and coffee-script 1.6.3. So I would have expected things to be the other way around, 1.6.3 should have worked, and 1.5.0 shouldn't. :)

So, what errors do you get with 1.6.3 on the command line? Does things change if you run coffee with the -cp option:

coffee -cp file.coffee

Better yet, can you provide a small test file illustrating the problem?

@diranl
Copy link
Author

diranl commented Jun 18, 2013

Here's my test file:

function #this function should be an error

a = (asdflakjsdlfakjsdlsdkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk) ->  # Greater than 80 chars should be syntax error
  1+1 # Line ending with whitespace 

Here's the output:

coffee -cp fail.coffee
fail.coffee:1:1: error: reserved word "function"
function #this function should be an error
^

Syntastic doesn't provide any feedback
:messages empty

Coffee
Here are my versions

  • coffeelint: 0.5.6
  • coffee: 1.6.3
  • npm: 1.2.17

@lcd047
Copy link
Collaborator

lcd047 commented Jun 18, 2013

Well, with coffee-script your test file works for me without any changes to syntastic:
2013-06-18-130730_560x188
This is with coffee-script 1.6.3 and node v0.10.11. With coffee-script 1.5.0 it probably wouldn't work, as expected.

With coffeelint the output looks more like the parser crashing:

/opt/node/lib/node_modules/coffeelint/node_modules/coffee-script/lib/coffee-script/lexer.js:682
      throw SyntaxError("" + message + " on line " + (this.line + 1));
            ^
SyntaxError: reserved word "function" on line 1
    at SyntaxError (<anonymous>)
    at Lexer.exports.Lexer.Lexer.error (/opt/node/lib/node_modules/coffeelint/node_modules/coffee-script/lib/coffee-script/lexer.js:682:13)
    at Lexer.exports.Lexer.Lexer.identifierToken (/opt/node/lib/node_modules/coffeelint/node_modules/coffee-script/lib/coffee-script/lexer.js:86:16)
    at Lexer.exports.Lexer.Lexer.tokenize (/opt/node/lib/node_modules/coffeelint/node_modules/coffee-script/lib/coffee-script/lexer.js:33:19)
    at Object.exports.tokens (/opt/node/lib/node_modules/coffeelint/node_modules/coffee-script/lib/coffee-script/coffee-script.js:62:18)
    at new LexicalLinter (/opt/node/lib/node_modules/coffeelint/lib/coffeelint.js:430:34)
    at Object.coffeelint.lint (/opt/node/lib/node_modules/coffeelint/lib/coffeelint.js:955:21)
    at lintFiles (/opt/node/lib/node_modules/coffeelint/bin/coffeelint:305:44)
    at Object.<anonymous> (/opt/node/lib/node_modules/coffeelint/bin/coffeelint:369:21)
    at Object.<anonymous> (/opt/node/lib/node_modules/coffeelint/bin/coffeelint:374:4)

Note that the main error is in lexer.js, not in the file checked. Now, this could be accommodated to produce meaningful output in syntastic, but I'm not sure we actually want to go there. The "normal" output of coffeelint looks something like this:

rewriter.coffee,64,error,Line exceeds maximum allowed length
rewriter.coffee,87,error,Line exceeds maximum allowed length
rewriter.coffee,135,error,Line exceeds maximum allowed length
rewriter.coffee,136,error,Line exceeds maximum allowed length
rewriter.coffee,172,error,Line exceeds maximum allowed length

Trying to make sense of parser dumps looks like a pretty deep rabbit hole to me...

@diranl
Copy link
Author

diranl commented Jun 18, 2013

Cool, mind sharing your .vimrc configs for syntastic?

Here's what I am seeing:
screen shot 2013-06-18 at 3 50 35 am

@lcd047
Copy link
Collaborator

lcd047 commented Jun 18, 2013

Sure:

let g:syntastic_mode_map = {'mode': 'passive'}
let g:syntastic_always_populate_loc_list = 1
let g:syntastic_auto_jump = 1
let g:syntastic_check_on_wq = 0
let g:syntastic_auto_loc_list = 1
let g:syntastic_check_on_open = 1

The rest are error symbols, status line flags, and definitions for checkers unrelated to coffee.

Please set g:syntastic_debug to 1, run the checker, and post the output of :mes.

@diranl
Copy link
Author

diranl commented Jun 18, 2013

Nothing too exciting going on debug mode:
screen shot 2013-06-18 at 4 47 23 am

Here's my vim version:

VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Aug 22 2012 15:36:46)
Compiled by [email protected]
Normal version without GUI.  Features included (+) or not (-):
-arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent
-clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
-conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs
-dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path
+find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv
+insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent
+listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape
-mouse_dec -mouse_gpm -mouse_jsbterm -mouse_netterm -mouse_sysmouse
+mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype
+path_extra -perl +persistent_undo +postscript +printer -profile +python/dyn
-python3 +quickfix +reltime -rightleft +ruby/dyn +scrollbind +signs
+smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title
 -toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
+vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp
 -xterm_clipboard -xterm_save
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -D_FORTIFY_SOURCE=0 -Iproto -DHAVE_CONFIG_H -arch i386 -arch x86_64 -g -Os -pipe
Linking: gcc -arch i386 -arch x86_64 -o vim -lncurses

@lcd047
Copy link
Collaborator

lcd047 commented Jun 18, 2013

Please upgrade syntastic to master HEAD, and try again.

@diranl
Copy link
Author

diranl commented Jun 18, 2013

Dooope. Thanks for making me feel like Homer Simpson :)

Much appreciated the help!

PS: Will close down the issue now

@diranl diranl closed this as completed Jun 18, 2013
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants