summaryrefslogtreecommitdiff
path: root/ale_linters/php
diff options
context:
space:
mode:
authorShahin Sorkh <sorkh.shahin@hotmail.com>2019-03-26 01:59:34 +0430
committerw0rp <w0rp@users.noreply.github.com>2019-03-25 21:29:34 +0000
commitad998211f892cdbfac6df3ab296a4d1b849f4086 (patch)
treece884aa0b9dfb57b1bb0c06252b116c9164e7e39 /ale_linters/php
parent80ef7ea2d0b22f0d8de7387a3d5bf6e9e5b72e9d (diff)
downloadale-ad998211f892cdbfac6df3ab296a4d1b849f4086.zip
Use location of `composer.json` for PHP project path too (#2391)
* move php-langserver "test for .git dir" test-project to its own directory * search for composer.json file in php-langserver first then .git dir * add test for php-langserver composer.json
Diffstat (limited to 'ale_linters/php')
-rw-r--r--ale_linters/php/langserver.vim6
1 files changed, 6 insertions, 0 deletions
diff --git a/ale_linters/php/langserver.vim b/ale_linters/php/langserver.vim
index c88281c4..fdd1bf2b 100644
--- a/ale_linters/php/langserver.vim
+++ b/ale_linters/php/langserver.vim
@@ -5,6 +5,12 @@ call ale#Set('php_langserver_executable', 'php-language-server.php')
call ale#Set('php_langserver_use_global', get(g:, 'ale_use_global_executables', 0))
function! ale_linters#php#langserver#GetProjectRoot(buffer) abort
+ let l:composer_path = ale#path#FindNearestFile(a:buffer, 'composer.json')
+
+ if (!empty(l:composer_path))
+ return fnamemodify(l:composer_path, ':h')
+ endif
+
let l:git_path = ale#path#FindNearestDirectory(a:buffer, '.git')
return !empty(l:git_path) ? fnamemodify(l:git_path, ':h:h') : ''