Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Explore language server compatibility #521
I think that using a PHP wrapper of psalm (That invokes
However, two (or one) CLI options would have to be added, and there would need to be some work on writing a wrapper:
E.g. as an experiment:
<projectFiles> - <directory name="src" /> - <directory name="tests" /> - <directory name="examples" /> - <ignoreFiles> - <file name="src/Psalm/CallMap.php" /> - <directory name="src/Psalm/Stubs" /> - <directory name="tests/stubs" /> - </ignoreFiles> + <file name="src/Psalm/CodeLocation.php" /> </projectFiles>
Time needed to analyze src/Psalm/CodeLocation with a modified psalm invocation and CLI command: 0.20 seconds (That can be reduced to 0.15 with igbinary)
php-language-server can be used as a base (Or this project forked from php-language-server to focus on linting)
didOpen/didChange/didClose/didChangedWatchedFiles could be used as a base.
Aside: If psalm takes 0.20 seconds to analyze a small set of files (or even 1 second), it may receive events faster than it can respond. https://github.com/phan/phan/blob/df577b0699869df888d33c7d18d1f451d8264378/src/Phan/LanguageServer/LanguageServer.php#L140-L183 (Separate events for 'message' and for 'readMessageGroup' are one way to mitigate that).