Getting Started
Build extensions for SrcNexus Code Editor to add commands, themes, formatters, editor enhancements, and more.
What Extensions Can Do
Extensions run in isolated JavaScript environments and communicate with the editor through an SDK. With extensions, you can:
- Add commands to the command palette and bind them to actions
- Create themes with custom editor and app colors
- Register formatters for code formatting
- Extend the editor with CodeMirror 6 plugins (keymaps, decorations, linting)
- Add UI elements like status bar items, drawer icons, and bottom sheets
- Access APIs for file system, terminal, storage, network, and more
- Provide snippets for quick code insertion
Getting Started
Using the CLI
Run the scaffolding tool to generate a ready-to-go extension project:
npm create @srcnexus/extension
The CLI will prompt you for an extension name, language (JavaScript or TypeScript), and other options. You can also run it non-interactively:
npm create @srcnexus/extension -- --name "My Extension" --lang ts -y
This generates manifest.json, build.js, and an entry point (src/main.ts or src/main.js) with a sample command already wired up.
Using the Create Extension extension
Install the Create Extension extension from the store. It provides a guided setup directly inside the editor.
Build and Install
The generated build.js uses esbuild to bundle your extension. Run:
npm run build
This bundles your TypeScript/JavaScript source into dist/main.js. No manual zipping is needed — when you publish through the extension manager, the app automatically packages the required files (manifest.json, icon.png, and the bundled JS) into a distributable archive.
For CodeMirror plugins, uncomment the CM build section in build.js.
Next Steps
- Manifest Reference — Full schema for
manifest.json - Commands API — Register commands and hooks
- Themes — Create custom themes
- Contribution Points — All contribution types
- Permissions — Declare required permissions
- Publishing — Publish to the extension store