First steps in plugin development

Hello,

I've installed Joplin 1.3.18 on Windows (Node.js 14, then 12, no change).

I create a basic plugin, (followed "Getting started with plugin development", steps 1 (created "toc" plugin), 2 and 3.

In the console, I see:

main-html.js:49 19:10:09 Plugin Service: PluginService: Loading plugin from W:\Joplin\toc
main-html.js:49 19:10:11 Plugin Service: Starting plugin: toc
main-html.js:49 19:10:11 Plugin Service: Finished running onStart handler: toc (Took 98ms)

However, despite the fact that the plugin code contains:
onStart: async function() {
console.info('Test plugin started!');
},

I don't see any other message.

Also, trying to understand what goes on, I've placed a breakpoint in main-html.js at line 49, but the breakpoint is activated 3 times (till appType: desktop" gets printed), and that's it.

I've also set a breakpoint in C:\Program Files\Joplin\resources\app.asar\lib\services\plugins\api\JoplinPlugins.js, at line 36, where I see:
this.logger.info(Starting plugin: ${this.plugin.id});

Execution doesn't stop either.

Can anyone help?

Thanks
Christian

1 Like

The plugin system has changed quite a bit since that version so it's best to use the pre-release if you want to develop a plugin. In your particular case, I suspect the plugin dev tool window is hidden by the app dev tool window, but this has been fixed in v1.4

I now see the log in the second console (1.4.11). Thanks

Having a look at plugin development. Using 1.7.4 but having the same problem seeing the "Test plugin started!" message in the console?

I have "Starting plugin" and "Finished running on start handler" but no output. I have detached/floated the main developer tool window, which I assume is the "app dev tool" window, but this thread talks about a second window "dev tool" window?

Can someone shed some light on this please?

Do you start Joplin with --env dev for the develop?
As described in the doc, than you get the second window.

https://joplinapp.org/api/get_started/plugins/

Yes, I have started Joplin, gone to help and used Help -> copy dev mode command to clipboard. Pasted the link into a Powershell window and hit return. The copied path does have --env dev at the end.

Joplin declares that it's in developer mode i.e. it has Joplin (DEV) on the title bar and I have the standard developer window that I would see in Chrome if I was to hit F12, but I do not have the second window shown on the left in your image?

I don't know if this makes any difference, but I am using Windows portable version. Do you know, if I need to make a full install of Joplin in order for this to work?

Thanks for your reply.

Okay, I've now installed the full Windows client and tried again. I still do not get the developer tools window opening despire going into DEV mode!

Grrrrr.

Worked it out.

The Instructions here Getting started with plugin development | Joplin (joplinapp.org) state that you have to enter the path to your plugin and gives the example of /home/user/src/joplin-plugin

This is confusing as the plugin has a src directory within it, but you need to point to the root of your plugin and not to the src file contained within!

@laurent perhaps you could make the instructions clearer please, or remove the src from the example path?

I'm not sure, I think it would still be possible to make a mistake because the path clearly doesn't end with "/src" or "/dist". Maybe when such a path is specified, the console should display a clear error message. Actually wasn't there some error message when you tried to load from /src?

No error was shown that I saw.

What confused me was the example has a src directory in it i.e. /home/user/src/joplin-plugin which I confused with the src directory in the main plugin directory.

Perhaps the example could be changed to something like path/to/your/root/plugin/directory ?

Just a thought, I've been at this for hours today not understanding why it wasn't working.