-
-
Notifications
You must be signed in to change notification settings - Fork 959
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
Multiline markdown documentation paragraphs get bad linebreaks in documentation hover #3720
Comments
This is the result of
|
Configure |
Indeed, to be honest, I think this is a duplicate, I think I've gone through this before and was against applying "formatting" to
It's an option, but I wished better flowed text in smaller-by-default floats. Large floats get much in the way while coding. |
I see this could potentially add a bad side effect for say, docs with box drawing contents, when they would display fine, in a large float, but would get broken if linebreaks are removed. Well, guess there's not a good way out without a side-effect, so better be as it is. |
The language server should be responsible for format the document. |
Right, agree, it should be a fix in rust-analyzer. |
Please consider reopening, see rust-lang/rust-analyzer#11787, markdown rendering should not present newlines (unless the line ends with 2 spaces or more). If comments are treated as markdown, I think that should be respected. |
Not supported by marked, you can try to hack marked if you want the lines to get merged, can't be done with custome |
Ok, thanks. Well, then maybe they need this fixed upstream, I'll check out what's up. |
const {marked} = require('marked')
marked.setOptions({
gfm: true,
breaks: true
})
const html = marked.parse('foo\nbar') results:
Same behavior on github. |
Do you mean github comments? Indeed that's the case, but I suspect they're not following original/standard markdown guidelines on purpose because people in general wish a newline when they insert one when commenting, instead of having to learn that they have to end line with 2 spaces or more for hard line break. See this issue for example: Possibly coc.nvim should adopt |
That option possible cause unnecessary new lines as well. |
Yeah, I'm gonna have to check it on my dev machine asap. Their docs seem confusing indeed, because it says it should be |
Ok, just tried marked locally and it doesn't generate |
|
Okay, I'm not sure which ones are removed though.
I realize what you mean, it's some kind of tension between honoring the usual Markdown specs (GFM-comments is unusual) vs preserving the original text layout as in the source code comments, even though by that you can break usual Markdown rendering rules. If there was a way to render it properly, I'd prefer to have Markdown honored, but even then, it seems you would prefer to preserve newlines from comment sources, for them to display verbatim in a large window. |
Hello, just joining in. I was wondering if we could make the Something like this (untested)? https://github.com/cheukyin699/coc.nvim/commit/1e1c057696049fd694ab197c69ff1803e243bb78 |
Add configuration |
After some testing, it appears that simply setting See https://github.com/cheukyin699/coc.nvim/commit/728172e5572193d061fac1f98209867d3b97ebd1 |
Result from CocInfo
Describe the bug
A clear and concise description of what the bug is.
The linebreaks from documentation are transported to the hover docs, the hover window can often be narrower than the line length in documentation, so this creates spurious linebreaks in addition to the ones that exists due to window size.
Reproduce the bug
We will close your issue when you don't provide minimal vimrc and we can't
reproduce it
Create file
mini.vim
with:Install
coc-rust-analyzer
Start (neo)vim with command:
vim -u mini.vim
File edited in screenshot bellow is https://docs.rs/bevy_transform/0.6.0/src/bevy_transform/components/transform.rs.html#111-118.
Check documentation hover (better reproduced if it's small)
Screenshots (optional)
If applicable, add screenshots to help explain your problem.
Notice how in this example the docs strangely breaks at "the" and at "direction", it's because the documentation comment is:
The text was updated successfully, but these errors were encountered: