You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
VSCode default language extensions override custom language extensions #20074
vscode-icons provides support for Vue files by leveraging the language id but it seems that the mechanism that it's used by the icon theme API is giving priority to the default language extensions provided by VSCode.
This has an unexpected behavior as the users are not able to see the expected icon.
This is the only case where the file association has to be explicit, meaning that the user has to explicitly change the file association so she can see the proper icon. That's not the case when the language id is not provided by default by VSCode.
This is clearly creating inconsistencies in the user experience thus confusing the users about what they are supposed to do.
It would be nice if this could somehow be changed to prioritize custom language ids over default ones. This is at least what we were expecting from our side as icon theme builders until we've found out that this is not how it seems to be working.
Reacted by Dimitris "Jimi" Charalampidis, mudrz, Christopher Schmitz and Jens Hausdorf
There are three factors that are causing this misbehavior.
.vue is also registered as an extension for the html language id in the internal support of htmlsyntax highlighting as already mentioned.
Although vscode issues a warning about the extension getting overwriten, it doesn't get handled, in order for the internal association to get removed from the appropriate list (nonUserRegisteredAssociations).
While iterating through the association list (in this case the nonUserRegisteredAssociations), the flow logic prevents the correct mime to be assigned, as it gets assigned to html because the iteration finds the html first and then prevents the flow to get through to vue.
My proposed solution is to handle the issue in the already coded check section.
Reacted by Roberto Huertas, Jens Hausdorf and evandrocoan
Benjamin Pasero (@bpasero) I know, this is now invalid as you guys removed the vue filename extension from the html extension. But try this with the asp or volt extension.
Dimitris "Jimi" Charalampidis (@JimiC) it is not clear how to solve that though, there are 2 extensions that provide a language for an extension and the first one wins, but how do you argue that the second one should win? What are the rules?
After talking to alexandrudima we decided to go forward with the model of letting a user installed extension override our built in extensions.
I have added a new property userInstalled to ITextMimeAssociation for the registerTextMime method that is being used to register all languages. This property should be set to true for extensions that are originating from the extensions folder and not our installation directory.
I did not find any property on ILanguageExtensionPoint that would tell me if the extension point is contributed from a built in or user installed extension.
Sandeep Somavarapu (@sandy081) is there any chance we could add this info to extension point handler here? I think that is the only piece missing.
Benjamin Pasero (@bpasero) It has been reported to us that due to this change there is an issue with the scss association (only noticeable in Code-Insiders). Using the sass-intended extension the icon association for scss gets lost. This line may cause the issue.
Activity
JimiC commentedon Feb 14, 2017
Martin Aeschlimann (@aeschli)
After a three hours debugging session, I figured out what's going wrong.
There are three factors that are causing this misbehavior.
.vueis also registered as an extension for thehtmllanguage id in the internal support ofhtmlsyntax highlighting as already mentioned.Although
vscodeissues a warning about the extension getting overwriten, it doesn't get handled, in order for the internal association to get removed from the appropriate list (nonUserRegisteredAssociations).While iterating through the association list (in this case the
nonUserRegisteredAssociations), the flow logic prevents the correctmimeto be assigned, as it gets assigned tohtmlbecause the iteration finds thehtmlfirst and then prevents the flow to get through tovue.My proposed solution is to handle the issue in the already coded check section.
aeschli commentedon Feb 15, 2017
Thanks Dimitris "Jimi" Charalampidis (@JimiC) for the investigation and the detailed write-up!
JimiC commentedon Feb 27, 2017
alexandrudima Do we have any news on this? Is it OK if I provide a PR with my proposed solution?
alexdima commentedon Mar 2, 2017
Appears to be in
mime.tsJimiC commentedon Mar 2, 2017
Actually the flow starts from https://github.com/Microsoft/vscode/blob/master/src/vs/editor/common/services/languagesRegistry.ts#L301 but the main logic is in
mime.ts.bpasero commentedon Mar 2, 2017
I cannot reproduce:
=> icon shows up correctly
=> language in status bar reads Vue.js
JimiC commentedon Mar 2, 2017
Benjamin Pasero (@bpasero) I know, this is now invalid as you guys removed the
vuefilename extension from thehtmlextension. But try this with the asp or volt extension.bpasero commentedon Mar 3, 2017
Dimitris "Jimi" Charalampidis (@JimiC) it is not clear how to solve that though, there are 2 extensions that provide a language for an extension and the first one wins, but how do you argue that the second one should win? What are the rules?
27 remaining items
bpasero commentedon Mar 8, 2017
After talking to alexandrudima we decided to go forward with the model of letting a user installed extension override our built in extensions.
I have added a new property
userInstalledtoITextMimeAssociationfor theregisterTextMimemethod that is being used to register all languages. This property should be set totruefor extensions that are originating from the extensions folder and not our installation directory.I did not find any property on
ILanguageExtensionPointthat would tell me if the extension point is contributed from a built in or user installed extension.Sandeep Somavarapu (@sandy081) is there any chance we could add this info to extension point handler
here? I think that is the only piece missing.sandy081 commentedon Mar 8, 2017
Yeah that information is already there in extension description. You can get it as follows
bpasero commentedon Mar 8, 2017
Dimitris "Jimi" Charalampidis (@JimiC) please verify from tomorrows insider build
JimiC commentedon Mar 9, 2017
Benjamin Pasero (@bpasero) Confirming that behavior is as excepted in today's
insiderversion. 👍Test done with
aspandvolt.bpasero commentedon Mar 9, 2017
Dimitris "Jimi" Charalampidis (@JimiC) awesome thanks.
JimiC commentedon Mar 14, 2017
Benjamin Pasero (@bpasero) It has been reported to us that due to this change there is an issue with the
scssassociation (only noticeable inCode-Insiders). Using the sass-intended extension the icon association forscssgets lost. This line may cause the issue.bpasero commentedon Mar 14, 2017
Dimitris "Jimi" Charalampidis (@JimiC) can we extract this into a new issue?
JimiC commentedon Mar 14, 2017
Benjamin Pasero (@bpasero) Sure.
VSCode default language extensions override custom language extensions (