Skip to content

Conversation

lambdalisue
Copy link
Member

@lambdalisue lambdalisue commented Aug 24, 2025

Summary

This PR updates the Denops documentation to recommend using workspace configuration with deno.jsonc for managing dependencies, based on the pattern established in vim-fall/fall.vim#42.

Why this change is needed

  • When multiple Denops plugins are installed, they are merged into a single runtime directory
  • Root-level deno.json files would conflict between plugins
  • Plugin-specific directories under denops/ remain unique, preventing conflicts
  • Workspace configuration enables development tools (deno fmt, deno lint) to work from the project root

Changes

Documentation Structure Updates

  • ✅ Updated introduction to emphasize modern dependency management
  • ✅ Revised Getting Started guide with workspace setup
  • ✅ Added comprehensive explanation of development vs runtime configuration
  • ✅ Updated all tutorial examples (Hello World and Maze)

Key Improvements

  • 📁 Clear separation: root deno.jsonc for development, plugin deno.jsonc for runtime
  • 📝 All examples now use import maps instead of direct URL imports
  • 🔧 Added examples of development configuration (lint, fmt, test)
  • 📚 Documented support for import_map.json(c) as an alternative
  • ⚡ Explained differences between deno.json imports and Import Maps Standard

Example Structure

plugin-root/
├── deno.jsonc          # Development config (workspace, lint, fmt)
└── denops/
    └── plugin-name/
        ├── deno.jsonc  # Runtime dependencies (import maps)
        └── main.ts

Testing

  • Verified all code examples are syntactically correct
  • Confirmed import map examples follow correct format
  • Checked that directory structures match recommended patterns

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Updated docs and examples to modern imports (bumped to @denops/std v8 / bare module names) and added dependency-management guidance.
    • Added a "Managing dependencies" tutorial and deno.jsonc/import map examples for workspace and plugin runtimes.
    • Revised Hello World and Maze guides with enhanced samples (including an async dispatcher hello method) and clarified setup, import sources, and project layout to avoid plugin conflicts.

Copy link

coderabbitai bot commented Aug 24, 2025

Walkthrough

Documentation updates standardize imports to bare module aliases and import maps, add root and per-plugin deno.jsonc examples, adjust tutorial code samples to use @denops/std/@core/unknownutil/maze_generator, and expand example main.ts with a simple async dispatcher hello method and dependency-management guidance.

Changes

