Skip to content

gutterIconPath is not loading correctly in Insider release #12111

Closed

Description

  • VSCode Version: 1.6.0 Insider
  • OS Version: Windows 10

Steps to Reproduce:

  1. Define a pathIcon variable using context.asAbsolutePath('images\\bookmark.png')
let pathIcon: string = context.asAbsolutePath('images\\bookmark.png');
  1. Create a decorator and use the pathIcon variable as gutterIconPath.
let bookmarkDecorationType = vscode.window.createTextEditorDecorationType({
        gutterIconPath: pathIcon,
        overviewRulerLane: vscode.OverviewRulerLane.Full,
        overviewRulerColor: 'rgba(21, 126, 251, 0.7)'
    });
  1. The image will not be loaded, and it will output an error in Developer Tools console
GET file:///C:/%5CUsers%5Calefr%5C.vscode-insiders%5Cextensions%5Calefragnani.Bookmarks-0.9.1%5Cimages%5Cbookmark.png net::ERR_FILE_NOT_FOUND

Unfortunattely, I'm also not able to debug in Insider release (this issue). Maybe something in gutterIconPath or Uri has changed and now the file is not being located?

Thanks in advance

Activity

  1. ArtemGovorov commented on Sep 17, 2016

    @ArtemGovorov
    Contributor

    We have hit the exact same issue. Works ok on OSX, but not on Windows.
    The workaround we use for now in our extension is replacing backslashes with slashes:

    gutterIconPath: pathIcon.split('\\').join('/'),

    What's interesting is that the resource URIs didn't seem to change, so perhaps it's moving to the newer electron/v8 had broken it and URIs with encoded slashes don't work anymore.

  2. alefragnani commented on Sep 17, 2016

    @alefragnani
    Author

    Hi Artem Govorov (@ArtemGovorov) , that was my first attempt, with no success 😢 . Good to know that at least it fixes for OS X (and probably Linux). Thanks 👍

    Uri.ts had some changes last month, but since I don't have a _debugabble source of VS Code` available, I can't check where is the problem.

    I hope it to be fixed soon, or at least new tips for adapting to any new API.

  3. ArtemGovorov commented on Sep 18, 2016

    @ArtemGovorov
    Contributor

    that was my first attempt, with no success 😢 . Good to know that at least it fixes for OS X (and probably Linux).

    That's not what I meant. I mean the original issue doesn't seem to affect OS X at all.

    And the workaround that I suggested (gutterIconPath: pathIcon.split('\\').join('/'),) fixed it for us for all platforms, including Windows. Perhaps your case is different from ours if it doesn't work for you.

    Also, as I said, the URI generation in our case didn't change, so I doubt it is the Uri issue. You may check it in your extension in Dev Tools:

    screen shot 2016-09-17 at 12 06 30 pm

    In our case the icon URI on Windows in both cases (working in 1.5.2 and non-working in 1.6.0) is similar (just pointing to a different folder).

  4. alefragnani commented on Sep 19, 2016

    @alefragnani
    Author

    Ops, I read you tip but didn't see your tip 😞 .

    I replaced \\ by / in the code below, and id didn't work:

    let pathIcon: string = context.asAbsolutePath('images\\bookmark.png');
    // replaced by
    let pathIcon: string = context.asAbsolutePath('images/bookmark.png');

    BUT, updating the code as you suggested, really worked!!! The difference? Your tip replaced the backslashes from the entire path, and not only the added piece. So, I have to add this line, right after that:

    pathIcon = pathIcon.replace(/\\/g, "/");

    Something related to path separator has changed internally (Uri, Decorator, I don't know), and now it's forced to use /, even context returning \\.

    Thanks again 👍

  5. alexdima commented on Sep 20, 2016

    @alexdima
    Member

    I believe the new electron version drags in a new node version where something changed with casing drive letters. We are seeing issues regarding this change everywhere.

    fyi Johannes Rieken (@jrieken) Benjamin Pasero (@bpasero) João Moreno (@joaomoreno) -- I'm not sure where we ended up with a systematic workaround the drive letter casing change?

    This used to work fine before the new electron version:

    let pathIcon: string = context.asAbsolutePath('images\\bookmark.png');
    
    let bookmarkDecorationType = vscode.window.createTextEditorDecorationType({
         gutterIconPath: pathIcon
    });
    

    On the main side I do:

    cssTextArr.push(strings.format('background:url(\'{0}\') center center no-repeat;', URI.parse(opts.gutterIconPath).toString()));
    
  6. added
    bug
    on Sep 20, 2016
  7. 18 remaining items

  8. locked and limited conversation to collaborators on Nov 18, 2017
  9. added 2 commits that reference this issue on Sep 6, 2026
    ba126d5
    5a16625
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions