Skip to content

Commit 1f33403

Browse files
committed
👍 Follow denops's breaking change
vim-denops/denops.vim#53
1 parent 881b35d commit 1f33403

File tree

6 files changed

+10
-74
lines changed

6 files changed

+10
-74
lines changed

deps_test.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
export * from "https://deno.land/std@0.95.0/testing/asserts.ts";
2+
export * from "https://deno.land/x/denops_core@v0.16.0/test/mod.ts";

main.ts

Lines changed: 0 additions & 21 deletions
This file was deleted.

mod.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,4 @@
11
export { Vim } from "./vim/mod.ts";
2-
export { main } from "./main.ts";
32

43
// Re-export
5-
export {
6-
Denops,
7-
ensureArray,
8-
ensureNumber,
9-
ensureRecord,
10-
ensureString,
11-
} from "./deps.ts";
12-
13-
// Deprecated APIs
14-
export { start } from "./vim/mod.ts";
4+
export type { Context, Denops, Dispatcher } from "./deps.ts";

test/mod.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// Re-export
2+
export { test } from "../deps_test.ts";
3+
export type { TestDefinition } from "../deps_test.ts";

vim/variable_test.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
import { Denops } from "../deps.ts";
2-
import { assertEquals } from "../deps_test.ts";
1+
import { assertEquals, test } from "../deps_test.ts";
32
import * as variable from "./variable.ts";
43

5-
Denops.test("getVar() return the value of the variable", async (denops) => {
4+
test("any", "getVar() return the value of the variable", async (denops) => {
65
await denops.cmd("let g:denops_std_vim_variable_test = 'hello'");
76
const result = await variable.getVar(
87
denops,
@@ -12,7 +11,7 @@ Denops.test("getVar() return the value of the variable", async (denops) => {
1211
assertEquals(result, "hello");
1312
});
1413

15-
Denops.test("setVar() replace the value of the variable", async (denops) => {
14+
test("any", "setVar() replace the value of the variable", async (denops) => {
1615
await denops.cmd("let g:denops_std_vim_variable_test = 'hello'");
1716
await variable.setVar(denops, "g", "denops_std_vim_variable_test", "world");
1817
const result = await variable.getVar(
@@ -23,7 +22,7 @@ Denops.test("setVar() replace the value of the variable", async (denops) => {
2322
assertEquals(result, "world");
2423
});
2524

26-
Denops.test("removeVar() remove the variable", async (denops) => {
25+
test("any", "removeVar() remove the variable", async (denops) => {
2726
await denops.cmd("let g:denops_std_vim_variable_test = 'hello'");
2827
await variable.removeVar(denops, "g", "denops_std_vim_variable_test");
2928
const result = await variable.getVar(

vim/vim.ts

Lines changed: 1 addition & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import { load } from "./load.ts";
1414
*
1515
*/
1616
export class Vim {
17-
private static instance?: Vim;
18-
1917
#denops: Denops;
2018

2119
readonly g: VariableHelper;
@@ -36,16 +34,6 @@ export class Vim {
3634
this.fn = new FunctionHelper(denops);
3735
}
3836

39-
/**
40-
* Get thread-local Vim instance.
41-
*/
42-
static get(): Vim {
43-
if (!Vim.instance) {
44-
Vim.instance = new Vim(Denops.get());
45-
}
46-
return Vim.instance;
47-
}
48-
4937
/**
5038
* Plugin name
5139
*/
@@ -124,30 +112,6 @@ export class Vim {
124112
* @param dispatcher: A collection of the plugin APIs
125113
*/
126114
register(dispatcher: Dispatcher): void {
127-
this.#denops.extendDispatcher(dispatcher);
115+
this.#denops.dispatcher = dispatcher;
128116
}
129117
}
130-
131-
/**
132-
* Define a plugin main function which starts denops mainloop for the plugin
133-
* @deprecated Use `main` function instead.
134-
*/
135-
export function start(main: (vim: Vim) => Promise<void>) {
136-
Denops.start(async () => {
137-
const vim = Vim.get();
138-
console.warn(
139-
`${vim.name}: The 'start()' is deprecated since denops_std@v0.8.`,
140-
);
141-
console.warn(
142-
`${vim.name}: Use 'main()' instead to launch a plugin like:`,
143-
);
144-
console.warn(`${vim.name}:`);
145-
console.warn(`${vim.name}: main(async ({ vim }) => {`);
146-
console.warn(`${vim.name}: vim.register({`);
147-
console.warn(`${vim.name}: // ...`);
148-
console.warn(`${vim.name}: });`);
149-
console.warn(`${vim.name}: });`);
150-
console.warn(`${vim.name}:`);
151-
await main(vim);
152-
});
153-
}

0 commit comments

Comments
 (0)