File tree Expand file tree Collapse file tree 5 files changed +50
-5
lines changed Expand file tree Collapse file tree 5 files changed +50
-5
lines changed Original file line number Diff line number Diff line change 11export type {
22 Context ,
33 Dispatcher ,
4- } from "https://deno.land/x/denops_core@v0.10 .0/mod.ts" ;
5- export { Denops } from "https://deno.land/x/denops_core@v0.10 .0/mod.ts" ;
4+ } from "https://deno.land/x/denops_core@v0.11 .0/mod.ts" ;
5+ export { Denops } from "https://deno.land/x/denops_core@v0.11 .0/mod.ts" ;
Original file line number Diff line number Diff line change 1- export * from "https://deno.land/std@0.92 .0/testing/asserts.ts" ;
1+ export * from "https://deno.land/std@0.93 .0/testing/asserts.ts" ;
Original file line number Diff line number Diff line change 1+ import { Denops } from "./deps.ts" ;
2+ import { Vim } from "./vim/mod.ts" ;
3+
4+ export interface RunnerContext {
5+ denops : Denops ;
6+ vim : Vim ;
7+ }
8+
9+ /**
10+ * Define a plugin main function which starts denops mainloop for the plugin
11+ */
12+ export function main ( runner : ( context : RunnerContext ) => Promise < void > ) {
13+ Denops . start ( async ( denops ) => {
14+ const vim = Vim . get ( ) ;
15+ const ctx : RunnerContext = {
16+ denops,
17+ vim,
18+ } ;
19+ await runner ( ctx ) ;
20+ } ) ;
21+ }
Original file line number Diff line number Diff line change 1- export { start , Vim } from "./vim/mod.ts" ;
1+ export { Vim } from "./vim/mod.ts" ;
2+ export { main } from "./main.ts" ;
3+
4+ // Deprecated APIs
5+ export { start } from "./vim/mod.ts" ;
Original file line number Diff line number Diff line change @@ -65,6 +65,26 @@ export class Vim {
6565 }
6666}
6767
68+ /**
69+ * Define a plugin main function which starts denops mainloop for the plugin
70+ * @deprecated Use `main` function instead.
71+ */
6872export function start ( main : ( vim : Vim ) => Promise < void > ) {
69- Denops . start ( ( ) => main ( Vim . get ( ) ) ) ;
73+ Denops . start ( async ( ) => {
74+ const vim = Vim . get ( ) ;
75+ console . warn (
76+ `${ vim . name } : The 'start()' is deprecated since denops_std@v0.8.` ,
77+ ) ;
78+ console . warn (
79+ `${ vim . name } : Use 'main()' instead to launch a plugin like:` ,
80+ ) ;
81+ console . warn ( `${ vim . name } :` ) ;
82+ console . warn ( `${ vim . name } : main(async ({ vim }) => {` ) ;
83+ console . warn ( `${ vim . name } : vim.register({` ) ;
84+ console . warn ( `${ vim . name } : // ...` ) ;
85+ console . warn ( `${ vim . name } : });` ) ;
86+ console . warn ( `${ vim . name } : });` ) ;
87+ console . warn ( `${ vim . name } :` ) ;
88+ await main ( vim ) ;
89+ } ) ;
7090}
You can’t perform that action at this time.
0 commit comments