Adding default fileicon support to language contributions#118846
Adding default fileicon support to language contributions#118846aeschli merged 13 commits intomicrosoft:mainfrom
Conversation
|
Can this support different default fileicons for the different file-extensions that an extension can associate with a language? |
|
@gjsjohnmurray no it can't (at least at the moment). its implemented like the proposed way from aeschli in this comment #14662 (comment) which only allows one default icon per language definition |
|
Can we use SVG files instead of fonts? Dark and light icons? What's the syntax for both? |
|
Is there any update on this PR? @aeschli is there something wrong with it? |
| aliases?: string[]; | ||
| mimetypes?: string[]; | ||
| configuration?: URI; | ||
| icon?: string; |
There was a problem hiding this comment.
We want to use ThemeIcon as the type to represent icons. You can create an instance on the fly { id: iconName; }
But in the contribution point it's fine that it's just a string.
There was a problem hiding this comment.
Sure, can do. I only ran into a problem when I changed the icon field on the ILanguageExtensionPoint from string to ThemeIcon because of monaco (monacod.d.ts) not seemingly containing/finding this class.
4e4246a to
80a5369
Compare
|
It seems that @Mai-Lapyst got the @aeschli's review point covered in the last commit. Any chance to get this PR landed soon? 😃 |
|
Thanks @Mai-Lapyst! I made some changes.
"languages": [
{
"id": "diff",
"extensions": [ ".diff" ],
"configuration": "./languages/diff.language-configuration.json",
"icon": "$(zap)"
},
|
|
Nice! This is something that we are really looking forward to. Anything preventing this from going in? I'm happy to help if required. |
|
After adding this feature, how difficult will it be to give custom icons based on a specific filename? For example, if developers have a file called I'm looking forward to this. Thank you to the people adding this feature. |
|
@hamirmahal It all builds on the existing ways on how filenames are associated to languages
|
|
@aeschli Ah, okay. Thank you for the response! After merging this pull request, how will we know in which version of VSCode this feature will be available? |
|
Next endgame is end of January, if this does get deemed ready for merge |
|
I made the following change: {
"contributes": {
"languages": [
{
"id": "latex",
// ...
"icon": {
"light": "./latex.png",
"dark": "./latex.png"
}
}
]
}That simplifies the usage of the new property. It is no longer necessary to also create an icon font and we no longer depend on |
|
The new property is currently marked as to its package.json and cannot yet be published to the marketplace. I'll bring the API to the API call so I can hopefully remove the proposed API check soon. |
|
See #140047 for the current proposal and implementation |
|
The API is now final, |
|
Thanks for getting this in. I just tried the following: "languages": [
{
"id": "plz",
"aliases": [
"Please",
"please"
],
"filenames": [
"BUILD"
],
"extensions": [
".plz",
".build_defs",
".build"
],
"icon": {
"light": "./plz_128.png",
"dark": "./plz_128.png"
},
"configuration": "./syntax/language-configuration.json"
}
]And the icon defined above is correctly linked to all |
|
No, that's on purpose. I would recommend filing an issue against the themes if you think the icon they provide needs to be improved. With Seti it's a bit special at it is generated by us. What we could do is improve our converter. Please file an issue against microsoft/vscode |
|
I see, thanks! |
This PR fixes #14662. The changes can be test by using a custom language as in the language-configuration-sample with an custom font that uses the contributes.icons and contributes.iconFonts API.
Example package.json:
{ "name": "language-configuration-sample", "displayName": "Language Configuration Sample", "description": "Language Configuration Sample", "version": "0.0.1", "publisher": "vscode-samples", "engines": { "vscode": "^1.28.0" }, "categories": [ "Programming Languages" ], "enableProposedApi": true, "contributes": { "icons": [ { "id": "foojs-fileicon", "description": "FooJS file icon", "default": { "fontId": "foojs-icon-font", "fontCharacter": "\\E000" } } ], "iconFonts": [ { "id": "foojs-icon-font", "src": [ { "path": "./foojs.woff", "format": "woff" } ] } ], "languages": [ { "id": "foo-javascript", "extensions": [ ".fjs" ], "aliases": [ "fjs", "Foo-JavaScript" ], "icon": "foojs-fileicon", "configuration": "./language-configuration.json" } ] } }The font is generated like the font from the product-icon-theme-sample.