Vscode: The sidebar is throwing errors like crazy in VSCode 1.6.0

Created on 10 Oct 2016  ·  30Comments  ·  Source: microsoft/vscode

This behavior started happening after upgrading to VSCode 1.6.0 today.

  • VSCode Version: Code 1.6.0 (e52fb0bc87e6f5c8f144e172639891d8d8c9aa55, 2016-10-10T18:28:55.412Z)
  • OS Version: Darwin x64 16.0.0
  • Extensions: QassimFarid.ejs-language-support-0.0.1, dbaeumer.vscode-eslint-1.0.7, donjayamanne.githistory-0.1.0, naumovs.node-modules-resolve-1.0.2, nwallace.peep-0.0.5

Steps to Reproduce:

1. Search pane is blank

  1. Launch Visual Studio Code
  2. Click the magnifying glass on the left side to switch to the "Search" pane
  3. The search pane is empty. No search fields (see screenshot)
    screen shot 2016-10-10 at 3 57 51 pm

    2. Cannot read property 'focus' of undefined

  4. Launch Visual Studio Code

  5. Press cmd+shift+f to trigger the workbench.view.search command
  6. An error occurs (see screenshot)
    screen shot 2016-10-10 at 3 59 37 pm

    3. Cannot read property 'toCustomLabel' of undefined

  7. Launch Visual Studio Code

  8. Press cmd+shift+f to trigger the workbench.view.search command
  9. An error occurs (see screenshot)
    screen shot 2016-10-10 at 4 03 42 pm

    4. Cannot read property 'setWidth' of undefined

  10. Launch Visual Studio Code

  11. Press cmd+b to trigger the workbench.action.toggleSidebarVisibility command
  12. An error occurs (see screenshot)
    screen shot 2016-10-10 at 4 07 18 pm
bug important verified

Most helpful comment

A workaround would be to make sure the following commands are bound to at least one (arbitrary) key combination:

  • "toggleSearchCaseSensitive"
  • "toggleSearchWholeWord"
  • "toggleSearchRegex"

And, as you mentioned, a restart is necessary to make it work.

All 30 comments

Here are the error messages in the devtools console....

screen shot 2016-10-10 at 4 10 38 pm

btw... these errors happen even with the --disable-extensions argument, so they don't appear to be caused by an extension

Does code --force-gpu-rasterization help any?

Just ran into this myself with 1.6. With --force-gpu-rasterization I get:

Cannot read property 'toCustomLabel' of undefined

