Fix denops#cache#update()
Use loop to fix import error like this.
[denops] Update cache of the following files. Call `denops#cache#update(#{reload: v:true})` to forcibly update.
[denops] /home/shougo/work/denops.vim/denops/@denops-private/mod.ts
[denops] /home/shougo/work/dpp.vim/denops/dpp/app.ts
[denops] /home/shougo/.cache/dpp/repos/github.com/lambdalisue/kensaku.vim/denops/kensaku/main.ts
[denops] /home/shougo/work/ddc.vim/denops/ddc/app.ts
[denops] /home/shougo/work/ddt.vim/denops/ddt/app.ts
[denops] /home/shougo/work/ddu.vim/denops/ddu/app.ts
[denops] Download https://jsr.io/@std/json/meta.json
[denops] Download https://jsr.io/@std/json/1.0.2_meta.json
[denops] Download https://jsr.io/@lambdalisue/workerio/4.0.1/types.ts
[denops] Download https://jsr.io/@std/json/1.0.2/types.ts
[denops] error: Relative import path "@core/unknownutil/is" not prefixed with / or ./ or ../ and not in import map from "file:///home/shougo/work/dpp.vim/denops/dpp/app.ts"
[denops] hint: If you want to use a JSR or npm package, try running `deno add jsr:@core/unknownutil/is` or `deno add npm:@core/unknownutil/is`
[denops] at file:///home/shougo/work/dpp.vim/denops/dpp/app.ts:21:20
[denops] Deno cache is updated.
Summary by CodeRabbit
-
Refactor
- Caching now processes each entry individually instead of one batch; each entry is handled and awaited separately.
- Per-entry reload option applied per file; progress messages shown per entry.
-
Bug Fixes
- Added per-run summary reporting failures and listing failed entries when any occur.
- Improved per-entry error reporting and clearer final success/failure notification.
Walkthrough
Replaces the batched deno cache invocation with a per-entry loop that builds args (optional --reload), starts and awaits a Denops job per entry, collects failures, updates on_exit signature, and prints a final success/failure summary listing failed entries.
Changes
| Cohort / File(s) | Summary |
|---|---|
Per-entry caching & failure collectionautoload/denops/cache.vim |
Replace single aggregated deno cache call with a loop over [s:mod] and plugin entry files; construct l:args per entry (add --reload when requested), start and wait a Denops job per entry, collect l:failures, change s:on_exit signature to s:on_exit(failures, entryfile, job, status, event), and print per-run success/failure summary listing failed entries. |
Sequence Diagram(s)
sequenceDiagram
autonumber
actor User
participant Vim as denops#cache#update()
participant Denops as denops job runner
participant Deno as deno
User->>Vim: call denops#cache#update(reload?)
Vim->>Vim: gather [s:mod] + plugin entry files
loop for each entryfile
Vim->>Vim: build l:args (add --reload if requested)
Vim->>Denops: start job: deno cache <entryfile> (env: NO_COLOR,DENO_NO_PROMPT)
Denops->>Deno: execute deno cache <entryfile>
Deno-->>Denops: exit status
Denops-->>Vim: s:on_exit(failures, entryfile, job, status, event)
Vim->>Vim: record failure if status != 0
end
alt any failures
Vim-->>User: echo warning with failed count and list of entries
else all succeeded
Vim-->>User: echo final success message
end
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~20 minutes
- Review
s:on_exitsignature change and ensure callers/closures match. - Verify failure collection and reported entry paths are correct and escaped.
- Confirm per-entry job lifecycle and environment isolation behave as intended.
Possibly related PRs
- vim-denops/denops.vim#367 — Modifies
autoload/denops/cache.vimand the caching flow; similar per-entry vs batched processing changes. - vim-denops/denops.vim#342 — Also updates
denops#cache#update()behavior and callbacks; directly related to this refactor.
Poem
Hop, one file at a time I go,
nibbling bytes where soft winds blow.
Deno hums, each job a bite,
I mark the ones that didn't bite.
Thump-thump, report — the patch is right. 🥕🐇
Pre-merge checks and finishing touches
❌ Failed checks (1 warning)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | ⚠️ Warning | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | You can run @coderabbitai generate docstrings to improve docstring coverage. |
✅ Passed checks (2 passed)
| Check name | Status | Explanation |
|---|---|---|
| Description Check | ✅ Passed | Check skipped - CodeRabbit’s high-level summary is enabled. |
| Title Check | ✅ Passed | The title "Fix denops#cache#update()" directly identifies the primary change in the pull request—modifications to the denops#cache#update() function to resolve an import error. The title is clear, specific, and properly identifies what was changed without using vague terminology. While the title does not detail the specific implementation change (switching from batch to per-entry processing), it appropriately communicates the main objective that a fix was applied to this function, which is sufficient for scanning commit history and understanding the primary change at a glance. |
✨ Finishing touches
🧪 Generate unit tests (beta)
- [ ] Create PR with unit tests
- [ ] Post copyable unit tests in a comment
- [ ] Commit unit tests in branch
fix_deno_cache_update
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 97.07%. Comparing base (5cfca39) to head (60709f4).
Additional details and impacted files
@@ Coverage Diff @@
## main #461 +/- ##
=======================================
Coverage 97.07% 97.07%
=======================================
Files 11 11
Lines 924 924
Branches 146 146
=======================================
Hits 897 897
Misses 24 24
Partials 3 3
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
I don't remember but do we still need this?
The error still exists. I will fix the conflict.
Fixed.
The key point of this change is not to ignore errors. By reloading modules one at a time, it avoids producing unnecessary errors.
Note: I'm not ignoring errors, just to be clear.
The key point of this change is not to ignore errors. By reloading modules one at a time, it avoids producing unnecessary errors.
Then I don’t understand why “reloading modules one at a time” solves the issue. Do you have any perspective on that? I’m just afraid that this “fix” might unintentionally conceal the actual bugs or behaviors of Deno.
I'm not very familiar with the details here either, but it's clear that reloading all the plugins at once causes them not to work properly. Each denops plugin is loading plugins independently via deno.jsonc, so they might be conflicting with each other.
As long as my understanding, this PR won't fix the issue while https://github.com/lambdalisue/deno-import-map-importer does nothing on deno cache. However, you said this PR fixes the issue so I want to know the mechanisms to accept this PR.
As long as my understanding, this PR won't fix the issue while https://github.com/lambdalisue/deno-import-map-importer does nothing on deno cache. However, you said this PR fixes the issue so I want to know the mechanisms to accept this PR.
The error occurs in a plugin that uses deno-import-map-importer, so I think they're related, but I don't know the exact reason myself.