-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
47de250
commit 9f9af3b
Showing
8 changed files
with
302 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: test | ||
|
||
on: | ||
schedule: | ||
- cron: "0 7 * * 0" | ||
push: | ||
paths: | ||
- "**.md" | ||
- "**.ts" | ||
- ".github/workflows/test.yml" | ||
- "deno.jsonc" | ||
pull_request: | ||
paths: | ||
- "**.md" | ||
- "**.ts" | ||
- ".github/workflows/test.yml" | ||
- "deno.jsonc" | ||
|
||
jobs: | ||
check: | ||
strategy: | ||
matrix: | ||
runner: | ||
- ubuntu-latest | ||
version: | ||
- "1.x" | ||
runs-on: ${{ matrix.runner }} | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: denoland/setup-deno@v1 | ||
with: | ||
deno-version: "${{ matrix.version }}" | ||
- name: Lint check | ||
run: deno lint | ||
- name: Format check | ||
run: deno fmt --check | ||
- name: Type check | ||
run: deno task check |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
name: update | ||
|
||
on: | ||
schedule: | ||
- cron: "0 0 * * *" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
update: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: denoland/setup-deno@v1 | ||
with: | ||
deno-version: 1.x | ||
- name: Configure Git | ||
run: | | ||
git config user.name github-actions[bot] | ||
git config user.email github-actions[bot]@users.noreply.github.com | ||
- name: Update dependencies and commit changes | ||
run: deno task -q upgrade:commit --summary ../title.txt --report ../body.md | ||
- name: Check result | ||
id: result | ||
uses: andstor/file-existence-action@v2 | ||
with: | ||
files: ../title.txt, ../body.md | ||
- name: Read title.txt | ||
id: title | ||
if: steps.result.outputs.files_exists == 'true' | ||
uses: juliangruber/read-file-action@v1 | ||
with: | ||
path: ../title.txt | ||
- name: Read body.md | ||
id: body | ||
if: steps.result.outputs.files_exists == 'true' | ||
uses: juliangruber/read-file-action@v1 | ||
with: | ||
path: ../body.md | ||
- name: Create a pull request | ||
if: steps.result.outputs.files_exists == 'true' | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
token: ${{ secrets.PA_TOKEN }} | ||
author: github-actions[bot] <github-actions[bot]@users.noreply.github.com> | ||
branch: automation/update-dependencies | ||
title: ${{ steps.title.outputs.content }} | ||
body: ${{ steps.body.outputs.content }} | ||
labels: automation | ||
delete-branch: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
|
||
|
||
# Guide (v1.0) | ||
# | ||
# 👍 :+1: Apply changes. | ||
# | ||
# 🌿 :herb: Add or update things for tests. | ||
# ☕ :coffee: Add or update things for developments. | ||
# 📦 :package: Add or update dependencies. | ||
# 📝 :memo: Add or update documentations. | ||
# | ||
# 🐛 :bug: Bugfixes. | ||
# 💋 :kiss: Critical hotfixes. | ||
# 🚿 :shower: Remove features, codes, or files. | ||
# | ||
# 🚀 :rocket: Improve performance. | ||
# 💪 :muscle: Refactor codes. | ||
# 💥 :boom: Breaking changes. | ||
# 💩 :poop: Bad codes needs to be improved. | ||
# | ||
# How to use: | ||
# git config commit.template .gitmessage | ||
# | ||
# Reference: | ||
# https://github.com/lambdalisue/emojiprefix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
Copyright 2021 vim-denops | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# denops_core | ||
|
||
[![test](https://github.com/vim-denops/deno-denops/workflows/test/badge.svg)](https://github.com/vim-denops/deno-denops/actions?query=workflow%3Atest) | ||
[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/denops/mod.ts) | ||
[![deno land](http://img.shields.io/badge/available%20on-deno.land/x/denops-lightgrey.svg?logo=deno)](https://deno.land/x/denops) | ||
|
||
This is a core module of [denops.vim][denops.vim] which is an ecosystem of | ||
Vim/Neovim to write plugins in [Deno][deno]. | ||
|
||
Note that most of users should use [denops_std][denops_std] module instead to | ||
write plugins of [denops.vim][denops.vim]. This module is designed as a core | ||
layer of [denops_std][denops_std] so using this module directly from plugins is | ||
strongly dis-recommended. | ||
|
||
[deno]: https://deno.land/ | ||
[denops.vim]: https://github.com/vim-denops/denops.vim | ||
[denops_std]: https://deno.land/x/denops_std |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"lock": false, | ||
"tasks": { | ||
"test": "deno test -A --parallel --shuffle --doc --coverage=.coverage", | ||
"check": "deno check ./**/*.ts", | ||
"coverage": "deno coverage .coverage", | ||
"upgrade": "deno run -q -A https://deno.land/x/[email protected]/cli.ts ./**/*.ts", | ||
"upgrade:commit": "deno task -q upgrade --commit --prefix :package: --pre-commit=fmt" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
/** | ||
* Method dispatcher | ||
*/ | ||
export interface Dispatcher { | ||
[key: string]: (...args: unknown[]) => unknown; | ||
} | ||
|
||
/** | ||
* Context which is expanded to the local namespace (l:) | ||
*/ | ||
export type Context = Record<string, unknown>; | ||
|
||
/** | ||
* Environment meta information. | ||
*/ | ||
export interface Meta { | ||
// Current denops mode. | ||
// In "debug" or "test" mode, some features become enabled | ||
// which might impact the performance. | ||
readonly mode: "release" | "debug" | "test"; | ||
// Host program. | ||
readonly host: "vim" | "nvim"; | ||
// Host program version. | ||
readonly version: string; | ||
// Host platform name. | ||
readonly platform: "windows" | "mac" | "linux"; | ||
} | ||
|
||
/** | ||
* Batch error which is raised when one of function fails during batch process | ||
*/ | ||
export class BatchError extends Error { | ||
// A result list which is successfully completed prior to the error | ||
readonly results: unknown[]; | ||
|
||
constructor(message: string, results: unknown[]) { | ||
super(message); | ||
this.name = "BatchError"; | ||
this.results = results; | ||
} | ||
} | ||
|
||
/** | ||
* Denpos is a facade instance visible from each denops plugins. | ||
*/ | ||
export interface Denops { | ||
/** | ||
* Denops instance name which uses to communicate with vim. | ||
*/ | ||
readonly name: string; | ||
|
||
/** | ||
* Environment meta information. | ||
*/ | ||
readonly meta: Meta; | ||
|
||
/** | ||
* Context object for plugins. | ||
*/ | ||
readonly context: Record<string | number | symbol, unknown>; | ||
|
||
/** | ||
* User defined API name and method map which is used to dispatch API request | ||
*/ | ||
dispatcher: Dispatcher; | ||
|
||
/** | ||
* Redraw text and cursor on Vim. | ||
* | ||
* It's not equivalent to `redraw` command on Vim script and does nothing on Neovim. | ||
* Use `denops.cmd('redraw')` instead if you need to execute `redraw` command. | ||
* | ||
* @param force: Clear screen prior to redraw. | ||
*/ | ||
redraw(force?: boolean): Promise<void>; | ||
|
||
/** | ||
* Call an arbitrary function of Vim/Neovim and return the result | ||
* | ||
* @param fn: A function name of Vim/Neovim. | ||
* @param args: Arguments of the function. | ||
* | ||
* Note that arguments after `undefined` in `args` will be dropped for convenience. | ||
*/ | ||
call(fn: string, ...args: unknown[]): Promise<unknown>; | ||
|
||
/** | ||
* Call arbitrary functions of Vim/Neovim sequentially without redraw and | ||
* return the results. | ||
* | ||
* It throw a BatchError when one of a function fails. The `results` attribute | ||
* of the error instance holds succeeded results of functions prior to the | ||
* error. | ||
* | ||
* @param calls: A list of tuple ([fn, args]) to call Vim/Neovim functions. | ||
* | ||
* Note that arguments after `undefined` in `args` will be dropped for convenience. | ||
*/ | ||
batch(...calls: [string, ...unknown[]][]): Promise<unknown[]>; | ||
|
||
/** | ||
* Execute an arbitrary command of Vim/Neovim under a given context. | ||
* | ||
* @param cmd: A command expression to be executed. | ||
* @param ctx: A context object which is expanded to the local namespace (l:) | ||
*/ | ||
cmd(cmd: string, ctx?: Context): Promise<void>; | ||
|
||
/** | ||
* Evaluate an arbitrary expression of Vim/Neovim under a given context and return the result. | ||
* | ||
* @param expr: An expression to be evaluated. | ||
* @param ctx: A context object which is expanded to the local namespace (l:) | ||
*/ | ||
eval(expr: string, ctx?: Context): Promise<unknown>; | ||
|
||
/** | ||
* Dispatch an arbitrary function of an arbitrary plugin and return the result. | ||
* | ||
* @param name: A plugin registration name. | ||
* @param fn: A function name in the API registration. | ||
* @param args: Arguments of the function. | ||
*/ | ||
dispatch(name: string, fn: string, ...args: unknown[]): Promise<unknown>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/** | ||
* This is a core module of [denops.vim][denops.vim] which is an ecosystem of | ||
* Vim/Neovim to write plugins in [Deno][deno]. | ||
* | ||
* Note that most of users should use [denops_std][denops_std] module instead to | ||
* write plugins of [denops.vim][denops.vim]. This [denops_core][denops_core] module | ||
* is designed as a core layer of [denops_std][denops_std] so using this module | ||
* directly from plugins is **strongly dis-recommended**. | ||
* | ||
* [deno]: https://deno.land/ | ||
* [denops.vim]: https://github.com/vim-denops/denops.vim | ||
* [denops_core]: https://github.com/vim-denops/deno-denops-core | ||
* [denops_std]: https://github.com/vim-denops/deno-denops-std | ||
* | ||
* @module | ||
*/ | ||
|
||
export { BatchError } from "./denops.ts"; | ||
export type { Context, Denops, Dispatcher, Meta } from "./denops.ts"; |