Cohort / File(s) Summary of Changes
Getting-started and docs overview
src/getting-started/README.md, src/getting-started/explanation.md, src/SUMMARY.md, src/tutorial/helloworld/managing-dependencies.md
Updated examples and prose to recommend import maps and deno.jsonc; added managing-dependencies doc and SUMMARY entry; README example updated to show async denops.dispatcher.hello() echo and to recommend using import maps instead of direct URLs.
Hello World tutorial examples
src/tutorial/helloworld/adding-an-api.md, src/tutorial/helloworld/calling-vim-features.md, src/tutorial/helloworld/creating-a-minimal-denops-plugin.md
Bumped import specifiers from jsr:@denops/std@^7.0.0jsr:@denops/std@^8.0.0 or @denops/std in examples; added dependency-management guidance in Next Steps.
Maze tutorial and related files
src/tutorial/maze/... (adjusting-maze-size-to-fit-the-window.md, creating-applicative-plugin.md, outputting-content-to-buffer.md, properly-configured-the-buffer.md, properly-create-a-virtual-buffer.md, reduce-the-number-of-rpc-calls.md, utilizing-third-party-library.md)
Replaced legacy jsr:/npm: specifiers with bare aliases (@denops/std, @denops/std/*, maze_generator, @core/unknownutil), added deno.jsonc workspace/runtime examples, updated imports and small example adjustments (opener arg, buffer setup) without changing runtime logic.
Introduction copy
src/introduction.md
Replaced dependency-management bullet with a “Modern dependency management” paragraph describing import maps and per-plugin workspace isolation; text-only change.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant Vim
  participant DenopsPlugin as Denops Plugin (main.ts)
  participant DenopsRuntime as denops API

  note over DenopsPlugin,DenopsRuntime #DFF2E1: New/updated dispatcher method

  Vim->>DenopsPlugin: call "hello" RPC
  DenopsPlugin->>DenopsRuntime: denops.dispatcher.hello()
  DenopsRuntime-->>DenopsPlugin: await
  DenopsPlugin->>DenopsRuntime: denops.call('denops#api#echo', "Hello, Denops!")
  DenopsRuntime-->>Vim: show message "Hello, Denops!"
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

I hopped through docs with a tidy little grin,
Swapped messy URLs for maps tucked within.
A dispatcher wave, “Hello!” sent on cue,
Mazes and buffers now find paths anew.
Carrots for configs — clean imports, whoo-hoo! 🥕✨

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch update-denops-docs-import-maps

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 9

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
src/tutorial/maze/creating-applicative-plugin.md (3)

58-61: Optional opener currently crashes; make the parameter optional and validate correctly.

assert(opener, is.String) rejects undefined, contradicting the “optional argument” claim. Also compute the command once.

-    async maze(opener) {
-      assert(opener, is.String);
+    async maze(opener?: unknown) {
+      if (opener != null) {
+        assert(opener, is.String);
+      }
...
-      await batch(denops, (denops) => {
-        await denops.cmd(opener || "new");
+      await batch(denops, async (denops) => {
+        const cmd = typeof opener === "string" ? opener : "new";
+        await denops.cmd(cmd);

Also applies to: 69-71


60-67: Use window size, not screen size; ensure integer dimensions.

op.columns/op.lines are global and don’t reflect the current window. Prefer fn.winwidth(0)/fn.winheight(0) and convert to sensible integers.

-      const [xSize, ySize] = await collect(denops, (denops) => [
-        op.columns.get(denops),
-        op.lines.get(denops),
-      ]);
-      const maze = new Maze({
-        xSize: xSize / 3,
-        ySize: ySize / 3,
-      }).generate();
+      const [winWidth, winHeight] = await collect(denops, (denops) => [
+        fn.winwidth(denops, 0),
+        fn.winheight(denops, 0),
+      ]);
+      const maze = new Maze({
+        xSize: Math.max(2, Math.floor(winWidth / 3)),
+        ySize: Math.max(2, Math.floor(winHeight / 3)),
+      }).generate();

69-78: Make the batch callback async.

You’re using await inside the batch callback but the callback itself isn’t async. This would throw.

-      await batch(denops, (denops) => {
+      await batch(denops, async (denops) => {
🧹 Nitpick comments (23)
src/tutorial/maze/properly-configured-the-buffer.md (1)

24-26: Prefer integer sizes and clamp to a minimum of 1

winwidth()/winheight() return numbers; Maze dimensions should be integers and positive. Floating values may be implicitly coerced or cause unexpected behavior on library updates.

Apply:

-        xSize: winWidth / 3,
-        ySize: winHeight / 3,
+        xSize: Math.max(1, Math.floor(winWidth / 3)),
+        ySize: Math.max(1, Math.floor(winHeight / 3)),
src/introduction.md (1)

21-24: Cross-link “Modern dependency management” to the Getting Started section

This is a great high-level summary. Consider linking to the new workspace/import-map guide so readers can immediately jump to the concrete setup.

For example, append: “See Getting Started → Managing Dependencies with Workspace and Import Maps” (use the appropriate relative link in this repo/site).

src/tutorial/maze/outputting-content-to-buffer.md (1)

29-29: Consistency: command should be :Maze (with colon)

Elsewhere the docs use :Maze. Use the same form here to avoid confusion for new Vim users.

-Restart Vim, rerun the `Maze` command, and then you can see:
+Restart Vim, rerun the `:Maze` command, and then you can see:
src/tutorial/maze/adjusting-maze-size-to-fit-the-window.md (2)

23-25: Use integer sizes and clamp to ≥ 1

Same rationale as other pages: avoid fractional or zero dimensions.

-        xSize: winWidth / 3,
-        ySize: winHeight / 3,
+        xSize: Math.max(1, Math.floor(winWidth / 3)),
+        ySize: Math.max(1, Math.floor(winHeight / 3)),

53-54: Align documentation link versioning with the new import strategy

The link pins @denops/std@7.0.0 docs while the code uses unpinned, map-based imports. Consider either:

  • Linking to a version-agnostic docs page, or
  • Explicitly noting that the linked docs are for v7.
-[function module of @denops/std API document](https://jsr.io/@denops/std@7.0.0/doc/function/~)
+[function module of @denops/std API document](<version-agnostic-or-latest-doc-url>)

If a stable unversioned URL is not available, add “(v7 docs)” after the link text.

src/tutorial/maze/properly-create-a-virtual-buffer.md (1)

26-28: Round and clamp the maze dimensions

Make xSize/ySize integers and ≥ 1 to avoid edge-case failures in tiny windows.

-        xSize: winWidth / 3,
-        ySize: winHeight / 3,
+        xSize: Math.max(1, Math.floor(winWidth / 3)),
+        ySize: Math.max(1, Math.floor(winHeight / 3)),
src/tutorial/maze/creating-applicative-plugin.md (3)

44-46: Tighten wording: “non-file readonly buffer” → “non-file, read-only buffer”.

Small grammar polish to read more naturally.

- options to make it non-file readonly buffer, etc.
+ options to make it a non-file, read-only buffer, etc.

33-41: Prefer jsonc fence for a .jsonc example (consistency and tooling).

The block is titled deno.jsonc; use jsonc fence for clarity.

-```json,title=denops/denops-maze/deno.jsonc
+```jsonc,title=denops/denops-maze/deno.jsonc

91-92: Minor grammar fix: “each modules” → “each module”.

- about each modules.
+ about each module.
src/tutorial/maze/utilizing-third-party-library.md (2)

20-29: Add a language to the directory tree fence.

This satisfies MD040 and improves rendering.

-```
+```text
 ~/denops-maze
 ├── deno.jsonc
 ...

---

`53-61`: **Consider labeling as jsonc for consistency with .jsonc filename.**

No comments here, but keeping fences consistent helps readers.

```diff
-```json,title=denops/denops-maze/deno.jsonc
+```jsonc,title=denops/denops-maze/deno.jsonc
src/tutorial/maze/reduce-the-number-of-rpc-calls.md (2)

26-28: Round and clamp maze dimensions for robustness.

Maze typically expects integer sizes; ensure non-zero positive integers.

-        xSize: winWidth / 3,
-        ySize: winHeight / 3,
+        xSize: Math.max(2, Math.floor(winWidth / 3)),
+        ySize: Math.max(2, Math.floor(winHeight / 3)),

31-36: Optional: set buffer type/swapfile explicitly depending on buffer.open semantics.

If buffer.open(denops, "maze://") doesn’t already mark the buffer as nofile with no swap, consider adding:

       await batch(denops, async (denops) => {
         await buffer.replace(denops, bufnr, content.split(/\r?\n/g));
         await buffer.concrete(denops, bufnr);
+        await op.buftype.setLocal(denops, "nofile");
+        await op.swapfile.setLocal(denops, false);
         await op.bufhidden.setLocal(denops, "wipe");
         await op.modifiable.setLocal(denops, false);
       });
src/getting-started/explanation.md (1)

418-432: Be consistent: for deno.jsonc, a single @denops/std entry is sufficient; drop the @denops/std/ line.

   "imports": {
     "@denops/std": "jsr:@denops/std@^7.0.0",
-    "@denops/std/": "jsr:@denops/std@^7.0.0/",
     "@core/unknownutil": "jsr:@core/unknownutil@^4.3.0",
     "your-npm-lib": "npm:some-package@^1.0.0"
   }
src/tutorial/helloworld/calling-vim-features.md (1)

56-56: Add alt text to image for accessibility (MD045).

-![](./img/calling-vim-features-01.png)
+![Calling Vim features screenshot](./img/calling-vim-features-01.png)
src/tutorial/helloworld/adding-an-api.md (2)

8-15: Use jsonc fence for .jsonc examples to satisfy deno fmt and improve editor tooling

The snippet is a .jsonc file but the fence is labeled as json. Deno’s formatter and many editors rely on the correct fence to format/validate JSONC in Markdown.

Apply this diff:

-```json,title=denops/denops-helloworld/deno.jsonc
+```jsonc,title=denops/denops-helloworld/deno.jsonc
 {
   "imports": {
     "@denops/std": "jsr:@denops/std@^7.0.0",
     "@core/unknownutil": "jsr:@core/unknownutil@^4.3.0"
   }
 }

---

`49-51`: **Add language to Vim command fence (fixes MD040 and improves highlighting)**

Annotate the fence with `vim` to satisfy markdownlint and improve readability.

```diff
-```
+:```vim
 :echo denops#request("denops-helloworld", "hello", ["Your name"])

</blockquote></details>
<details>
<summary>src/getting-started/README.md (3)</summary><blockquote>

`13-21`: **Label the directory tree code block (fixes MD040)**

Add a language to the fence. `text` is fine for a static tree.

```diff
-```
+```text
 $HOME
 └── denops-getting-started
     ├── deno.jsonc
     └── denops
         └── denops-getting-started
             ├── deno.jsonc
             └── main.ts

---

`25-31`: **Use jsonc fence for .jsonc file content**

The example is `deno.jsonc`; label the fence `jsonc` for correct formatting.

```diff
-```json,title=deno.jsonc
+```jsonc,title=deno.jsonc
 {
   "workspace": [
     "./denops/denops-getting-started"
   ]
 }

---

`41-47`: **Same here: jsonc fence for plugin .jsonc**

Keep fence and filename extension consistent.

```diff
-```json,title=denops/denops-getting-started/deno.jsonc
+```jsonc,title=denops/denops-getting-started/deno.jsonc
 {
   "imports": {
     "@denops/std": "jsr:@denops/std@^7.0.0"
   }
 }

</blockquote></details>
<details>
<summary>src/tutorial/helloworld/creating-a-minimal-denops-plugin.md (3)</summary><blockquote>

`22-31`: **Add language to directory tree fence (fixes MD040)**

Label the fence as `text` for clarity and lint compliance.

```diff
-```
+```text
 denops-helloworld
 ├── deno.jsonc
 ├── denops
 │    └── denops-helloworld
 │           ├── deno.jsonc
 │           └── main.ts
 └── plugin
      └── denops-helloworld.vim

---

`35-50`: **Use jsonc fence for root deno.jsonc with comments**

The example includes comments and targets `.jsonc`; switch the fence to `jsonc` to align with tooling.

```diff
-```json,title=deno.jsonc
+```jsonc,title=deno.jsonc
 {
   "workspace": [
     "./denops/denops-helloworld"
   ],
   // Optional: Add development tools configuration
   "fmt": {
     "indentWidth": 2
   },
   "lint": {
     "rules": {
       "tags": ["recommended"]
     }
   }
 }

---

`54-60`: **Use jsonc fence for plugin deno.jsonc**

Keep language and filename extension consistent across docs.

```diff
-```json,title=denops/denops-helloworld/deno.jsonc
+```jsonc,title=denops/denops-helloworld/deno.jsonc
 {
   "imports": {
     "@denops/std": "jsr:@denops/std@^7.0.0"
   }
 }

</blockquote></details>

</blockquote></details>

<details>
<summary>📜 Review details</summary>

**Configuration used**: CodeRabbit UI

**Review profile**: CHILL

**Plan**: Pro

**💡 Knowledge Base configuration:**

- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 13390fadc324acb3e15b77a0bff5f24d8a3103e7 and 35b2af61c60fd494f844069413a1b68bb263f75d.

</details>

<details>
<summary>📒 Files selected for processing (13)</summary>

* `src/getting-started/README.md` (2 hunks)
* `src/getting-started/explanation.md` (3 hunks)
* `src/introduction.md` (1 hunks)
* `src/tutorial/helloworld/adding-an-api.md` (1 hunks)
* `src/tutorial/helloworld/calling-vim-features.md` (1 hunks)
* `src/tutorial/helloworld/creating-a-minimal-denops-plugin.md` (1 hunks)
* `src/tutorial/maze/adjusting-maze-size-to-fit-the-window.md` (1 hunks)
* `src/tutorial/maze/creating-applicative-plugin.md` (1 hunks)
* `src/tutorial/maze/outputting-content-to-buffer.md` (1 hunks)
* `src/tutorial/maze/properly-configured-the-buffer.md` (1 hunks)
* `src/tutorial/maze/properly-create-a-virtual-buffer.md` (1 hunks)
* `src/tutorial/maze/reduce-the-number-of-rpc-calls.md` (1 hunks)
* `src/tutorial/maze/utilizing-third-party-library.md` (1 hunks)

</details>

<details>
<summary>🧰 Additional context used</summary>

<details>
<summary>🪛 LanguageTool</summary>

<details>
<summary>src/introduction.md</summary>

[grammar] ~24-~24: There might be a mistake here.
Context: ...e Denops plugins are installed together. - **Simple and efficient code**:<br>Deno uti...

(QB_NEW_EN)

</details>
<details>
<summary>src/getting-started/explanation.md</summary>

[grammar] ~123-~123: There might be a mistake here.
Context: ...etailed information about the library at `https://jsr.io/@denops/std`.  Note that...

(QB_NEW_EN)

---

[grammar] ~334-~334: There might be a mistake here.
Context: ...3.0"   } } ```  This separation ensures: - Development tools like `deno fmt` and `d...

(QB_NEW_EN)

---

[grammar] ~372-~372: There might be a mistake here.
Context: ....jsonc` over `import_map.jsonc` because: > - It requires less verbose configuration >...

(QB_NEW_EN)

</details>
<details>
<summary>src/getting-started/README.md</summary>

[grammar] ~36-~36: There might be a mistake here.
Context: ...no test` to work from your project root. > You can add development-specific setti...

(QB_NEW_EN)

---

[grammar] ~74-~74: There might be a mistake here.
Context: ...configuration from runtime dependencies: > - **Root `deno.jsonc`**: Contains workspace ...

(QB_NEW_EN)

</details>
<details>
<summary>src/tutorial/helloworld/adding-an-api.md</summary>

[grammar] ~17-~17: There might be a mistake here.
Context: ...ain.ts` and rewrite the content with the following code:  ```typescript,title=den...

(QB_NEW_EN)

</details>
<details>
<summary>src/tutorial/maze/creating-applicative-plugin.md</summary>

[grammar] ~44-~44: There might be a mistake here.
Context: ...ccept the optional argument for a custom opener, generate a maze that fits the cu...

(QB_NEW_EN)

---

[grammar] ~45-~45: There might be a mistake here.
Context: ...urrent window size, configure the buffer options to make it non-file readonly buf...

(QB_NEW_EN)

---

[grammar] ~46-~46: There might be a mistake here.
Context: ...e, configure the buffer options to make it non-file readonly buffer, etc.  ```type...

(QB_NEW_EN)

</details>

</details>
<details>
<summary>🪛 markdownlint-cli2 (0.17.2)</summary>

<details>
<summary>src/getting-started/explanation.md</summary>

281-281: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

---

343-343: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>
<details>
<summary>src/tutorial/maze/utilizing-third-party-library.md</summary>

70-70: Images should have alternate text (alt text)

(MD045, no-alt-text)

</details>
<details>
<summary>src/tutorial/helloworld/creating-a-minimal-denops-plugin.md</summary>

22-22: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>
<details>
<summary>src/getting-started/README.md</summary>

13-13: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

</details>

</details>
<details>
<summary>🪛 GitHub Actions: Test</summary>

<details>
<summary>src/getting-started/explanation.md</summary>

[error] 239-241: Deno fmt --check detected formatting issues. Run 'deno fmt' to fix formatting.

</details>
<details>
<summary>src/tutorial/helloworld/creating-a-minimal-denops-plugin.md</summary>

[error] 19-19: Deno fmt --check detected formatting issues. Run 'deno fmt' to fix formatting.

</details>
<details>
<summary>src/getting-started/README.md</summary>

[error] 11-11: Deno fmt --check detected formatting issues. Run 'deno fmt' to fix formatting.

</details>
<details>
<summary>src/tutorial/helloworld/adding-an-api.md</summary>

[error] 6-6: Deno fmt --check detected formatting issues. Run 'deno fmt' to fix formatting.

</details>

</details>

</details>

<details>
<summary>🔇 Additional comments (16)</summary><blockquote>

<details>
<summary>src/tutorial/maze/properly-configured-the-buffer.md (1)</summary><blockquote>

`10-14`: **Confirm import-map entries for bare specifiers**

The imports now rely on bare specifiers (`@denops/std`, `@denops/std/*`, and `maze_generator`). Ensure the plugin-local deno.jsonc (runtime) includes matching `imports` mappings for these, and that the root workspace config does not shadow them.

If not already present in the tutorial flow, add a short reminder and a minimal snippet showing the expected mappings in `denops/<plugin-name>/deno.jsonc`.

</blockquote></details>
<details>
<summary>src/tutorial/maze/outputting-content-to-buffer.md (1)</summary><blockquote>

`10-11`: **Confirm import-map entry for `maze_generator`**

The example adopts a bare specifier (`maze_generator`). Make sure the prior steps already guided readers to add this mapping in the plugin’s `deno.jsonc` (runtime).

If not, add a brief “Before you start” note referencing the mapping to avoid “Cannot resolve module” errors when readers run the sample.

</blockquote></details>
<details>
<summary>src/tutorial/maze/adjusting-maze-size-to-fit-the-window.md (1)</summary><blockquote>

`11-13`: **Bare specifiers require runtime import-map entries**

As with the other Maze pages, confirm `@denops/std`, `@denops/std/function`, and `maze_generator` are mapped in the plugin-local `deno.jsonc`.

Consider adding a small “Dependencies” callout here to reinforce the requirement.

</blockquote></details>
<details>
<summary>src/tutorial/maze/properly-create-a-virtual-buffer.md (2)</summary><blockquote>

`13-16`: **Ensure import-map coverage for all bare specifiers**

Readers will need mappings for `@denops/std`, its subpaths, and `maze_generator` in the plugin’s `deno.jsonc`.

Suggest adding a short note and a minimal `imports` example inline or link to the Getting Started section.

---

`55-61`: **Great guidance on buffer.replace vs setline/setbufline**

Calling out modifiable/folding pitfalls and centralizing them in `buffer.replace` is exactly what readers need.

</blockquote></details>
<details>
<summary>src/tutorial/maze/creating-applicative-plugin.md (1)</summary><blockquote>

`49-55`: **Imports look good and consistent with the new import-map guidance.**

Using `@denops/std` and submodules via the import map aligns with the PR’s direction.

</blockquote></details>
<details>
<summary>src/tutorial/maze/utilizing-third-party-library.md (1)</summary><blockquote>

`71-84`: **Imports modernized correctly.**

Switched to import-map aliases (`@denops/std`, `maze_generator`) without altering behavior.

</blockquote></details>
<details>
<summary>src/tutorial/maze/reduce-the-number-of-rpc-calls.md (1)</summary><blockquote>

`9-15`: **Import path modernization LGTM.**

All denops std submodules and npm dep moved to import-map aliases as intended.

</blockquote></details>
<details>
<summary>src/getting-started/explanation.md (3)</summary><blockquote>

`109-120`: **Clear transition from URL imports to import-map alias LGTM.**

The example correctly shows `import type { Entrypoint } from "@denops/std";`.

---

`221-232`: **API usage example updated correctly.**

Using `@denops/std/function` gives typed results and aligns with the guidance.

---

`239-241`: **Action Required: Normalize Fenced Code Block Languages**

Please update the Markdown so that:

- JSON fences containing comments (`// …`) use `jsonc` instead of `json`.  
  - e.g. in `src/getting-started/explanation.md` around line 323, change  
    ```diff
    - ```json
    + ```jsonc
      // denops/your-plugin-name/deno.jsonc
      { …
    ```
- All code fences specify a language to satisfy MD040.  
  - Any standalone ````` lines (no language) in your tutorials (e.g. in `src/tutorial/.../*.md`) should be updated to the correct language label (`bash`, `ts`, `jsonc`, etc.).

Once updated, re-run your formatter/linter checks (e.g. `deno fmt --check` and your markdown linter) to confirm all failures are resolved.

</blockquote></details>
<details>
<summary>src/tutorial/helloworld/calling-vim-features.md (1)</summary><blockquote>

`8-9`: **Import-path updates are correct.**

Switching to `@denops/std` and `@core/unknownutil` via import maps is consistent with the new guidance.

</blockquote></details>
<details>
<summary>src/tutorial/helloworld/adding-an-api.md (1)</summary><blockquote>

`21-22`: **Imports via mapped specifiers look good**

Switching to `@denops/std` and `@core/unknownutil` through the import map aligns with the new guidance.

</blockquote></details>
<details>
<summary>src/getting-started/README.md (1)</summary><blockquote>

`61-61`: **LGTM on import mapping usage in code sample**

`import type { Entrypoint } from "@denops/std";` matches the import map and new guidance.

</blockquote></details>
<details>
<summary>src/tutorial/helloworld/creating-a-minimal-denops-plugin.md (2)</summary><blockquote>

`65-70`: **TS snippet aligns with mapped imports**

`Entrypoint` import via `@denops/std` matches the plugin `deno.jsonc`. Looks good.

---

`19-31`: **Fix Markdown formatting and run `deno fmt` locally**

Please address the following lint and formatting issues in `src/tutorial/helloworld/creating-a-minimal-denops-plugin.md` and then re-run `deno fmt`/`deno fmt --check` on your machine (with Deno installed):

- Remove the trailing space at line 19.  
- Specify a language for fenced code blocks (e.g., change ``` to ```text) at line 22.  
- Provide alt text for the image at line 83.  
- Repeat these fixes for the other code-block sections (lines 35–50, 54–60, 65–70).  
- After applying the above, run:
  ```shell
  deno fmt
  deno fmt --check

to confirm there are no remaining formatter errors.

@lambdalisue lambdalisue force-pushed the update-denops-docs-import-maps branch 2 times, most recently from 98977dd to a38135e Compare August 24, 2025 06:35
@lambdalisue lambdalisue marked this pull request as draft August 24, 2025 06:39
@lambdalisue lambdalisue force-pushed the update-denops-docs-import-maps branch 8 times, most recently from 71f1955 to c505d97 Compare August 24, 2025 07:01
…ement

This commit restructures the documentation to present dependency management
more appropriately:

Key changes:
- Keep Getting Started simple with direct URL imports
- Add note in Getting Started pointing to tutorials for import maps
- Create new tutorial section "Managing Dependencies" explaining import maps
- Move all detailed import map explanations to the tutorial
- Revert Hello World tutorial to use direct URL imports
- Keep Maze tutorial using import maps as an advanced example

Structure improvements:
- Getting Started: Simple direct imports for beginners
- Tutorial: Dedicated section explaining the recommended approach
- Clear progression from simple to advanced patterns

The documentation now properly guides users:
1. Start simple with direct URL imports
2. Learn about import maps in the dedicated tutorial section
3. Apply import maps in real projects (Maze tutorial)

Technical notes:
- Import map features require Denops v8.0.0+
- Use @denops/std@^8.0.0 in import map examples
- Use @denops/std@^7.0.0 in direct import examples

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
@lambdalisue lambdalisue force-pushed the update-denops-docs-import-maps branch from c505d97 to 922baeb Compare August 24, 2025 07:02
- Fix title=denops/denops-helloworld/main.ts to title=denops/denops-maze/main.ts
- Ensure consistency in filepath references within maze tutorial
@lambdalisue lambdalisue marked this pull request as ready for review August 24, 2025 07:08
@lambdalisue lambdalisue mentioned this pull request Aug 24, 2025
17 tasks
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: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
src/tutorial/maze/creating-applicative-plugin.md (1)

48-78: Fix await-in-non-async callback; allow optional opener; ensure integer sizes

  • The batch callback uses await but isn’t async — this is a syntax error.
  • The opener argument is documented as optional; validate as optional and default to "new".
  • Use integer sizes for the maze (floor); fractional sizes may cause unexpected behavior.
 import type { Entrypoint } from "@denops/std";
 import { batch, collect } from "@denops/std/batch";
 import * as fn from "@denops/std/function";
 import * as op from "@denops/std/option";
 import { Maze } from "maze_generator";
 import { assert, is } from "@core/unknownutil";

 export const main: Entrypoint = (denops) => {
   denops.dispatcher = {
     async maze(opener) {
-      assert(opener, is.String);
+      // opener is optional; when omitted, open a new window
+      assert(opener, is.OptionalOf(is.String));
       const [xSize, ySize] = await collect(denops, (denops) => [
         op.columns.get(denops),
         op.lines.get(denops),
       ]);
       const maze = new Maze({
-        xSize: xSize / 3,
-        ySize: ySize / 3,
+        xSize: Math.max(2, Math.floor(xSize / 3)),
+        ySize: Math.max(2, Math.floor(ySize / 3)),
       }).generate();
       const content = maze.getString();
-      await batch(denops, (denops) => {
-        await denops.cmd(opener || "new");
+      await batch(denops, async (denops) => {
+        const openCmd = opener && opener.length > 0 ? opener : "new";
+        await denops.cmd(openCmd);
         await op.modifiable.setLocal(denops, true);
         await fn.setline(denops, 1, content.split(/\r?\n/g));
         await op.bufhidden.setLocal(denops, "wipe");
         await op.buftype.setLocal(denops, "nofile");
         await op.swapfile.setLocal(denops, false);
         await op.modifiable.setLocal(denops, false);
         await op.modified.setLocal(denops, false);
       });
     },
   };
 };
♻️ Duplicate comments (2)
src/getting-started/README.md (2)

14-20: Add a fence language for the directory tree (MD040)

Specify a language for the tree block to satisfy markdownlint and improve rendering.

-```
+```text
 $HOME
 └── denops-getting-started
     └── denops
         └── denops-getting-started
             └── main.ts

---

`67-67`: **Provide alt text for the image (MD045)**

Add descriptive alt text to meet accessibility and markdownlint guidance.



```diff
-![](./img/README-01.png)
+![Screenshot showing :call denops#request hello output](./img/README-01.png)
🧹 Nitpick comments (4)
src/introduction.md (1)

21-24: Clarify what provides isolation vs. tooling; tighten phrasing

Isolation comes from per-plugin import maps (denops//deno.jsonc), while a root workspace deno.jsonc mainly helps tooling. Suggest rewording to avoid implying the workspace config itself isolates dependencies.

-**Modern dependency management**:<br>Deno's built-in dependency system with
-  import maps provides clean, maintainable dependency management. The workspace
-  configuration ensures each plugin's dependencies are isolated, preventing
-  conflicts when multiple Denops plugins are installed together.
+**Modern dependency management**:<br>Deno’s import maps provide clean, maintainable
+dependency management. Per‑plugin `denops/<plugin>/deno.jsonc` keeps dependencies
+isolated, while a root `deno.jsonc` with a workspace streamlines tooling (fmt/lint/test)
+without causing cross‑plugin conflicts.
src/tutorial/helloworld/managing-dependencies.md (3)

49-55: Use jsonc for code fences containing comments

These blocks include comments, so jsonc is the correct fence language for accurate highlighting and to avoid confusion.

-```json
+```jsonc
 {
   "workspace": [
     "./denops/denops-helloworld"
   ]
 }

64-71: Use jsonc fence (comments present) and consider pinning unknownutil to the exact major range you intend

The block contains comments later and maps JS/TS deps. Prefer jsonc. The versions look fine; ensure they match the rest of the docs.

-```json
+```jsonc
 {
   "imports": {
     "@denops/std": "jsr:@denops/std@^8.0.0",
     "@core/unknownutil": "jsr:@core/unknownutil@^4.3.0"
   }
 }

14-23: Add fence languages for non-code blocks (MD040)

These are directory trees; add a language like text.

-```
+```text
 # Multiple plugins installed:
 ~/.vim/pack/plugins/start/plugin-a/
 ├── deno.jsonc              # Could conflict
 └── denops/plugin-a/        # Always unique
 ...
-```
+```text
 denops-helloworld/
 ├── deno.jsonc                    # Development configuration
 ├── denops/
 │   └── denops-helloworld/
 │       ├── deno.jsonc           # Runtime dependencies
 │       └── main.ts
 └── plugin/
     └── denops-helloworld.vim

Also applies to: 34-43

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 35b2af6 and a6b3b3c.

📒 Files selected for processing (15)
  • src/SUMMARY.md (1 hunks)
  • src/getting-started/README.md (2 hunks)
  • src/getting-started/explanation.md (3 hunks)
  • src/introduction.md (1 hunks)
  • src/tutorial/helloworld/adding-an-api.md (1 hunks)
  • src/tutorial/helloworld/calling-vim-features.md (2 hunks)
  • src/tutorial/helloworld/creating-a-minimal-denops-plugin.md (1 hunks)
  • src/tutorial/helloworld/managing-dependencies.md (1 hunks)
  • src/tutorial/maze/adjusting-maze-size-to-fit-the-window.md (1 hunks)
  • src/tutorial/maze/creating-applicative-plugin.md (1 hunks)
  • src/tutorial/maze/outputting-content-to-buffer.md (1 hunks)
  • src/tutorial/maze/properly-configured-the-buffer.md (1 hunks)
  • src/tutorial/maze/properly-create-a-virtual-buffer.md (1 hunks)
  • src/tutorial/maze/reduce-the-number-of-rpc-calls.md (1 hunks)
  • src/tutorial/maze/utilizing-third-party-library.md (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (10)
  • src/getting-started/explanation.md
  • src/tutorial/maze/properly-configured-the-buffer.md
  • src/tutorial/helloworld/creating-a-minimal-denops-plugin.md
  • src/tutorial/maze/outputting-content-to-buffer.md
  • src/tutorial/maze/utilizing-third-party-library.md
  • src/tutorial/maze/reduce-the-number-of-rpc-calls.md
  • src/tutorial/maze/properly-create-a-virtual-buffer.md
  • src/tutorial/helloworld/adding-an-api.md
  • src/tutorial/maze/adjusting-maze-size-to-fit-the-window.md
  • src/tutorial/helloworld/calling-vim-features.md
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: 2024-11-26T05:28:34.278Z
Learnt from: whtsht
PR: vim-denops/denops-documentation#17
File: src/tutorial/helloworld/calling-vim-features.md:63-63
Timestamp: 2024-11-26T05:28:34.278Z
Learning: README.mdを指定するとスタイルが反映されないため、`src/tutorial/helloworld/calling-vim-features.md`内の`Maze`チュートリアルへのリンクは`../../tutorial/maze/index.html`を使用する。

Applied to files:

  • src/SUMMARY.md
🪛 LanguageTool
src/getting-started/README.md

[grammar] ~38-~38: There might be a mistake here.
Context: ...for simplicity. The recommended approach > for managing dependencies is to use `d...

(QB_NEW_EN)


[grammar] ~39-~39: There might be a mistake here.
Context: ...use deno.jsonc with import maps, which > you'll learn about in the [tutorials](...

(QB_NEW_EN)

src/introduction.md

[grammar] ~24-~24: There might be a mistake here.
Context: ...e Denops plugins are installed together. - Simple and efficient code:
Deno uti...

(QB_NEW_EN)

src/tutorial/helloworld/managing-dependencies.md

[grammar] ~4-~4: There might be a mistake here.
Context: ...rks, the recommended approach for Denops plugins (v8.0.0+) is to use import maps ...

(QB_NEW_EN)


[grammar] ~5-~5: There might be a mistake here.
Context: ...s with deno.jsonc for cleaner and more maintainable dependency management. ## ...

(QB_NEW_EN)


[grammar] ~11-~11: There might be a mistake here.
Context: ...a unique directory name under denops/, but root-level configuration files could...

(QB_NEW_EN)


[grammar] ~25-~25: There might be a mistake here.
Context: ...eature that combines plugin directories, but even without merging, placing config...

(QB_NEW_EN)


[grammar] ~26-~26: There might be a mistake here.
Context: ...g configuration files in plugin-specific directories (denops/plugin-name/) ensu...

(QB_NEW_EN)


[grammar] ~27-~27: There might be a mistake here.
Context: ...res no conflicts can occur regardless of how plugins are installed or managed. #...

(QB_NEW_EN)


[grammar] ~57-~57: There might be a mistake here.
Context: ...t, deno lint, and deno test` to work from your project root and discover your...

(QB_NEW_EN)


[grammar] ~91-~91: There might be a mistake here.
Context: ...c)` files, but they require more verbose configuration due to the [Import Maps St...

(QB_NEW_EN)


[grammar] ~92-~92: There might be a mistake here.
Context: ...re more verbose configuration due to the [Import Maps Standard](https://github.co...

(QB_NEW_EN)


[grammar] ~106-~106: There might be a mistake here.
Context: ...e details about the differences, see the [Deno documentation](https://docs.deno.c...

(QB_NEW_EN)


[grammar] ~111-~111: There might be a mistake here.
Context: ...ops v8.0.0 or later. For older versions, > continue using direct URL imports. ##...

(QB_NEW_EN)

src/tutorial/maze/creating-applicative-plugin.md

[grammar] ~31-~31: There might be a mistake here.
Context: ...e/deno.jsonc` to include the unknownutil dependency: ```json,title=denops/denops...

(QB_NEW_EN)


[grammar] ~44-~44: There might be a mistake here.
Context: ...ccept the optional argument for a custom opener, generate a maze that fits the cu...

(QB_NEW_EN)


[grammar] ~45-~45: There might be a mistake here.
Context: ...urrent window size, configure the buffer options to make it non-file readonly buf...

(QB_NEW_EN)


[grammar] ~46-~46: There might be a mistake here.
Context: ...e, configure the buffer options to make it non-file readonly buffer, etc. ```type...

(QB_NEW_EN)

🪛 markdownlint-cli2 (0.17.2)
src/tutorial/helloworld/managing-dependencies.md

14-14: Fenced code blocks should have a language specified

(MD040, fenced-code-language)


34-34: Fenced code blocks should have a language specified

(MD040, fenced-code-language)

🔇 Additional comments (4)
src/SUMMARY.md (1)

13-13: Additions look good; link path is consistent with new doc

The new “Managing dependencies” entry correctly points to ./tutorial/helloworld/managing-dependencies.md and matches the PR’s structure changes.

src/getting-started/README.md (1)

25-33: Update to std v8 looks good; sample API usage is correct

The import bump to jsr:@denops/std@^8.0.0 and the async hello() dispatcher are consistent with v8 usage.

src/tutorial/helloworld/managing-dependencies.md (1)

109-113: Version gating statement may be misleading—please verify

Import maps are a Deno feature. What likely requires v8+ is the @denops/std package structure and exported subpaths used in examples. Please confirm whether this should say “@denops/std v8.0.0+” (and optionally the minimum Deno version), rather than “Denops v8.0.0+.”

-> Import map features require Denops v8.0.0 or later. For older versions,
+> These examples assume @denops/std v8.0.0 or later. For older versions,
 > continue using direct URL imports.
src/tutorial/maze/creating-applicative-plugin.md (1)

31-42: Dependency mapping looks good

The per‑plugin deno.jsonc mapping for @denops/std, @core/unknownutil, and maze_generator aligns with the import style used below.

@lambdalisue lambdalisue merged commit d0c8a62 into main Aug 24, 2025
2 checks passed
@lambdalisue lambdalisue deleted the update-denops-docs-import-maps branch August 24, 2025 11:06
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