dense-analysis / dense-analysis/ale
php-language-server/ langserver does not work if not in git directory
- Dominant language
- Vim Script
- Stars
- 14k
- Forks
- 1.5k
- Avg merge
- 17h 49m
- Merged PRs (30d)
- 1
Description
## Information
**VIM version**
NVIM v0.3.1
Build type: Release
Operating System: macOS
## What went wrong
Opening php files in a non-git directory with [php-langserver](https://github.com/felixfbecker/php-language-server) already installed doesn't trigger php-langserver (as seen shown `:ALEInfo`).
This is easily remedied by making the current directory a git directory by running `git init`.
## Reproducing the bug
Create a new directory with a blank index.php:
```
$ mkdir test
$ cd test
$ touch index.php
```
minimal vimrc:
```
call plug#begin('~/.vim/plugged')
Plug 'w0rp/ale'
call plug#end()
```
Installing php-langserver:
```
$ echo "{
"minimum-stability": "dev",
"prefer-stable": true
}" > composer.json
$ composer require felixfbecker/language-server
```
Open index.php and check `:ALEInfo`:
```
$ vim index.php
:ALEInfo
ALEInfo
Current Filetype: php
Available Linters: ['langserver', 'phan', 'php', 'phpcs', 'phpmd', 'phpstan', 'psalm']
Enabled Linters: ['langserver', 'phan', 'php', 'phpcs', 'phpmd', 'phpstan', 'psalm']
...
Command History:
(executable check - failure) phan
(executable check - success) php
(finished - exit code 0) ['/bin/zsh', '-c', '''php'' -l -d error_reporting=E_ALL -d display_errors=1 -d log_errors=0 -- < ''/var/folders/l1/vlhwp4js4kg3s7d38dtccw8h0000gn/T/nvimWJ8j
um/2/index.php''']
<<>>
No syntax errors detected in -
<<>>
(executable check - failure) phpcs
(executable check - failure) phpmd
(executable check - failure) phpstan
(executable check - failure) phan
(finished - exit code 0) ['/bin/zsh', '-c', '''php'' -l -d error_reporting=E_ALL -d display_errors=1 -d log_errors=0 -- < ''/var/folders/l1/vlhwp4js4kg3s7d38dtccw8h0000gn/T/nvimWJ8j
um/3/index.php''']
<<>>
No syntax errors detected in -
<<>>
(executable check - failure) phpcs
(executable check - failure) phpmd
(executable check - failure) phpstan
```
Then initialize git, open index.php and check `:ALEInfo` again:
```
$ git init
$ vim index.php
:ALEInfo
ALEInfo
Current Filetype: php
Available Linters: ['langserver', 'phan', 'php', 'phpcs', 'phpmd', 'phpstan', 'psalm']
Enabled Linters: ['langserver', 'phan', 'php', 'phpcs', 'phpmd', 'phpstan', 'psalm']
...
Command History:
(started) ['/bin/zsh', '-c', 'php ''/Users/bokwoon/Sites/test/vendor/bin/php-language-server.php''']
(executable check - failure) phan
(executable check - success) php
(finished - exit code 0) ['/bin/zsh', '-c', '''php'' -l -d error_reporting=E_ALL -d display_errors=1 -d log_errors=0 -- < ''/var/folders/l1/vlhwp4js4kg3s7d38dtccw8h0000gn/T/nvimKq3I
6q/2/index.php''']
<<>>
No syntax errors detected in -
<<>>
(executable check - failure) phpcs
(executable check - failure) phpmd
(executable check - failure) phpstan
(executable check - failure) phan
(finished - exit code 0) ['/bin/zsh', '-c', '''php'' -l -d error_reporting=E_ALL -d display_errors=1 -d log_errors=0 -- < ''/var/folders/l1/vlhwp4js4kg3s7d38dtccw8h0000gn/T/nvimKq3I
6q/3/index.php''']
<<>>
No syntax errors detected in -
<<>>
(executable check - failure) phpcs
(executable check - failure) phpmd
(executable check - failure) phpstan
```
Notice the extra line indicating that `php-language-server.php` has been run:
```
Command History:
(started) ['/bin/zsh', '-c', 'php ''/Users/bokwoon/Sites/test/vendor/bin/php-language-server.php''']
```
This seems to only be an issue with `php-language-server`, as `eslint` started normally with or without being in a git directory.
I don't think this is particularly significant since not being in a git directory is a rare use case, and I'm also not sure if it's an issue with ALE or with php-language-server so I'll just close this issue.
Contributor guide
Assessment
This issue has not been assessed yet.