-
Notifications
You must be signed in to change notification settings - Fork 13
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
On Hover Doc String Formatting Lacks Linebreaks #42
Comments
I think that's because we render it in Markdown format. However, a single def get_sheet_index(self, sheet: "Sheet") -> Tuple[int, int]:
"""
Returns the group, and index within the group of the `sheet`
Returns (-1, -1) if not found
"""
... {
"range": {"start": {"character": 8, "line": 676}, "end": {"character": 23, "line": 676}},
"contents": {
"value": "```python\n(method) get_sheet_index: (self: Window, sheet: Sheet) -> Tuple[int, int]\n```\nReturns the group, and index within the group of the `sheet`\nReturns (-1, -1) if not found",
"kind": "markdown",
},
} Wondering could we intercept messages in LSP-* before it gets rendered with mdpopup lib... I, privately, actually would like to change the output format of signature help for better syntax highlighting for it. But even if we can intercept the message here, replacing all |
The pyright language server tells LSP that the content is The fact that the content is not actually markdown, but numpy-flavored restructured text, is really a problem of pyright. |
There is another aspect to it - the markdown implementation that is used. Using github flavored implementation would preserve the single linebreaks too. |
Fair point. I'll link this to facelessuser/sublime-markdown-popups#103 and ping @facelessuser so we have another example where it would be beneficial to switch mdpopups to (GitHub-flavored) commonmark. But I still think pyright should put in more effort to move from numpy-flavored restructured text-space to commonmark-space. It might accidentally render alright in VSCode, but the spaces are wrong. For one thing pyright puts in no effort at all to fill in the parameter documentation. This is readily parseable information. |
Have you compared the output in commonmark? I'm not sure it would render as expected there either. |
I've only checked here in github but you are right that commonmark also doesn't render the newline: |
That's what I figured. It doesn't look like it's formatted for Markdown at all. |
Sorry for being new to the ecosystem. But yes, @rwols , from a quick search on the microsoft/pyright#721 |
I'll close this because we're doing everything correctly here. pyright should have a transformation from whatever its documentation space is to markdown space. I understand that is not trivial because there are many different documentation-styles in Python, but that is a problem of pyright. |
Seems that I noticed a change in the docstring formatting in sublime lsp-pyright after the latest Not sure if everything is fixed on the pyright side ... but a quick comparison with |
Example response (identical in both ST and VSCode) where the line breaks are formatted correctly in VSCode but not in ST: {
"contents": {
"kind": "markdown",
"value": "```python\n(function) open: (url: Text, new: int = ..., autoraise: bool = ...) -> bool\n```\nDisplay url using the default browser.\n\nIf possible, open url in a location determined by new.\n- 0: the same browser window (the default).\n- 1: a new browser window.\n- 2: a new browser page (\"tab\").\nIf possible, autoraise raises the window (the default) or not."
},
"range": {
"end": {
"character": 23,
"line": 56
},
"start": {
"character": 19,
"line": 56
}
}
} I believe it's again about differences with the markdown parser used. ST: VSCode: |
Yes, python-markdown wants two newlines before starting an unordered list. In the sample payload, only one newline is used before starting an unordered list. So we're back at facelessuser/sublime-markdown-popups#103. |
Also, I'm not sure if that issue is exactly what @maegul seen. |
Not exactly but it seems to be the same issue. VS Code: ST: |
So it's still pretty much the same as in the initial comment then. |
Not really, initially it was just restructured text, but now it's commonmark. |
Regarding line breaks ... yes There is a slight difference in the output though ... indentation white space is preserved now but wasn't before (which is what prompted me to check for updates in pyright). Don't know why though 🤷 (I'm not on top of the code base here ... just a nagging user 😏 ) |
sublimelsp/LSP@111fac6 should be an improvement :) |
Nice! Makes a world of difference!! |
Not sure if this is a pyright or lsp issue (I'm new to this ecosystem).
Line breaks between parameters are not being printed in the hover over signature and docstring.
See screenshot below:
Line breaks between parameters are not printed. Compare with the ipython output:
The text was updated successfully, but these errors were encountered: