Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A generic method to get documentation string or SignatureInformation #2031

Open
tkarna opened this issue Sep 30, 2024 · 0 comments
Open

A generic method to get documentation string or SignatureInformation #2031

tkarna opened this issue Sep 30, 2024 · 0 comments
Labels
feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities new request
Milestone

Comments

@tkarna
Copy link

tkarna commented Sep 30, 2024

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:

  1. A request for getting docstrings, similar to get documentation for arbitrary identifier. #1034 or Idea: Add support for querying documentation #1508
  2. A request to get SignatureInformation from declaration or implementation location.
  3. Extend textDocument/documentSymbol to include SignatureInformation or documentation attribute.

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.

@dbaeumer dbaeumer added feature-request Request for new features or functionality new request help wanted Issues identified as good community contribution opportunities labels Oct 1, 2024
@dbaeumer dbaeumer added this to the Backlog milestone Oct 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities new request
Projects
None yet
Development

No branches or pull requests

2 participants