vim-denops / denops.vim

🐜 An ecosystem of Vim/Neovim which allows developers to write cross-platform plugins in Deno
https://vim-denops.github.io/denops-documentation/
MIT License
666 stars 33 forks source link

Expose types for plugin's main function #336

Closed Milly closed 4 months ago

Milly commented 4 months ago

Exposes the type PluginMain for the plugin's main function. Update the way to define the main function of the plugin as follows:

// New approach
export const main: PluginMain = (denops) => {
  // ...
};

There is a discussion in #332 about extending the definition of the plugin's main function.

lambdalisue commented 4 months ago

Actually, I usually prefer ordinal function style but the new approach has a big advantage so I'm positive to change the style.

What we need to updates are

lambdalisue commented 4 months ago

Moreover, I believe there are more suitable names than "PluginMain" for the following reasons:

Considering the aforementioned points, I suggest "Entrypoint" as the type name. What are your thoughts?

Milly commented 4 months ago

I suggest "Entrypoint" as the type name. What are your thoughts?

Very good. I agree.

lambdalisue commented 4 months ago

Now denops_std (v6.5.0) serve Entrypoint and we can define the main function like

import type { Entrypoint } from "https://deno.land/x/denops_std@v6.5.0/mod.ts";

export const main: Entrypoint = (denops) => {
  // ...
};