Skip to content

Commit 5ecc25a

Browse files
committed
👍 Refine documentations
1 parent 6d22df8 commit 5ecc25a

File tree

3 files changed

+40
-39
lines changed

3 files changed

+40
-39
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/denops_core/mod.ts)
55
[![deno land](http://img.shields.io/badge/available%20on-deno.land/x/denops__core-lightgrey.svg?logo=deno)](https://deno.land/x/denops_core)
66

7-
This is a core module of [denops.vim][denops.vim] which is an ecosystem of
8-
Vim/Neovim to write plugins in [Deno][deno].
7+
This module is a fundamental component of [denops.vim], an ecosystem for
8+
crafting plugins in [Deno] for Vim/Neovim.
99

10-
Note that most of users should use [denops_std][denops_std] module instead to
11-
write plugins of [denops.vim][denops.vim]. This module is designed as a core
12-
layer of [denops_std][denops_std] so using this module directly from plugins is
13-
strongly dis-recommended.
10+
It's essential to highlight that the recommended practice for most users is to
11+
utilize the [denops_std] module when developing plugins for [denops.vim]. The
12+
current module is structured as a foundational layer within [denops_std], and
13+
utilizing it directly from plugins is **strongly discouraged**.
1414

1515
[deno]: https://deno.land/
1616
[denops.vim]: https://github.com/vim-denops/denops.vim

denops.ts

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,56 @@
11
/**
2-
* Method dispatcher
2+
* API dispatcher
33
*/
4-
export interface Dispatcher {
4+
export type Dispatcher = {
55
[key: string]: (...args: unknown[]) => unknown;
6-
}
6+
};
77

88
/**
9-
* Context which is expanded to the local namespace (l:)
9+
* Context that expands into the local namespace (l:)
1010
*/
1111
export type Context = Record<string, unknown>;
1212

1313
/**
1414
* Environment meta information.
1515
*/
16-
export interface Meta {
16+
export type Meta = {
1717
// Current denops mode.
18-
// In "debug" or "test" mode, some features become enabled
19-
// which might impact the performance.
18+
// In "debug" or "test" mode, some features become enabled,
19+
// which might impact performance.
2020
readonly mode: "release" | "debug" | "test";
2121
// Host program.
2222
readonly host: "vim" | "nvim";
2323
// Host program version.
2424
readonly version: string;
2525
// Host platform name.
2626
readonly platform: "windows" | "mac" | "linux";
27-
}
27+
};
2828

2929
/**
30-
* Batch error which is raised when one of function fails during batch process
30+
* Batch error raised when one of the functions fails during batch process.
3131
*/
3232
export class BatchError extends Error {
33-
// A result list which is successfully completed prior to the error
33+
// A result list that is successfully completed prior to the error.
3434
readonly results: unknown[];
3535

3636
constructor(message: string, results: unknown[]) {
3737
super(message);
38-
this.name = "BatchError";
38+
39+
if (Error.captureStackTrace) {
40+
Error.captureStackTrace(this, BatchError);
41+
}
42+
43+
this.name = this.constructor.name;
3944
this.results = results;
4045
}
4146
}
4247

4348
/**
44-
* Denpos is a facade instance visible from each denops plugins.
49+
* Denops is a facade instance visible from each denops plugin.
4550
*/
46-
export interface Denops {
51+
export type Denops = {
4752
/**
48-
* Denops instance name which uses to communicate with vim.
53+
* Denops instance name used to communicate with Vim.
4954
*/
5055
readonly name: string;
5156

@@ -57,25 +62,25 @@ export interface Denops {
5762
/**
5863
* Context object for plugins.
5964
*/
60-
readonly context: Record<string | number | symbol, unknown>;
65+
readonly context: Record<PropertyKey, unknown>;
6166

6267
/**
63-
* User defined API name and method map which is used to dispatch API request
68+
* User-defined API name and method map used to dispatch API requests.
6469
*/
6570
dispatcher: Dispatcher;
6671

6772
/**
6873
* Redraw text and cursor on Vim.
6974
*
70-
* It's not equivalent to `redraw` command on Vim script and does nothing on Neovim.
71-
* Use `denops.cmd('redraw')` instead if you need to execute `redraw` command.
75+
* It is not equivalent to the `redraw` command in Vim script and does nothing on Neovim.
76+
* Use `denops.cmd('redraw')` instead if you need to execute the `redraw` command.
7277
*
73-
* @param force: Clear screen prior to redraw.
78+
* @param force: Clear the screen prior to redraw.
7479
*/
7580
redraw(force?: boolean): Promise<void>;
7681

7782
/**
78-
* Call an arbitrary function of Vim/Neovim and return the result
83+
* Call an arbitrary function of Vim/Neovim and return the result.
7984
*
8085
* @param fn: A function name of Vim/Neovim.
8186
* @param args: Arguments of the function.
@@ -88,11 +93,11 @@ export interface Denops {
8893
* Call arbitrary functions of Vim/Neovim sequentially without redraw and
8994
* return the results.
9095
*
91-
* It throw a BatchError when one of a function fails. The `results` attribute
96+
* It throws a BatchError when one of the functions fails. The `results` attribute
9297
* of the error instance holds succeeded results of functions prior to the
9398
* error.
9499
*
95-
* @param calls: A list of tuple ([fn, args]) to call Vim/Neovim functions.
100+
* @param calls: A list of tuples ([fn, args]) to call Vim/Neovim functions.
96101
*
97102
* Note that arguments after `undefined` in `args` will be dropped for convenience.
98103
*/
@@ -102,15 +107,15 @@ export interface Denops {
102107
* Execute an arbitrary command of Vim/Neovim under a given context.
103108
*
104109
* @param cmd: A command expression to be executed.
105-
* @param ctx: A context object which is expanded to the local namespace (l:)
110+
* @param ctx: A context object that expands into the local namespace (l:)
106111
*/
107112
cmd(cmd: string, ctx?: Context): Promise<void>;
108113

109114
/**
110115
* Evaluate an arbitrary expression of Vim/Neovim under a given context and return the result.
111116
*
112117
* @param expr: An expression to be evaluated.
113-
* @param ctx: A context object which is expanded to the local namespace (l:)
118+
* @param ctx: A context object that expands into the local namespace (l:)
114119
*/
115120
eval(expr: string, ctx?: Context): Promise<unknown>;
116121

@@ -122,4 +127,4 @@ export interface Denops {
122127
* @param args: Arguments of the function.
123128
*/
124129
dispatch(name: string, fn: string, ...args: unknown[]): Promise<unknown>;
125-
}
130+
};

mod.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
/**
2-
* This is a core module of [denops.vim][denops.vim] which is an ecosystem of
3-
* Vim/Neovim to write plugins in [Deno][deno].
2+
* This module is a fundamental component of [denops.vim], an ecosystem for crafting plugins in [Deno] for Vim/Neovim.
43
*
5-
* Note that most of users should use [denops_std][denops_std] module instead to
6-
* write plugins of [denops.vim][denops.vim]. This [denops_core][denops_core] module
7-
* is designed as a core layer of [denops_std][denops_std] so using this module
8-
* directly from plugins is **strongly dis-recommended**.
4+
* It's essential to highlight that the recommended practice for most users is to utilize the [denops_std] module when developing plugins for [denops.vim].
5+
* The current module is structured as a foundational layer within [denops_std], and utilizing it directly from plugins is **strongly discouraged**.
96
*
107
* [deno]: https://deno.land/
118
* [denops.vim]: https://github.com/vim-denops/denops.vim
12-
* [denops_core]: https://github.com/vim-denops/deno-denops-core
13-
* [denops_std]: https://github.com/vim-denops/deno-denops-std
9+
* [denops_std]: https://deno.land/x/denops_std
1410
*
1511
* @module
1612
*/

0 commit comments

Comments
 (0)