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

Make a tooltip position configurable according to other menus #17

Open
ddovod opened this issue Feb 6, 2016 · 10 comments
Open

Make a tooltip position configurable according to other menus #17

ddovod opened this issue Feb 6, 2016 · 10 comments

Comments

@ddovod
Copy link

ddovod commented Feb 6, 2016

Hi. I have some issue with tooltip. Instead of thouthand words please look at the picture http://imgur.com/w2Daspa

Is there any solution? Thank you a lot!

@cpitclaudel
Copy link
Member

This is going to be really hard to fix; the other menu is from autocomplete, right? I don't think there's a way for us to autodetect its width, so we'd have to have a special case for every package that displays a menu (company, ac, ...)

Of course, I'm hoping @lunaryorn to prove me wrong :)

@swsnr
Copy link
Contributor

swsnr commented Feb 7, 2016

I tend to agree with @cpitclaudel: I don't think that we can easily prevent this sort of thing. I'm inclined to close this issue was "wontfix".

@swsnr
Copy link
Contributor

swsnr commented Feb 7, 2016

At best, we could provide an option to adjust tooltip placement, but I'm not firm enough with pos-tip to implement that.

@ambihelical
Copy link

I'm having the exact same problem, but since I only manually complete I'd be happy with a way to disable the pos-tip when the completion menu is showing. Any ideas how to accomplish this?

@cpitclaudel
Copy link
Member

@ambihelical You can remap the command that starts completion to a defun of your own that would call pos-tip-hide before calling through to the completion function. I can give more details if needed :)

@ambihelical
Copy link

I tried it but it doesn't completely solve the problem, as flycheck can cause the tooltip to reappear while the completion menu is still showing. I will probably look into temporarily disabling flycheck next, as there seems to be hooks for completion start and stop.

A potentially simple way to fix this for everyone would be if there was an option to always place the tooltip above the line, and then the two popups shouldn't interfere.

@seagle0128
Copy link

call pos-tip-hide before calling through to the completion function

I think it's a good solution.

@ambihelical
Copy link

@seagle0128 Did it work for you? It's been awhile but as I said, it seem to be possible for pos-tip-show to be called again while the completion menu is still active, and I seem to recall this occurring during my experiments.

I ended up doing the following, it has worked so far for me, but requires saving and restoring the flycheck-pos-tip-error-messages function, which seems a bit of a hack to me.

Partial config follows.

(use-package company
  :init
  (add-hook 'company-completion-started-hook #'me:company-started)
  (add-hook 'company-completion-finished-hook #'me:company-ended)
  (add-hook 'company-completion-cancelled-hook #'me:company-ended)
  :config
  (defvar me:flycheck-error-function nil)
  (defun me:company-started (&optional args)
    (when (fboundp 'flycheck-pos-tip-error-messages)
      (setq me:flycheck-error-function (symbol-function 'flycheck-pos-tip-error-messages))
      (fset 'flycheck-pos-tip-error-messages 'ignore)))

  (defun me:company-ended (&optional args)
    (when (fboundp 'flycheck-pos-tip-error-messages)
      (fset 'flycheck-pos-tip-error-messages me:flycheck-error-function))))

@seagle0128
Copy link

@ambihelical Honestly I didn't try this workaround. But it seems your workaround works as well.

@cpitclaudel
Copy link
Member

Thanks for sharing that. I think we should have an API to temporarily suspend Flycheck. It turns out that autocomplete already uses advice to override an internal function and disable Flycheck while completing, so that API would be useful there too.

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

No branches or pull requests

5 participants