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

Use all-the-icons in breadcrumb #115

Open
memeplex opened this issue Oct 9, 2021 · 17 comments
Open

Use all-the-icons in breadcrumb #115

memeplex opened this issue Oct 9, 2021 · 17 comments

Comments

@memeplex
Copy link

memeplex commented Oct 9, 2021

I'm not sure if I should report this here but it seems that lsp uses the icon theme of treemacs. If there is a better place, please let me know.

Compare the icons (all-the-icons) in treemacs:

image

with the ones in the breadcrumb:

image

Not only utterly inconsistent but also the images render blurry in a HiDPI screen (MacBook).

There are related issues reported:

Treemacs supports themes but AFAIK treemacs does not come with all-the-icons-theme OOTB.

which I believe is not true anymore. Then there are a lot of comments saying that the icons are indeed showing but are not all-the-icons, which is my concern here. So I believe a specific ticket has to track that issue.

@yyoncho
Copy link
Member

yyoncho commented Oct 9, 2021

AFAIC @ericdallo is using similar setup. Can you help with the config settings to achieve what OP wants?

@ericdallo
Copy link
Member

AFAIK is just use the treemacs all-the-icons theme that was included some time ago in treemacs here

@memeplex
Copy link
Author

memeplex commented Oct 9, 2021

@ericdallo as described above treemacs is configured to use all-the-icons (see the screenshots) but the breadcrumb (and emacs-lsp in general) still uses image icons. There are many similar reports at the end of emacs-lsp/lsp-mode#1858.

Moreover, switching everything to image icons for consistency is neither a good option as per emacs-lsp/lsp-mode#3143.

@ericdallo
Copy link
Member

I see, I stopped using headerline-breadcrumb, but I'll try to take a look on lsp-mode code to understand why it's using the images instead of all-the-icons

@memeplex
Copy link
Author

memeplex commented Oct 9, 2021

Great, thanks, I was looking at your config here https://github.com/ericdallo/dotfiles/blob/master/.doom.d/init.el#L42. I'm not a doom emacs user but I believe they turn off the breadcrumb by default.

@memeplex
Copy link
Author

memeplex commented Oct 9, 2021

It seems like support for all-the-icons is not provided through a transparent, unified icon interface across emacs-lsp and it's only used in an ad hoc way for the headerline arrow.

image

The problem is not restricted to the headerline indeed, if you take a look at the session explorer it isn't using all-the-icons.

@yyoncho
Copy link
Member

yyoncho commented Oct 9, 2021

unified icon interface across emacs-lsp and it's only used in an ad hoc way for the headerline arrow.

Unfortunately, there is no such interface so that it can be used across all packages. Also, the icons on each place were not added at the same time.

@memeplex
Copy link
Author

memeplex commented Oct 9, 2021

Considering the conversations here and in emacs-lsp/lsp-mode#3143 maybe it's better to open a "meta" issue in order to coordinate icon related tasks, because the situation is quite messy. Some things are totally missing or only partially provided. Potential TODO list:

  • Provide SVG icons
  • Provide consistent lsp, treemacs and company themes across the board
  • Support all-the icons

@yyoncho
Copy link
Member

yyoncho commented Oct 9, 2021

  • Provide consistent lsp, treemacs and company themes across the board

The question is how to achieve that. In an ideal world, we will have a root package "icons" which provides an api to add these icons. At this point, each component has a separate set of icons and a separate API to add and configure them.

@ericdallo
Copy link
Member

the idea behind lsp-icons.el was to provide something like that as a start

@yyoncho
Copy link
Member

yyoncho commented Oct 9, 2021

lsp-icons.el cannot be used by company-mode nor treemacs...

@memeplex
Copy link
Author

memeplex commented Oct 9, 2021

But company, company-box and treemacs provide interfaces to set the icons, so it could be done.

