Skip to content

VSCode default language extensions override custom language extensions #20074

Closed

Description

  • VSCode Version: 1.9.0
  • OS Version: Windows 10

Steps to Reproduce:

  1. Install vscode-icons
  2. Install Vue language extension
  3. Create a new file with the .vue extension.
  4. Instead of the Vue icon the html icon is shown.

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.

In the case of Vue, you can see where it is associated to html in VSCode's code in the html extension as Dimitris "Jimi" Charalampidis (@JimiC) pointed out in vscode-icons #725.

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.

Activity

  1. JimiC commented on Feb 14, 2017

    @JimiC
    Contributor

    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.

    1. .vue is also registered as an extension for the html language id in the internal support of html syntax highlighting as already mentioned.

    2. 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).

    3. 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.

  2. aeschli commented on Feb 15, 2017

    @aeschli
    Contributor

    Thanks Dimitris "Jimi" Charalampidis (@JimiC) for the investigation and the detailed write-up!

  3. JimiC commented on Feb 27, 2017

    @JimiC
    Contributor

    alexandrudima Do we have any news on this? Is it OK if I provide a PR with my proposed solution?

  4. alexdima commented on Mar 2, 2017

    @alexdima
    Member

    Appears to be in mime.ts

  5. JimiC commented on Mar 2, 2017

    @JimiC
    Contributor
  6. bpasero commented on Mar 2, 2017

    @bpasero
    Contributor

    I cannot reproduce:

    • installed vscode-icons
    • installed vue extension
    • opened a foo.vue file

    => icon shows up correctly
    => language in status bar reads Vue.js

    screen shot 2017-03-02 at 17 27 03

  7. added
    info-needed
    on Mar 2, 2017
  8. JimiC commented on Mar 2, 2017

    @JimiC
    Contributor

    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.

  9. bpasero commented on Mar 3, 2017

    @bpasero
    Contributor

    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?

  10. 27 remaining items

  11. bpasero commented on Mar 8, 2017

    @bpasero
    Contributor

    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.

  12. sandy081 commented on Mar 8, 2017

    @sandy081
    Member

    Yeah that information is already there in extension description. You can get it as follows

    extensions[i].description.isBuiltin
    
  13. added
    bug
    on Mar 8, 2017
  14. bpasero commented on Mar 8, 2017

    @bpasero
    Contributor

    Dimitris "Jimi" Charalampidis (@JimiC) please verify from tomorrows insider build

  15. JimiC commented on Mar 9, 2017

    @JimiC
    Contributor

    Benjamin Pasero (@bpasero) Confirming that behavior is as excepted in today's insider version. 👍
    Test done with asp and volt.

  16. bpasero commented on Mar 9, 2017

    @bpasero
    Contributor
  17. JimiC commented on Mar 14, 2017

    @JimiC
    Contributor

    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.

  18. bpasero commented on Mar 14, 2017

    @bpasero
    Contributor

    Dimitris "Jimi" Charalampidis (@JimiC) can we extract this into a new issue?

  19. JimiC commented on Mar 14, 2017

    @JimiC
    Contributor
  20. locked and limited conversation to collaborators on Nov 18, 2017
  21. added a commit that references this issue on Sep 6, 2026
    dc70c8e
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugdebtverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions