Skip to content

Conversation

Shougo
Copy link
Contributor

@Shougo Shougo commented Sep 23, 2025

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
    • Updated caching to process each entry individually rather than in batches.
    • Applies the reload option per file for more granular control.
    • Preserves existing user-facing messages, including final update notifications.

Copy link

coderabbitai bot commented Sep 23, 2025

Walkthrough

Refactors denops#cache#update to iterate over each entry file and invoke deno cache per file with optional --reload, starting and awaiting a Denops job per iteration. Removes batched invocation and final combined wait; retains final success/update messaging.

Changes

Cohort / File(s) Summary
Per-file cache update refactor
autoload/denops/cache.vim
Replace batched deno cache call with a loop over [s:mod] and plugin scripts; build args per entry file, start and await a Denops job for each, handle optional --reload per call, remove parallel batching and aggregate wait, keep final update message behavior.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Vim as Vim (denops#cache#update)
  participant Denops as Denops
  participant Deno as deno cache

  User->>Vim: denops#cache#update({reload?})
  Note over Vim: Build list: [s:mod] + plugin entry files

  loop For each entry file
    Vim->>Vim: Construct args (add --reload if requested)
    Vim->>Denops: start job (deno cache <entryfile>)
    Denops->>Deno: deno cache <entryfile>
    Deno-->>Denops: exit status
    Denops-->>Vim: job done
  end

  Vim-->>User: Echo final update message
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested reviewers

  • kuuote

Poem

Hop by hop, I cache each file,
No more herds—just single mile.
Deno hums, jobs queue in line,
One nibble each, efficiency fine.
Thump-thump logs, carrots compile—
Update done; I twitch and smile. 🥕🐇

Pre-merge checks and finishing touches

✅ Passed checks (3 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()" clearly names the function being changed and succinctly conveys the author's intent to fix a bug; it matches the changeset which refactors denops#cache#update() to iterate per-entry file to address import errors. The phrasing is concise and specific enough for a teammate scanning history.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix_deno_cache_update

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

codecov bot commented Sep 23, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.75%. Comparing base (a278b83) to head (b648ed2).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #461   +/-   ##
=======================================
  Coverage   96.75%   96.75%           
=======================================
  Files          11       11           
  Lines         924      924           
  Branches      143      143           
=======================================
  Hits          894      894           
  Misses         27       27           
  Partials        3        3           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a278b83 and b648ed2.

📒 Files selected for processing (1)
  • autoload/denops/cache.vim (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
  • GitHub Check: test (macos-latest, 2.x, v9.1.1646, v0.11.3)
  • GitHub Check: test (ubuntu-latest, 2.x, v9.1.1646, v0.11.3)
  • GitHub Check: test (macos-latest, 2.3.0, v9.1.1646, v0.11.3)
  • GitHub Check: test (windows-latest, 2.x, v9.1.1646, v0.11.3)
  • GitHub Check: test (windows-latest, 2.3.0, v9.1.1646, v0.11.3)
🔇 Additional comments (5)
autoload/denops/cache.vim (5)

9-11: Message on non-reload path — LGTM.

Helpful guidance for forcing reload. No change needed.


13-15: Per‑file caching loop — LGTM.

Sequentializing isolates failures and matches the PR goal.


16-21: Argument construction — LGTM.

Simple and clear; per‑file --reload wiring is correct.


32-32: No-op change.

Nothing to flag here.


22-30: Handle per-file failures, respect each plugin’s cwd, and use string env values.

Failures/timeouts currently report success and per-plugin deno.json import-maps can be skipped because cwd isn't set; env values should be strings for job portability.

  • Initialize: let l:failures = [] before the loop.
  • In the loop when starting the job: add cwd: fnamemodify(l:entryfile, ':h') and make env values strings (e.g. '1').
  • Capture wait result: let l:done = denops#_internal#wait#for(60 * 1000, { -> s:job is# v:null }, 100).
  • If !l:done || s:last_status != 0 then call add(l:failures, l:entryfile).
  • At top-level: let s:last_status = 0 and update s:on_exit(job, status, event) to set s:last_status = a:status and let s:job = v:null.

This prevents false “success” and ensures each cache runs from the plugin directory so per‑plugin import‑maps are respected.

\})
call denops#_internal#wait#for(60 * 1000, { -> s:job is# v:null }, 100)

echomsg '[denops] Deno cache is updated.'
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Report failures instead of unconditional success.

End with an error summary when any file fails.

-  echomsg '[denops] Deno cache is updated.'
+  if empty(l:failures)
+    echomsg '[denops] Deno cache is updated.'
+  else
+    echohl WarningMsg
+    echomsg printf('[denops] Deno cache finished with errors: %d failure(s).', len(l:failures))
+    for l:f in l:failures
+      echomsg printf('[denops] failed: %s', l:f)
+    endfor
+    echohl None
+  endif
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
echomsg '[denops] Deno cache is updated.'
if empty(l:failures)
echomsg '[denops] Deno cache is updated.'
else
echohl WarningMsg
echomsg printf('[denops] Deno cache finished with errors: %d failure(s).', len(l:failures))
for l:f in l:failures
echomsg printf('[denops] failed: %s', l:f)
endfor
echohl None
endif
🤖 Prompt for AI Agents
In autoload/denops/cache.vim around line 33, the code unconditionally echoes a
success message; change it to collect failures during the caching loop (e.g.,
keep a list or counter of failed files when file operations return error), and
after the loop check that collection: if there are failures echoerr a concise
error summary including the failure count (and optionally the filenames) and
return a non-zero/false result, otherwise echomsg the success message; ensure
any error paths push the failed file info into the collection so the final
summary is accurate.

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.

1 participant