Language-server-protocol: Add support for icons (like colors)

Created on 17 Mar 2021  路  5Comments  路  Source: microsoft/language-server-protocol

There is a way for a language server to return colors found in the code. But I miss a way to do the same with icons/images. Some editors display icons referenced in code so that the developer can visually see the icon and not only the path or name of the icon.
The LSP should specify a way to tell a client about icons or images found in the code.
I guess there are two possibilities for the payload:

  1. a path to the icon
  2. the icon data itself (probably best encoded as Base64)

I hope to see this feature in the near future. Would be good for CSS and other languages with images.

feature-request new request

All 5 comments

I am not sure I understand you request. Where should these icons show up?

Well, of course there needs to be editor support added for this as well to actualy show up.
But I was asuming that there needs to be LSP support for that feature first.

Anyway, here is how this could show up.
Have you ever used Android Studio? There icons referenced in code are displayed on the left side of the line.
This picture taken from A StackOverflow question should help you understand
Preview

I'm not saying, that this is how editors should display the icons. It's just one way.
I like how VSCode displays colors right next to the color code.
Maybe this could be a valid way to display icons in code as well
Preview

I think @Khaos66 would like to have a LSP request IconInformation that it could be consumed in CSS language server for instance to display the icon on the left of background-image (like for ColorInformation for CSS color)

[LIZARD_ICON] background-image: url("../../media/examples/lizard.png"); 

Understood.

@DanTup

This would be really nice in flutter where you already get icons on hover.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Franciman picture Franciman  路  3Comments

lanza picture lanza  路  6Comments

felixfbecker picture felixfbecker  路  3Comments

kaloyan-raev picture kaloyan-raev  路  6Comments

ljw1004 picture ljw1004  路  3Comments