You have to create an psalm.xml
file in your git root, but after that, you can just do
(lsp-register-client
(make-lsp-client :new-connection
(lsp-stdio-connection
'("psalm" "--language-server"))
:major-modes '(php-mode)
:server-id 'psalmls)))
Since I'm toying with this today, I'm using the following in my extension:
<?xml version="1.0"?>
<psalm
errorLevel="2"
resolveFromConfigFile="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
>
<projectFiles>
<directory name="../../maintenance" />
<directory name="../../includes" />
<directory name="maintenance" />
<directory name="includes" />
<ignoreFiles>
<directory name="vendor" />
</ignoreFiles>
</projectFiles>
</psalm>
Except for the two relative paths under projectFiles
, psalm generated this automatically with psalm --init
.
Those two lines I added so that psalm's language server would be able to find, for example, the Maintenance class that I'm using in my maintenance script. (I would, of course, prefer to use MW_INSTALL_PATH
, but I don't know how to do that with this right now.)
Using this, I get popups with the method signature. For example, in a class that inherits from Maintenance, I can put point on addDescription
and emacs puts up a popup with the following:
If I want to see the actual implementation, I just hit M-.
Anyway, if I can just add codesniffer here, I'll be golden.