-
-
Notifications
You must be signed in to change notification settings - Fork 217
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
Use MarkdownString to format docstring #503
Conversation
Cool! Here are some quick thoughts, after having tested it very briefly.
About docs in signatures. If it is possible to know if the signature was brought up at will or just popping up because the user hasn't switched that behaviour off, then maybe it could make sense to include the docs in the case that the hover is explicitly requested. And, even then, probably make it configurable by the user. |
I hadn't encountered markdown in docstrings before, that's good to know this is a thing. I added support for codeblocks in docstrings, but with the current behavior of the hover box I'm not sure that we would be able to support any arbitrary markdown syntax. Check out the new screenshot in the description. I understand what you're saying about the signature, I took a quick look to see if your suggestion is possible and I didn't come up with any solutions. There is no command name for the |
After having run with it a day, I think I would configure it to be on in signatures if it was an option. I have automatic signature pop-ups disabled so for me they only show when i want it to. And to not have to hover over the function name to see the docs is actually pretty nice. Just sayn'. |
Nice, I wasn't aware that you can disable automatic parameter hints. Sounds like a good plan, I will add it back and make it configurable. |
I've found out some more information about how markdown is formatted. In markdown, a new line needs two spaces in front of it. And in order to have whitespace at the start of a line, the |
@PEZ I've made 2 changes
I've decided against trying to format the docstring without a codeblock. Beside the regex being a bit finicky, the biggest problem is that the plain text is not monospaced, so the alignment gets messed up no matter what. I am good to go here, please review and play around. I guess the last question is what the default value for the added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how to get rid of the review request, so just typing something here. 😄
@PEZ I think you've pushed to the wrong branch 😅 |
The setting for including docs with parameter hints works well, I think. (I mean as a concept, even if it also seems to work well technically when I try it.) Even so I think it is a nice default to have it as I think that when the docs are not included with the parameters, that it should not be a Markdown hover. They get visibly larger and line break more. So:
The padding at the top of the doc hover, nothing we can do about it, right? |
Nah, I just merged |
Ah, gotcha. Are you familiar with rebasing? |
I just copy/pasted the commands that Github suggested 😀
…On Thu, Dec 5, 2019 at 7:53 PM Stefan Toubia ***@***.***> wrote:
@PEZ <https://github.com/PEZ> I think you've pushed to the wrong branch 😅
Nah, I just merged dev onto this one for easier merging later.
Ah, gotcha. Are you familiar with rebasing?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#503?email_source=notifications&email_token=AAAHKOW62CEDMJJHKF27R3DQXFE3LA5CNFSM4JVEHAJKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEGBXTCI#issuecomment-562264457>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAHKOTIDDOBECLSMTMO4J3QXFE3LANCNFSM4JVEHAJA>
.
|
00d8f23
to
d898ea4
Compare
118262f
to
28421c8
Compare
Ok squashed and good to go, LMK if you think anything else should be changed. |
Great. For me the only thing remaining would be to not use markdown in the case where doc strings are not included. Might see something else today, but right now that's the only thing on my wish list. |
@PEZ I'm not sure I follow here, you're talking about this condition, right? As far as I can see, there is no difference between this and the current appearance. Is there something I'm missing? |
28421c8
to
544df45
Compare
I was referring to the parameter hints. But even so it seems I saw things that weren't there. I'll merge this tomorrow when my brain is a bit rested. |
What has Changed?
MarkdownString
Currently multi-line docstrings are very hard to read because VS Code doesn't respect newlines. I think this is behavior that should be fixed with VS Code, but this PR fixes this by using
MarkdownStrings
to format the hover text.The fix was possible by formatting the docstring as a codeblock, which preserves most of the docstring formatting. One thing to note is that this does seem to make my font a little bigger in the docstring portion, but I think this is fine since it is much more important to properly format the docstring.
Hover
Before
After
Embedded codeblock detection
Signatures
I tested out adding the docstring to the signature since I think this is when the docstring is most useful, I'm not sure if others have a different opinion on this.
Signature formatting is sometimes broken for long lines of text
Completion
Issues
My Calva PR Checklist
I have:
dev
branch. (Or have specific reasons to target some other branch.)master
. (Sorry for the nagging.)ci/circleci: build
test. (For now you'll need to opt in to the CircleCI New Experience UI to see the Artifacts tab, because bug.)[Unreleased]
entry inCHANGELOG.md
, linking the issue(s) that the PR is addressing.The Calva Team PR Checklist:
Before merging we (at least one of us) have:
dev
branch (unless reasons).Ping @PEZ, @kstehn, @cfehse, @bpringe