Skip to content

Commit 2b0eb47

Browse files
committed
Do not trunacte description
1 parent 979a961 commit 2b0eb47

File tree

3 files changed

+16
-20
lines changed

3 files changed

+16
-20
lines changed

README.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,18 +26,7 @@ Using [vim-plug](https://github.com/junegunn/vim-plug):
2626

2727
You can configure the level PHPStan uses. By default the level is 2.
2828

29-
```
30-
let g:phpstan_analyse_level = 4
31-
```
32-
33-
By default the plugin will look for PHPStan in `./vendor/bin/phpstan`, then
34-
`./bin/phpstan` and fallback to the global `phpstan` global executable if it exists.
35-
36-
You can override the path with
37-
38-
```
39-
let g:phpstan_path = '/path//to/phpstan'
40-
```
29+
`let g:phpstan_analyse_level = 4` in your `.vimrc` file to change the level to fit your needs.
4130

4231
# Assumptions
4332

autoload/phpstan.vim

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,37 @@
11
function! phpstan#PHPStanAnalyse(...)
22
let paths = join(a:000, '\ ')
3-
43
let phpstan_path = phpstan#_resolvePhpstanPath()
54

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

98
let list = []
10-
for line in split(result, "\n")
9+
for line in split(output, "\n")
10+
11+
" Parse the filename and line number
1112
let parts = split(line, ':')
12-
call add(list, { 'filename': parts[0], 'lnum': parts[1], 'text': parts[2] })
13+
14+
" The reset of the string is the description
15+
let description = join(parts[2:], ':')
16+
17+
" Add to the quickfix List
18+
call add(list, { 'filename': parts[0], 'lnum': parts[1], 'text': description })
19+
1320
endfor
1421

1522
call setqflist(list)
16-
execute ':cwindow'
23+
exe 'cwindow'
1724
endfun
1825

1926
function! phpstan#_resolvePhpstanPath()
20-
echo g:phpstan_paths
2127
for phpstan_path in g:phpstan_paths
2228
if filereadable(phpstan_path)
2329
return phpstan_path
2430
endif
2531
endfor
2632

2733
if !executable('phpstan')
28-
throw 'PHPStan doesn't seem to be globally installed or detected locally'
34+
throw "PHPStan doesn't seem to be globally installed or detected locally"
2935
endif
3036

3137
return 'phpstan'

plugin/phpstan.vim

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
if exists('g:phpstan_plugin_loaded') || &cp
22
finish
33
endif
4+
45
let g:phpstan_plugin_loaded = 1
5-
let phpstan_paths = [ './vendor/bin/phpstan', './bin/phpstan' ]
6+
let g:phpstan_paths = [ './vendor/bin/phpstan', './bin/phpstan' ]
67

78
if !exists('g:phpstan_analyse_level')
89
let g:phpstan_analyse_level = 2

0 commit comments

Comments
 (0)