emacs-lsp / lsp-ui

UI integrations for lsp-mode
https://emacs-lsp.github.io/lsp-ui
GNU General Public License v3.0
1.03k stars 141 forks source link

When use company with lsp, flycheck make the first(default selected) cadicate invisible. #679

Open zw963 opened 2 years ago

zw963 commented 2 years ago

Thank you for the bug report

Bug description

https://github.com/company-mode/company-mode/issues/1292

Steps to reproduce

https://github.com/company-mode/company-mode/issues/1292

Expected behavior

https://github.com/company-mode/company-mode/issues/1292

Which Language Server did you use?

lsp-dart

OS

Linux

Error callstack

No

Anything else?

No

yyoncho commented 2 years ago

Please provide detailed steps to reproduce.

zw963 commented 2 years ago

Please provide detailed steps to reproduce.

Okay, finally, i find out what cause this issue.

Following is a can reproducable config:

(setq truncate-partial-width-windows t)
(require 'flycheck_init)
(require 'company)
(setq company-show-quick-access t)
(require 'treemacs)

(require 'dap-mode)
(require 'dap-ui)
(require 'dap-mouse)

(require 'lsp-mode)
(require 'lsp-modeline)
(require 'lsp-headerline)
(require 'lsp-diagnostics)

(require 'lsp-ui)
(setq lsp-ui-sideline-show-code-actions t)

(require 'lsp-dart)
(require 'dart-mode)
(add-hook 'dart-mode-hook 'lsp)
(add-to-list 'auto-mode-alist '("\\.dart\\'" . dart-mode))
(with-eval-after-load 'treemacs
  (add-hook
   'dart-mode-hook
   (lambda ()
     (save-selected-window (treemacs-select-window))))
  )

This issue only happen when company candidate occur at first, then the code action appear, which broken the company candidate menu, create blank line onto it.

If not set truncate-partial-width-windows to t, we can see the blank line added into company candidate menu. like this:

image

For reproduce the exact the issue i meet, following condition must meet:

  1. (setq lsp-ui-sideline-show-code-actions t), which can make above blank line reproduceable.

  2. (setq truncate-partial-width-windows t), and ensure to open treemacs when try to reproduce this issue.

Then, you will see there exists cases which the first candidate invisible.

image

it sound like treemacs exists some issue ... but anyway, report here for check it out.

yyoncho commented 2 years ago

moving the issue in lsp-ui. as a side note, using company-posframe will fix the issue.

zw963 commented 2 years ago

Yes, i confirm, company-posframe work quite well.