Skip to content

cook-md/plugins

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Cook Editor Plugins

First-party plugins for Cook Editor, and a reference for writing your own. Each plugin is a standalone npm package in its own folder.

Plugin Description
meal-journal Daily meal journal in Cooklang markup. Start here — it demonstrates the most common plugin APIs.

How plugins work

Cook Editor is built on Eclipse Theia, which runs VS Code-style extensions: plugins are written against the VS Code Extension API and declare their UI contributions (commands, menus, keybindings, settings, snippets, languages) in package.json. Cook Editor currently supports VS Code API 1.110.

At startup the app loads every plugin found in editor/plugins/ — an unpacked .vsix layout or a plain folder with a package.json both work. The meal-journal plugin demonstrates:

  • Commands + keybindings + menuscontributes.commands, keybindings, menus (with when clauses scoping buttons to .journal files)
  • Settingscontributes.configuration, read via workspace.getConfiguration(...)
  • Language associationcontributes.languages adding .journal to the built-in cooklang language, inheriting its grammar and language server
  • Snippetscontributes.snippets
  • Status barwindow.createStatusBarItem(...) in activate()
  • Workspace file accessworkspace.fs (URI-based), workspace.findFiles
  • Quick-pick UIwindow.showQuickPick

Writing a new plugin

  1. Copy the meal-journal folder structure: package.json (manifest), tsconfig.json, src/extension.ts with an exported activate().
  2. The manifest needs name, version, publisher, engines.vscode, and main pointing at the compiled entry point.
  3. Keep logic that doesn't need the vscode API in separate modules — they can be unit-tested with plain mocha (see src/journal-files.spec.ts).
  4. Build and deploy: npm run deploy copies the plugin into ../../editor/plugins/<publisher>.<name>.
  5. Start the editor: cd ../../editor && npm run start:electron. The app copies editor/plugins into its own plugins folder on every start.

The dev loop is: edit → npm run deploy → restart the editor.

Publishing to plugins.cook.md

Releases go to the Cook plugins marketplace (an OpenVSX-compatible registry). One-time setup:

  1. Sign in at https://plugins.cook.md with GitHub and create a personal access token (PAT) in your dashboard.

  2. Create the namespace matching the plugin's publisher (once per namespace):

    npx ovsx create-namespace cooklang -r https://plugins.cook.md -p <PAT>

To release a new version:

cd meal-journal
npm version patch        # or minor/major — updates package.json
npm run package          # builds meal-journal-<version>.vsix
OVSX_PAT=<PAT> npm run publish:marketplace

Verify with curl https://plugins.cook.md/api/cooklang/meal-journal.

Useful references

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors