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
18 changes: 9 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,24 +35,24 @@ jobs:
# - macos-latest
- ubuntu-latest
version:
- "1.45.0"
- "1.x"
- "2.3.0"
- "2.x"
host_version:
- vim: "v9.1.0488"
nvim: "v0.10.0"
- vim: "v9.1.1646"
nvim: "v0.11.3"
runs-on: ${{ matrix.runner }}
steps:
- run: git config --global init.defaultBranch main
- run: git config --global core.autocrlf false
if: runner.os == 'Windows'
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
path: "./repo"
- uses: actions/checkout@v4
- uses: actions/checkout@v5
with:
repository: "vim-denops/denops.vim"
path: "./denops.vim"
- uses: denoland/setup-deno@v1
- uses: denoland/setup-deno@v2
with:
deno-version: "${{ matrix.version }}"
- uses: actions/cache@v4
Expand All @@ -69,7 +69,7 @@ jobs:
- name: Format check
working-directory: ./repo
run: deno task fmt-check
- uses: thinca/action-setup-vim@v1
- uses: thinca/action-setup-vim@v2
id: vim
with:
vim_type: "Vim"
Expand All @@ -81,7 +81,7 @@ jobs:
${DENOPS_TEST_VIM} --version
env:
DENOPS_TEST_VIM: ${{ steps.vim.outputs.executable_path }}
- uses: thinca/action-setup-vim@v1
- uses: thinca/action-setup-vim@v2
id: nvim
with:
vim_type: "Neovim"
Expand Down
17 changes: 12 additions & 5 deletions deno.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
{
"lock": false,
"unstable": ["kv"],
"tasks": {
"check": "deno task fmt-check && deno task lint && deno task test",
"fmt-check": "deno fmt --check denops",
"lint": "deno lint",
"test": "deno test -A",
"check": "deno task fmt-check && deno task lint && deno task test"
}
"lint": "deno lint denops",
"test": "deno test -A denops"
},
"unstable": [
"kv"
],
"workspace": [
"./denops/@ddc-sources/skkeleton",
"./denops/@ddc-sources/skkeleton_okuri",
"./denops/skkeleton"
]
}
6 changes: 6 additions & 0 deletions denops/@ddc-sources/skkeleton/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"imports": {
"@denops/std": "jsr:@denops/std@^8.0.0",
"@shougo/ddc-vim": "jsr:@shougo/ddc-vim@^10.0.0"
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import type { CompletionData, RankData } from "../skkeleton/types.ts";
import type { CompletionData, RankData } from "../../skkeleton/types.ts";

import * as fn from "jsr:@denops/std@^7.6.0/function";
import * as fn from "@denops/std/function";
import {
BaseSource,
type GatherArguments,
type GetCompletePositionArguments,
type GetPreviewerArguments,
type OnCompleteDoneArguments,
} from "jsr:@shougo/ddc-vim@~9.1.0/source";
import {
type DdcGatherItems,
Previewer,
} from "jsr:@shougo/ddc-vim@~9.1.0/types";
} from "@shougo/ddc-vim/source";
import { type DdcGatherItems, Previewer } from "@shougo/ddc-vim/types";

export type CompletionMetadata = {
kana: string;
Expand Down
6 changes: 6 additions & 0 deletions denops/@ddc-sources/skkeleton_okuri/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"imports": {
"@shougo/ddc-vim": "jsr:@shougo/ddc-vim@^10.0.0",
"@std/assert": "jsr:@std/assert@^1.0.14"
}
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { getOkuriStr } from "../skkeleton/okuri.ts";
import { okuriSplits } from "./skkeleton/okurisplits.ts";
import { getOkuriStr } from "../../skkeleton/okuri.ts";
import { okuriSplits } from "./okurisplits.ts";

import {
BaseSource,
type GatherArguments,
type GetCompletePositionArguments,
type OnCompleteDoneArguments,
} from "jsr:@shougo/ddc-vim@~9.1.0/source";
import { type Item } from "jsr:@shougo/ddc-vim@~9.1.0/types";
} from "@shougo/ddc-vim/source";
import { type Item } from "@shougo/ddc-vim/types";

