Add documentation to LSP#5267
Merged
muglug merged 10 commits intovimeo:masterfrom Feb 24, 2021
Merged
Conversation
Add descriptions for all Classes, Functions, Methods, Class Constants for LSP methods for Hover, SignatureInformation and Completions
Collaborator
I've just bumped that package version, so you can bump that here and all should be good |
Contributor
Author
|
@muglug I've updated that dev, thanks! Currently the listing is failing on a long line with a |
Collaborator
|
Thanks! Psalm does indeed support docblocks on multiple lines, thankfully. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds documentation to several features of the LSP. Specifically:
Functions, methods, classes, class constants and class properties will now display their documentation/description in the IDE's Hover information, Autocomplete lists and Signature Information.
Here's some examples:
Autocomplete documentation:
Hover documentation:
Documentation in function param signature
I mostly modeled these off the default TypeScript documentation in VS Code.
--
This is blocked on felixfbecker/php-language-server-protocol#17
Personally I am bullish on including documentation on all the PHP inbuilt functions, this reflects what the Typescript / JS LSP by default also does.
I didn't yet add guards around all documentation collection for the LSP only -- I wasn't quite sure how to do that (I imagine that is stored in the
configobject?), though I wasn't sure how difficult it would be to get the scope/context of that value at each point.As a comparison, I ran
./vendor/bin/psalm --no-cache --no-reflection-cache --no-file-cache .on a pretty large WordPress project (which makes a lot of use of phpdocumentation)masterChecks took 5.19 seconds and used 552.723MB of memory
lsp-documentationChecks took 5.19 seconds and used 554.804MB of memory