Vscode: Snippet can freeze the editor

Created on 11 Jul 2017  路  14Comments  路  Source: microsoft/vscode

I found out that latest VScode freezes and not opening any projects.
Reinstalling VScode 1.13 solved the problem.

  • VSCode Version: 1.14
  • OS Version: Mac sierra 10.12.5
candidate freeze-slow-crash-leak important snippets verified

Most helpful comment

Removing just ruby-on-rails-snippets-0.0.1 seems to fix it for me

All 14 comments

Could you retry with code --verbose and append the output here?

Here's mine:

[main 1:56:08 PM] Starting VS Code in verbose mode
[main 1:56:08 PM] from: /Applications/Visual Studio Code.app/Contents/Resources/app
[main 1:56:08 PM] args: { _: [],
  help: false,
  h: false,
  version: false,
  v: false,
  wait: false,
  w: false,
  diff: false,
  d: false,
  goto: false,
  g: false,
  'new-window': false,
  n: false,
  'unity-launch': false,
  'reuse-window': false,
  r: false,
  performance: false,
  p: false,
  'prof-startup': false,
  verbose: true,
  logExtensionHostCommunication: false,
  'disable-extensions': false,
  disableExtensions: false,
  'list-extensions': false,
  'show-versions': false,
  nolazy: false,
  'skip-getting-started': false }
[main 1:56:09 PM] IPC#vscode-machineId
[52878:0711/135610.165590:INFO:CONSOLE(28)] "Overwriting extension <<.erb>> to now point to mime <<text/x-erb>>", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js (28)
[52878:0711/135610.165664:INFO:CONSOLE(28)] "Overwriting extension <<.rhtml>> to now point to mime <<text/x-erb>>", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js (28)
[52878:0711/135610.169747:INFO:CONSOLE(28)] "Overwriting extension <<.jsx>> to now point to mime <<text/x-jsx>>", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js (28)
[52878:0711/135610.169824:INFO:CONSOLE(28)] "Overwriting extension <<.jsx>> to now point to mime <<text/javascript>>", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js (28)
[52878:0711/135610.169864:INFO:CONSOLE(28)] "Overwriting extension <<.jsx>> to now point to mime <<text/javascript>>", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js (28)
[52878:0711/135610.169899:INFO:CONSOLE(28)] "Overwriting extension <<.erb>> to now point to mime <<text/x-erb>>", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js (28)
[52878:0711/135610.169934:INFO:CONSOLE(28)] "Overwriting extension <<.rhtml>> to now point to mime <<text/x-erb>>", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js (28)
[52878:0711/135610.169967:INFO:CONSOLE(28)] "Overwriting extension <<.erb>> to now point to mime <<text/x-erb>>", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js (28)
[52878:0711/135610.170002:INFO:CONSOLE(28)] "Overwriting extension <<.rhtml>> to now point to mime <<text/x-erb>>", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js (28)
[52878:0711/135610.494634:INFO:CONSOLE(28)] "[/Users/piersadrian/.vscode/extensions/TwentyChung.jsx-snippets-0.0.1]: The "class"-snippet very likely confuses snippet-variables and snippet-placeholders. See https://code.visualstudio.com/docs/editor/userdefinedsnippets#_snippet-syntax for more details.", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js (28)
[52878:0711/135610.501582:INFO:CONSOLE(28)] "[/Users/piersadrian/.vscode/extensions/atefth.ruby-on-rails-snippets-0.0.1]: The "fi"-snippet very likely confuses snippet-variables and snippet-placeholders. See https://code.visualstudio.com/docs/editor/userdefinedsnippets#_snippet-syntax for more details.", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js (28)
[52878:0711/135610.502832:INFO:CONSOLE(28)] "[/Users/piersadrian/.vscode/extensions/atefth.ruby-on-rails-snippets-0.0.1]: The "ft"-snippet very likely confuses snippet-variables and snippet-placeholders. See https://code.visualstudio.com/docs/editor/userdefinedsnippets#_snippet-syntax for more details.", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js (28)

Looks like --disable-extensions solves this problem, so it may be a specific extension. Don't have time right now to bisect my extension list...

[main 1:07:35 PM] Starting VS Code in verbose mode
[main 1:07:35 PM] from: /Applications/Visual Studio Code.app/Contents/Resources/app
[main 1:07:35 PM] args: { _: [],
  help: false,
  h: false,
  version: false,
  v: false,
  wait: false,
  w: false,
  diff: false,
  d: false,
  goto: false,
  g: false,
  'new-window': false,
  n: false,
  'unity-launch': false,
  'reuse-window': false,
  r: false,
  performance: false,
  p: false,
  'prof-startup': false,
  verbose: true,
  logExtensionHostCommunication: false,
  'disable-extensions': false,
  disableExtensions: false,
  'list-extensions': false,
  'show-versions': false,
  nolazy: false,
  'skip-getting-started': false }
