Vscode-markdown: command 'markdown.extension.togglePreview' not found

Created on 12 Nov 2018  ·  9Comments  ·  Source: yzhang-gh/vscode-markdown

VS Code: Version 1.28.2 (1.28.2)
Markdown All in One: 1.7.0

What is the problem?

Just installed the plugin and when toggling the preview it fails with the error in subject.

Is there any error message in the console?

mainThreadExtensionService.ts:44 TypeError: Cannot read property 'document' of undefined
    at BlameViewProvider.<anonymous> (/Users/mmelato/.vscode/extensions/huizhou.githd-2.0.0/out/src/blameViewProvider.js:157:33)
    at Generator.next (<anonymous>)
    at /Users/mmelato/.vscode/extensions/huizhou.githd-2.0.0/out/src/blameViewProvider.js:7:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/mmelato/.vscode/extensions/huizhou.githd-2.0.0/out/src/blameViewProvider.js:3:12)
    at BlameViewProvider._onDidChangeTextDocument (/Users/mmelato/.vscode/extensions/huizhou.githd-2.0.0/out/src/blameViewProvider.js:156:16)
    at BlameViewProvider.vscode_1.workspace.onDidChangeTextDocument.e (/Users/mmelato/.vscode/extensions/huizhou.githd-2.0.0/out/src/blameViewProvider.js:72:22)
    at e.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:99:496)
    at e.$acceptDirtyStateChanged (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:485:777)
    at t._doInvokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:640:888)
    at t._invokeHandler (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:640:554)
    at t._receiveRequest (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:639:126)
    at t._receiveOneMessage (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:638:59)
    at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:635:926
    at /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:98:138
    at e.fire (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:99:496)
    at a (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:154:213)
    at Socket._socketDataListener (/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/node/extensionHostProcess.js:154:432)
    at emitOne (events.js:116:13)
    at Socket.emit (events.js:211:7)
    at addChunk (_stream_readable.js:263:12)
    at readableAddChunk (_stream_readable.js:250:11)
    at Socket.Readable.push (_stream_readable.js:208:10)
    at Pipe.onread (net.js:594:20)
input Question Fixed

Most helpful comment

I had a similar issue, was getting the same error @mauri-melato initially reported, and this was because I had not yet saved my file with the .md extension. Once I did this, I was able to preview.

All 9 comments

It seems not to be an error message from this extension but huizhou.githd-2.0.0. Could you find more message?

And how do you "toggle preview"? by keybinding?

I now disabled the huizhou.githd plugin and reinstalled Markdown.

Yes I'm trying to use both Open Preview and Toggle Preview by key binding (ctrl-shift-v / ctrl-k-v) and both with the same error msg in the subject.
Thanks

Does it work well after the reinstallation?

I still get the same error when using keybinding.
Also tried to enable markdown.extension.preview.autoShowPreviewToSide flag, but no preview is displayed.
For your info, time ago I also installed the Preview/searking.preview-vscode plugin, it has different keybinding but just wondering if it may conflict in some way.

Are you sure you still get the same error? It is strange because 1) you have disabled the huizhou.githd extension, 2) the error message shows nothing to do with the Markdown preview 😳

I wasn't clear, with the same error I meant the message "command 'markdown.extension.togglePreview' not found" in the pop-up when I try to open / toggle preview.

Instead there are no more error messages in the console but just the following warnings:

/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:4362 Overwriting grammar scope name to file mapping for scope source.ruby.
Old grammar file: file:///Applications/Visual%20Studio%20Code.app/Contents/Resources/app/extensions/ruby/syntaxes/ruby.tmLanguage.json.
New grammar file: file:///Users/mmelato/.vscode/extensions/rebornix.ruby-0.20.0/syntaxes/ruby.cson.json
e.register @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:4362
/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:1446  INFO standard startup
/Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:294 [Extension Host] Git extension API method 'getGitPath' is deprecated.
t.log @ /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/workbench.main.js:294

Then it seems that this extension is not properly activated. Do other keybinding work? e.g. ctrl/cmd+b, ctrl/cmd+i

My fault! I wrongly assumed the plugin also worked with .rst files... while it works fine with .md ones.
Thanks for the support, closing the issue.

I had a similar issue, was getting the same error @mauri-melato initially reported, and this was because I had not yet saved my file with the .md extension. Once I did this, I was able to preview.

Was this page helpful?
0 / 5 - 0 ratings