Skip to content

Defer global dictionary parsing until first lookup - #259

Merged
Shougo merged 3 commits into
mainfrom
copilot/implement-dictionary-lazy-parsing
Sep 17, 2026
Merged

Shougo merged 3 commits into
mainfrom
copilot/implement-dictionary-lazy-parsing

Conversation

Copilot AI commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Global SKK dictionaries were parsed eagerly during initialization, increasing startup cost even when unused. This change defers file loading and parsing until the dictionary is queried.

  • Lazy loading
    • Add file-backed dictionary construction via Dictionary.fromFile().
    • Load and parse on the first conversion or completion request.
    • Share concurrent load operations through a single promise.
  • Source initialization
    • Return lazy dictionaries from the SKK dictionary source instead of parsing immediately.
  • Regression coverage
    • Verify that file access is deferred until lookup.
const dictionary = Dictionary.fromFile(path, encoding);
// File is loaded only when queried.
await dictionary.getHenkanResult("okurinasi", "かな");

Copilot AI and others added 2 commits September 17, 2026 10:58
Co-authored-by: Shougo <41495+Shougo@users.noreply.github.com>
Co-authored-by: Shougo <41495+Shougo@users.noreply.github.com>
@Shougo

Shougo commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

@copilot

Task lint deno lint denops
error[require-await]: Async method 'getDictionaries' has no 'await' expression or 'await using' declaration.
Error:   --> /home/runner/work/skkeleton/skkeleton/repo/denops/skkeleton/sources/skk_dictionary.ts:26:3
   | 
26 |   async getDictionaries(): Promise<BaseDictionary[]> {
   |   ^^^^^
   = hint: Remove 'async' keyword from the function or use 'await' expression or 'await using' declaration inside.

  docs: https://docs.deno.com/lint/rules/require-await


error[require-await]: Async method 'getDictionaries' has no 'await' expression or 'await using' declaration.
Error:   --> /home/runner/work/skkeleton/skkeleton/repo/denops/skkeleton/sources/skk_dictionary.ts:26:3
   | 
26 |   async getDictionaries(): Promise<BaseDictionary[]> {
   |   ^^^^^
   = hint: Remove 'async' keyword from the function or use 'await' expression or 'await using' declaration inside.

  docs: https://docs.deno.com/lint/rules/require-await


error[require-await]: Async method 'getDictionaries' has no 'await' expression or 'await using' declaration.
Error:   --> /home/runner/work/skkeleton/skkeleton/repo/denops/skkeleton/sources/skk_dictionary.ts:26:3
   | 
26 |   async getDictionaries(): Promise<BaseDictionary[]> {
   |   ^^^^^
   = hint: Remove 'async' keyword from the function or use 'await' expression or 'await using' declaration inside.

  docs: https://docs.deno.com/lint/rules/require-await


Found 3 problems
``` 直してください

Co-authored-by: Shougo <41495+Shougo@users.noreply.github.com>

Copilot AI commented Sep 17, 2026

Copy link
Copy Markdown
Contributor Author

@copilot

...

getDictionaries から async を削除し、Promise.resolve(...) を返すよう修正しました。Deno は環境にないため lint は実行できませんでしたが、変更はコミット済みです(f2a1d6e)。

Copilot AI requested a review from Shougo September 17, 2026 11:07
@Shougo
Shougo merged commit f0868ec into main Sep 17, 2026
2 checks passed
@Shougo
Shougo deleted the copilot/implement-dictionary-lazy-parsing branch September 17, 2026 11:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants