Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🎉 For Denops v7 #8

Merged
merged 11 commits into from
Jul 20, 2024
2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
run: deno fmt --check
- name: Type check
run: deno task check
- name: Test doc
run: deno task test

jsr-publish:
runs-on: ubuntu-latest
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
deno.lock
31 changes: 22 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,31 @@
# 🪐 denops_core

[![JSR](https://jsr.io/badges/@denops/core)](https://jsr.io/@denops/core)
[![denoland](https://img.shields.io/github/v/release/vim-denops/deno-denops-core?logo=deno&label=denoland)](https://deno.land/x/denops_core)
[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/denops_core/mod.ts)
[![test](https://github.com/vim-denops/deno-denops/workflows/test/badge.svg)](https://github.com/vim-denops/deno-denops/actions?query=workflow%3Atest)

This module is a fundamental component of [denops.vim], an ecosystem for
crafting plugins in [Deno] for Vim/Neovim.
This is a core module of [denops.vim], an ecosystem for creating Vim/Neovim
plugin in [Deno].
Comment on lines +6 to +7
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct the grammatical number.

The noun "plugin" should be pluralized to "plugins" for grammatical correctness.

- plugin in [Deno].
+ plugins in [Deno].
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
This is a core module of [denops.vim], an ecosystem for creating Vim/Neovim
plugin in [Deno].
This is a core module of [denops.vim], an ecosystem for creating Vim/Neovim
plugins in [Deno].
Tools
LanguageTool

[uncategorized] ~6-~6: The grammatical number of this noun doesn’t look right. Consider replacing it.
Context: ...], an ecosystem for creating Vim/Neovim plugin in [Deno]. > [!WARNING] > > This modul...

(AI_EN_LECTOR_REPLACEMENT_NOUN_NUMBER)


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]. The
current module is structured as a foundational layer within [denops_std], and
utilizing it directly from plugins is **strongly discouraged**.
> [!WARNING]
>
> This module is mainly for internal use. It's **strongly discouraged** to
> utilize this module directly from plugins. Use the [@denops/std] module
> instead.

```ts
import type { Entrypoint } from "jsr:@denops/core";

export const main: Entrypoint = (denops) => {
// ...
};
```

[deno]: https://deno.land/
[denops.vim]: https://github.com/vim-denops/denops.vim
[denops_std]: https://deno.land/x/denops_std
[@denops/std]: https://jsr.io/@denops/std

# License

The code follows the MIT license, as stated in [LICENSE](./LICENSE).
Contributors need to agree that any modifications sent to this repository follow
the license.
2 changes: 1 addition & 1 deletion deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
"update:commit": "deno task -q update --commit --pre-commit=fmt,lint"
},
"imports": {
"https://deno.land/x/denops_core@$MODULE_VERSION/": "./"
"jsr:@denops/core": "./mod.ts"
}
}
29 changes: 26 additions & 3 deletions denops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ export interface Denops {
*/
readonly context: Record<PropertyKey, unknown>;

/**
* AbortSignal instance that is triggered when the user invoke `denops#interrupt()`
*/
readonly interrupted?: AbortSignal;

/**
* User-defined API name and method map used to dispatch API requests.
*/
Expand Down Expand Up @@ -142,14 +147,32 @@ export interface Denops {
/**
* Denops's entrypoint definition.
*
* Use this type to ensure the `main` function is properly implemented like
* Use this type to ensure the `main` function is properly implemented like:
*
* ```ts
* import type { Entrypoint } from "jsr:@denops/core";
*
* export const main: Entrypoint = (denops) => {
* // ...
* }
* ```
*
* If an `AsyncDisposable` object is returned, resources can be disposed of
* asynchronously when the plugin is unloaded, like:
*
* ```ts
* import type { Entrypoint } from "https://deno.land/x/denops_core@$MODULE_VERSION/mod.ts";
* import type { Entrypoint } from "jsr:@denops/core";
*
* export const main: Entrypoint = (denops) => {
* // ...
* return {
* [Symbol.asyncDispose]: async () => {
* // Dispose resources...
* }
* }
* }
* ```
*/
export type Entrypoint = (denops: Denops) => void | Promise<void>;
export type Entrypoint = (
denops: Denops,
) => void | AsyncDisposable | Promise<void | AsyncDisposable>;
lambdalisue marked this conversation as resolved.
Show resolved Hide resolved
20 changes: 16 additions & 4 deletions mod.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
/**
* This module is a fundamental component of [denops.vim], an ecosystem for crafting plugins in [Deno] for Vim/Neovim.
* This is a core module of [denops.vim], an ecosystem for creating Vim/Neovim
* plugin in [Deno].
*
* 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].
* The current module is structured as a foundational layer within [denops_std], and utilizing it directly from plugins is **strongly discouraged**.
* > [!WARNING]
* >
* > This module is mainly for internal use. It's **strongly discouraged** to
* > utilize this module directly from plugins. Use the [@denops/std] module
* > instead.
*
* ```ts
* import type { Entrypoint } from "jsr:@denops/core";
*
* export const main: Entrypoint = (denops) => {
* // ...
* };
* ```
*
* [deno]: https://deno.land/
* [denops.vim]: https://github.com/vim-denops/denops.vim
* [denops_std]: https://deno.land/x/denops_std
* [@denops/std]: https://jsr.io/@denops/std
*
* @module
*/
Expand Down