@chrmarti - I tried code --force-gpu-rasterization and code --force-gpu-rasterization --disable-extensions. Neither one fixed the problem :(

Possibly related to #12709

I at least do not have the REST Client extension installed, and --disable-extensions doesn't fix the issue.

@TimMensch Which OS and OS version are you running?

Windows 10/x64, version 1.6.0, 2016-10-10T18:37:40

Sorry, OS version: Windows 10 Pro, 1511, 10586.589

@chrmarti I've got another Windows 10 system, but I've not let VS Code update on it for fear of losing search on both.

I uninstalled all of my extensions, just to see if that helped, but no luck.

Could you append your keybindings.json? There appears to be a bug with the new commands in the Search viewlet. @sandy081

I'm not modifying the "Find" key:

[
    { "key": "ctrl+]", "command": "editor.action.jumpToBracket", "when": "editorTextFocus" },
    { "key": "ctrl+alt+b", "command": "editor.action.format","when": "editorTextFocus" },
    { "key": "ctrl+w", "command": "workbench.action.closeActiveEditor" },
    { "key": "alt+w","command": "expand_region" },
    { "key": "alt+left",         "command": "workbench.action.focusPreviousGroup" },
    { "key": "alt+right",        "command": "workbench.action.focusNextGroup" },
    { "key": "ctrl+'", "command": "esQuotes.transformBetweenSingleDoubleQuotes" },
    { "key": "ctrl+alt+left",         "command": "workbench.action.focusPreviousGroup" },
    { "key": "ctrl+alt+right",        "command": "workbench.action.focusNextGroup" },
    { "key": "ctrl+shift+'", "command": "esQuotes.transformToTemplateString" },
    { "key": "ctrl+alt+d ctrl+alt+t", "command":"docthis.traceTypeScriptSyntaxNode"}
]

@chrmarti For fun I deleted my keybindings and it still comes up with the same error, and selecting View: Show Search from the command palette _also_ brings up the same error.

@chrmarti - Yep. I was just about to post that.

I completely uninstalled VSCode and deleted my ~/Library/Application Support/Code folder. Then I reinstalled VSCode, and the errors were gone. 👍

Then I restored my custom keybindings and restarted VSCode, and the errors were back. 👎

So I started removing custom keybindings one-by-one and restarting VSCode after each one until I found the culprit. Here is the keybinding that's causing the error (for me, anyway)...

// Place your key bindings in this file to overwrite the defaults
[
  {
    "key": "alt+cmd+w",
    "command": "workbench.action.closeAllEditors"
  }
]

@BigstickCarpet @chrmarti Sure enough, success:

    { "key": "alt+w","command": "expand_region" },

This was the culprit for me. It didn't fix things to just delete it; I had to restart VS Code between tests.

A workaround would be to make sure the following commands are bound to at least one (arbitrary) key combination:

  • "toggleSearchCaseSensitive"
  • "toggleSearchWholeWord"
  • "toggleSearchRegex"

And, as you mentioned, a restart is necessary to make it work.

Awesome sleuthing. 🕵️ This also works for me:

    { "key": "alt+w","command": "expand_region", "when":"editorFocus" },

I added a "when" clause to my keybinding so it wouldn't _kill_ the other binding, just hide it when the editor is active.

/cc @isidorn

Problem for me was also a custom keybinding:
{ "key": "cmd+alt+r", "command": "workbench.action.focusSideBar" },

Presumably because it overwrites the default for toggleFindRegex and thus invalidates the requirements specified by @chrmarti :
{ "key": "alt+cmd+r", "command": "toggleFindRegex", "when": "editorFocus" },

To me it only happens when assigns to cmd+alt+r, for instance:

left menu empty

  {
    "key": "cmd+alt+r",
    "command": "editor.action.format"
  }

left menu ok

  {
    "key": "cmd+r",
    "command": "editor.action.format"
  }

@eduardonunesp On Mac, cmd+alt+r is the short cut for enabling reg-ex toggleSearchCaseSensitive in Search view which is taken by editor.action.format. I have fix in ready and is already available in Insiders. Temporary workaround is to assign a different shortcut for toggleSearchCaseSensitive.

Thanks

Problem for me was due to:

{ "key": "alt+cmd+c", "command": "workbench.files.action.collapseFilesExplorerFolders" }

Same here on MacOS El Capitan

my keybindings.json was

[
    { "key": "shift+cmd+7",                 "command": "editor.action.commentLine"},
    { "key": "alt+`",                 "command": "workbench.action.navigateBack" },
    { "key": "shift+alt+`",                 "command": "workbench.action.navigateForward" },
    { "key": "cmd+alt+c",           "command": "workbench.action.git.input-commit" },
    { "key": "cmd+alt+p",           "command": "workbench.action.git.push" },
    { "key": "cmd+m",          "command": "editor.action.jumpToBracket"}
]

After delete the custom keybindings and restart, everything works fine.

@d4v1dst Sorry for that. This is because of the key-binding cmd+alt+c.

Verification:

Customize following default key bindings to other actions

Mac

  • alt+cmd+c
  • alt+cmdr
  • alt+cmdw

Windows/Linux

  • alt+c
  • alt+r
  • alt+w

Verify that Search view is opening without any errors

For me, these custom keybindings were the issue, after removing them, the search view worked:

{ "key": "shift+alt+c", "command": "toggleFindCaseSensitive", "when": "editorFocus" },
{ "key": "shift+alt+w", "command": "toggleFindWholeWord", "when": "editorFocus" },

Also, I need to mention that I have another custom key bound to alt+c, that before the update of vs code to 1.6.0, was a free key:
{ "key": "alt+c", "command": "vstortoise.svnCommit" },

@lypscan alt+c was always taken to toggle case sensitive option in Editor find widget. With your customization, this key binding was overridden

@sandy081 yes, now I remember... In any case, the error seems to manifest itself whenever I override the default keybindings for: toggleFindCaseSensitive, toggleFindWholeWord, toggleFindRegex.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

vsccarl picture vsccarl  ·  3Comments

ryan-wong picture ryan-wong  ·  3Comments

lukehoban picture lukehoban  ·  3Comments

DovydasNavickas picture DovydasNavickas  ·  3Comments

VitorLuizC picture VitorLuizC  ·  3Comments