haxe.vim 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. "============================================================================
  2. "File: haxe.vim
  3. "Description: Syntax checking plugin for syntastic
  4. "Maintainer: David Bernard <david.bernard.31 at gmail dot com>
  5. "License: This program is free software. It comes without any warranty,
  6. " to the extent permitted by applicable law. You can redistribute
  7. " it and/or modify it under the terms of the Do What The Fuck You
  8. " Want To Public License, Version 2, as published by Sam Hocevar.
  9. " See http://sam.zoy.org/wtfpl/COPYING for more details.
  10. "
  11. "============================================================================
  12. if exists('g:loaded_syntastic_haxe_haxe_checker')
  13. finish
  14. endif
  15. let g:loaded_syntastic_haxe_haxe_checker = 1
  16. let s:save_cpo = &cpo
  17. set cpo&vim
  18. function! SyntaxCheckers_haxe_haxe_GetLocList() dict
  19. let buf = bufnr('')
  20. let hxml = syntastic#util#bufRawVar(buf, 'vaxe_hxml')
  21. if hxml ==# ''
  22. let hxml = syntastic#util#findGlobInParent('*.hxml', fnamemodify(bufname(buf), ':p:h'))
  23. endif
  24. let hxml = fnamemodify(hxml, ':p')
  25. call self.log('hxml =', hxml)
  26. if hxml !=# ''
  27. let makeprg = self.makeprgBuild({
  28. \ 'fname': syntastic#util#shescape(fnamemodify(hxml, ':t')),
  29. \ 'args_after' : ['--no-output'] })
  30. let errorformat =
  31. \ '%W%f:%l: characters %c-%n : Warning : %m,' .
  32. \ '%E%f:%l: characters %c-%n : %m'
  33. let loclist = SyntasticMake({
  34. \ 'makeprg': makeprg,
  35. \ 'errorformat': errorformat,
  36. \ 'cwd': fnamemodify(hxml, ':h') })
  37. for e in loclist
  38. let e['hl'] = '\%>' . e['col'] . 'c\%<' . (e['nr'] + 1) . 'c'
  39. let e['col'] += 1
  40. let e['nr'] = 0
  41. endfor
  42. return loclist
  43. endif
  44. return []
  45. endfunction
  46. call g:SyntasticRegistry.CreateAndRegisterChecker({
  47. \ 'filetype': 'haxe',
  48. \ 'name': 'haxe'})
  49. let &cpo = s:save_cpo
  50. unlet s:save_cpo
  51. " vim: set sw=4 sts=4 et fdm=marker: