sebastiencs / company-box

A company front-end with icons
563 stars 64 forks source link

cannot see current selected item #176

Closed 354651432 closed 1 year ago

354651432 commented 2 years ago

uncompany-boxed gnome-shell-screenshot-QYB090

company-boxed image current item is use-package-hush, but its background hight light is missing

acanimal commented 1 year ago

same issue here with emacs 28.2

once installes company-box the selected candidate is not hightlighted

Hi-Angel commented 1 year ago

So, I'm trying to figure out why it breaks (the code in the plugin really just inherits the colors of company-mode, but due to the company-mode declaring colors through a list which I don't yet understand how it works, something breaks).

But if someone wants a quick fix, you can execute something like this:

(set-face-attribute 'company-box-selection nil :background "light blue")
dgutov commented 1 year ago

It's probably related to how your theme you're using is defined. It's not the default one, right?

Hi-Angel commented 1 year ago

It's probably related to how your theme you're using is defined. It's not the default one, right?

Well, as a matter of fact it seems to be the default one. I don't see in my .emacs file anything theme-changing related, except a variable custom-safe-themes. IIRC at some point I settled with the default theme, because I disable a number of major-mode font-locks to make identifiers stand out per this advice anyway.

dgutov commented 1 year ago

Hmm, that's unfortunate. I figured this issue only affects a number of people.

Maybe try installing and enabling company-posframe instead? And see how it behaves.

If it doesn't have this problem, one could compare the implementations.

Hi-Angel commented 1 year ago

Maybe try installing and enabling company-posframe instead? And see how it behaves.

Works, as a matter of fact I see no difference with and without company-posframe-mode enabled

If it doesn't have this problem, one could compare the implementations.

I looked at the code, apparently it has no problem compared to company-box because it doesn't defface selection face. It only has 6 uses of defface, the only interesting ones are company-posframe-active-backend-name and same for "inactive", Idk what they're for. But I doubt it's anything related to a completion selection face.

dgutov commented 1 year ago

Ah, yup. I forgot that company-box has its own set of faces. Not sure why it needs a separate set.

Hi-Angel commented 1 year ago

Ah, yup. I forgot that company-box has its own set of faces. Not sure why it needs a separate set.

Right, as I mentioned in the first comment, the problems comes to it inheriting the face which is somehow broken. But overriding the face directly like a (set-face-attribute 'company-box-selection nil :background "light blue") makes it work.

Hi-Angel commented 1 year ago

So, I sent a PR that fixes the company-box problem.

Basically, the problem was that the plugin was using its own faces before actually declaring them. IMO this should've raised a runtime error, but for some reason it didn't, and just resulted in a silent bug.