company-mode / company-quickhelp

Documentation popup for Company
GNU General Public License v3.0
374 stars 33 forks source link

Usage of company-show-doc-buffer with company-quickhelp enabled #97

Closed knusprjg closed 4 years ago

knusprjg commented 4 years ago

I've described my problem in more length on stackexchange. To summarize: when company-quickhelp-mode is enabled, the doc buffer window opened with company-show-doc-buffer will always immediately (probably after the timer runs out) jump back to the top when using scroll-other-window. I guess that company-quickhelp does somehow trigger the doc buffer to reload.

Is this the intended behaviour? Is there a workaround so that I can use both company-quickhelp-mode and company-show-doc-buffer (or similar) to view lengthy documentations?

expez commented 4 years ago

Is this the intended behaviour?

Can't say that I intended this as I never use the doc buffer myself. I either use the quickhelp popup, a popup doc buffer (that isn't the internal *help* buffer), or in the very rare situation that I have to repeatedly consult some doc I'll open a browser window on another monitor.

If you want to dig into this you should be able to find out exactly what's happening by using the excellent debugger included in emacs.

Feel free to re-open this if you discover that company-quickhelp does something that it shouldn't.

knusprjg commented 4 years ago

Okay, I fiddled around a bit and I think I see a little clearer now.

  1. My actual problem is, that I have to view long documentation (like 100 lines) for some keywords. Is there a practicable way of doing so with company-quickhelp-mode I'm not aware of? Like scrolling through the popup?

  2. When using company-show-doc-buffer in combination with company-quickhelp-mode, the doc buffer works fine, but it looks like scroll-other-window triggers the quickhelp timer. As soon as it runs out, the company doc buffer is somehow reset to the start. At this point I'm feeling a little lost here to be honest, because I'm not seeing through what behaviour is intended here and what is not.

expez commented 4 years ago

Like scrolling through the popup?

Not sure why you'd need to, it usually shows everything. Have you set company-quickhelp-max-lines to anything other than nil?

I'm not seeing through what behaviour is intended here and what is not.

company-quickhelp doesn't really care about the doc buffer itself. It just asks company for the documentation that goes with the currently selected completion candidate. company puts this information in the doc buffer and at that point company-quickhelp just calls buffer-substring to slurp the content of that buffer.

In other words, it's expected that the content of the doc buffer, which you were previously viewing with company-show-doc-buffer, will change as you select completion candidates, but the interaction with scroll-other-window is surprising to me.

knusprjg commented 4 years ago

Not sure why you'd need to, it usually shows everything. Have you set company-quickhelp-max-lines to anything other than nil?

Yes, simply because some popups were basically covering the whole screen but still not large enough to view the whole page. I'm dealing with some documentation for a tool here, with some commands having like 100 parameters and as much documentation as you would expect. It's like viewing a Wikipedia basically. I think scrolling through a buffer on its own is probably the way better way to go here.

In other words, it's expected that the content of the doc buffer, which you were previously viewing with company-show-doc-buffer, will change as you select completion candidates, but the interaction with scroll-other-window is surprising to me.

Sounds like scroll-other-window might trigger a re-evaluation of the completion candidate and hence restarting the quickhelp timer..? Could be an explanation, I will have a look. Thanks a lot for your patience!