Skip to content

Support addPath in Icon Generation#840

Merged
egorikftp merged 6 commits into
mainfrom
feature/addPathData-option
Feb 11, 2026
Merged

Support addPath in Icon Generation#840
egorikftp merged 6 commits into
mainfrom
feature/addPathData-option

Conversation

@t-regbs

@t-regbs t-regbs commented Feb 8, 2026

Copy link
Copy Markdown
Collaborator

Adds support for addPath in icon preview and adds a settings option for addPath for icon generation.
Closes #783

Screenshot 2026-02-08 at 03 11 52 Screenshot 2026-02-08 at 03 10 53 Screenshot 2026-02-08 at 03 08 32

Todo:

  • Support this feature for gradle plugin and cli (or create sub task for separate implementation)
  • Update IDEA plugin changelog

@coderabbitai

coderabbitai Bot commented Feb 8, 2026

Copy link
Copy Markdown

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

Walkthrough

A new boolean configuration flag usePathDataString was added and propagated through the image-vector generator, CLI, Gradle plugin, IDE settings, and related view models. Generator code now conditionally emits path data as pathData strings (via addPath/addPathNodes) or via existing builder calls; PSI parsing and parser support for pathData strings were added. Public constructors, config objects, APIs, tests, and resources were updated to include and validate this flag.

🚥 Pre-merge checks | ✅ 4 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.04% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'Support addPath in Icon Generation' accurately summarizes the main change - adding support for the addPath approach in icon code generation.
Description check ✅ Passed The description is related to the changeset, explaining the addition of addPath support in icon preview and a settings option for icon generation, with reference to issue #783.
Linked Issues check ✅ Passed The PR meets the requirements from issue #783: it adds support for pathData string generation (addPath/addPathNodes), exposes configuration options (usePathDataString flag), propagates settings across CLI, Gradle plugin, and IDEA plugin, and includes test coverage for the feature.
Out of Scope Changes check ✅ Passed All changes are in scope: core path data generation logic, configuration options across all tools (CLI, Gradle, IDEA plugin), test resources, and API definitions directly support the pathData feature from issue #783.

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

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/addPathData-option

Tip

Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord.


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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In
`@tools/cli/src/main/kotlin/io/github/composegears/valkyrie/cli/command/SvgXmlToImageVectorCommand.kt`:
- Line 242: Add a CLI boolean option for usePathDataString and thread it through
to the generator instead of hardcoding false: add a booleanOption(...) for
usePathDataString in SvgXmlToImageVectorCommand alongside the other options
(useComposeColors, addTrailingComma, useFlatPackage), update
SvgXmlToImageVectorCommand.run() to pass the parsed flag into
svgXml2ImageVector(...), and modify the svgXml2ImageVector function signature
and its call sites to accept and forward usePathDataString into the
ImageVectorGeneratorConfig construction (replace the hardcoded usePathDataString
= false with the new parameter).
🧹 Nitpick comments (4)
tools/gradle-plugin/src/main/kotlin/io/github/composegears/valkyrie/gradle/internal/task/GenerateImageVectorsTask.kt (1)

91-91: usePathDataString is hardcoded to false — consider exposing it as a configurable Gradle plugin option.

Unlike other generation options (useExplicitMode, addTrailingComma, etc.) which are backed by @Input properties, usePathDataString is hardcoded. This means Gradle plugin users cannot opt into path data string generation. If this is intentional for the initial rollout (IDE-only), a // TODO comment would help track the gap.

sdk/intellij/psi/imagevector/src/main/kotlin/io/github/composegears/valkyrie/sdk/intellij/psi/imagevector/common/KtCallExpression.kt (1)

78-87: Silent empty-list fallback on parse failure — consider whether this is acceptable.

When PathParser.parsePathString throws (Line 86), runCatching silently returns an empty path list. This means a malformed pathData string in the source file will produce an icon with no visible paths, with no indication of the parse error. The same silent-failure pattern applies to the early-return guards.

This is consistent with the other extract*/parse* functions in this file that return defaults on missing/invalid input, so it may be intentional. Just flagging in case logging the error or propagating it would be preferred for debuggability.

sdk/intellij/psi/imagevector/src/main/kotlin/io/github/composegears/valkyrie/sdk/intellij/psi/imagevector/parser/RegularImageVectorPsiParser.kt (2)

71-83: Consider using when or else if to avoid redundant checks.

The sequential if statements mean all three conditions are evaluated even after a match. A when expression would be more idiomatic and slightly more efficient, though this follows the existing pattern in the file.

♻️ Suggested refactor
     private fun KtCallExpression.parseVectorNode(): IrVectorNode? {
-        var node: IrVectorNode? = null
-        if (calleeExpression?.text == "path") {
-            node = parsePath()
-        }
-        if (calleeExpression?.text == "addPath") {
-            node = parseAddPath()
-        }
-        if (calleeExpression?.text == "group") {
-            node = parseGroup()
-        }
-        return node
+        return when (calleeExpression?.text) {
+            "path" -> parsePath()
+            "addPath" -> parseAddPath()
+            "group" -> parseGroup()
+            else -> null
+        }
     }

126-140: parseAddPath largely duplicates parsePath — consider extracting shared parameter parsing.

Both parseAddPath (lines 126–140) and parsePath (lines 107–124) construct IrVectorNode.IrPath with identical field extraction logic for all parameters except paths. A shared helper could reduce duplication, but this is manageable given the scope.

@t-regbs t-regbs requested a review from egorikftp February 8, 2026 03:25
@egorikftp

Copy link
Copy Markdown
Member

@t-regbs what about cli and gradle plugin?

@t-regbs

t-regbs commented Feb 10, 2026

Copy link
Copy Markdown
Collaborator Author

@t-regbs what about cli and gradle plugin?

will push changes adding that in a bit

Comment thread tools/idea-plugin/CHANGELOG.md
@t-regbs t-regbs force-pushed the feature/addPathData-option branch from 4285afa to 3f00101 Compare February 11, 2026 18:12
@egorikftp

Copy link
Copy Markdown
Member

Perfect!
Thanks for contribution ❤️

@egorikftp egorikftp merged commit ff4b5ac into main Feb 11, 2026
3 checks passed
@egorikftp egorikftp deleted the feature/addPathData-option branch February 11, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[EPIC] [SDK] Support pathData (addPath/addPathNodes) in icon generation

2 participants