Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
runner:
- ubuntu-latest
deno_version:
- "1.x"
- "2.x"
runs-on: ${{ matrix.runner }}
steps:
- run: git config --global core.autocrlf false
Expand Down Expand Up @@ -77,11 +77,11 @@ jobs:
- macos-latest
- ubuntu-latest
deno_version:
- "1.45.0"
- "1.x"
- "2.3.0"
- "2.x"
host_version:
- vim: "v9.1.0448"
nvim: "v0.10.0"
- vim: "v9.1.1646"
nvim: "v0.11.3"
runs-on: ${{ matrix.runner }}
timeout-minutes: 15
steps:
Expand Down
2 changes: 1 addition & 1 deletion .scripts/apply-supported-versions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
} from "./supported_versions.ts";

async function main(): Promise<void> {
const supportedVersions = await loadSupportedVersions("main");
const supportedVersions = await loadSupportedVersions();
await updateREADME(supportedVersions);
await updateGithubWorkflowsTest(supportedVersions);
}
Expand Down
1 change: 1 addition & 0 deletions .scripts/gen-function/format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const translate: Record<string, string> = {
"lnum-end": "lnum_end",
"instanceof": "instanceof_",
"class": "class_",
"package": "package_",
};

export function formatDocs(docs: string): string[] {
Expand Down
20 changes: 12 additions & 8 deletions .scripts/gen-function/gen-function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,26 @@ const vimHelpDownloadUrls = [
`https://raw.githubusercontent.com/vim/vim/v${VIM_VERSION}/runtime/doc/testing.txt`,
`https://raw.githubusercontent.com/vim/vim/v${VIM_VERSION}/runtime/doc/textprop.txt`,
];
for (const vimHelpDownloadUrl of vimHelpDownloadUrls) {
console.log(`Download from ${vimHelpDownloadUrl}`);
}
const vimHelps = await Promise.all(vimHelpDownloadUrls.map(downloadString));
const vimDefs = parse(vimHelps.join("\n"));
const vimFnSet = new Set(vimDefs.map((def) => def.fn)).difference(manualFnSet);

const nvimHelpDownloadUrls = [
`https://raw.githubusercontent.com/neovim/neovim/v${NVIM_VERSION}/runtime/doc/api.txt`,
`https://raw.githubusercontent.com/neovim/neovim/v${NVIM_VERSION}/runtime/doc/builtin.txt`,
`https://raw.githubusercontent.com/neovim/neovim/v${NVIM_VERSION}/runtime/doc/eval.txt`,
[
`https://raw.githubusercontent.com/neovim/neovim/v${NVIM_VERSION}/runtime/doc/builtin.txt`,
// Neovim 0.11+ removed "builtin.txt", but "vimfn.txt" seems to be equivalent.
// https://github.com/neovim/neovim/pull/24493
`https://raw.githubusercontent.com/neovim/neovim/v${NVIM_VERSION}/runtime/doc/vimfn.txt`,
],
[
`https://raw.githubusercontent.com/neovim/neovim/v${NVIM_VERSION}/runtime/doc/eval.txt`,
// Neovim 0.11+ removed "eval.txt", but "vimeval.txt" seems to be equivalent.
// https://github.com/neovim/neovim/pull/24493
`https://raw.githubusercontent.com/neovim/neovim/v${NVIM_VERSION}/runtime/doc/vimeval.txt`,
],
`https://raw.githubusercontent.com/neovim/neovim/v${NVIM_VERSION}/runtime/doc/sign.txt`,
];
for (const nvimHelpDownloadUrl of nvimHelpDownloadUrls) {
console.log(`Download from ${nvimHelpDownloadUrl}`);
}
const nvimHelps = await Promise.all(nvimHelpDownloadUrls.map(downloadString));
const nvimDefs = parse(nvimHelps.join("\n"));
const nvimFnSet = new Set(nvimDefs.map((def) => def.fn)).difference(
Expand Down
18 changes: 13 additions & 5 deletions .scripts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,20 @@ import { toText } from "@std/streams/to-text";
* Downloads a text file and returns the contents.
* Throws error if fetch fails.
*/
export async function downloadString(url: string): Promise<string> {
const response = await fetch(url);
if (response.status >= 400 || !response.body) {
throw new Error(`Failed to read ${url}`);
export async function downloadString(urls: string | string[]): Promise<string> {
urls = Array.isArray(urls) ? urls : [urls];
for (const url of urls) {
console.log(`Download from ${url}`);
const response = await fetch(url);
if (response.status >= 400 || !response.body) {
console.debug(
`Failed to download ${url}. Fallback to next URL if exists.`,
);
continue;
}
return await toText(response.body);
}
return await toText(response.body);
throw new Error(`Failed to download from ${urls.join(", ")}`);
}

/**
Expand Down
3 changes: 2 additions & 1 deletion .scripts/utils_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ Deno.test(downloadString.name, async (t) => {

await t.step("Throws error if fetch fails", async () => {
const url = "https://example.net/foo.ts";
const expectedMessage = "Failed to read https://example.net/foo.ts";
const expectedMessage =
"Failed to download from https://example.net/foo.ts";
await mockFetch({
init: { status: 404 },
async fn() {
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
[![Test](https://github.com/vim-denops/deno-denops-std/actions/workflows/test.yml/badge.svg)](https://github.com/vim-denops/deno-denops-std/actions/workflows/test.yml)
[![codecov](https://codecov.io/github/vim-denops/deno-denops-std/branch/main/graph/badge.svg?token=RKAZMUQ3D9)](https://codecov.io/github/vim-denops/deno-denops-std)

[![Deno 1.45.0 or above](https://img.shields.io/badge/Deno-Support%201.45.0-yellowgreen.svg?logo=deno)](https://github.com/denoland/deno/tree/v1.45.0)
[![Vim 9.1.0448 or above](https://img.shields.io/badge/Vim-Support%209.1.0448-yellowgreen.svg?logo=vim)](https://github.com/vim/vim/tree/v9.1.0448)
[![Neovim 0.10.0 or above](https://img.shields.io/badge/Neovim-Support%200.10.0-yellowgreen.svg?logo=neovim&logoColor=white)](https://github.com/neovim/neovim/tree/v0.10.0)
[![Deno 2.3.0 or above](https://img.shields.io/badge/Deno-Support%202.3.0-yellowgreen.svg?logo=deno)](https://github.com/denoland/deno/tree/v2.3.0)
[![Vim 9.1.1646 or above](https://img.shields.io/badge/Vim-Support%209.1.1646-yellowgreen.svg?logo=vim)](https://github.com/vim/vim/tree/v9.1.1646)
[![Neovim 0.11.3 or above](https://img.shields.io/badge/Neovim-Support%200.11.3-yellowgreen.svg?logo=neovim&logoColor=white)](https://github.com/neovim/neovim/tree/v0.11.3)

Standard module for [denops.vim].

Expand Down
8 changes: 5 additions & 3 deletions buffer/decoration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -261,14 +261,16 @@ async function nvimDecorate(
for (const chunk of itertools.chunked(decorations, 1000)) {
await batch(denops, async (denops) => {
for (const deco of chunk) {
await nvimFn.nvim_buf_add_highlight(
await nvimFn.nvim_buf_set_extmark(
denops,
bufnr,
ns,
deco.highlight,
deco.line - 1,
deco.column - 1,
deco.column - 1 + deco.length,
{
end_col: deco.column - 1 + deco.length,
hl_group: deco.highlight,
},
);
}
});
Expand Down
2 changes: 1 addition & 1 deletion deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,6 @@
"gen:function": "deno run -A ./.scripts/gen-function/gen-function.ts",
"gen:option": "deno run -A ./.scripts/gen-option/gen-option.ts",
"gen": "deno task gen:function && deno task gen:option && deno fmt",
"apply:supported-versions": "deno run --allow-net --allow-read --allow-write .scripts/apply-supported-versions.ts"
"apply:supported-versions": "deno run --allow-net --allow-read --allow-write --allow-env .scripts/apply-supported-versions.ts"
}
}
Loading
Loading