Skip to content

Commit

Permalink
Do not trunacte description
Browse files Browse the repository at this point in the history
  • Loading branch information
dantleech committed Mar 31, 2018
1 parent 979a961 commit 955f64d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,6 @@ You can configure the level PHPStan uses. By default the level is 2.
let g:phpstan_analyse_level = 4
```

By default the plugin will look for PHPStan in `./vendor/bin/phpstan`, then
`./bin/phpstan` and fallback to the global `phpstan` global executable if it exists.

You can override the path with

```
let g:phpstan_path = '/path//to/phpstan'
```

# Assumptions

This plugin assumes that the `phpstan` executable is available in the `$PATH`.
Expand Down
20 changes: 13 additions & 7 deletions autoload/phpstan.vim
Original file line number Diff line number Diff line change
@@ -1,31 +1,37 @@
function! phpstan#PHPStanAnalyse(...)
let paths = join(a:000, '\ ')

let phpstan_path = phpstan#_resolvePhpstanPath()

let cmd = phpstan_path . ' analyse --errorFormat=raw --no-progress -l' . g:phpstan_analyse_level . ' ' . paths
let result = system(cmd)
let output = system(cmd)

let list = []
for line in split(result, "\n")
for line in split(output, "\n")

" Parse the filename and line number
let parts = split(line, ':')
call add(list, { 'filename': parts[0], 'lnum': parts[1], 'text': parts[2] })

" The reset of the string is the description
let description = join(parts[2:], ':')

" Add to the quickfix List
call add(list, { 'filename': parts[0], 'lnum': parts[1], 'text': description })

endfor

call setqflist(list)
execute ':cwindow'
exe 'cwindow'
endfun

function! phpstan#_resolvePhpstanPath()
echo g:phpstan_paths
for phpstan_path in g:phpstan_paths
if filereadable(phpstan_path)
return phpstan_path
endif
endfor

if !executable('phpstan')
throw 'PHPStan doesn't seem to be globally installed or detected locally'
throw "PHPStan doesn't seem to be globally installed or detected locally"
endif

return 'phpstan'
Expand Down
1 change: 1 addition & 0 deletions plugin/phpstan.vim
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
if exists('g:phpstan_plugin_loaded') || &cp
finish
endif

let g:phpstan_plugin_loaded = 1
let phpstan_paths = [ './vendor/bin/phpstan', './bin/phpstan' ]

Expand Down

0 comments on commit 955f64d

Please sign in to comment.