1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Add docs for language server support

This commit is contained in:
Brown 2018-10-19 17:51:07 -04:00
parent 8b525a066b
commit 6af3a226c4

60
docs/language_server.md Normal file
View File

@ -0,0 +1,60 @@
# Using Psalm's Language Server
Psalm now has built-in Language Server Compatibility support.
It currently only supports diagnostics, with more functionality coming soon.
It works well in a variety of editors:
## emacs
I got it working with [eglot](https://github.com/joaotavora/eglot)
This is the config I used:
```
(require 'eglot)
(add-to-list 'eglot-server-programs '(php-mode . ("php" "vendor/bin/psalm-language-server")))
```
## PhpStorm
Haven't managed to get it working yet in PhpStorm. But soon.
## Sublime Test
I use the excellent Sublime [LSP plugin](https://github.com/tomv564/LSP) with the following config:
```json
"psalm":
{
"command": ["php", "vendor/bin/psalm-language-server"],
"scopes": ["source.php", "embedding.php"],
"syntaxes": ["Packages/PHP/PHP.sublime-syntax"],
"languageId": "php"
}
```
## vim/neovim
### ALE
[Coming soon](https://github.com/w0rp/ale/pull/2008), but you can use the existing ALE Psalm plugin for now.
### vim-lsp
I got it working with [vim-lsp](https://github.com/prabirshrestha/vim-lsp)
This is the config I used:
```
au User lsp_setup call lsp#register_server({
\ 'name': 'psalm-language-server',
\ 'cmd': {server_info->[expand('vendor/bin/psalm-language-server')]},
\ 'whitelist': ['php'],
\ })
```
## VS Code
Plugin under development here: https://github.com/psalm/psalm-vscode-plugin