Skip to content

extension views API

Administrator requested to merge extension-views into master

Created by: sqs

Adds a new (experimental) extension API sourcegraph.app.registerViewProvider and ViewProvider that allows extensions to display pages (with Markdown content and scoped search bars) on the Sourcegraph instance at the URL path /views/ID (where ID is the view ID chosen by the extension).

This is useful for:

  • Displaying content that is globally relevant (such as global statistics), not per-repository
  • In the future, creating purpose-built forms (by extending the ViewProvider to support more components, such as a JSON Schema-based form generator with onChange and onSubmit callbacks to registered extension commands)
  • In the future, extending the views API to show partial views in more places (e.g., repository pages)

See https://github.com/sourcegraph/sourcegraph-custom-views for an example extension that uses this, and https://sourcegraph.slack.com/archives/C0B2RU51Q/p1587197734394700 for a screenshot of what it looks like. See https://docs.google.com/presentation/d/1FQ03zih1vlxCvAJyivLxHnvMXpN7fz0VF-K-QQd1fWk/edit#slide=id.g7d3a321198_0_311 for a screenshot of what a purpose-built form could look like (this PR does not support those yet, since that requires a JSON Schema form generator and change/submit callbacks, but it gets us most of the way there).

Merge request reports

Loading