[main 1:07:36 PM] IPC#vscode-machineId
[65808:0711/130736.752052:INFO:CONSOLE(28)] "Overwriting extension <<.erb>> to now point to mime <<text/x-erb>>", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js (28)
[65808:0711/130736.752192:INFO:CONSOLE(28)] "Overwriting extension <<.rhtml>> to now point to mime <<text/x-erb>>", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js (28)
[65808:0711/130736.754473:INFO:CONSOLE(28)] "Overwriting extension <<.js>> to now point to mime <<text/x-javascript>>", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js (28)
[65808:0711/130736.755396:INFO:CONSOLE(28)] "Overwriting extension <<.erb>> to now point to mime <<text/x-erb>>", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js (28)
[65808:0711/130736.755456:INFO:CONSOLE(28)] "Overwriting extension <<.rhtml>> to now point to mime <<text/x-erb>>", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js (28)
[65808:0711/130736.768313:INFO:CONSOLE(28)] "[/Users/alex/.vscode/extensions/TimonVS.ReactSnippetsStandard-1.1.0]: Unknown language in `contributes.snippets.language`. Provided value: jsx", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js (28)
[65808:0711/130737.257434:INFO:CONSOLE(28)] "[/Users/alex/.vscode/extensions/atefth.ruby-on-rails-snippets-0.0.1]: The "fi"-snippet very likely confuses snippet-variables and snippet-placeholders. See https://code.visualstudio.com/docs/editor/userdefinedsnippets#_snippet-syntax for more details.", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js (28)
[65808:0711/130737.257884:INFO:CONSOLE(28)] "[/Users/alex/.vscode/extensions/atefth.ruby-on-rails-snippets-0.0.1]: The "ft"-snippet very likely confuses snippet-variables and snippet-placeholders. See https://code.visualstudio.com/docs/editor/userdefinedsnippets#_snippet-syntax for more details.", source: file:///Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/electron-browser/workbench.main.js (28)
[VS Code]: detected unresponsive

Removing just ruby-on-rails-snippets-0.0.1 seems to fix it for me

@alexkrolick that did it for me, thanks!

@jrieken Can reproduce, the source is at https://github.com/atefth/ruby-on-rails-snippets-vs-code.

I am not using the ruby-on-rails extension and I am also experiencing issues that are causing the application to become unresponsive. Running --verbose showed several issues that had the confuses snippet message within them. After removing those extensions, the application still becomes unresponsive, even though there are no further errors being shown. --disable-extensions does fix the problem.

Is there a way to enable extensions one-by-one until the problematic extension is found?

@jrieken one good snippet that leads to the freeze

"con": {
聽  "prefix": "con",
聽  "body": "class ${1:${TM_FILENAME/(?:\\A|_)([A-Za-z0-9]+)(?:\\.rb)?/(?2::\\u$1)/g}} < ${2:Application}Controller\n  $3\nend",
聽  "description": "Create controller class",
聽  "scope": "source.ruby"
}

and the infinite while loop https://github.com/Microsoft/vscode/blob/master/src/vs/workbench/parts/snippets/electron-browser/TMSnippets.ts#L166..L171

@bradrich Unfortunately extensions can only be uninstalled when starting with --disable-extensions. You could list them with --list-extensions and uninstall/install from the command line (see --help). Could you post the list of installed extensions here?

@rebornix thanks. I am removing ruby.json on my config folder and it works just fine now.

@bradrich also if you have user snippets for ruby language it may cause crash.

Removing the atefth.ruby-on-rails-snippets extension fixed it for me. i.e.:

# code  --uninstall-extension atefth.ruby-on-rails-snippets
Uninstalling atefth.ruby-on-rails-snippets...
Extension 'atefth.ruby-on-rails-snippets' was successfully uninstalled!

From my side I had to remove the ruby extension and reboot my Mac and it works now.

Fix on master and cherry picked to release/1.14.

The underlying issue is an unhappy recursion of snippets: Repeating placeholders get expanded when having no value, so ${1:foo}bar$1 will be inserted as foobarfoo. Now, if a subsequent reference of a placeholder occurs inside the first definition, like ${1:foo${VAR:bar$1baz}} our logic creates a cycle in the parse tree. Further operations then walk the tree indefinitely.

Was this page helpful?
0 / 5 - 0 ratings