type Never = Record<PropertyKey, never>;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { okuriSplits } from "./okurisplits.ts";

import { assertEquals } from "jsr:@std/assert@~1.0.3/equals";
import { assertEquals } from "@std/assert/equals";

Deno.test({
name: "split",
Expand Down
6 changes: 3 additions & 3 deletions denops/skkeleton/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import { getKanaTable, loadKanaTableFiles } from "./kana.ts";
import { ConfigOptions, Encode, Encoding } from "./types.ts";
import { homeExpand } from "./util.ts";

import { ensure } from "jsr:@core/unknownutil@~4.3.0/ensure";
import { is } from "jsr:@core/unknownutil@~4.3.0/is";
import { Denops } from "jsr:@denops/std@^7.6.0";
import { ensure } from "@core/unknownutil/ensure";
import { is } from "@core/unknownutil/is";
import { Denops } from "@denops/std";

export const config: Omit<ConfigOptions, "globalDictionaries"> & {
globalDictionaries: [string, string][];
Expand Down
4 changes: 2 additions & 2 deletions denops/skkeleton/config_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { dispatch } from "./function/testutil.ts";
import { currentContext, currentLibrary, variables } from "./store.ts";
import { test } from "./testutil.ts";

import type { Denops } from "jsr:@denops/std@^7.6.0";
import { assertEquals } from "jsr:@std/assert@~1.0.3/equals";
import type { Denops } from "@denops/std";
import { assertEquals } from "@std/assert/equals";

const defaultConfig = { ...config };

Expand Down
2 changes: 1 addition & 1 deletion denops/skkeleton/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { HenkanType } from "./dictionary.ts";
import { PreEdit } from "./preedit.ts";
import { initializeState, State, toString } from "./state.ts";

import type { Denops } from "jsr:@denops/std@^7.6.0";
import type { Denops } from "@denops/std";

type CandidateResult = {
type: HenkanType;
Expand Down
20 changes: 20 additions & 0 deletions denops/skkeleton/deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"imports": {
"@core/asyncutil": "jsr:@core/asyncutil@^1.2.0",
"@core/unknownutil": "jsr:@core/unknownutil@^4.3.0",
"@denops/std": "jsr:@denops/std@^8.0.0",
"@denops/test": "jsr:@denops/test@^3.0.4",
"@geolonia/japanese-numeral": "npm:@geolonia/japanese-numeral@^1.0.2",
"@lambdalisue/import-map-importer": "jsr:@lambdalisue/import-map-importer@^0.5.1",
"@std/assert": "jsr:@std/assert@^1.0.13",
"@std/async": "jsr:@std/async@^1.0.14",
"@std/collections": "jsr:@std/collections@^1.1.2",
"@std/msgpack": "jsr:@std/msgpack@^1.0.3",
"@std/path": "jsr:@std/path@^1.1.1",
"@std/streams": "jsr:@std/streams@^1.0.10",
"@std/yaml": "jsr:@std/yaml@^1.0.9",
"cr-numeral": "npm:cr-numeral@^1.1.3",
"encoding-japanese": "npm:encoding-japanese@^2.2.0",
"jsonschema": "npm:jsonschema@^1.5.0"
}
}
49 changes: 31 additions & 18 deletions denops/skkeleton/dictionary.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import { config } from "./config.ts";
import type { CompletionData, RankData } from "./types.ts";
import { number2kanji } from "npm:@geolonia/japanese-numeral@1.0.2";
import { convertNumberToRoman } from "npm:cr-numeral@1.1.3";

import { is, Predicate } from "jsr:@core/unknownutil@~4.3.0";
import { zip } from "jsr:@std/collections@~1.0.5/zip";
import { toFileUrl } from "jsr:@std/path@~1.0.3/to-file-url";
import { number2kanji } from "@geolonia/japanese-numeral";
import { convertNumberToRoman } from "cr-numeral";

import { is, Predicate } from "@core/unknownutil";
import {
ImportMapImporter,
loadImportMap,
} from "@lambdalisue/import-map-importer";
import { zip } from "@std/collections/zip";
import { fromFileUrl } from "@std/path/from-file-url";

export const okuriAriMarker = ";; okuri-ari entries.";
export const okuriNasiMarker = ";; okuri-nasi entries.";
Expand Down Expand Up @@ -310,27 +315,35 @@ export class Library {
}
}

export async function load(paths: Record<string, string>): Promise<Library> {
const userMod = await import(
toFileUrl(paths["sources/user_dictionary"]).href
export async function load(sources: string[]): Promise<Library> {
const importMap = await loadImportMap(
fromFileUrl(import.meta.resolve("./deno.json")),
);
const importer = new ImportMapImporter(importMap);
// deno-lint-ignore no-explicit-any
const userMod = await importer.import<any>(
import.meta.resolve("./sources/user_dictionary.ts"),
);
const userDictionary = await (new userMod.Source()).getUserDictionary();

const dictionaries: Dictionary[] = [];
for (const source of config.sources) {
const key = `sources/${source}`;
const path = paths[key];
for (const source of sources) {
try {
// deno-lint-ignore no-explicit-any
const mod = await importer.import<any>(
import.meta.resolve(`./sources/${source}.ts`),
);

if (!path) {
dictionaries.push(
...await (new mod.Source().getDictionaries()),
);
} catch (e) {
console.error(`Invalid source name: ${source}`);
if (config.debug) {
console.error(e);
}
continue;
}

const mod = await import(toFileUrl(path).href);

dictionaries.push(
...await (new mod.Source().getDictionaries()),
);
}

return new Library(dictionaries, userDictionary);
Expand Down
8 changes: 4 additions & 4 deletions denops/skkeleton/dictionary_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { Dictionary as SkkDictionary } from "./sources/skk_dictionary.ts";
import { Dictionary as DenoKvDictionary } from "./sources/deno_kv.ts";
import { Dictionary as UserDictionary } from "./sources/user_dictionary.ts";

import { assertEquals } from "jsr:@std/assert@~1.0.3/equals";
import { dirname } from "jsr:@std/path@~1.0.3/dirname";
import { fromFileUrl } from "jsr:@std/path@~1.0.3/from-file-url";
import { join } from "jsr:@std/path@~1.0.3/join";
import { assertEquals } from "@std/assert/equals";
import { dirname } from "@std/path/dirname";
import { fromFileUrl } from "@std/path/from-file-url";
import { join } from "@std/path/join";

const newJisyoJson = join(
dirname(fromFileUrl(import.meta.url)),
Expand Down
2 changes: 1 addition & 1 deletion denops/skkeleton/function/common_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { cancel, kakutei, kakuteiKey } from "./common.ts";
import { katakana } from "./mode.ts";
import { dispatch } from "./testutil.ts";

import { assertEquals } from "jsr:@std/assert@~1.0.3/equals";
import { assertEquals } from "@std/assert/equals";

const lib = await currentLibrary.get();

Expand Down
12 changes: 6 additions & 6 deletions denops/skkeleton/function/dictionary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { HenkanState } from "../state.ts";
import { kakutei } from "./common.ts";
import { modeChange } from "../mode.ts";

import * as autocmd from "jsr:@denops/std@^7.6.0/autocmd";
import { batch } from "jsr:@denops/std@^7.6.0/batch";
import * as fn from "jsr:@denops/std@^7.6.0/function";
import * as mapping from "jsr:@denops/std@^7.6.0/mapping";
import * as op from "jsr:@denops/std@^7.6.0/option";
import * as vars from "jsr:@denops/std@^7.6.0/variable";
import * as autocmd from "@denops/std/autocmd";
import { batch } from "@denops/std/batch";
import * as fn from "@denops/std/function";
import * as mapping from "@denops/std/mapping";
import * as op from "@denops/std/option";
import * as vars from "@denops/std/variable";

const cmapKeys = ["<Esc>", "<C-g>"];

Expand Down
4 changes: 2 additions & 2 deletions denops/skkeleton/function/dictionary_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { currentContext } from "../store.ts";
import { test } from "../testutil.ts";
import { registerWord } from "./dictionary.ts";

import type { Denops } from "jsr:@denops/std@^7.6.0";
import { assertEquals } from "jsr:@std/assert@~1.0.3/equals";
import type { Denops } from "@denops/std";
import { assertEquals } from "@std/assert/equals";

test({
mode: "all",
Expand Down
2 changes: 1 addition & 1 deletion denops/skkeleton/function/disable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { Context } from "../context.ts";
import { initializeState } from "../state.ts";
import { kakutei } from "./common.ts";

import * as autocmd from "jsr:@denops/std@^7.6.0/autocmd";
import * as autocmd from "@denops/std/autocmd";

export async function disable(context: Context) {
const denops = context.denops!;
Expand Down
4 changes: 2 additions & 2 deletions denops/skkeleton/function/disable_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { currentContext } from "../store.ts";
import { test } from "../testutil.ts";
import { dispatch } from "./testutil.ts";

import type { Denops } from "jsr:@denops/std@^7.6.0";
import { assertEquals } from "jsr:@std/assert@~1.0.3/equals";
import type { Denops } from "@denops/std";
import { assertEquals } from "@std/assert/equals";

// deno-lint-ignore no-explicit-any
async function getResult(x: Promise<any>): Promise<string> {
Expand Down
4 changes: 2 additions & 2 deletions denops/skkeleton/function/henkan.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { kakutei } from "./common.ts";
import { registerWord } from "./dictionary.ts";
import { acceptResult, henkanPoint, kakuteiFeed, kanaInput } from "./input.ts";

import type { Denops } from "jsr:@denops/std@^7.6.0";
import { Mutex } from "jsr:@core/asyncutil@^1.2.0/mutex";
import { Mutex } from "@core/asyncutil/mutex";
import type { Denops } from "@denops/std";

const mutex = new Mutex();

Expand Down
2 changes: 1 addition & 1 deletion denops/skkeleton/function/henkan_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { currentLibrary } from "../store.ts";
import { henkanFirst } from "./henkan.ts";
import { dispatch } from "./testutil.ts";

import { assertEquals } from "jsr:@std/assert@~1.0.3/equals";
import { assertEquals } from "@std/assert/equals";

const l = await currentLibrary.get();
await l.registerHenkanResult("okurinasi", "へんかん", "返還");
Expand Down
6 changes: 3 additions & 3 deletions denops/skkeleton/function/input_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import { deleteChar, henkanPoint } from "./input.ts";
import { hankatakana, katakana } from "./mode.ts";
import { dispatch } from "./testutil.ts";

import { Denops } from "jsr:@denops/std@^7.6.0";
import * as op from "jsr:@denops/std@^7.6.0/option";
import { assertEquals } from "jsr:@std/assert@~1.0.3/equals";
import { Denops } from "@denops/std";
import * as op from "@denops/std/option";
import { assertEquals } from "@std/assert/equals";

Deno.test({
name: "kana input",
Expand Down
8 changes: 4 additions & 4 deletions denops/skkeleton/function/mode_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import { deleteChar, kanaInput } from "./input.ts";
import { abbrev, hankatakana, katakana, zenkaku } from "./mode.ts";
import { dispatch } from "./testutil.ts";

import { Denops } from "jsr:@denops/std@^7.6.0";
import * as autocmd from "jsr:@denops/std@^7.6.0/autocmd";
import * as vars from "jsr:@denops/std@^7.6.0/variable";
import { assertEquals } from "jsr:@std/assert@~1.0.3/equals";
import { Denops } from "@denops/std";
import * as autocmd from "@denops/std/autocmd";
import * as vars from "@denops/std/variable";
import { assertEquals } from "@std/assert/equals";

test({
mode: "all",
Expand Down
6 changes: 3 additions & 3 deletions denops/skkeleton/kana.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import { romToZen } from "./kana/rom_zen.ts";
import type { KanaResult, KanaTable } from "./kana/type.ts";
import { Cell, readFileWithEncoding } from "./util.ts";

import { distinctBy } from "jsr:@std/collections@~1.0.5/distinct-by";
import { is } from "jsr:@core/unknownutil@~4.3.0/is";
import { assert } from "jsr:@core/unknownutil@~4.3.0/assert";
import { distinctBy } from "@std/collections/distinct-by";
import { is } from "@core/unknownutil/is";
import { assert } from "@core/unknownutil/assert";

type PartialKanaTable = [string, KanaResult | null][];

Expand Down
Loading
Loading