summaryrefslogtreecommitdiff
path: root/ale_linters
diff options
context:
space:
mode:
authorArie Oldman <arie.oldman@vhs7.tv>2021-11-18 14:54:10 +1100
committerGitHub <noreply@github.com>2021-11-18 12:54:10 +0900
commit3b8ff6536e6eb4b9af946e2028164e8966ec5458 (patch)
tree2a83e0663a948d7e00910afab90433d69e42e157 /ale_linters
parent31dc6a61a07839ea906f6f0b80be713fb8cad1c7 (diff)
downloadale-3b8ff6536e6eb4b9af946e2028164e8966ec5458.zip
Adds PHPActor Linter (LSP) (#3975)
* Adds phpactor lsp linter * Fixes missing comma * Adds tests for phpactor lsp linter * Adds note that this part is not my own work * Removes unused variable * Adds phpactor to supported tools list * Fixes doc sorting * Wraps phpactor in code tags
Diffstat (limited to 'ale_linters')
-rw-r--r--ale_linters/php/phpactor.vim23
1 files changed, 23 insertions, 0 deletions
diff --git a/ale_linters/php/phpactor.vim b/ale_linters/php/phpactor.vim
new file mode 100644
index 00000000..b137eaf1
--- /dev/null
+++ b/ale_linters/php/phpactor.vim
@@ -0,0 +1,23 @@
+" Author: Arizard <https://github.com/Arizard>
+" Description: PHPactor integration for ALE
+
+" Copied from langserver.vim
+function! ale_linters#php#phpactor#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') : ''
+endfunction
+
+call ale#linter#Define('php', {
+\ 'name': 'phpactor',
+\ 'lsp': 'stdio',
+\ 'executable': 'phpactor',
+\ 'command': '%e language-server',
+\ 'project_root': function('ale_linters#php#phpactor#GetProjectRoot'),
+\})