Skip to content

Commit

Permalink
parse error messages in to location list, and show message if kendo-l…
Browse files Browse the repository at this point in the history
…int is not installed
  • Loading branch information
Derick Bailey committed Jul 9, 2013
1 parent 0b43e92 commit 780f786
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 3 deletions.
36 changes: 34 additions & 2 deletions autoload/kendoui.vim
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,44 @@ if !exists("s:kui_command")
endif

function! kendoui#version()
return '0.0.1'
return '0.0.2'
endfunction

function! s:Lint(mode)
" clear the current message, if any
silent !clear
execute "!" . s:kui_command . " --".a:mode . " " . bufname("%")

" make sure kendo-lint is installed
if !executable(s:kui_command)
echo "D'OH! The kendo-lint tool is not installed or could not be found. :("
echo "Please run 'npm install -g kendo-lint' to install it."
return
endif

" run the kendo-lint tool in the correct mode
let l:result = system(s:kui_command . " --".a:mode . " " . bufname("%"))

if result != ""
" example error message:
" imagegallery.js[4,2]: Option stepUp2TheStreets not found
set errorformat=%f[%l\\,%c]:\ %m

" load the error results in to the location list
" and make them clickable, to go to that location
lexpr result
laddexpr ""
lwindow
else

" clear the location list, close it and show
" a friendly message about how awesome you are!
lexpr! ""
lclose
echo "Kendo UI Lint: No Errors Found! :)"

endif


endfunction

function! kendoui#KUILintJS()
Expand Down
8 changes: 7 additions & 1 deletion changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v0.0.1
### v0.0.2 [view commit logs](https://github.com/kendo-labs/kendoui-lint.vim/compare/v0.0.1...v0.0.2)

* Show the list of errors in the "location list", clickable to go to that location
* Clear and hide the "location list" if no errors are found
* If KendoUI-Lint is not installed, show a message saying so

### v0.0.1

* Initial Release

0 comments on commit 780f786

Please sign in to comment.