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

feat: Format signature help when valid docstring style #6170

Closed

Conversation

wusteven815
Copy link
Contributor

@wusteven815 wusteven815 commented Oct 4, 2024

  • Closes Markdown formatted autocomplete web-client-ui#2247
  • Adds docstring_parser library for autocomplete usage
  • If a valid docstring is found, format the autocomplete help tooltip with markdown, similar to how VS Code does it
  • Regular docstrings can now use Markdown, but the whitespace style follows plain text

devinrsmith pushed a commit to deephaven/deephaven-server-docker that referenced this pull request Oct 4, 2024
- Add `docstring_parser>=0.16` to `requirements.txt`
- Related core PR: deephaven/deephaven-core#6170
- Related issue: deephaven/web-client-ui#2247
docker/server-jetty/src/main/server-jetty/requirements.txt Outdated Show resolved Hide resolved
docker/server/src/main/server-netty/requirements.txt Outdated Show resolved Hide resolved
py/server/setup.py Outdated Show resolved Hide resolved
@wusteven815 wusteven815 changed the title feat: format docstrings when valid style feat: Format signature help when valid docstring style Oct 18, 2024
@wusteven815 wusteven815 marked this pull request as ready for review October 18, 2024 19:41
@mofojed mofojed requested a review from devinrsmith November 28, 2024 15:33
@wusteven815 wusteven815 requested a review from cpwright as a code owner December 3, 2024 21:58
Copy link
Member

@devinrsmith devinrsmith left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The totality of my review is/was around ensuring the base images contained the docstring_parser dependency and we are correctly depending on it from py/server/setup.py. In those regards, the PR is correct (the base image bumps already landed in main). I have not reviewed the other logic.

Copy link
Member

@chipkent chipkent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't have a chance to look at all of this in great detail, but here are some comments.

py/server/tests/test_docstring_parser.py Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a general comment, these tests are unnecessarily difficult to follow. They are using wrappers and do not follow the principle of minimizing variable scope. Together, this has made what should be a simple review take way too long. It is not friendly to the next guy reading the code. Is there really a need to have this code scattered in two files like this?

@jmao-denver should comment in case he disagrees.

return params


def _generate_description_markdown(docs: Docstring, params: list[Any]) -> str:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

params typehint is too vague. See comment on the return type above.

Comment on lines +240 to +245
return [
_generate_display_sig(signature),
description,
param_docs,
signature.index if signature.index is not None else -1,
]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be a class rather than a list in order to make it easier to work with?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is returned to Java, and was the format being done prior to this change. Was not looking to refactor it.

return param_docs


def _get_signature_help(signature: Signature) -> list[Any]:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return signature is too vague.

Comment on lines +199 to +200
Returns:
A list that contains [signature name, docstring, param docstrings, index]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be returning something more structured/organized, like a class?

@mofojed
Copy link
Member

mofojed commented Feb 14, 2025

Closing in favour of #6649

@mofojed mofojed closed this Feb 14, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Feb 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Markdown formatted autocomplete
4 participants