microsoft / microsoft/language-server-protocol
A generic method to get documentation string or `SignatureInformation`
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 13k
- Forks
- 1k
- Avg merge
- 6d 1h
- Merged PRs (30d)
- 10
Description
I need to build a feature that lists all functions, classes, and methods in a file (or workspace) including possible documentation strings.
Currently textDocument/documentSymbol returns documentSymbol that includes name, detail, and kind. But there's no way to get documentation strings.
In textDocument/signatureHelp, there already is support for docstrings: SignatureInformation includes all the necessary metadata about the signature, label, documentation, and parameters. However, as far as I understand, this request can only be triggered from a use (e.g., of a function), not via the function declaration itself.
There should be a generic way to obtain this information. I see three possibilities:
- A request for getting docstrings, similar to https://github.com/microsoft/language-server-protocol/issues/1034 or https://github.com/microsoft/language-server-protocol/issues/1508
- A request to get
SignatureInformationfrom declaration or implementation location. - Extend
textDocument/documentSymbolto includeSignatureInformationordocumentationattribute.
In inclined to favor option 2. as it is generic and most backward compatible.
It seems that many LSP servers already support documentation strings (they're being included in hover results for example), so in most cases the server already has this information, it just cannot be easily accessed.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by comparing the existing textDocument/documentSymbol and textDocument/signatureHelp requests and their documented fields. Review the related discussions in issues 1034 and 1508, then evaluate the three proposed approaches. Done means selecting and specifying a generic, backward-compatible way to obtain documentation or SignatureInformation from declarations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100