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

Various bugfixes to display mouse-hover mdpopups for macros & functions properly #768

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

LexouDuck
Copy link
Contributor

Hello again ! And again, thank you for making this plugin, it has been of great use to me.

There were a couple of bugs with the mdpopup hover-doc feature (4 to be exact), so I have prepared 4 commits, which fix each of these. Here is an explanation for each one:

So, there were a couple of problems with how macros worked in the mouse-hover mdpopup display:

  • The popup would only appear if the user hovered the mouse over the usage of a macro, and not when hovering the definition of the macro. I fixed this in commit 8304528
  • The mdpopups for macros never showed any documentation comments: this is because clang doesn't keep this info, so cursor.raw_comment is always None for a macro. I fixed this in commit 1e430d4, by adding some custom doc-comment-parsing logic to your Macro_Parser utility class, in ./plugin/utils/macro_parser.py.

Also, there were some less important issues with how functions showed up in the mdpopup as well:

  • Functions with variadic arguments did not display their last argument (I mean the ... ellipsis, not va_list). I fixed this in commit d6d65b5
  • There was never a "Body" section for functions in mdpopups, only the "Declaration" section. I fixed this in commit da2592c. Note that even though the "Declaration" and "Body" sections both show the function prototype declaration, it is still useful to have "Body" since it has syntax coloring, which the "Declaration" section does not have (since it has hyperlinks).

Let me know if you have any questions/remarks.

lexouduck added 4 commits April 1, 2022 18:51
…not display variadic argument ellipsis '...'
… function declaration with syntax color in 'Body' section
…nts for macros, despite clang not doing this for us
@@ -45,7 +45,7 @@
{content}
"""

FULL_DOC_TEMPLATE = """### Full doxygen comment:
FULL_DOC_TEMPLATE = """### Detailed documentation:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This right here is an aesthetic change, which you are free to keep or throw out - I think it is more consistent since it is more similar to the title of the other related section, "Brief documentation".

@LexouDuck
Copy link
Contributor Author

Ah, it seems that the tests have failed for style/lint reasons, because some of my lines of code go beyond the 80th char column. Will fix this right away.

@LexouDuck
Copy link
Contributor Author

There were also a handful of tests that needed updating, since mdpopups for functions now have a "Body" section as well. I have fixed this in commit 83f6b68

@codecov
Copy link

codecov bot commented Apr 3, 2022

Codecov Report

Merging #768 (268c5c4) into master (3b16eb1) will decrease coverage by 1.36%.
The diff coverage is 50.28%.

@@            Coverage Diff             @@
##           master     #768      +/-   ##
==========================================
- Coverage   82.16%   80.79%   -1.37%     
==========================================
  Files          39       39              
  Lines        3319     3458     +139     
==========================================
+ Hits         2727     2794      +67     
- Misses        592      664      +72     
Impacted Files Coverage Δ
plugin/completion/lib_complete.py 80.71% <0.00%> (-1.11%) ⬇️
plugin/settings/settings_storage.py 80.69% <ø> (ø)
plugin/utils/macro_parser.py 45.83% <21.95%> (-29.17%) ⬇️
plugin/error_vis/popups.py 80.49% <60.46%> (-9.45%) ⬇️
plugin/utils/thread_pool.py 96.77% <0.00%> (+3.12%) ⬆️
plugin/utils/progress_status.py 73.77% <0.00%> (+13.11%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update c2e8913...268c5c4. Read the comment docs.

lexouduck added 2 commits June 27, 2022 17:26
…pup hoverdoc: one the reorder the sections in the popup, and another setting to display the documentation body text as markdown, rather than plaintext
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant