casouri / eldoc-box

childframe doc for eglot and anything that uses eldoc
342 stars 27 forks source link

eldoc-box overlapping with company-box #80

Closed lld2001 closed 1 year ago

lld2001 commented 1 year ago

I use company-box and eldoc-box at the same time. There's a problem that both childframes popping and overlapping. I want to eldoc-box popping only in company-box not active. Could you help me? Thanks.

image

lld2001 commented 1 year ago

After override the eldoc-box--at-point-x-by-company, it looks better.

(defun eldoc-box--at-point-x-by-company ()
  "Return the x position that accommodates company's popup."
  (if company-box--x
      (+ company-box--x (* (frame-char-width (company-box--get-frame))
                    (frame-parameter (company-box--get-frame) 'width)))
    nil))

image

casouri commented 1 year ago

Thanks, could you redefine the function to the following and see if it works? Thanks.

(defun eldoc-box--at-point-x-by-company ()
  "Return the x position that accommodates company's popup."
  (cond
   ((and (boundp 'company-pseudo-tooltip-overlay)
         company-pseudo-tooltip-overlay)
    (+ (* (frame-char-width)
          (+ (overlay-get company-pseudo-tooltip-overlay
                          'company-width)
             (overlay-get company-pseudo-tooltip-overlay
                          'company-column)))
       (or (line-number-display-width t) 0)))
   ((and (boundp 'company-box--x) (numberp company-box--x))
    (+ company-box--x
       (frame-pixel-width (company-box--get-frame))))
   (t nil)))
lld2001 commented 1 year ago

Works as expected. But if company-pseudo-tooltip-overlay set to t, it will fail.

image

casouri commented 1 year ago

Why would company-pseudo-tooltip-overlay be set to t?

lld2001 commented 1 year ago

I found (and (featurep 'company) company-pseudo-tooltip-overlay) in fun eldoc-box--at-point-x-by-company previously. So I set it to t. When using company-box, this variable is no longer necessary.

casouri commented 1 year ago

Yeah, it won't be a problem in normal operation. Cool. I'll push this change soon, thanks for the report!

lld2001 commented 1 year ago

The issue is fixed. Thank you.