Sourcegraph extension authoring
A Sourcegraph extension is a single JavaScript file that runs in users' web browsers in a Web Worker and has an exported activate
function. The JavaScript file is usually produced by compiling and bundling one or more TypeScript source files.
The Sourcegraph extension API (generated from sourcegraph.d.ts
) is available to extensions by importing the sourcegraph
module. Writing a Sourcegraph extension is very similar to writing an editor extension for VS Code.
Explanations
- Activation and deactivation
- Contribution points (actions, menus, etc.)
- Builtin commands
- Context key expressions
- Principles of the Sourcegraph extension API
How-tos
- Set up your development environment
- Creating an extension
- Importing the
sourcegraph
module - Local development
- Publishing an extension
- Debugging an extension
Tutorials
- Hello world
- Buttons and custom commands
- Building a language specific extension
- File decorations
- Status bar items
References
- Extension API documentation (full API is in
sourcegraph.d.ts
) - Extension manifest (
package.json
) - Testing extensions
- Example extension: Token Highlights
- More examples: Sourcegraph.com extension registry (most extensions link to their source repository)
- Cookbook (sample code)
- UX style guide