Skip to content

Support searching the marketplace for compatible notebook renderers  #60

@connor4312

Description

@connor4312

Following microsoft/vscode#119899, there is a structure in the package.json which looks like:

{
	// ...
	"contributes": {
		"notebookRenderer": [
			{
				"id": "github-issues",
				"displayName": "Github Issues Notebook Renderer",
				"entrypoint": "./dist/renderer.js",
				"mimeTypes": [
					"x-application/github-issues"
				],
				"dependencies": [
					"gh-issue-kernel"
				]
			}
		]
	}
}

VS Code will know the mimeType and available kernelProvides list. We need to be able to issue a query which will return:

  • Extensions that have the mimeType in its list of contributes.notebookOutputRenderer.mimeTypes list,
  • excluding extensions who have a non-empty dependencies list which does not include anything in the kernelProvides list

In pseudo-code:

def search_extensions(mimeType, kernelProvides):
  for extension in extensions:
    if any(matches(c, mimeType, kernelProvides) for c in extension.contributes.notebookOutputRenderer):
      yield extension

def matches(contribution, mimeType, kernelProvides):
  if mimeType not in contribution.mimeTypes:
    return False
  
  if kernelDependency.dependencies is not None and len(kernelDependency.dependencies) > 0:
    if not any(d in kernelProvides for d in kernelDependency.dependencies):
      return False

  return True

We will then be able to show a helpful hint in VS Code if there are no renderers for a mimeType.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions