Skip to content

Commit 9122f91

Browse files
authored
Merge pull request #14 from vim-denops/support-v7
📝 Use JSR instead to support Denops v7
2 parents 4e10ba0 + ab1765b commit 9122f91

16 files changed

+82
-190
lines changed

src/api-reference.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# API Reference
22

3-
There is a standard module [denops_std] to develop denops plugins. It provides
3+
There is a standard module [@denops/std] to develop denops plugins. It provides
44
various functions to interact with Vim and Neovim and some shorthands to make it
55
easier to write plugins.
66

77
You can find API references about the module by checking the Deno doc page:
8-
`https://deno.land/x/denops_std/mod.ts`.
8+
`https://jsr.io/@denops/std`.
99

10-
[denops_std]: https://deno.land/x/denops_std/mod.ts
10+
[@denops/std]: https://jsr.io/@denops/std

src/getting-started/README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ $HOME
2121

2222
Next, write the following TypeScript code in `main.ts`:
2323

24-
```typescript
25-
import type { Entrypoint } from "https://deno.land/x/[email protected]/mod.ts";
24+
```typescript:denops/denops-getting-started/main.ts
25+
import type { Entrypoint } from "jsr:@denops/[email protected]";
2626

2727
export const main: Entrypoint = (denops) => {
2828
denops.dispatcher = {

src/getting-started/explanation.md

+19-36
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ easily call.
9191
In the Getting Started, we wrote the following code in the `main.ts` file:
9292

9393
```typescript
94-
import type { Entrypoint } from "https://deno.land/x/[email protected]/mod.ts";
94+
import type { Entrypoint } from "jsr:@denops/[email protected]";
9595

9696
export const main: Entrypoint = (denops) => {
9797
denops.dispatcher = {
@@ -107,14 +107,14 @@ Let's break down this code step by step.
107107
### About Imports
108108

109109
```typescript
110-
import type { Entrypoint } from "https://deno.land/x/[email protected]/mod.ts";
110+
import type { Entrypoint } from "jsr:@denops/[email protected]";
111111
```
112112

113-
The first line imports the `Entrypoint` type from the [denops_std] standard
113+
The first line imports the `Entrypoint` type from the [@denops/std] standard
114114
library. You can find detailed information about the library by checking the
115-
URL: `https://deno.land/x/[email protected].0` (remove `/mod.ts`). We fixed the
116-
version in the import URL, so it's recommended to check for details and update
117-
to the latest version URL.
115+
URL: `https://jsr.io/@denops/[email protected].0` (replace `jsr:` to `https://jsr.io/`).
116+
We fixed the version in the import URL, so it's recommended to check for details
117+
and update to the latest version URL.
118118

119119
Note that we use `import type` syntax, which is part of TypeScript's
120120
[Type-Only Imports and Export](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-8.html).
@@ -130,28 +130,11 @@ meaning. Using `import { Entrypoint }` for a type-only import is also valid.
130130
> [`denops/@denops-private/denops.ts`](https://github.com/vim-denops/denops.vim/blob/main/denops/%40denops-private/denops.ts),
131131
> but it is not publicly exposed for the reasons mentioned above.
132132
>
133-
> This type information is provided by [denops_core], and [denops_std] simply
134-
> re-exports the type information from [denops_core]. However, [denops_core] is
135-
> intended to be referenced only by [denops.vim] and [denops_std], so Denops
133+
> This type information is provided by [@denops/core], and [@denops/std] simply
134+
> re-exports the type information from [@denops/core]. However, [@denops/core]
135+
> is intended to be referenced only by [denops.vim] and [@denops/std], so Denops
136136
> plugin developers don't need to use it directly.
137137
138-
> [!NOTE]
139-
>
140-
> Prior to denops-std v6.5.0, the `Entrypoint` type was not defined thus
141-
> developers must define the `main` function as like
142-
>
143-
> ```typescript
144-
> import type { Denops } from "https://deno.land/x/[email protected]/mod.ts";
145-
>
146-
> export function main(denops: Denops): void {
147-
> denops.dispatcher = {
148-
> async hello() {
149-
> await denops.cmd(`echo "Hello, Denops!"`);
150-
> },
151-
> };
152-
> }
153-
> ```
154-
155138
### About Entry Point
156139

157140
```typescript
@@ -162,8 +145,8 @@ export const main: Entrypoint = (denops) => {
162145

163146
The above code exports the `main` function. The `main` function is called by
164147
Denops, and it takes the
165-
[Denops instance](https://deno.land/x/denops_std/mod.ts?s=Denops) (`denops`) as
166-
an argument. Denops plugins use this `denops` to add user-defined APIs or call
148+
[Denops instance](https://jsr.io/@denops/core/doc/~/Denops) (`denops`) as an
149+
argument. Denops plugins use this `denops` to add user-defined APIs or call
167150
Vim's features.
168151

169152
### About User-Defined APIs
@@ -222,17 +205,17 @@ several methods:
222205
| `eval` | Evaluate a Vim expression and returns the result. If `ctx` is provided, it is expanded as local variables. |
223206
| `dispatch` | Calls a user-defined API of another Denops plugin and returns the result. |
224207

225-
Although `denops` provides low-level interfaces, [denops_std] combines these
208+
Although `denops` provides low-level interfaces, [@denops/std] combines these
226209
low-level interfaces to offer higher-level interfaces. Therefore, it's
227-
recommended to use [denops_std] to call Vim's features in actual plugin
210+
recommended to use [@denops/std] to call Vim's features in actual plugin
228211
development.
229212

230213
For example, use
231-
[`function` module](https://deno.land/x/[email protected].0/function/mod.ts) to
232-
call Vim's function instead of `denops.call` like:
214+
[`function` module](https://jsr.io/@denops/[email protected].0/doc/function/~) to call
215+
Vim's function instead of `denops.call` like:
233216

234217
```typescript
235-
import * as fn from "https://deno.land/x/[email protected].0/function/mod.ts";
218+
import * as fn from "jsr:@denops/[email protected].0/function";
236219

237220
// Bad (result1 is `unknown`)
238221
const result1 = await denops.call("expand", "%");
@@ -251,8 +234,8 @@ plugin.
251234

252235
- [Tutorial (Hello World)](../tutorial/helloworld/README.md)
253236
- [Tutorial (Maze)](../tutorial/maze/README.md)
254-
- [API reference](https://deno.land/x/denops_std/mod.ts)
237+
- [API reference](https://jsr.io/@denops/std)
255238

256239
[denops.vim]: https://github.com/vim-denops/denops.vim
257-
[denops_std]: https://deno.land/x/denops_std
258-
[denops_core]: https://deno.land/x/denops_core
240+
[@denops/std]: https://jsr.io/@denops/std
241+
[@denops/core]: https://jsr.io/@denops/core

src/install.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -76,11 +76,11 @@ You can check the health of Denops by running the `:checkhealth` command
7676
==============================================================================
7777
denops: health#denops#check
7878
79-
- Supported Deno version: `1.38.5`
80-
- Detected Deno version: `1.39.4`
79+
- Supported Deno version: `1.45.0`
80+
- Detected Deno version: `1.45.4`
8181
- OK Deno version check: passed
82-
- Supported Neovim version: `0.9.4`
83-
- Detected Neovim version: `0.9.5`
82+
- Supported Neovim version: `0.10.0`
83+
- Detected Neovim version: `0.10.0`
8484
- OK Neovim version check: passed
8585
- Denops status: `running`
8686
- OK Denops status check: passed

src/tutorial.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ This article is a tutorial on developing Denops plugins.
66

77
In this tutorial, we use the following software and version as of writing.
88

9-
- [denops.vim v6.0.7](https://github.com/vim-denops/denops.vim/releases/tag/v6.0.7)
10-
(2024-05-15)
11-
- [denops_std v6.5.0](https://github.com/vim-denops/deno-denops-std/releases/tag/v6.5.0)
12-
(2024-05-15)
9+
- [denops.vim v7.0.0](https://github.com/vim-denops/denops.vim/releases/tag/v7.0.0)
10+
(2024-07-27)
11+
- [denops_std v7.0.0](https://github.com/vim-denops/deno-denops-std/releases/tag/v7.0.0)
12+
(2024-07-27)
1313

1414
[vim-jp]: https://vim-jp.org/
1515
[denops.vim]: https://github.com/vim-denops/denops.vim

src/tutorial/helloworld/adding-an-api.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ Open `denops/denops-helloworld/main.ts` and rewrite the content with the
77
following code:
88

99
```typescript:denops/denops-helloworld/main.ts
10-
import type { Entrypoint } from "https://deno.land/x/[email protected]/mod.ts";
11-
import { assert, is } from "https://deno.land/x/unknownutil@v3.18.1/mod.ts";
10+
import type { Entrypoint } from "jsr:@denops/[email protected]";
11+
import { assert, is } from "jsr:@core/unknownutil@3.18.1";
1212

1313
export const main: Entrypoint = (denops) => {
1414
denops.dispatcher = {
@@ -29,8 +29,8 @@ for details about User-Defined APIs.
2929
>
3030
> While Vim script does not facilitate types, Denops uses `unknown` types on the
3131
> interface between Vim and Denops. That's why we use
32-
> [unknownutil](https://deno.land/x/unknownutil) to ensure that the `name` is of
33-
> type `string` in the above code.
32+
> [unknownutil](https://jsr.io/@core/unknownutil) to ensure that the `name` is
33+
> of type `string` in the above code.
3434
3535
Once you've updated the file, restart Vim, and execute the following command,
3636
you will see the message "Hello, Your name!".

src/tutorial/helloworld/calling-vim-features.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ the `denops` instance passed to the plugin's `main` function. You can rewrite
55
`main.ts` as follows to register the `DenopsHello` as a Vim command:
66

77
```ts:denops/denops-helloworld/main.ts
8-
import type { Entrypoint } from "https://deno.land/x/[email protected]/mod.ts";
9-
import { assert, is } from "https://deno.land/x/unknownutil@v3.18.1/mod.ts";
8+
import type { Entrypoint } from "jsr:@denops/[email protected]";
9+
import { assert, is } from "jsr:@core/unknownutil@3.18.1";
1010

1111
export const main: Entrypoint = (denops) => {
1212
denops.dispatcher = {
@@ -61,4 +61,4 @@ In the next step, follow the tutorial to learn how to develop a real Denops
6161
plugin.
6262

6363
- [Tutorial (Maze)](../tutorial/maze/README.md)
64-
- [API reference](https://deno.land/x/denops_std/mod.ts)
64+
- [API reference](https://jsr.io/@denops/std)

src/tutorial/helloworld/creating-a-minimal-denops-plugin.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ denops-helloworld
3232
Here is the content of the `denops/denops-helloworld/main.ts` file:
3333

3434
```typescript:denops/denops-helloworld/main.ts
35-
import type { Entrypoint } from "https://deno.land/x/[email protected]/mod.ts";
35+
import type { Entrypoint } from "jsr:@denops/[email protected]";
3636

3737
export const main: Entrypoint = (denops) => {
3838
console.log("Hello, Denops from TypeScript!");
@@ -45,7 +45,7 @@ export const main: Entrypoint = (denops) => {
4545
> `console.error`, etc.) for debug output. The content will be echoed to Vim.
4646
> However, it is not recommended to use `console.log` in production code.
4747
> Instead, use `denops.cmd("echo '...'")` or the `echo` function in the `helper`
48-
> module of the `denops_std` library.
48+
> module of the `@denops/std` library.
4949
5050
Once you've created the file, restart Vim, and "Hello, Denops from TypeScript!"
5151
will be displayed on Vim startup.

src/tutorial/maze/adjusting-maze-size-to-fit-the-window.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ Let's modify the plugin to ensure the generated maze fits the current window
88
size.
99

1010
```typescript:denops/denops-helloworld/main.ts
11-
import type { Entrypoint } from "https://deno.land/x/[email protected]/mod.ts";
12-
import * as fn from "https://deno.land/x/[email protected].0/function/mod.ts";
13-
import { Maze } from "https://deno.land/x/maze_generator@v0.4.0/mod.js";
11+
import type { Entrypoint } from "jsr:@denops/[email protected]";
12+
import * as fn from "jsr:@denops/[email protected].0/function";
13+
import { Maze } from "npm:@thewizardbear/maze_generator@0.4.0";
1414

1515
export const main: Entrypoint = (denops) => {
1616
denops.dispatcher = {
@@ -31,10 +31,10 @@ export const main: Entrypoint = (denops) => {
3131
};
3232
```
3333

34-
In this code, we utilize the `function` module (aliased to `fn`) of `denops_std`
35-
(Denops Standard Library) to call `winwidth()`, `winheight()`, and `setline()`
36-
functions. Then, we create a maze that fits the current window size and write it
37-
to the buffer.
34+
In this code, we utilize the `function` module (aliased to `fn`) of
35+
`@denops/std` (Denops Standard Library) to call `winwidth()`, `winheight()`, and
36+
`setline()` functions. Then, we create a maze that fits the current window size
37+
and write it to the buffer.
3838

3939
So why do we use the `function` module instead of `denops.call`? With
4040
`denops.call`, developers must know the function name, arguments, return type,
@@ -44,13 +44,13 @@ checking, etc. It is more convenient and safe to use the `function` module.
4444

4545
> [!TIP]
4646
>
47-
> The `function` module of the `denops_std` library provides a set of functions
47+
> The `function` module of the `@denops/std` library provides a set of functions
4848
> that are available on both Vim and Neovim. If you'd like to use Vim or Neovim
4949
> only functions, use the `vim` or `nvim` module under the `function` module
5050
> instead.
5151
>
5252
> See the
53-
> [function module of denops_std API document](https://doc.deno.land/https/deno.land/x/denops_std/function/mod.ts)
53+
> [function module of @denops/std API document](https://jsr.io/@denops/[email protected]/doc/function/~)
5454
> for more details.
5555
5656
Restart Vim, rerun the `:Maze` command, and then you can see:

src/tutorial/maze/creating-applicative-plugin.md

+9-10
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ opener, generate a maze that fits the current window size, configure the buffer
3333
options to make it non-file readonly buffer, etc.
3434

3535
```ts:denops/denops-maze/main.ts
36-
import type { Entrypoint } from "https://deno.land/x/[email protected]/mod.ts";
37-
import { batch, collect } from "https://deno.land/x/[email protected].0/batch/mod.ts";
38-
import * as fn from "https://deno.land/x/[email protected].0/function/mod.ts";
39-
import * as op from "https://deno.land/x/[email protected].0/option/mod.ts";
40-
import { Maze } from "https://deno.land/x/maze_generator@v0.4.0/mod.js";
41-
import { assert, is } from "https://deno.land/x/unknownutil@v3.18.1/mod.ts";
36+
import type { Entrypoint } from "jsr:@denops/[email protected]";
37+
import { batch, collect } from "jsr:@denops/[email protected].0/batch";
38+
import * as fn from "jsr:@denops/[email protected].0/function";
39+
import * as op from "jsr:@denops/[email protected].0/option";
40+
import { Maze } from "npm:@thewizardbear/maze_generator@0.4.0";
41+
import { assert, is } from "jsr:@core/unknownutil@3.18.1";
4242

4343
export const main: Entrypoint = (denops) => {
4444
denops.dispatcher = {
@@ -68,16 +68,15 @@ export const main: Entrypoint = (denops) => {
6868
};
6969
```
7070

71-
In above code, we utilize the following denops_std modules:
71+
In above code, we utilize the following `@denops/std` modules:
7272

7373
- `batch` and `collect` functions in a `batch` module to execute multiple
7474
commands in a single RPC
7575
- `function` module to call Vim's functions
7676
- `option` module to get and set Vim's options
7777

78-
See the
79-
[denops_std API document](https://doc.deno.land/https/deno.land/x/denops_std/mod.ts)
80-
for more details about each modules.
78+
See the [denops_std API document](https://jsr.io/@denops/std) for more details
79+
about each modules.
8180

8281
That's it. Now you can see a smaller maze shown on the window with `:Maze`
8382
command.

src/tutorial/maze/outputting-content-to-buffer.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ the maze to a buffer so that users can yank the maze with daily Vim operations!
77
Let's modify the code to make the generated maze output to a buffer.
88

99
```ts:denops/denops-maze/main.ts
10-
import type { Entrypoint } from "https://deno.land/x/[email protected]/mod.ts";
11-
import { Maze } from "https://deno.land/x/maze_generator@v0.4.0/mod.js";
10+
import type { Entrypoint } from "jsr:@denops/[email protected]";
11+
import { Maze } from "npm:@thewizardbear/maze_generator@0.4.0";
1212

1313
export const main: Entrypoint = (denops) => {
1414
denops.dispatcher = {

src/tutorial/maze/properly-configured-the-buffer.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ buffer after closure. Open the `main.ts` file and modify the `maze` method as
77
follows:
88

99
```typescript:denops/denops-maze/main.ts
10-
import type { Entrypoint } from "https://deno.land/x/[email protected]/mod.ts";
11-
import * as buffer from "https://deno.land/x/[email protected].0/buffer/mod.ts";
12-
import * as fn from "https://deno.land/x/[email protected].0/function/mod.ts";
13-
import * as op from "https://deno.land/x/[email protected].0/option/mod.ts";
14-
import { Maze } from "https://deno.land/x/maze_generator@v0.4.0/mod.js";
10+
import type { Entrypoint } from "jsr:@denops/[email protected]";
11+
import * as buffer from "jsr:@denops/[email protected].0/buffer";
12+
import * as fn from "jsr:@denops/[email protected].0/function";
13+
import * as op from "jsr:@denops/[email protected].0/option";
14+
import { Maze } from "npm:@thewizardbear/maze_generator@0.4.0";
1515

1616
export const main: Entrypoint = (denops) => {
1717
denops.dispatcher = {

src/tutorial/maze/properly-create-a-virtual-buffer.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ For example, if a user executes the `:edit` command on the buffer, the maze will
55
disappear. This is because Vim does not know how to reload the buffer content,
66
and we must inform Vim about the content of the buffer when it is reloaded.
77

8-
In this section, we will use the `buffer` module of `denops_std` to create a
8+
In this section, we will use the `buffer` module of `@denops/std` to create a
99
proper virtual buffer that concretizes the buffer content. Let's modify the
1010
`main.ts` file as follows:
1111

1212
```typescript:denops/denops-maze/main.ts
13-
import type { Entrypoint } from "https://deno.land/x/[email protected]/mod.ts";
14-
import * as buffer from "https://deno.land/x/[email protected].0/buffer/mod.ts";
15-
import * as fn from "https://deno.land/x/[email protected].0/function/mod.ts";
16-
import { Maze } from "https://deno.land/x/maze_generator@v0.4.0/mod.js";
13+
import type { Entrypoint } from "jsr:@denops/[email protected]";
14+
import * as buffer from "jsr:@denops/[email protected].0/buffer";
15+
import * as fn from "jsr:@denops/[email protected].0/function";
16+
import { Maze } from "npm:@thewizardbear/maze_generator@0.4.0";
1717

1818
export const main: Entrypoint = (denops) => {
1919
denops.dispatcher = {

src/tutorial/maze/reduce-the-number-of-rpc-calls.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
As Denops employs RPC to interact with Vim, the volume of RPC calls
44
significantly influences the plugin's performance. In this section, we aim to
55
enhance performance by reducing the number of RPC calls using the `batch` module
6-
from `denops_std`. Let's revise the `main.ts` file as follows:
6+
from `@denops/std`. Let's revise the `main.ts` file as follows:
77

88
```typescript:denops/denops-maze/main.ts
9-
import type { Entrypoint } from "https://deno.land/x/[email protected]/mod.ts";
10-
import { batch, collect } from "https://deno.land/x/[email protected].0/batch/mod.ts";
11-
import * as buffer from "https://deno.land/x/[email protected].0/buffer/mod.ts";
12-
import * as fn from "https://deno.land/x/[email protected].0/function/mod.ts";
13-
import * as op from "https://deno.land/x/[email protected].0/option/mod.ts";
14-
import { Maze } from "https://deno.land/x/maze_generator@v0.4.0/mod.js";
9+
import type { Entrypoint } from "jsr:@denops/[email protected]";
10+
import { batch, collect } from "jsr:@denops/[email protected].0/batch";
11+
import * as buffer from "jsr:@denops/[email protected].0/buffer";
12+
import * as fn from "jsr:@denops/[email protected].0/function";
13+
import * as op from "jsr:@denops/[email protected].0/option";
14+
import { Maze } from "npm:@thewizardbear/maze_generator@0.4.0";
1515

1616
export const main: Entrypoint = (denops) => {
1717
denops.dispatcher = {
@@ -96,7 +96,7 @@ properly with `batch` and `collect`.
9696

9797
In the next step, read API references or real-world plugins
9898

99-
- [API reference](https://deno.land/x/denops_std/mod.ts)
99+
- [API reference](https://jsr.io/@denops/std)
100100
- [lambdalisue/gin.vim](https://github.com/lambdalisue/gin.vim)
101101
- [vim-skk/skkeleton](https://github.com/vim-skk/skkeleton)
102102
- [Shougo/ddu.vim](https://github.com/Shougo/ddu.vim)

0 commit comments

Comments
 (0)