From 955f64d51c2e079a571c2a4fd4cc3f2cd5d0bfd3 Mon Sep 17 00:00:00 2001 From: dantleech Date: Sat, 31 Mar 2018 20:26:56 +0200 Subject: [PATCH] Do not trunacte description --- README.md | 9 --------- autoload/phpstan.vim | 20 +++++++++++++------- plugin/phpstan.vim | 1 + 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 830bedb..83068d6 100644 --- a/README.md +++ b/README.md @@ -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`. diff --git a/autoload/phpstan.vim b/autoload/phpstan.vim index 320232d..938b17c 100644 --- a/autoload/phpstan.vim +++ b/autoload/phpstan.vim @@ -1,23 +1,29 @@ 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 @@ -25,7 +31,7 @@ function! phpstan#_resolvePhpstanPath() 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' diff --git a/plugin/phpstan.vim b/plugin/phpstan.vim index 5d549b9..9fea4a0 100644 --- a/plugin/phpstan.vim +++ b/plugin/phpstan.vim @@ -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' ]