Skip to content

Extending markdown preview disallows using acquireVsCodeApi in embedded previewScripts #122961

Closed

Description

Version: 1.55.2
Commit: 3c4e3df
Date: 2021-04-13T09:37:02.931Z
Electron: 11.3.0
Chrome: 87.0.4280.141
Node.js: 12.18.3
V8: 8.7.220.31-electron.0
OS: Linux x64 5.11.0-7614-generic

Steps to Reproduce:

  1. Start with an extension that adds a preview script in the package.json
               "markdown.previewScripts": [
			"./media/main.js"
		]
  1. Make sure the script included uses the acquireVsCodeApi() call
	const vscode = acquireVsCodeApi();
  1. Start an extension workbench window and the markdown preview.
  2. Toggle the Developer Tools
  3. Look in the console for [Embedded Page] Uncaught Error: An instance of the VS Code API has already been acquired

Question: Is there a way around this or some way to grab the markdown preview window's vscode api handle? I'd like to add a click event listener to intercept a particular protocol

Does this issue occur when all extensions are disabled?: Yes/No

Activity

  1. mjbvz commented on May 4, 2021

    @mjbvz
    Contributor

    This is by-design and done for security reasons. No plans on changing it since the markdown preview is not designed to be a generic extension point

  2. added
    *as-designed
    markdown-ext
    on May 4, 2021
  3. locked and limited conversation to collaborators on Jun 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

*as-designedmarkdown-ext

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions