├── .github └── workflows │ ├── test.yml │ └── update.yml ├── .gitmessage ├── LICENSE ├── README.md ├── deno.jsonc ├── denops.ts └── mod.ts /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: test 2 | 3 | on: 4 | schedule: 5 | - cron: "0 7 * * 0" 6 | push: 7 | paths: 8 | - "**.md" 9 | - "**.ts" 10 | - ".github/workflows/test.yml" 11 | - "deno.jsonc" 12 | pull_request: 13 | paths: 14 | - "**.md" 15 | - "**.ts" 16 | - ".github/workflows/test.yml" 17 | - "deno.jsonc" 18 | 19 | jobs: 20 | check: 21 | strategy: 22 | matrix: 23 | runner: 24 | - ubuntu-latest 25 | version: 26 | - "1.x" 27 | runs-on: ${{ matrix.runner }} 28 | steps: 29 | - uses: actions/checkout@v4 30 | - uses: denoland/setup-deno@v1 31 | with: 32 | deno-version: "${{ matrix.version }}" 33 | - name: Lint check 34 | run: deno lint 35 | - name: Format check 36 | run: deno fmt --check 37 | - name: Type check 38 | run: deno task check 39 | -------------------------------------------------------------------------------- /.github/workflows/update.yml: -------------------------------------------------------------------------------- 1 | name: update 2 | 3 | on: 4 | schedule: 5 | - cron: "0 0 * * *" 6 | workflow_dispatch: 7 | 8 | jobs: 9 | update: 10 | runs-on: ubuntu-latest 11 | steps: 12 | - uses: actions/checkout@v4 13 | - uses: denoland/setup-deno@v1 14 | with: 15 | deno-version: 1.x 16 | - name: Configure Git 17 | run: | 18 | git config user.name github-actions[bot] 19 | git config user.email github-actions[bot]@users.noreply.github.com 20 | - name: Update dependencies and commit changes 21 | run: deno task -q upgrade:commit --summary ../title.txt --report ../body.md 22 | - name: Check result 23 | id: result 24 | uses: andstor/file-existence-action@v2 25 | with: 26 | files: ../title.txt, ../body.md 27 | - name: Read title.txt 28 | id: title 29 | if: steps.result.outputs.files_exists == 'true' 30 | uses: juliangruber/read-file-action@v1 31 | with: 32 | path: ../title.txt 33 | - name: Read body.md 34 | id: body 35 | if: steps.result.outputs.files_exists == 'true' 36 | uses: juliangruber/read-file-action@v1 37 | with: 38 | path: ../body.md 39 | - name: Create a pull request 40 | if: steps.result.outputs.files_exists == 'true' 41 | uses: peter-evans/create-pull-request@v5 42 | with: 43 | token: ${{ secrets.PA_TOKEN }} 44 | author: github-actions[bot] 45 | branch: automation/update-dependencies 46 | title: ${{ steps.title.outputs.content }} 47 | body: ${{ steps.body.outputs.content }} 48 | labels: automation 49 | delete-branch: true 50 | -------------------------------------------------------------------------------- /.gitmessage: -------------------------------------------------------------------------------- 1 | 2 | 3 | # Guide (v1.0) 4 | # 5 | # 👍 :+1: Apply changes. 6 | # 7 | # 🌿 :herb: Add or update things for tests. 8 | # ☕ :coffee: Add or update things for developments. 9 | # 📦 :package: Add or update dependencies. 10 | # 📝 :memo: Add or update documentations. 11 | # 12 | # 🐛 :bug: Bugfixes. 13 | # 💋 :kiss: Critical hotfixes. 14 | # 🚿 :shower: Remove features, codes, or files. 15 | # 16 | # 🚀 :rocket: Improve performance. 17 | # 💪 :muscle: Refactor codes. 18 | # 💥 :boom: Breaking changes. 19 | # 💩 :poop: Bad codes needs to be improved. 20 | # 21 | # How to use: 22 | # git config commit.template .gitmessage 23 | # 24 | # Reference: 25 | # https://github.com/lambdalisue/emojiprefix 26 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright 2021 vim-denops 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all 11 | copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 19 | SOFTWARE. 20 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # denops 2 | 3 | > [!IMPORTANT] 4 | > 5 | > **This module has been deprecated since v0.12.** Although it carries the 6 | > v6.0.0 tag for historical reasons, it is recommended to use [denops_core] 7 | > instead. 8 | > 9 | > Please note that if you are a plugin developer using [denops.vim], you should 10 | > consider using [denops_std] instead. 11 | 12 | [![test](https://github.com/vim-denops/deno-denops/workflows/test/badge.svg)](https://github.com/vim-denops/deno-denops/actions?query=workflow%3Atest) 13 | [![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/denops/mod.ts) 14 | [![deno land](http://img.shields.io/badge/available%20on-deno.land/x/denops-lightgrey.svg?logo=deno)](https://deno.land/x/denops) 15 | 16 | This is a core module of [denops.vim] which is an ecosystem of Vim/Neovim to 17 | write plugins in [Deno]. 18 | 19 | Note that most of users should use [denops_std] module instead to write plugins 20 | of [denops.vim]. This module is designed as a core layer of [denops_std] so 21 | using this module directly from plugins is strongly dis-recommended. 22 | 23 | [deno]: https://deno.land/ 24 | [denops.vim]: https://github.com/vim-denops/denops.vim 25 | [denops_core]: https://deno.land/x/denops_core 26 | [denops_std]: https://deno.land/x/denops_std 27 | -------------------------------------------------------------------------------- /deno.jsonc: -------------------------------------------------------------------------------- 1 | { 2 | "lock": false, 3 | "tasks": { 4 | "test": "deno test --unstable -A --parallel --shuffle --doc --coverage=.coverage", 5 | "check": "deno check --unstable ./**/*.ts", 6 | "coverage": "deno coverage --unstable .coverage", 7 | "upgrade": "deno run -q -A https://deno.land/x/molt@0.11.0/cli.ts ./**/*.ts", 8 | "upgrade:commit": "deno task -q upgrade --commit --prefix :package: --pre-commit=fmt" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /denops.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * Method dispatcher 3 | */ 4 | export interface Dispatcher { 5 | [key: string]: (...args: unknown[]) => unknown; 6 | } 7 | 8 | /** 9 | * Context which is expanded to the local namespace (l:) 10 | */ 11 | export type Context = Record; 12 | 13 | /** 14 | * Environment meta information. 15 | */ 16 | export interface Meta { 17 | // Current denops mode. 18 | // In "debug" or "test" mode, some features become enabled 19 | // which might impact the performance. 20 | readonly mode: "release" | "debug" | "test"; 21 | // Host program. 22 | readonly host: "vim" | "nvim"; 23 | // Host program version. 24 | readonly version: string; 25 | // Host platform name. 26 | readonly platform: "windows" | "mac" | "linux"; 27 | } 28 | 29 | /** 30 | * Batch error which is raised when one of function fails during batch process 31 | */ 32 | export class BatchError extends Error { 33 | // A result list which is successfully completed prior to the error 34 | readonly results: unknown[]; 35 | 36 | constructor(message: string, results: unknown[]) { 37 | super(message); 38 | this.name = "BatchError"; 39 | this.results = results; 40 | } 41 | } 42 | 43 | /** 44 | * Denpos is a facade instance visible from each denops plugins. 45 | */ 46 | export interface Denops { 47 | /** 48 | * Denops instance name which uses to communicate with vim. 49 | */ 50 | readonly name: string; 51 | 52 | /** 53 | * Environment meta information. 54 | */ 55 | readonly meta: Meta; 56 | 57 | /** 58 | * Context object for plugins. 59 | */ 60 | readonly context: Record; 61 | 62 | /** 63 | * User defined API name and method map which is used to dispatch API request 64 | */ 65 | dispatcher: Dispatcher; 66 | 67 | /** 68 | * Redraw text and cursor on Vim. 69 | * 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. 72 | * 73 | * @param force: Clear screen prior to redraw. 74 | */ 75 | redraw(force?: boolean): Promise; 76 | 77 | /** 78 | * Call an arbitrary function of Vim/Neovim and return the result 79 | * 80 | * @param fn: A function name of Vim/Neovim. 81 | * @param args: Arguments of the function. 82 | * 83 | * Note that arguments after `undefined` in `args` will be dropped for convenience. 84 | */ 85 | call(fn: string, ...args: unknown[]): Promise; 86 | 87 | /** 88 | * Call arbitrary functions of Vim/Neovim sequentially without redraw and 89 | * return the results. 90 | * 91 | * It throw a BatchError when one of a function fails. The `results` attribute 92 | * of the error instance holds succeeded results of functions prior to the 93 | * error. 94 | * 95 | * @param calls: A list of tuple ([fn, args]) to call Vim/Neovim functions. 96 | * 97 | * Note that arguments after `undefined` in `args` will be dropped for convenience. 98 | */ 99 | batch(...calls: [string, ...unknown[]][]): Promise; 100 | 101 | /** 102 | * Execute an arbitrary command of Vim/Neovim under a given context. 103 | * 104 | * @param cmd: A command expression to be executed. 105 | * @param ctx: A context object which is expanded to the local namespace (l:) 106 | */ 107 | cmd(cmd: string, ctx?: Context): Promise; 108 | 109 | /** 110 | * Evaluate an arbitrary expression of Vim/Neovim under a given context and return the result. 111 | * 112 | * @param expr: An expression to be evaluated. 113 | * @param ctx: A context object which is expanded to the local namespace (l:) 114 | */ 115 | eval(expr: string, ctx?: Context): Promise; 116 | 117 | /** 118 | * Dispatch an arbitrary function of an arbitrary plugin and return the result. 119 | * 120 | * @param name: A plugin registration name. 121 | * @param fn: A function name in the API registration. 122 | * @param args: Arguments of the function. 123 | */ 124 | dispatch(name: string, fn: string, ...args: unknown[]): Promise; 125 | } 126 | -------------------------------------------------------------------------------- /mod.ts: -------------------------------------------------------------------------------- 1 | /** 2 | * This is a core module of [denops.vim] which is an ecosystem of Vim/Neovim to write plugins in [Deno]. 3 | * 4 | * Note that most of users should use [denops_std] module instead to write plugins of [denops.vim]. 5 | * This module is designed as a core layer of [denops_std] so using this module directly from plugins is **strongly dis-recommended**. 6 | * 7 | * [deno]: https://deno.land/ 8 | * [denops.vim]: https://github.com/vim-denops/denops.vim 9 | * [denops_core]: https://deno.land/x/denops_core 10 | * [denops_std]: https://deno.land/x/denops_std 11 | * 12 | * @deprecated This module is deprecated. Use [denops_core] module instead. 13 | * @module 14 | */ 15 | 16 | export { BatchError } from "./denops.ts"; 17 | export type { Context, Denops, Dispatcher, Meta } from "./denops.ts"; 18 | --------------------------------------------------------------------------------