-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fix autocomplete & hover unit tests #1012
Conversation
@@ -49,8 +49,8 @@ export function extractSignatureAndDocumentation(definition: proxy.IAutoComplete | |||
} | |||
|
|||
export function highlightCode(docstring: string): string { | |||
// Add blank line | |||
docstring = EOL + EOL + docstring + EOL + EOL; |
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.
These EOL
should be kept.
Because some blocks are ended with 'blank line' or EOF
(end of file), I added two EOL
(making a blank line) before and after the docstring to make it easier to match with regex.
To fix the unit tests, I think trim()
the docstring at the end of this function makes more sense.
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.
Perhaps I didn't read through this closely enough before making changes to fix the tests up. My intention was to ensure the docstring was in a known state with exactly a certain amount of whitespace either end. I'll change it to have the two lines and do a trim at the end.
Also I'm curious - what's the circumstance that the docstrings would end with EOF?
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.
Oh, my wrong expression 😅. It's not EOF
, just the end of the docstring.
To elaborate, taking this docstring as an example
>>> fun1()
a
>>> fun2()
b
There are two 'doctest' blocks above.
Assuming that EOL
is \n
, above code is >>> fun1()\na\n\n>>> fun2()\nb
.
It can be split into two parts
>>> fun1()\na\n\n
>>> fun2()\nb
Now it's clear why I need to add two \n\n
after the docstring
Then I replace them using regexs (from reStructuredText syntax to Markdown syntax).
After the replacements (at the end of the function), those blank lines are not needed anymore.
So you don't need to add a EOL
after you trim()
it.
Some formats were broken by these changes 😥 |
Hopefully I've fixed that in #1048 |
No description provided.