CodeEdit icon indicating copy to clipboard operation
CodeEdit copied to clipboard

👀 Extension Architecture / API

Open jasonplatts opened this issue 3 years ago • 9 comments

Overview

Support for extensions is planned for a future release of CodeEdit. The extension system will provide similar capabilities to that of other editors.

Contributing

If you wish to contribute to building the CodeEdit extension architecture, please see the tasks below and review the relevant parts of the API documentation repository. This documentation should be used as the guide for development.

PLEASE NOTE THE DOCUMENTATION IS STILL WORK IN PROGRESS. TASKS AND THEIR RELATED GITHUB ISSUES WILL BE UPDATED AS THE RELEVANT DOCUMENTATION IS COMPLETED.

Each API feature functionality first needs to be built into CodeEdit so that it can be used internally by the application and then later exposed to extensions through the API.

Tasks

  • [ ] CodeEditApp/CodeEdit#180
  • [ ] CodeEditApp/CodeEdit#183
  • [x] CodeEditApp/CodeEdit#167
  • [ ] CodeEditApp/CodeEditTextView#32
  • [ ] CodeEditApp/CodeEdit#391
  • [ ] CodeEditApp/CodeEdit#222
  • [ ] CodeEditApp/CodeEdit#220
  • [ ] CodeEditApp/CodeEditTextView#40
  • [ ] CodeEditApp/CodeEdit#224
  • [ ] CodeEditApp/CodeEdit#262
  • [ ] CodeEditApp/CodeEdit#392
  • [ ] Data Storage
  • [ ] Display Notifications
  • [ ] Themes
  • [ ] Custom UI support with React Components
  • [ ] Extension Debug Console
  • [ ] CodeEditApp/CodeEdit#107

References

jasonplatts avatar Mar 19 '22 04:03 jasonplatts

If extensions have a JS API, it would be great if they can be standard ESM instead of CJS like Nova requires for its extensions:

https://docs.nova.app/extensions/#javascript-modules

CJS makes it tricky (but not impossible) to author extensions using Deno or other standards-aligned tooling without introducing a build step.

jaydenseric avatar Mar 21 '22 00:03 jaydenseric

Related: https://github.com/CodeEditApp/CodeEditTextView/issues/40 .

jaydenseric avatar Mar 21 '22 00:03 jaydenseric

Hi @jaydenseric.

Thanks for joining the discussion. @austincondiff and I talked about this and it has been brought up in our Discord too.

Since it is early in the development, no decisions have been made in relation to the extension architecture. JavaScript Core (https://developer.apple.com/documentation/javascriptcore) has been mentioned as a possible option for implementing extensions. Unfortunately, as far as I am aware, it does not support ESM.

Having developed some extensions for Nova, I know this has been a frustration shared by other devs too. And, hopefully we can find a final solution that supports ESM. We also have an extensions channel in our Discord if you would like to get involved in the conversation.

jasonplatts avatar Mar 21 '22 03:03 jasonplatts

Whether or not the host environment supports ESM, it should be straightforward to provide a standard bit of boilerplate to make bundling it into a version which handles module scopes etc. easy for end user developers. (I'm happy to provide some input that way if/as you get there; just ping me about it!) Related: please do what Nova has not yet done and build your JS API in TypeScript and shipping types natively. (I'm also happy to advise on that!)

chriskrycho avatar Oct 05 '23 15:10 chriskrycho

@chriskrycho That would definitely be ideal for a JS/TS API. We'd love to hear what you had in mind!

austincondiff avatar Oct 05 '23 15:10 austincondiff

What about an extension system via WebAssembly? You could use WasmKit.

TheBlckbird avatar Jan 13 '24 19:01 TheBlckbird

If extensions have a JS API, it would be great if they can be standard ESM instead of CJS like Nova requires for its extensions:

https://docs.nova.app/extensions/#javascript-modules

CJS makes it tricky (but not impossible) to author extensions using Deno or other standards-aligned tooling without introducing a build step.

How do you plan to run the JS? Cuz if you were using Bun, the whole CJS/ESM thing wouldn’t be such a problem, since Bun supports both, even in the same file.

TheBlckbird avatar Jan 13 '24 19:01 TheBlckbird