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

Add the ability to pass popup_params when creating a custom ycm_hover #4137

Merged
merged 5 commits into from Mar 20, 2023
Merged

Add the ability to pass popup_params when creating a custom ycm_hover #4137

merged 5 commits into from Mar 20, 2023

Conversation

eliasdaler
Copy link
Contributor

@eliasdaler eliasdaler commented Mar 17, 2023

PR Prelude

Thank you for working on YCM! :)

Please complete these steps and check these boxes (by putting an x inside
the brackets) before filing your PR:

  • I have read and understood YCM's CONTRIBUTING document.
  • I have read and understood YCM's CODE_OF_CONDUCT document.
  • I have included tests for the changes in my PR. If not, I have included a
    rationale for why I haven't.
  • I understand my PR may be closed if it becomes obvious I didn't
    actually perform all of these steps.

Why this change is necessary and useful

This PR adds the ability to pass popup_params to a custom ycm_hover like this:

autocmd FileType c,cpp let b:ycm_hover = {
  \ 'command': 'GetDoc',
  \ 'syntax': &filetype,
  \ 'popup_params': {
      \ 'drag': 1,
      \ 'maxwidth': 80,
      \ 'resize': 1,
      \ 'border': [],
      \ 'borderchars': ['─', '│', '─', '│', '┌', '┐', '┘', '└'],
  \   },
  \ }
augroup END

This allows users to customize the popup window by adding maximum width, borders and other behaviour:

popup2.mp4

This change is Reviewable

Copy link
Member

@puremourning puremourning left a comment

Choose a reason for hiding this comment

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

NICE! thanks.

LGTM with a few nits.

Reviewable status: 0 of 2 LGTMs obtained (waiting on @eliasdaler)


autoload/youcompleteme.vim line 1653 at r1 (raw file):

    endif

    let s:popup_params = {

I don't think this needs to be a script-local variable. Function-local is fine (let popup_params = ...).


autoload/youcompleteme.vim line 1664 at r1 (raw file):

    if has_key( b:ycm_hover, 'popup_params' )
      let s:popup_params = extend( copy( s:popup_params ), b:ycm_hover.popup_params )

looks > 80 chars


doc/youcompleteme.txt line 3280 at r1 (raw file):

- 'syntax': The syntax to use (as in 'set syntax=') in the popup window for
  highlighting.
- 'popup_params': The params passed to a popup window which gets opened.

need to make this change in README.md rather than here. This file is generated from README.md

Copy link
Member

@puremourning puremourning left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 3 files at r1, all commit messages.
Reviewable status: 0 of 2 LGTMs obtained (waiting on @eliasdaler)

@codecov
Copy link

codecov bot commented Mar 17, 2023

Codecov Report

Merging #4137 (0378f61) into master (aaebb55) will decrease coverage by 10.19%.
The diff coverage is 100.00%.

❗ Current head 0378f61 differs from pull request most recent head a4a869c. Consider uploading reports for the commit a4a869c to get more accurate results

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #4137       +/-   ##
===========================================
- Coverage   84.07%   73.88%   -10.19%     
===========================================
  Files          34       34               
  Lines        4483     4484        +1     
===========================================
- Hits         3769     3313      -456     
- Misses        714     1171      +457     

@eliasdaler
Copy link
Contributor Author

need to make this change in README.md rather than here. This file is generated from README.md
Done.

I also noticed that YCM's docs refer to other docs by saying "see :help <something>" and not by using tags like |something| which allow you to jump to the tag directly when reading the docs.

Is this the limitation of generator that people are okay with, or is this |something| syntax avoided on purpose?

@puremourning
Copy link
Member

It's a limitation of the converter.

Copy link
Member

@puremourning puremourning left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 2 files at r2, 2 of 2 files at r3, all commit messages.
Reviewable status: 0 of 2 LGTMs obtained (waiting on @eliasdaler)


autoload/youcompleteme.vim line 1655 at r3 (raw file):

    let popup_params = {
          \ 'col': col,
          \ 'wrap': 1,

this change seems wrong?

@eliasdaler
Copy link
Contributor Author

Indeed. Fixed.

Copy link
Member

@puremourning puremourning left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r4, all commit messages.
Reviewable status: 1 of 2 LGTMs obtained (waiting on @eliasdaler)

Copy link
Member

@puremourning puremourning left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r4, all commit messages.
Reviewable status: 1 of 2 LGTMs obtained (waiting on @eliasdaler)

@puremourning puremourning added the Ship It! Manual override to merge a PR by maintainer label Mar 20, 2023
@puremourning
Copy link
Member

Thanks

@mergify
Copy link
Contributor

mergify bot commented Mar 20, 2023

Thanks for sending a PR!

@mergify mergify bot merged commit d0657bb into ycm-core:master Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ship It! Manual override to merge a PR by maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants