Skip to content

Commit 33b37dd

Browse files
authored
Merge pull request #222 from vim-denops/v6-pre
Support Denops v6
2 parents 4b48d9f + 0019e2d commit 33b37dd

File tree

126 files changed

+3450
-2850
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

126 files changed

+3450
-2850
lines changed

.github/workflows/test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ jobs:
5757
- macos-latest
5858
- ubuntu-latest
5959
version:
60-
- "1.32.x"
60+
- "1.38.x"
6161
- "1.x"
6262
host_version:
6363
- vim: "v9.0.1499"
@@ -105,10 +105,10 @@ jobs:
105105
env:
106106
DENOPS_TEST_NVIM: ${{ steps.nvim.outputs.executable }}
107107
- name: Cache
108-
run: deno cache $(find . -name '*.ts')
108+
run: deno cache ./**/*.ts
109109
working-directory: ./repo
110110
- name: Test
111-
run: deno task test
111+
run: deno task test:coverage
112112
env:
113113
DENOPS_TEST_DENOPS_PATH: "../denops.vim"
114114
DENOPS_TEST_VIM_EXECUTABLE: ${{ steps.vim.outputs.executable }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/.tools
22
/.coverage
3+
/docs
34
deno.lock
45

scripts/gen-function/format.ts renamed to .scripts/gen-function/format.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Definition, Variant } from "./types.ts";
22

3-
const denops = "https://deno.land/x/denops_core@v5.0.0/mod.ts";
3+
const denops = "https://deno.land/x/denops_core@v6.0.5/mod.ts";
44

55
const translate: Record<string, string> = {
66
"*cmd": "cmd",
@@ -16,6 +16,8 @@ const translate: Record<string, string> = {
1616
"fname-two": "fname_two",
1717
"function": "function_",
1818
"lnum-end": "lnum_end",
19+
"instanceof": "instanceof_",
20+
"class": "class_",
1921
};
2022

2123
export function formatDocs(docs: string): string[] {

scripts/gen-function/gen-function.ts renamed to .scripts/gen-function/gen-function.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ import {
22
difference,
33
intersection,
44
} from "https://deno.land/x/set_operations@v1.1.1/mod.ts";
5-
import * as path from "https://deno.land/std@0.205.0/path/mod.ts";
5+
import * as path from "https://deno.land/std@0.214.0/path/mod.ts";
66
import { parse } from "./parse.ts";
77
import { format } from "./format.ts";
88
import { DOCS_OVERRIDES } from "./override.ts";
99
import { transform } from "./transform.ts";
1010
import { downloadString } from "../utils.ts";
1111

12-
const VIM_VERSION = "9.0.1499";
13-
const NVIM_VERSION = "0.8.0";
12+
const VIM_VERSION = "9.0.2189";
13+
const NVIM_VERSION = "0.9.4";
1414

15-
const commonGenerateModule = "../../denops_std/function/_generated.ts";
16-
const vimGenerateModule = "../../denops_std/function/vim/_generated.ts";
17-
const nvimGenerateModule = "../../denops_std/function/nvim/_generated.ts";
15+
const commonGenerateModule = "../../function/_generated.ts";
16+
const vimGenerateModule = "../../function/vim/_generated.ts";
17+
const nvimGenerateModule = "../../function/nvim/_generated.ts";
1818

19-
const commonManualModule = "../../denops_std/function/_manual.ts";
20-
const vimManualModule = "../../denops_std/function/vim/_manual.ts";
21-
const nvimManualModule = "../../denops_std/function/nvim/_manual.ts";
19+
const commonManualModule = "../../function/_manual.ts";
20+
const vimManualModule = "../../function/vim/_manual.ts";
21+
const nvimManualModule = "../../function/nvim/_manual.ts";
2222

2323
const manualModules = [
2424
commonManualModule,
File renamed without changes.
File renamed without changes.
File renamed without changes.

scripts/gen-option/format.ts renamed to .scripts/gen-option/format.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type { Option, OptionScope, OptionType } from "./types.ts";
22

3-
const denops = "https://deno.land/x/denops_core@v5.0.0/mod.ts";
3+
const denops = "https://deno.land/x/denops_core@v6.0.5/mod.ts";
44

55
const translate: Record<string, string> = {
66
"default": "defaultValue",

scripts/gen-option/gen-option.ts renamed to .scripts/gen-option/gen-option.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ import {
22
difference,
33
intersection,
44
} from "https://deno.land/x/set_operations@v1.1.1/mod.ts";
5-
import * as path from "https://deno.land/std@0.205.0/path/mod.ts";
5+
import * as path from "https://deno.land/std@0.214.0/path/mod.ts";
66
import { parse } from "./parse.ts";
77
import { format } from "./format.ts";
88
import { DOCS_OVERRIDES } from "./override.ts";
99
import { transform } from "./transform.ts";
1010
import { downloadString } from "../utils.ts";
1111

12-
const VIM_VERSION = "9.0.1499";
13-
const NVIM_VERSION = "0.8.0";
12+
const VIM_VERSION = "9.0.2189";
13+
const NVIM_VERSION = "0.9.4";
1414

15-
const commonGenerateModule = "../../denops_std/option/_generated.ts";
16-
const vimGenerateModule = "../../denops_std/option/vim/_generated.ts";
17-
const nvimGenerateModule = "../../denops_std/option/nvim/_generated.ts";
15+
const commonGenerateModule = "../../option/_generated.ts";
16+
const vimGenerateModule = "../../option/vim/_generated.ts";
17+
const nvimGenerateModule = "../../option/nvim/_generated.ts";
1818

19-
const commonManualModule = "../../denops_std/option/_manual.ts";
20-
const vimManualModule = "../../denops_std/option/vim/_manual.ts";
21-
const nvimManualModule = "../../denops_std/option/nvim/_manual.ts";
19+
const commonManualModule = "../../option/_manual.ts";
20+
const vimManualModule = "../../option/vim/_manual.ts";
21+
const nvimManualModule = "../../option/nvim/_manual.ts";
2222

2323
const manualModules = [
2424
commonManualModule,
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

scripts/markdown_test.ts renamed to .scripts/markdown_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { assertEquals } from "https://deno.land/std@0.205.0/assert/mod.ts";
1+
import { assertEquals } from "https://deno.land/std@0.214.0/assert/mod.ts";
22

33
import { createMarkdownFromHelp } from "./markdown.ts";
44

scripts/transform.ts renamed to .scripts/transform.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {
22
fromFileUrl,
33
toFileUrl,
4-
} from "https://deno.land/std@0.205.0/path/mod.ts";
4+
} from "https://deno.land/std@0.214.0/path/mod.ts";
55
import { intersection } from "https://deno.land/x/set_operations@v1.1.1/mod.ts";
66

77
interface ModuleInformation {

scripts/utils.ts renamed to .scripts/utils.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
1-
import * as streams from "https://deno.land/std@0.205.0/streams/mod.ts";
1+
import * as streams from "https://deno.land/std@0.214.0/streams/mod.ts";
22

33
/**
44
* Downloads a text file and returns the contents.
55
* Throws error if fetch fails.
66
*/
77
export async function downloadString(url: string): Promise<string> {
8-
const textDecoder = new TextDecoder();
98
const response = await fetch(url);
109
if (!response.body) {
1110
throw new Error(`Failed to read ${url}`);
1211
}
13-
const reader = streams.readerFromStreamReader(response.body.getReader());
14-
return textDecoder.decode(await streams.readAll(reader));
12+
//const reader = streams.readerFromStreamReader(response.body.getReader());
13+
return await streams.toText(response.body);
1514
}
1615

1716
/**

scripts/utils_test.ts renamed to .scripts/utils_test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ import {
33
assertInstanceOf,
44
assertRejects,
55
assertThrows,
6-
} from "https://deno.land/std@0.205.0/assert/mod.ts";
7-
import { stub } from "https://deno.land/std@0.205.0/testing/mock.ts";
6+
} from "https://deno.land/std@0.214.0/assert/mod.ts";
7+
import { stub } from "https://deno.land/std@0.214.0/testing/mock.ts";
88

99
import {
1010
Counter,

README.md

Lines changed: 54 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,68 @@
11
# 🐜 denops_std
22

3-
[![Vim 9.0.1499 or above](https://img.shields.io/badge/Vim-Support%209.0.1499-yellowgreen.svg?logo=vim)](https://github.com/vim/vim/tree/v9.0.1499)
4-
[![Neovim 0.8.0 or above](https://img.shields.io/badge/Neovim-Support%200.8.0-yellowgreen.svg?logo=neovim&logoColor=white)](https://github.com/neovim/neovim/tree/v0.8.0)
3+
[![Vim 9.0.2189 or above](https://img.shields.io/badge/Vim-Support%209.0.2189-yellowgreen.svg?logo=vim)](https://github.com/vim/vim/tree/v9.0.2189)
4+
[![Neovim 0.9.4 or above](https://img.shields.io/badge/Neovim-Support%200.9.4-yellowgreen.svg?logo=neovim&logoColor=white)](https://github.com/neovim/neovim/tree/v0.9.4)
55
[![Test](https://github.com/vim-denops/deno-denops-std/actions/workflows/test.yml/badge.svg)](https://github.com/vim-denops/deno-denops-std/actions/workflows/test.yml)
66
[![codecov](https://codecov.io/github/vim-denops/deno-denops-std/branch/main/graph/badge.svg?token=RKAZMUQ3D9)](https://codecov.io/github/vim-denops/deno-denops-std)
77
[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/denops_std/mod.ts)
88
[![Documentation](https://img.shields.io/badge/denops-Documentation-yellow.svg)](https://vim-denops.github.io/denops-documentation/)
99
[![deno land](http://img.shields.io/badge/available%20on-deno.land/x/denops__std-lightgrey.svg?logo=deno)](https://deno.land/x/denops_std)
1010

11-
[Deno][deno] module for [denops.vim][denops.vim]. This module is assumed to be
12-
used in denops plugin and the code is assumed to be called in a worker thread
13-
for a plugin.
11+
Standard module for [denops.vim].
1412

15-
See [deno doc](https://doc.deno.land/https/deno.land/x/denops_std/mod.ts) for
16-
quick usage and API documentations and see
17-
[Denops Documentation](https://vim-denops.github.io/denops-documentation/) for
18-
learning how to write Vim/Neovim plugins.
13+
This module is assumed to be used for developing denops plugins. The code is
14+
assumed to be called in a dedicated worker thread.
15+
16+
By using this module, developers can write Vim/Neovim denops plugins like:
17+
18+
```typescript
19+
import type { Denops } from "https://deno.land/x/denops_std@$MODULE_VERSION/mod.ts";
20+
import * as batch from "https://deno.land/x/denops_std@$MODULE_VERSION/batch/mod.ts";
21+
import * as fn from "https://deno.land/x/denops_std@$MODULE_VERSION/function/mod.ts";
22+
import * as vars from "https://deno.land/x/denops_std@$MODULE_VERSION/variable/mod.ts";
23+
import * as helper from "https://deno.land/x/denops_std@$MODULE_VERSION/helper/mod.ts";
24+
25+
import { assert, is } from "https://deno.land/x/unknownutil@v3.14.1/mod.ts";
26+
27+
export function main(denops: Denops): void {
28+
denops.dispatcher = {
29+
async init() {
30+
// This is just an example. Developers usually should define commands directly in Vim script.
31+
await batch.batch(denops, async (denops) => {
32+
await denops.cmd(
33+
`command! HelloWorld call denops#notify("${denops.name}", "say", ["World"])`,
34+
);
35+
await denops.cmd(
36+
`command! HelloDenops call denops#notify("${denops.name}", "say", ["Denops"])`,
37+
);
38+
});
39+
},
40+
async say(where) {
41+
assert(where, is.String);
42+
const [name, progname] = await batch.collect(denops, (denops) => [
43+
fn.input(denops, "Your name: "),
44+
vars.v.get(denops, "progname"),
45+
]);
46+
const messages = [
47+
`Hello ${where}.`,
48+
`Your name is ${name}.`,
49+
`This is ${progname}.`,
50+
];
51+
await helper.echo(denops, messages.join("\n"));
52+
},
53+
};
54+
}
55+
```
56+
57+
**Note that developers should avoid calling initialization code within the
58+
`main` function**. If necessary, add an `init` API or a similar approach like
59+
above and call it from `plugin/<your_plugin>.vim`.
60+
61+
See [Denops Documentation] or [denops-helloworld.vim] for more details.
1962

20-
[deno]: https://deno.land/
2163
[denops.vim]: https://github.com/vim-denops/denops.vim
64+
[Denops Documentation]: https://vim-denops.github.io/denops-documentation
65+
[denops-helloworld.vim]: https://github.com/vim-denops/denops-helloworld.vim
2266

2367
## License
2468

File renamed without changes.

denops_std/argument/flags.ts renamed to argument/flags.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { parsePattern } from "./util.ts";
1+
import { parsePattern } from "./_util.ts";
22

33
export type Flags = Record<string, string | string[] | undefined>;
44

@@ -9,8 +9,8 @@ const shortPattern = /^-([a-zA-Z0-9])(.*)/;
99
* Parse string array to extract flags (-f/--flag).
1010
*
1111
* ```typescript
12-
* import { Denops } from "../mod.ts";
13-
* import { parseFlags } from "./mod.ts";
12+
* import type { Denops } from "https://deno.land/x/denops_std@$MODULE_VERSION/mod.ts";
13+
* import { parseFlags } from "https://deno.land/x/denops_std@$MODULE_VERSION/argument/mod.ts";
1414
*
1515
* export async function main(denops: Denops): Promise<void> {
1616
* const args = [
@@ -66,8 +66,8 @@ export function parseFlags(args: string[]): [Flags, string[]] {
6666
* Validate if `flags` has unknown attributes.
6767
*
6868
* ```typescript
69-
* import { Denops } from "../mod.ts";
70-
* import { parse, validateFlags } from "./mod.ts";
69+
* import type { Denops } from "https://deno.land/x/denops_std@$MODULE_VERSION/mod.ts";
70+
* import { parse, validateFlags } from "https://deno.land/x/denops_std@$MODULE_VERSION/argument/mod.ts";
7171
*
7272
* export async function main(denops: Denops): Promise<void> {
7373
* const args = [
@@ -102,8 +102,8 @@ export function validateFlags(flags: Flags, knownAttributes: string[]): void {
102102
* Format `key` and `value` to construct string array.
103103
*
104104
* ```typescript
105-
* import { Denops } from "../mod.ts";
106-
* import { formatFlag } from "./mod.ts";
105+
* import type { Denops } from "https://deno.land/x/denops_std@$MODULE_VERSION/mod.ts";
106+
* import { formatFlag } from "https://deno.land/x/denops_std@$MODULE_VERSION/argument/mod.ts";
107107
*
108108
* export async function main(denops: Denops): Promise<void> {
109109
* console.log(formatFlag("f", ""));
@@ -133,8 +133,8 @@ export function formatFlag(
133133
* Format `flags` to construct string array.
134134
*
135135
* ```typescript
136-
* import { Denops } from "../mod.ts";
137-
* import { formatFlags, parse } from "./mod.ts";
136+
* import type { Denops } from "https://deno.land/x/denops_std@$MODULE_VERSION/mod.ts";
137+
* import { formatFlags, parse } from "https://deno.land/x/denops_std@$MODULE_VERSION/argument/mod.ts";
138138
*
139139
* export async function main(denops: Denops): Promise<void> {
140140
* const args = [

denops_std/argument/flags_test.ts renamed to argument/flags_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { assertEquals } from "https://deno.land/std@0.205.0/assert/mod.ts";
1+
import { assertEquals } from "https://deno.land/std@0.214.0/assert/mod.ts";
22
import { parseFlags } from "./flags.ts";
33

44
Deno.test("parseFlags", () => {

denops_std/argument/mod.ts renamed to argument/mod.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@
1717
* Then, developers can use this module to parse, validate, or format the arguments.
1818
*
1919
* ```typescript
20-
* import type { Denops } from "../mod.ts";
20+
* import type { Denops } from "https://deno.land/x/denops_std@$MODULE_VERSION/mod.ts";
2121
* import {
2222
* builtinOpts,
2323
* formatFlags,
2424
* formatOpts,
2525
* parse,
2626
* validateFlags,
2727
* validateOpts,
28-
* } from "./mod.ts";
28+
* } from "https://deno.land/x/denops_std@$MODULE_VERSION/argument/mod.ts";
2929
*
3030
* export async function main(denops: Denops): Promise<void> {
3131
* denops.dispatcher = {
@@ -69,8 +69,8 @@ import { Flags, parseFlags } from "./flags.ts";
6969
* Parse string array to extract opts, flags.
7070
*
7171
* ```typescript
72-
* import { Denops } from "../mod.ts";
73-
* import { parse } from "./mod.ts";
72+
* import type { Denops } from "https://deno.land/x/denops_std@$MODULE_VERSION/mod.ts";
73+
* import { parse } from "https://deno.land/x/denops_std@$MODULE_VERSION/argument/mod.ts";
7474
*
7575
* export async function main(denops: Denops): Promise<void> {
7676
* const args = [

denops_std/argument/mod_test.ts renamed to argument/mod_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { assertEquals } from "https://deno.land/std@0.205.0/assert/mod.ts";
1+
import { assertEquals } from "https://deno.land/std@0.214.0/assert/mod.ts";
22
import { parse } from "./mod.ts";
33

44
Deno.test("parse", () => {

denops_std/argument/opts.ts renamed to argument/opts.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { parsePattern } from "./util.ts";
1+
import { parsePattern } from "./_util.ts";
22

33
export type Opts = Record<string, string | undefined>;
44

@@ -24,8 +24,8 @@ const optPattern = /^\+\+([a-zA-Z0-9-]+)(?:=(.*))?/;
2424
* Parse string array to extract opts (++opt).
2525
*
2626
* ```typescript
27-
* import { Denops } from "../mod.ts";
28-
* import { parseOpts } from "./mod.ts";
27+
* import type { Denops } from "https://deno.land/x/denops_std@$MODULE_VERSION/mod.ts";
28+
* import { parseOpts } from "https://deno.land/x/denops_std@$MODULE_VERSION/argument/mod.ts";
2929
*
3030
* export async function main(denops: Denops): Promise<void> {
3131
* const args = [
@@ -77,8 +77,8 @@ export function parseOpts(args: string[]): [Opts, string[]] {
7777
* Validate if `opts` has unknown attributes.
7878
*
7979
* ```typescript
80-
* import { Denops } from "../mod.ts";
81-
* import { builtinOpts, parse, validateOpts } from "./mod.ts";
80+
* import type { Denops } from "https://deno.land/x/denops_std@$MODULE_VERSION/mod.ts";
81+
* import { builtinOpts, parse, validateOpts } from "https://deno.land/x/denops_std@$MODULE_VERSION/argument/mod.ts";
8282
*
8383
* export async function main(denops: Denops): Promise<void> {
8484
* const args = [
@@ -112,8 +112,8 @@ export function validateOpts(opts: Opts, knownAttributes: string[]): void {
112112
* Format `key` and `value` to construct string array.
113113
*
114114
* ```typescript
115-
* import { Denops } from "../mod.ts";
116-
* import { formatOpt } from "./mod.ts";
115+
* import type { Denops } from "https://deno.land/x/denops_std@$MODULE_VERSION/mod.ts";
116+
* import { formatOpt } from "https://deno.land/x/denops_std@$MODULE_VERSION/argument/mod.ts";
117117
*
118118
* export async function main(denops: Denops): Promise<void> {
119119
* console.log(formatOpt("enc", "sjis"));
@@ -132,8 +132,8 @@ export function formatOpt(key: string, value: string | undefined): string[] {
132132
* Format `opts` to construct string array.
133133
*
134134
* ```typescript
135-
* import { Denops } from "../mod.ts";
136-
* import { formatOpts, parse } from "../argument/mod.ts";
135+
* import type { Denops } from "https://deno.land/x/denops_std@$MODULE_VERSION/mod.ts";
136+
* import { formatOpts, parse } from "https://deno.land/x/denops_std@$MODULE_VERSION/argument/mod.ts";
137137
*
138138
* export async function main(denops: Denops): Promise<void> {
139139
* const args = [

denops_std/argument/opts_test.ts renamed to argument/opts_test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { assertEquals } from "https://deno.land/std@0.205.0/assert/mod.ts";
1+
import { assertEquals } from "https://deno.land/std@0.214.0/assert/mod.ts";
22
import { parseOpts } from "./opts.ts";
33

44
Deno.test("parseOpts", () => {
File renamed without changes.

0 commit comments

Comments
 (0)