Skip to content

fix(capture): preserve canvas tab indentation on configured writes#1125

Merged
chhoumann merged 1 commit intomasterfrom
fix/canvas-json-tab-indent
Feb 27, 2026
Merged

fix(capture): preserve canvas tab indentation on configured writes#1125
chhoumann merged 1 commit intomasterfrom
fix/canvas-json-tab-indent

Conversation

@chhoumann
Copy link
Copy Markdown
Owner

@chhoumann chhoumann commented Feb 27, 2026

Preserve Obsidian-style tab indentation when QuickAdd updates configured Canvas text nodes.

Configured Canvas writes currently serialize JSON with 2-space indentation, which rewrites whole .canvas files with whitespace-only diffs. This follow-up keeps serialization aligned with Obsidian’s tab-indented format to reduce diff noise and avoid unnecessary formatting churn.

Changes made:

  • switch configured canvas serialization from JSON.stringify(..., null, 2) to JSON.stringify(..., null, \"\t\")
  • add a regression assertion in canvasCapture.test.ts to ensure persisted output keeps tab indentation

Alternative considered:

  • preserving original file formatting dynamically (more complex and brittle for this targeted follow-up)

Reviewer context:

Refs #1124


Open with Devin

Summary by CodeRabbit

  • Style

    • Updated JSON indentation format in canvas data files to use tabs instead of spaces.
  • Tests

    • Added test assertions to validate the updated indentation format.

@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
quickadd Building Building Preview Feb 27, 2026 8:46pm

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 27, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a53f889 and f486817.

📒 Files selected for processing (2)
  • src/engine/canvasCapture.test.ts
  • src/engine/canvasCapture.ts

📝 Walkthrough

Walkthrough

The changes update JSON indentation formatting in canvas capture functionality from 2-space to tab characters, with corresponding test assertions added to verify this formatting change.

Changes

Cohort / File(s) Summary
Canvas Indentation Formatting
src/engine/canvasCapture.ts, src/engine/canvasCapture.test.ts
Modified JSON serialization to use tab indentation instead of 2 spaces when persisting canvas data. Added test assertions to verify tab-indented "nodes" array declaration and reject 2-space indentation.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Suggested labels

released

Poem

🐰 Tabs replace the spaces fine,
JSON nodes now align,
Indentation, neat and tight,
Canvas captures formatted right! ✨

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/canvas-json-tab-indent

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.

@chhoumann chhoumann marked this pull request as ready for review February 27, 2026 20:48
@chhoumann chhoumann merged commit 0a1578e into master Feb 27, 2026
4 of 5 checks passed
@chhoumann chhoumann deleted the fix/canvas-json-tab-indent branch February 27, 2026 20:48
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

github-actions Bot pushed a commit that referenced this pull request Mar 5, 2026
# [2.12.0](2.11.0...2.12.0) (2026-03-05)

### Bug Fixes

* **capture:** preserve canvas tab indentation on configured writes ([#1125](#1125)) ([0a1578e](0a1578e))
* disallow capture targets with .base extension ([cb39ed4](cb39ed4))
* **field-suggestions:** opt-in inline values from fenced code blocks ([#1128](#1128)) ([8597905](8597905))
* **gui:** preserve modal edit position during settings reload ([#1132](#1132)) ([11bda19](11bda19))
* **gui:** reduce ai settings modal reload churn ([#1134](#1134)) ([ae0f7a1](ae0f7a1))
* **gui:** reduce choice builder reload churn ([#1136](#1136)) ([818272a](818272a))
* **gui:** reduce macro settings modal reload churn ([#1135](#1135)) ([a1a6271](a1a6271))
* harden existing-tab matching and document issue workflow ([#1108](#1108)) ([7b12d3b](7b12d3b))
* make template path resolution deterministic ([3297d54](3297d54))
* normalize capture title for non-markdown targets ([964d672](964d672))
* preserve capture-format spacing for insert-at-end ([#1119](#1119)) ([8bb8ed4](8bb8ed4))
* preserve explicit capture target file extensions ([57e43ff](57e43ff))
* preserve insert-at-end order for non-newline captures ([#1120](#1120)) ([e7cbbf2](e7cbbf2))
* resolve template file-name paths without duplicate default folder ([7bfd41b](7bfd41b))
* resolve vault-relative template paths using root folders ([81216de](81216de))

### Features

* add AI request logging API and reduce assistant log noise ([#1110](#1110)) ([2c36800](2c36800))
* automate docs version snapshot during release ([#1111](#1111)) ([1571846](1571846))
* **capture:** fully support capture into canvas cards ([#1124](#1124)) ([a53f889](a53f889))
* **cli:** add native QuickAdd Obsidian CLI handlers ([#1129](#1129)) ([8102d47](8102d47))
* **format:** support mapped VALUE suggester display text ([#1127](#1127)) ([b8ec56c](b8ec56c))
* **macro:** add editor cursor navigation commands ([101d5f6](101d5f6))
* support .base template files for template choices ([11e6490](11e6490))

### Reverts

* **gui:** remove modal reload refactor series ([#1137](#1137)) ([3ba1a73](3ba1a73)), closes [#1136](#1136) [#1135](#1135) [#1134](#1134) [#1133](#1133) [#1132](#1132)
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 5, 2026

🎉 This PR is included in version 2.12.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant