-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Demo Extension API (Swift) and Extension Store #416
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Or ultimately we can follow VS Code design and open an editor screen which shows the extensions it does give the extensions developers more space to work with. |
As I said this is just a PoC of Extensions Store and Extension API, so UI should be handled by someone else. And also I think it's better to discuss UI with @austincondiff. But I think that it is a good option to have UI similar to #414. |
Okay, I'll build the UI for it will just need to look into MD support but the nice thing about the Text view is it automatically supports MD |
…ll button if no release is selected, allow JIT (for editor)
…er needs to reopen workspace to make it work.
Conflicts: CodeEdit.xcodeproj/project.pbxproj
@pkasila : You could put a sample video of how everything happens, from installation to use. |
@Angelk90 There are no APIs for extensions implemented yet (except sample one), so video below just shows how app loads extensions on workspace opening (and extension prints "Hello from HelloWorldExtension: CodeEdit.CodeEditAPI!" on load). codeedit_extensions_demo.mp4 |
great work, keep it up! 👍🏻 |
@pkasila : Some suggestions:
|
…d (doesn't persist window's state, because it's automatically centered), remove all references to plugin after uninstall
@Angelk90 On the first suggestion I'll work a little bit later (it'll require some changes on the server-side). But with the second one here we go: 2022-04-09.23.57.45.mov |
@pkasila : Great, how about the loading is in the center? Registrazione.schermo.2022-04-09.alle.23.02.48.movThen I think after installing it would be useful too, probably show what version is installed. |
@pkasila : If the newly installed "Hello world" extension had a settings window, how can I access it? |
It's a great question. Right now I can suggest 3 options:
Again, this PR is just a PoC of how we can distribute, install, load and let extension interact with CodeEdit via |
@pkasila : Better to ask the problems now, than later. |
Great question @Angelk90. We will need to consider that many extensions will want to store both global and project-specific settings. @austincondiff, this is something that is really confusing for users in Nova. The first white window is where global settings are shown and the second darker project window is where project-specific settings are found. |
Really nice work @pkasila! It's great progress. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great @pkasila!
Description
Demoing the Extension API and basic Extension Store
Bundle
sSomeone else should work on the UI for Extension Store 😄
Related Issue
Checklist
Screenshots
As far it's just PoC, UI is not implemented according to the concept
2022-04-09.23.57.45.mov
How to work with Extensions?
First of all, right now Extension Store API adds plugin releases by receiving web-hooks from GitHub. So, you need to set up a GitHub repository. Everything in this, let's say, tutorial is based on
pkasila/helloworld-extension
- demo extension.About Extension's Bundle
Any extension is a
Bundle
. This bundle should haveceext
extension. Also, this bundle should referenceCodeEditKit
as its dependency.You should declare a subclass of
ExtensionBuilder
which hasbuild(withAPI:)
call which returnsExtensionInterface
conforming class.The subclass of
ExtensionBuilder
should be set as theNSPrincipalClass
inInfo.plist
Authorizing requests
In this PR, Extension Store API server is set to https://codeedit.pkasila.net/api/ (my personal server) which is secured using my Keycloak server (register, login).
NOTE: We need to deploy this Extension Store API server somewhere else.
Then you send request to receive a token to access API:
Then, you need provide this token in
Authorization
header:Publishing a plugin
You need to make a POST-request:
Server will return something like this (remember, you will receive secret only once):
Then, you need to set up web-hooks on GitHub, so Extension Store API could receive information about new releases
Setting up web-hooks with GitHub Releases
Go to your repository settings and to Webhooks tab. Here you need to:
https://codeedit.pkasila.net/api/webhooks/[YOUR_PLUGIN_ID: root.plugin.id]/github
application/json
Let me select individual events.
Releases
only in Individual eventsYou will have something like this:
First delivery may be unsuccessful, but when you will publish new releases everything should work fine.
Publishing releases
You publish releases to GitHub Releases as you would usually do. But you need to provide an additional asset to the release, so CodeEdit would be able to download, install and load the extension.
The final version of the extension should be archived as TAR-archive:
Then,
extension.tar
should be attached to your release (the name of the file should be exactlyextension.tar
).When Extension Store API will receive a web-hook, it will automatically add release to the database. If you delete release from GitHub, then it will automatically delete it from the database after a web-hook.