emacs-lsp seems a natural place to coordinate those icon sets, but it would be nicer to have consistent icon themes that don't require lsp, using treemacs with company but without lsp is still an important use case.

@memeplex
Copy link
Author

memeplex commented Oct 9, 2021

You know like base16 has become a meta theme for many many tools.

@yyoncho
Copy link
Member

yyoncho commented Oct 9, 2021

Yeah, I am not saying that it is not possible. I am just saying that we have to provide something like a recipe - do this and that, and you will get a consistent look.

@memeplex
Copy link
Author

memeplex commented Oct 9, 2021

You can have a package that provides one function that receives an icon theme name and takes care of setting every other project in a consistent manner, so it would be very simple for the user to achieve consistency. It's technically easy but still rather laborious. In any case, I wouldn't put that package under emacs-lsp/lsp-mode but it's ok if it's inside emacs-lsp as far as it can be also used without lsp, so the community at large will benefit and also users of lsp-mode that not necessarily use lsp for all their programming needs. In a similar vein, I dislike the idea that only emacs "distros" take care of this, because then you will be "locked-in" due to some comparatively minor issue like icon consistency.

@memeplex
Copy link
Author

memeplex commented Oct 9, 2021

Coming back to the specific issue, lsp-treemacs-symbol-icon uses lsp-treemacs-theme which is not in sync with the theme treemacs is effectively using. By default it's, well, "Default". So that's probably a source of confusion for people saying treemacs is set to use all-the-icons but lsp is ignoring that.

Anyway, setting lsp-treemacs-theme to "all-the-icons" kind of improves things a bit:

image

But there are still missing icons, probably because of naming mismatches between lsp and treemacs. That's likely the reason why lsp-treemacs-themes.el is redefining themes.

Leaving company and svg aside, here is a solution:

  1. Copy&paste the code from https://github.com/Alexander-Miller/treemacs/blob/master/src/extra/treemacs-all-the-icons.el to lsp-treemacs-themes.el and do the appropriate renamings or whatever adjustments you see fit.
  2. Start with lsp-treemacs-theme set to nil and try to match the current treemacs theme with an equally named theme in lsp-treemacs, only if that's not possible fallback to the "Default" theme.

@memeplex
Copy link
Author

memeplex commented Oct 9, 2021

  1. Copy&paste the code from https://github.com/Alexander-Miller/treemacs/blob/master/src/extra/treemacs-all-the-icons.el to lsp-treemacs-themes.el and do the appropriate renamings or whatever adjustments you see fit.

Mmm, I don't think this will be very useful, I thought there were icons for classes, methods, functions, etc. in treemacs-all-the-icons.el and it was mostly a matter of naming, but the fact is that there are little to no icons for that stuff, when you expand a file in the tree you only get a couple of icons with very little semantic awareness, for example:

image

Perhaps company-box all-the-icons theme is a better source of inspiration. Indeed the themes in https://github.com/emacs-lsp/lsp-treemacs/blob/master/lsp-treemacs-themes.el seem to be taken from https://github.com/sebastiencs/company-box/blob/master/company-box-icons.el only that all-the-icons theme is missing. Maybe it wasn't there when you guys created lsp-treemacs-themes.el, was it?

So seemingly the situation is not that bad. If lsp icons are mostly copied from company-box and have very little overlapping with treemacs icons, then everything will be pretty consistent out of the box. Of course the style of the icons still matter, specially fonts vs images, but at least there is no overlapping between the icons themselves, between "file explorer matters" and "programming matters" to say so.

  1. Start with lsp-treemacs-theme set to nil and try to match the current treemacs theme with an equally named theme in lsp-treemacs, only if that's not possible fallback to the "Default" theme.

Given the above, it seems now that company's theme is even more important for lsp that treemacs'. Maybe the best alternative is to add some guidelines in the documentation explaining how to set company-box, treemacs and lsp in a consistent fashion, instead of coding some magical patchwork.

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

3 participants