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

Unable to read anything from the completions #1099

Open
nolovelost opened this issue Nov 2, 2024 · 11 comments
Open

Unable to read anything from the completions #1099

nolovelost opened this issue Nov 2, 2024 · 11 comments

Comments

@nolovelost
Copy link

nolovelost commented Nov 2, 2024

As the tile says, due to the way the face attributes are set (or maybe some overlay?), I'm unable to read anything returned as candidates for completion. acm-frame-select-face itself is working fine but I haven't been able to change the unselected candidates' face attributes to make them readable. I've tried change foreground attributes for several acm- and lsp-bridge- faces but none of the changes have affected it. acm-frame-select-face does properly change the selected one from the list however.

Could you let me know exactly what face should I be modifying and maybe hint at what else could be causing this?

Below is an example image:
image
In this screenshot you can see the completion frame is dark upon dark making it very difficult to read. On actual use in fact, inside emacs, the text is way darker and impossible to read.

@manateelazycat
Copy link
Owner

How did you reproduce it?

@nolovelost
Copy link
Author

nolovelost commented Nov 3, 2024

I haven't changed anything related to face attributes specific to lsp-bridge or acm. In fact, everything related to lsp-bridge are left as is and I let it's plug-and-play nature to work as intended. Below is the whole snippet of the code that I entered to make everything work,
image

Also, this is my simple window setup I do in the beginning to change my background and related things in case it's helpful,
image

@manateelazycat
Copy link
Owner

Have you try emacs -Q and only load lsp-bridge config for compare test?

@nolovelost
Copy link
Author

So I'm finally able to reproduce it reliably. The line (set-background-color "#161616") does set the background for the frame to the dark color. However, (set-foreground-color "burlywood3") does not set the text to the bright colour. It does set everywhere else in my emacs instance but the completion frame is only taking the background colour for some reason.

@nolovelost
Copy link
Author

To illustrate my above comment. Following is my Emacs startup buffer without and then with (set-foreground-color "burlywood3"):
image
image

Then following is the completion frame without and then with (set-foreground-color "burlywood3"), meaning basically the same:
image
image

Maybe there is a set-face-attribute that can fix these?

@nolovelost
Copy link
Author

Also, for list of faces if that is useful.

acm-
image

lsp-bridge-
image

@nolovelost
Copy link
Author

nolovelost commented Nov 3, 2024

I have "fixed" this for now. It is very hacky but my solution was to override the acm-frame-init-colors function in my init file. Following I've provided how I'm forcing it to set it to arbitrary values for now, which is not exactly ideal but I want it up and running for now.

(defun acm-frame-init-colors (&optional force)
  (set-face-attribute 'acm-frame-default-face nil :background "white" :foreground "black")
  (set-face-attribute 'acm-frame-select-face nil  :background "burlywood3" :foreground "black"))

It doesn't seem right to me that in acm-frame-init-colors, any change to set-foreground\background-face for acm-frame-default-face isn't being respected. Strangely enough it is respecting changes to acm-frame-select-face.

Also I've noticed in acm-frame-init-colors that :foreground for acm-frame-default-face is missing. However, it still doesn't answer why setting using set-face-attribute for default face isn't working but for select face it is.

    ;; Make sure menu follow the theme of Emacs.
    (when (or force (equal (face-attribute 'acm-frame-default-face :background) 'unspecified))
      (set-face-background 'acm-frame-default-face (acm-frame-color-blend default-background blend-background (if is-dark-mode 0.8 0.9))))
    (when (or force (equal (face-attribute 'acm-frame-select-face :background) 'unspecified))
      (set-face-background 'acm-frame-select-face (acm-frame-color-blend default-background blend-background 0.6)))
    (when (or force (equal (face-attribute 'acm-frame-select-face :foreground) 'unspecified))
      (set-face-foreground 'acm-frame-select-face (face-attribute 'font-lock-function-name-face :foreground)))))

EDIT: Things aren't really "fixed" after all. It seems I can change the background that way but foreground is still stuck on black. It's still better than nothing though.

@manateelazycat
Copy link
Owner

@nolovelost Did you use lsp-bridge in terminal or GUI?

@nolovelost
Copy link
Author

This is in GUI. Native windows build v29.1.

@manateelazycat
Copy link
Owner

Maybe cause by

(advice-add #'load-theme :after #'acm-reset-colors))

@eotsn
Copy link

eotsn commented Dec 13, 2024

I'm not sure if it's the same issue, but I also experienced trouble with persisting color changes when I was attempting to support switching themes using customize-themes. The problem I found was that the acm-reset-colors calls acm-frame-init-colors with the optional force value, overriding any customizations depending on when you load your theme.

It's probably not the best solution, but I found the following workaround:

;; Prevent `acm-reset-colors' from overriding theme customizations.
(advice-add 'acm-frame-init-colors :around (lambda (orig-func &rest _) (funcall orig-func)))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants