Skip to content

fix(language-server): preserve metadata arrays when formatting#2944

Merged
davydkov merged 1 commit into
mainfrom
cgk/fix-2941-metadata-array-format
May 8, 2026
Merged

fix(language-server): preserve metadata arrays when formatting#2944
davydkov merged 1 commit into
mainfrom
cgk/fix-2941-metadata-array-format

Conversation

@ckeller42

Copy link
Copy Markdown
Collaborator

Fixes #2941.

Summary

  • Preserve metadata arrays when normalizing quotes in the LikeC4 formatter
  • Add a regression test for mixed-quote metadata arrays

Tests

  • pnpm generate
  • vitest run --no-isolate packages/language-server/src/formatting/LikeC4Formatter.spec.ts
  • pnpm --filter @likec4/language-server run typecheck

@changeset-bot

changeset-bot Bot commented May 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 7bf0b48

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 22 packages
Name Type
@likec4/language-server Patch
@likec4/playground Patch
@likec4/language-services Patch
likec4 Patch
@likec4/lsp Patch
@likec4/mcp Patch
@likec4/vite-plugin Patch
likec4-vscode Patch
@likec4/spa Patch
@likec4/docs-astro Patch
@likec4/style-preset Patch
@likec4/styles Patch
@likec4/config Patch
@likec4/core Patch
@likec4/diagram Patch
@likec4/generators Patch
@likec4/layouts Patch
@likec4/leanix-bridge Patch
@likec4/log Patch
@likec4/react Patch
@likec4/tsconfig Patch
@likec4/vscode-preview Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Comment thread packages/language-server/src/formatting/LikeC4Formatter.ts Fixed
@ckeller42

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ckeller42 ckeller42 force-pushed the cgk/fix-2941-metadata-array-format branch from 97ad39f to a59180f Compare May 8, 2026 14:31
@ckeller42

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack
No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4f9d883c-88fa-4f42-a83e-8d2155898b94

📥 Commits

Reviewing files that changed from the base of the PR and between a59180f and 7bf0b48.

📒 Files selected for processing (3)
  • .changeset/fix-metadata-array-format.md
  • packages/language-server/src/formatting/LikeC4Formatter.spec.ts
  • packages/language-server/src/formatting/LikeC4Formatter.ts
✅ Files skipped from review due to trivial changes (2)
  • .changeset/fix-metadata-array-format.md
  • packages/language-server/src/formatting/LikeC4Formatter.spec.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/language-server/src/formatting/LikeC4Formatter.ts

📝 Walkthrough

Walkthrough

This patch fixes a formatter bug in the language server where metadata attributes with array values were incorrectly converted to strings. The normalizeQuotes method now detects metadata attributes and conditionally formats array values or scalar values appropriately, preserving array structure while normalizing quotes.

Changes

Metadata Array Preservation in Formatter

Layer / File(s) Summary
Core Implementation Fix
packages/language-server/src/formatting/LikeC4Formatter.ts
normalizeQuotes method now checks if a metadata attribute value is an array and selects the formatting region from the array's values property for arrays, or falls back to scalar value formatting for non-array metadata.
Test Coverage
packages/language-server/src/formatting/LikeC4Formatter.spec.ts
New test case keeps metadata arrays as arrays verifies that a metadata block with tags as an array is formatted with array structure preserved and internal quotes normalized to single quotes.
Release Documentation
.changeset/fix-metadata-array-format.md
Changeset entry declares a patch version bump for @likec4/language-server documenting the fix for preserving metadata arrays in formatting.

🎯 2 (Simple) | ⏱️ ~8 minutes

Suggested reviewers:

  • davydkov
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely describes the main fix: preserving metadata arrays during formatting, which directly matches the primary change in the PR.
Description check ✅ Passed The description covers the main fix, includes a summary of changes, links to the issue, and documents the tests performed, aligning well with the provided template requirements.
Linked Issues check ✅ Passed The PR successfully addresses issue #2941 by modifying the formatter to preserve metadata arrays with mixed quoting, preventing them from being converted into single strings.
Out of Scope Changes check ✅ Passed All changes are directly related to fixing issue #2941: a formatter fix, a regression test, and a changesets entry, with no out-of-scope modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cgk/fix-2941-metadata-array-format

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


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.

Comment thread packages/language-server/src/formatting/LikeC4Formatter.ts Fixed
@ckeller42

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@ckeller42 ckeller42 marked this pull request as ready for review May 8, 2026 14:44
@ckeller42 ckeller42 requested a review from davydkov May 8, 2026 14:44
@ckeller42 ckeller42 force-pushed the cgk/fix-2941-metadata-array-format branch from a59180f to 7bf0b48 Compare May 8, 2026 14:49

@davydkov davydkov left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Great! Thank you!

@davydkov davydkov merged commit 1c70ea0 into main May 8, 2026
18 checks passed
@davydkov davydkov deleted the cgk/fix-2941-metadata-array-format branch May 8, 2026 15:01
@likec4-ci likec4-ci Bot mentioned this pull request May 8, 2026
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.

Formatting replaces metadata array with string

2 participants