lsp-php (其实应该说 PHP Language Server, 作为前端 lsp-php 是很无辜的) 的问题是,它没有把 vendor 纳入解析范围,所以能补全的东西少:
自己写的代码它能补全,一旦引用了 vendor 就瞎了。
APPEND 2018-09-08 11.36.15
搜罗了一下目前各种 PHP ls 的进展:
# | Language | Maintainer | Repository | Features | Memo |
---|---|---|---|---|---|
1 | JS + PHP + Python | SonarSource | GitHub - SonarSource/sonarlint-core: Core library to run SonarLint analysis | * |
|
2 | PHP | Felix Becker | GitHub - felixfbecker/php-language-server: PHP Implementation of the VS Code Language Server Protocol 🆚↔🖥 | ****** |
也就是 lsp-php 默认的后端,可惜自宫了(不分析 vendor) |
3 | PHP | Hvy Industries | GitHub - HvyIndustries/crane: PHP Intellisense/code-completion for VS Code | *** |
|
4 | PHP | Tyson Andre | GitHub - phan/phan: Phan is a static analyzer for PHP. Phan prefers to avoid false-positives and attempts to prove incorrectness rather than correctness. | ***** |
看起来很有希望(功能相对完备,又不排除 vendor): Editor-Support |
5 | PHP | Bmewburn | https://github.com/bmewburn/intelephense | ** |
@tobato 可以试试这个 phan,我很久不写 PHP 了。