Skip to content

"View title cannot contain newlines" with implicitViews (v1.50) on large projects #2672

@shelepovg

Description

@shelepovg

Relates to

LikeC4 Language

Version you are using

1.50.0

Describe the issue

Summary

After the introduction of the implicitViews option in LikeC4 extension v1.50, the Diagram Preview fails on larger projects with the error "View title cannot contain newlines". Setting implicitViews: false in the project config resolves the error and views build correctly. On smaller projects, implicit views work as expected.

Environment

  • Extension: LikeC4 VSCode 1.50.0
  • Config: implicitViews present in schema (defaults to true when not set)

Steps to reproduce

  1. Use a LikeC4 project with a substantial number of elements and without setting implicitViews (relying on default).
  2. Open the project in VS Code with the LikeC4 extension v1.50.
  3. Open Diagram Preview.

Actual behavior

  • Preview shows: "Oops, something went wrong."

  • Error message: "Request likec4/fetchComputedModel failed with message: View title cannot contain newlines."

  • Same error appears for likec4/layout-view and other requests.

  • Logs (Output → LikeC4):

    request 'fetchComputedModel' of 'system' failed after 1.2s
    Request likec4/fetchComputedModel failed with message: View title cannot contain newlines
    

Workaround

Set implicitViews: false in the project config (e.g. .likec4rc or likec4.config.json):

{
  "implicitViews": false
}

After that, views build normally and the error disappears.

Project scale (affected project)

Rough counts from the project where the bug appears:

Metric Count
LikeC4 source files 114
Elements 526
Relations 1328
Extends 148
Views 269
Deployment instances 380

On a smaller project, implicit views and auto-generation work correctly.

Root cause (hypothesis)

Implicit views are generated with a title derived from element titles (Auto / ${element.title ?? fqn}). If an element’s title contains newlines (e.g. multi-line or markdown in the DSL), the generated view title contains newlines. Later, view path/title handling (e.g. in view-title-path.ts) enforces that view titles must not contain newlines and throws, breaking the computed model and layout.

Proposed change

Change the semantics of implicitViews so that auto-generated implicit views are only enabled when the option is set explicitly in the config.

  • Current behaviour: implicitViews defaults to true when omitted → implicit views are created for all elements without explicit views, which can trigger the newline error when element titles contain newlines.
  • Desired behaviour: Implicit views are created only when implicitViews is explicitly set to true in the project config. When the option is absent (or set to false), do not auto-generate implicit views.

This would:

  1. Avoid breaking existing large projects that rely on the previous behaviour (no implicit views) and may have multi-line element titles.
  2. Keep the feature available for projects that opt in with implicitViews: true.
  3. Align with “enable only when explicitly configured” for a feature that can be sensitive to content (e.g. titles with newlines).

References

  • Config schema: packages/config/src/schema.ts (lines 103–107) — implicitViews optional, described as “Defaults to true”.
  • Error origin: View title cannot contain newlines is thrown from view title/path handling (e.g. packages/core view-title-path utilities).
  • Related: PR #2648 — auto-generate scoped views, configurable via implicitViews (enabled by default).

If possible, include link to the playground with example

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions