Skip to content

Move :codeviewer into sdk, introduce :hightlights-core#807

Merged
egorikftp merged 1 commit intomainfrom
task/codeviewer-to-sdk
Jan 13, 2026
Merged

Move :codeviewer into sdk, introduce :hightlights-core#807
egorikftp merged 1 commit intomainfrom
task/codeviewer-to-sdk

Conversation

@egorikftp
Copy link
Copy Markdown
Member

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 13, 2026

Walkthrough

The PR moves codeviewer functionality into sdk/compose/codeviewer and adds sdk/compose/highlights-core. Several symbols were relocated: KotlinCodeViewer, CodeViewer, CodeEditor sources and imports updated to the new SDK packages. The module ABI was changed: CodeEditor entry was removed in some ABI dumps and CodeViewer, KotlinCodeViewer, and a new rememberCodeHighlight(codeBlock: String, isLight: Boolean, vararg ...) were introduced under the SDK package. getEmphasisLocations was moved to sdk/compose/highlights-core and Highlights.buildAnnotatedString() was made public.

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.69% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: moving the codeviewer module into the sdk directory and introducing a new highlights-core module, matching the substantial structural refactoring across the changeset.
Description check ✅ Passed The description references issue #592, which is related to the changeset but provides minimal context. While brief, it is not unrelated to the actual changes (module reorganization and refactoring).

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

✨ Finishing touches
  • 📝 Generate docstrings

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.

Copy link
Copy Markdown

@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

🤖 Fix all issues with AI agents
In
@sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/Common.kt:
- Around line 14-16: The remember call that creates the Highlights instance
omits the emphasisLocation vararg from its keys, so changes to emphasisLocation
won't trigger recomposition; include the emphasisLocation elements in the
remember keys (e.g., pass the vararg via spread into remember along with isLight
and codeBlock) so Highlights is rebuilt when emphasis locations change, and
reference the vararg name emphasisLocation and the remember(...) that returns
Highlights to locate where to update.

In
@tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/imagevectortoxml/conversion/ui/XmlCodeViewer.kt:
- Around line 19-22: XmlCodeViewer is rendering XML content but calls
rememberCodeHighlight with a hardcoded SyntaxLanguage.KOTLIN; update the code to
accept and pass the correct language instead of forcing Kotlin. Modify
rememberCodeHighlight to accept a language parameter (or add an overload) and
update XmlCodeViewer to pass SyntaxLanguage.XML (or expose a language parameter
on XmlCodeViewer) so XML content is highlighted correctly; ensure all usages of
rememberCodeHighlight are updated to provide a language or default to a sensible
value.
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7684a44 and 8b87877.

📒 Files selected for processing (23)
  • compose/codeviewer/api/codeviewer.klib.api
  • sdk/compose/codeviewer/api/codeviewer.api
  • sdk/compose/codeviewer/api/codeviewer.klib.api
  • sdk/compose/codeviewer/build.gradle.kts
  • sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeEditor.kt
  • sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeViewer.kt
  • sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/Common.kt
  • sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/KotlinCodeViewer.kt
  • sdk/compose/foundation/build.gradle.kts
  • sdk/compose/highlights-core/api/highlights-core.api
  • sdk/compose/highlights-core/api/highlights-core.klib.api
  • sdk/compose/highlights-core/build.gradle.kts
  • sdk/compose/highlights-core/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/highlights/core/Common.kt
  • settings.gradle.kts
  • tools/idea-plugin/build.gradle.kts
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/highlights/CodeViewerTooltip.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/creation/common/util/IconPackTooltipContent.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/imagevectortoxml/conversion/ui/XmlCodeViewer.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/SimpleConversionScreen.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/preview/CodePreviewScreen.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/OutputFormatSection.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/PreviewAnnotationSection.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/ui/SelectableCard.kt
💤 Files with no reviewable changes (2)
  • sdk/compose/foundation/build.gradle.kts
  • compose/codeviewer/api/codeviewer.klib.api
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-10-21T20:55:27.073Z
Learnt from: egorikftp
Repo: ComposeGears/Valkyrie PR: 651
File: tools/idea-plugin/build.gradle.kts:147-175
Timestamp: 2025-10-21T20:55:27.073Z
Learning: In Gradle Kotlin DSL (.gradle.kts) scripts, the types `org.gradle.api.artifacts.ArtifactCollection` and `org.gradle.api.artifacts.component.ModuleComponentIdentifier` are implicitly available and do not require explicit import statements.

Applied to files:

  • settings.gradle.kts
  • sdk/compose/highlights-core/build.gradle.kts
📚 Learning: 2025-12-07T20:07:49.753Z
Learnt from: egorikftp
Repo: ComposeGears/Valkyrie PR: 750
File: tools/gradle-plugin/src/main/kotlin/io/github/composegears/valkyrie/gradle/internal/task/GenerateImageVectorsTask.kt:71-85
Timestamp: 2025-12-07T20:07:49.753Z
Learning: In the Valkyrie Gradle plugin (Kotlin), the `useFlatPackage` flag in `IconPackExtension` is only applicable when nested packs are configured. For single icon packs (without nested packs), the flag is intentionally not propagated to `ImageVectorGeneratorConfig` as there is no package hierarchy to flatten.

Applied to files:

  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/creation/common/util/IconPackTooltipContent.kt
📚 Learning: 2026-01-01T18:09:41.901Z
Learnt from: egorikftp
Repo: ComposeGears/Valkyrie PR: 801
File: gradle/libs.versions.toml:14-14
Timestamp: 2026-01-01T18:09:41.901Z
Learning: In the Valkyrie project (ComposeGears/Valkyrie), compose-ui-tooling-preview must use version 1.10.0 (even though runtime Compose is 1.8.2) because 1.10.0+ provides unified KMP preview annotation support required for IntelliJ IDEA 2025.3+ preview functionality.

Applied to files:

  • sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeViewer.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/OutputFormatSection.kt
  • tools/idea-plugin/build.gradle.kts
  • sdk/compose/highlights-core/build.gradle.kts
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/preview/CodePreviewScreen.kt
  • sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/KotlinCodeViewer.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/highlights/CodeViewerTooltip.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/ui/SelectableCard.kt
  • sdk/compose/codeviewer/build.gradle.kts
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/SimpleConversionScreen.kt
  • sdk/compose/highlights-core/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/highlights/core/Common.kt
  • sdk/compose/codeviewer/api/codeviewer.klib.api
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/PreviewAnnotationSection.kt
  • sdk/compose/codeviewer/api/codeviewer.api
🧬 Code graph analysis (2)
tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/OutputFormatSection.kt (1)
sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/Common.kt (1)
  • rememberCodeHighlight (10-24)
tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/imagevectortoxml/conversion/ui/XmlCodeViewer.kt (1)
sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/Common.kt (1)
  • rememberCodeHighlight (10-24)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build (ubuntu-latest)
🔇 Additional comments (30)
sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/KotlinCodeViewer.kt (3)

1-1: Package relocation looks correct.

The package update to io.github.composegears.valkyrie.sdk.compose.codeviewer aligns with the module move into the SDK namespace.


32-45: CodeEditor is correctly accessible from the same package.

CodeEditor.kt exists in the same package io.github.composegears.valkyrie.sdk.compose.codeviewer, so the removal of the explicit import is appropriate.


14-15: No action needed — the imports are correct as written. The isLight extension exists only in the non-SDK compose.util module and was not migrated to the SDK. Even SDK modules like CodeViewer.kt import from the same non-SDK compose.util path, so the mixed imports here reflect the intended architecture, not an inconsistency.

Likely an incorrect or invalid review comment.

settings.gradle.kts (1)

79-80: LGTM!

The new module includes are correctly placed within the sdk:compose group, following the existing alphabetical ordering pattern. The reorganization aligns with the PR objective of moving :codeviewer into the SDK and introducing :highlights-core.

sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeViewer.kt (2)

1-11: LGTM!

Package and import updates correctly reflect the module reorganization. The new imports from compose.util (for isLight) and highlights.core (for buildAnnotatedString) align with the SDK structure.


41-42: Good addition of theme propagation.

Passing isLight = MaterialTheme.colorScheme.isLight ensures the preview correctly reflects the current theme's light/dark mode for syntax highlighting colors.

sdk/compose/highlights-core/build.gradle.kts (1)

1-15: LGTM!

The build configuration is well-structured:

  • Appropriate plugins for KMP, ABI tracking, and Compose support
  • compose.foundation provides the necessary text APIs (AnnotatedString, SpanStyle)
  • Using api(libs.highlights) correctly exposes the highlights library transitively, which is needed since consumer code references types like Highlights and PhraseLocation
sdk/compose/codeviewer/build.gradle.kts (1)

11-11: LGTM!

The dependency change from api(libs.highlights) to implementation(projects.sdk.compose.highlightsCore) is correct. Since highlights-core exposes the highlights library via api(), consumers of codeviewer will still have transitive access to the necessary types.

sdk/compose/highlights-core/api/highlights-core.api (1)

1-5: LGTM!

The API surface is appropriately minimal and focused:

  • buildAnnotatedString extension on Highlights enables conversion to Compose's AnnotatedString
  • getEmphasisLocations provides utility for extracting code emphasis regions

This clean separation allows the core highlighting utilities to be reused across different viewer implementations.

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/highlights/CodeViewerTooltip.kt (1)

17-17: LGTM!

Import path correctly updated to reference CodeViewer from the new SDK module location.

sdk/compose/highlights-core/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/highlights/core/Common.kt (2)

13-42: LGTM!

The buildAnnotatedString extension cleanly handles both ColorHighlight and BoldHighlight types. The single-character highlight skip on line 21 appears intentional to avoid styling noise.


44-65: LGTM!

The getEmphasisLocations function and its helper allIndexesOf correctly identify all occurrences of the target substring, returning properly bounded PhraseLocation instances.

sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeEditor.kt (1)

1-1: LGTM!

Package and import paths correctly updated to align with the SDK module reorganization. The buildAnnotatedString import properly references the new highlights-core module.

Also applies to: 44-44

sdk/compose/highlights-core/api/highlights-core.klib.api (1)

1-10: LGTM!

The Klib ABI dump correctly reflects the public API surface: buildAnnotatedString extension on Highlights and getEmphasisLocations utility function. This aligns with the implementation in Common.kt.

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/imagevectortoxml/conversion/ui/XmlCodeViewer.kt (1)

9-11: LGTM on import updates.

Import paths correctly updated to reference the SDK module locations for isLight, CodeEditor, and rememberCodeHighlight.

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/SimpleConversionScreen.kt (1)

17-17: LGTM!

Import path correctly updated to reference KotlinCodeViewer from the new SDK module location.

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/OutputFormatSection.kt (2)

16-20: LGTM!

Import paths correctly updated to the new SDK locations (sdk.compose.codeviewer for rememberCodeHighlight and compose.util for isLight).


51-58: LGTM!

The rememberCodeHighlight calls are correctly updated to pass the isLight parameter using MaterialTheme.colorScheme.isLight, enabling proper theme-aware syntax highlighting.

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/creation/common/util/IconPackTooltipContent.kt (3)

3-8: LGTM!

Import paths correctly updated to the new SDK module locations for rememberCodeHighlight and getEmphasisLocations, with proper addition of MaterialTheme and isLight imports for theme-aware highlighting.


30-37: LGTM!

The rememberCodeHighlight call correctly uses named parameters to pass isLight for theme-aware syntax highlighting.


55-62: LGTM!

Consistent with buildPackPackageHighlight, the isLight parameter is properly passed using MaterialTheme.colorScheme.isLight.

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/PreviewAnnotationSection.kt (3)

12-21: LGTM!

Import paths correctly updated to the new SDK locations, with proper addition of MaterialTheme and isLight for theme-aware code highlighting.


54-71: LGTM!

The rememberCodeHighlight call for AndroidX Preview correctly passes isLight using MaterialTheme.colorScheme.isLight for proper theme adaptation.


73-90: LGTM!

Consistent with the AndroidX preview card, the JetBrains Preview card correctly uses the new isLight parameter.

tools/idea-plugin/build.gradle.kts (1)

34-35: LGTM!

Dependencies correctly updated to reference the new SDK module paths (sdk.compose.codeviewer and sdk.compose.highlightsCore), aligning with the module reorganization.

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/preview/CodePreviewScreen.kt (1)

11-11: LGTM!

Import path correctly updated to the new SDK location for KotlinCodeViewer.

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/ui/SelectableCard.kt (2)

18-19: LGTM!

The import updates correctly reflect the module restructuring to the new SDK location, and the addition of the isLight utility import enables theme-aware code highlighting.


70-78: LGTM!

The isLight parameter additions ensure that code highlighting colors in previews correctly adapt to the current theme. Both usages follow a consistent pattern using MaterialTheme.colorScheme.isLight.

Also applies to: 85-95

sdk/compose/codeviewer/api/codeviewer.klib.api (1)

1-12: LGTM!

The Klib ABI dump correctly declares the public API surface for the wasmJs target:

  • All four functions (CodeEditor, CodeViewer, KotlinCodeViewer, rememberCodeHighlight) are properly declared under the new SDK package.
  • The rememberCodeHighlight signature with the Boolean parameter matches the JVM API declaration.

Note: The AI summary indicated CodeEditor was removed, but it's present here—this appears to be a summary inaccuracy rather than a code issue.

sdk/compose/codeviewer/api/codeviewer.api (1)

1-15: LGTM!

The API surface correctly reflects the module restructuring:

  • All classes moved to the new sdk.compose.codeviewer package.
  • rememberCodeHighlight signature updated with the new Boolean (isLight) parameter.
  • getEmphasisLocations moved to highlights-core module as expected.

All usages of rememberCodeHighlight throughout the codebase have been properly updated to pass the isLight parameter.

@egorikftp egorikftp force-pushed the task/codeviewer-to-sdk branch from 8b87877 to 68a8d0a Compare January 13, 2026 09:59
@egorikftp egorikftp force-pushed the task/codeviewer-to-sdk branch from 68a8d0a to b744cb3 Compare January 13, 2026 10:01
Copy link
Copy Markdown

@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: 1

🤖 Fix all issues with AI agents
In
@sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/Common.kt:
- Around line 16-23: The remember call that builds the Highlights (via
Highlights.Builder().code(codeBlock).language(...).theme(...).emphasis(*emphasisLocation).build())
omits emphasisLocation from its keys, causing stale emphasis when
emphasisLocation changes; update the remember keys to include the emphasis
locations (either by expanding the vararg into the key list or by passing a
stable collection like emphasisLocation.toList()) alongside isLight and
codeBlock so the Highlights instance is recomputed when emphasisLocation
changes.
📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8b87877 and 68a8d0a.

📒 Files selected for processing (23)
  • compose/codeviewer/api/codeviewer.klib.api
  • sdk/compose/codeviewer/api/codeviewer.api
  • sdk/compose/codeviewer/api/codeviewer.klib.api
  • sdk/compose/codeviewer/build.gradle.kts
  • sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeEditor.kt
  • sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeViewer.kt
  • sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/Common.kt
  • sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/KotlinCodeViewer.kt
  • sdk/compose/foundation/build.gradle.kts
  • sdk/compose/highlights-core/api/highlights-core.api
  • sdk/compose/highlights-core/api/highlights-core.klib.api
  • sdk/compose/highlights-core/build.gradle.kts
  • sdk/compose/highlights-core/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/highlights/core/Common.kt
  • settings.gradle.kts
  • tools/idea-plugin/build.gradle.kts
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/highlights/CodeViewerTooltip.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/creation/common/util/IconPackTooltipContent.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/imagevectortoxml/conversion/ui/XmlCodeViewer.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/SimpleConversionScreen.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/preview/CodePreviewScreen.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/OutputFormatSection.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/PreviewAnnotationSection.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/ui/SelectableCard.kt
💤 Files with no reviewable changes (2)
  • sdk/compose/foundation/build.gradle.kts
  • compose/codeviewer/api/codeviewer.klib.api
🚧 Files skipped from review as they are similar to previous changes (9)
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/highlights/CodeViewerTooltip.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/preview/CodePreviewScreen.kt
  • tools/idea-plugin/build.gradle.kts
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/SimpleConversionScreen.kt
  • sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/KotlinCodeViewer.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/creation/common/util/IconPackTooltipContent.kt
  • sdk/compose/highlights-core/build.gradle.kts
  • sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeEditor.kt
  • sdk/compose/codeviewer/api/codeviewer.api
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: egorikftp
Repo: ComposeGears/Valkyrie PR: 807
File: tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/imagevectortoxml/conversion/ui/XmlCodeViewer.kt:19-22
Timestamp: 2026-01-13T10:00:23.462Z
Learning: The Highlights library used in the codebase does not support XML syntax highlighting. When displaying XML content (e.g., in XmlCodeViewer), Kotlin syntax highlighting is used as a fallback workaround.
Learnt from: egorikftp
Repo: ComposeGears/Valkyrie PR: 801
File: gradle/libs.versions.toml:14-14
Timestamp: 2026-01-01T18:09:41.901Z
Learning: In the Valkyrie project (ComposeGears/Valkyrie), compose-ui-tooling-preview must use version 1.10.0 (even though runtime Compose is 1.8.2) because 1.10.0+ provides unified KMP preview annotation support required for IntelliJ IDEA 2025.3+ preview functionality.
📚 Learning: 2026-01-01T18:09:41.901Z
Learnt from: egorikftp
Repo: ComposeGears/Valkyrie PR: 801
File: gradle/libs.versions.toml:14-14
Timestamp: 2026-01-01T18:09:41.901Z
Learning: In the Valkyrie project (ComposeGears/Valkyrie), compose-ui-tooling-preview must use version 1.10.0 (even though runtime Compose is 1.8.2) because 1.10.0+ provides unified KMP preview annotation support required for IntelliJ IDEA 2025.3+ preview functionality.

Applied to files:

  • settings.gradle.kts
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/OutputFormatSection.kt
  • sdk/compose/codeviewer/build.gradle.kts
  • sdk/compose/codeviewer/api/codeviewer.klib.api
  • sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeViewer.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/PreviewAnnotationSection.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/ui/SelectableCard.kt
  • sdk/compose/highlights-core/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/highlights/core/Common.kt
📚 Learning: 2026-01-13T10:00:23.462Z
Learnt from: egorikftp
Repo: ComposeGears/Valkyrie PR: 807
File: tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/imagevectortoxml/conversion/ui/XmlCodeViewer.kt:19-22
Timestamp: 2026-01-13T10:00:23.462Z
Learning: The Highlights library used in the codebase does not support XML syntax highlighting. When displaying XML content (e.g., in XmlCodeViewer), Kotlin syntax highlighting is used as a fallback workaround.

Applied to files:

  • sdk/compose/highlights-core/api/highlights-core.klib.api
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/OutputFormatSection.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/imagevectortoxml/conversion/ui/XmlCodeViewer.kt
  • sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/Common.kt
  • sdk/compose/highlights-core/api/highlights-core.api
  • sdk/compose/codeviewer/api/codeviewer.klib.api
  • sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeViewer.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/ui/SelectableCard.kt
  • sdk/compose/highlights-core/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/highlights/core/Common.kt
🧬 Code graph analysis (2)
tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/OutputFormatSection.kt (1)
sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/Common.kt (1)
  • rememberCodeHighlight (10-24)
tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/imagevectortoxml/conversion/ui/XmlCodeViewer.kt (1)
sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/Common.kt (1)
  • rememberCodeHighlight (10-24)
🔇 Additional comments (19)
settings.gradle.kts (1)

79-80: LGTM!

The new SDK module includes for codeviewer and highlights-core follow the existing naming conventions and are correctly placed within the SDK module group.

sdk/compose/codeviewer/build.gradle.kts (1)

10-12: LGTM!

Good encapsulation. The highlights library is now an internal implementation detail of highlights-core, and codeviewer depends on the SDK abstraction rather than exposing the third-party library directly.

sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeViewer.kt (3)

1-11: LGTM!

Package and import updates are consistent with the module restructuring. The buildAnnotatedString extension is correctly imported from the new highlights-core module.


13-23: LGTM!

The CodeViewer composable is clean and correctly uses the buildAnnotatedString extension on Highlights.


26-45: LGTM!

The preview correctly demonstrates the updated API with the isLight parameter derived from MaterialTheme.colorScheme.

sdk/compose/highlights-core/api/highlights-core.api (1)

1-5: LGTM!

The public API surface is minimal and well-defined. The two exposed functions (buildAnnotatedString and getEmphasisLocations) provide the necessary utilities for code highlighting without leaking internal implementation details.

sdk/compose/highlights-core/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/highlights/core/Common.kt (3)

1-1: LGTM!

The new package path aligns with the SDK restructuring.


13-42: LGTM! Public API for building annotated strings from Highlights.

The implementation correctly processes ColorHighlight and BoldHighlight instances to construct styled text.

One note: Line 21 skips single-character color highlights (location.end - location.start != 1). This appears intentional, likely to filter out noise from the Highlights library, but worth verifying this behavior is expected.


44-66: LGTM!

The getEmphasisLocations function and its helper allIndexesOf correctly find all occurrences of a substring and return properly constructed PhraseLocation objects. The implementation is clean and efficient.

sdk/compose/highlights-core/api/highlights-core.klib.api (1)

1-10: LGTM!

The ABI dump correctly reflects the public API surface for the highlights-core module, exposing buildAnnotatedString and getEmphasisLocations as expected.

sdk/compose/codeviewer/api/codeviewer.klib.api (1)

1-12: LGTM!

The ABI dump properly reflects the relocated codeviewer module's public API surface. The rememberCodeHighlight function now accepts an explicit isLight: Boolean parameter, enabling theme-aware highlighting while keeping the function decoupled from MaterialTheme.

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/PreviewAnnotationSection.kt (2)

12-12: LGTM!

Import updates correctly reference the new SDK paths for rememberCodeHighlight and add the necessary isLight utility for theme-aware highlighting.

Also applies to: 17-17, 21-21


54-71: LGTM!

Both SelectableCard instances now properly pass isLight = MaterialTheme.colorScheme.isLight to rememberCodeHighlight, ensuring code highlighting adapts to light/dark themes consistently.

Also applies to: 73-90

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/OutputFormatSection.kt (2)

16-16: LGTM!

Import updates correctly reference the new SDK path for rememberCodeHighlight and add the isLight utility.

Also applies to: 20-20


48-61: LGTM!

Both SelectableCard instances for backing property and lazy property formats now correctly pass isLight = MaterialTheme.colorScheme.isLight, enabling theme-aware syntax highlighting consistent with other updated components.

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/ui/SelectableCard.kt (2)

18-19: LGTM!

Import paths correctly updated to the new SDK module location, and isLight utility is properly imported for theme-aware highlighting.


70-78: LGTM!

The isLight parameter is correctly derived from MaterialTheme.colorScheme.isLight, ensuring the code highlighting theme matches the current UI theme in previews.

Also applies to: 85-95

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/imagevectortoxml/conversion/ui/XmlCodeViewer.kt (2)

9-11: LGTM!

Import paths correctly updated to reference the new SDK module locations.


19-22: LGTM!

The rememberCodeHighlight call correctly uses named parameters and derives isLight from the theme. Based on learnings, the use of Kotlin syntax highlighting for XML content is an intentional workaround since the Highlights library doesn't support XML syntax.

Copy link
Copy Markdown

@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: 0

🧹 Nitpick comments (1)
sdk/compose/highlights-core/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/highlights/core/Common.kt (1)

20-27: Consider documenting the single-character skip.

The condition location.end - location.start != 1 skips styling for single-character highlights. If this is intentional (e.g., to avoid highlighting punctuation), a brief comment would help future maintainers understand the reasoning.

📜 Review details

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 68a8d0a and b744cb3.

📒 Files selected for processing (23)
  • compose/codeviewer/api/codeviewer.klib.api
  • sdk/compose/codeviewer/api/codeviewer.api
  • sdk/compose/codeviewer/api/codeviewer.klib.api
  • sdk/compose/codeviewer/build.gradle.kts
  • sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeEditor.kt
  • sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeViewer.kt
  • sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/Common.kt
  • sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/KotlinCodeViewer.kt
  • sdk/compose/foundation/build.gradle.kts
  • sdk/compose/highlights-core/api/highlights-core.api
  • sdk/compose/highlights-core/api/highlights-core.klib.api
  • sdk/compose/highlights-core/build.gradle.kts
  • sdk/compose/highlights-core/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/highlights/core/Common.kt
  • settings.gradle.kts
  • tools/idea-plugin/build.gradle.kts
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/highlights/CodeViewerTooltip.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/creation/common/util/IconPackTooltipContent.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/imagevectortoxml/conversion/ui/XmlCodeViewer.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/SimpleConversionScreen.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/preview/CodePreviewScreen.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/OutputFormatSection.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/PreviewAnnotationSection.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/ui/SelectableCard.kt
💤 Files with no reviewable changes (2)
  • sdk/compose/foundation/build.gradle.kts
  • compose/codeviewer/api/codeviewer.klib.api
🚧 Files skipped from review as they are similar to previous changes (9)
  • sdk/compose/highlights-core/build.gradle.kts
  • sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/Common.kt
  • settings.gradle.kts
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/creation/common/util/IconPackTooltipContent.kt
  • sdk/compose/codeviewer/api/codeviewer.klib.api
  • sdk/compose/highlights-core/api/highlights-core.klib.api
  • sdk/compose/codeviewer/build.gradle.kts
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/highlights/CodeViewerTooltip.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/preview/CodePreviewScreen.kt
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: egorikftp
Repo: ComposeGears/Valkyrie PR: 807
File: tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/imagevectortoxml/conversion/ui/XmlCodeViewer.kt:19-22
Timestamp: 2026-01-13T10:00:23.462Z
Learning: The Highlights library used in the codebase does not support XML syntax highlighting. When displaying XML content (e.g., in XmlCodeViewer), Kotlin syntax highlighting is used as a fallback workaround.
📚 Learning: 2026-01-01T18:09:41.901Z
Learnt from: egorikftp
Repo: ComposeGears/Valkyrie PR: 801
File: gradle/libs.versions.toml:14-14
Timestamp: 2026-01-01T18:09:41.901Z
Learning: In the Valkyrie project (ComposeGears/Valkyrie), compose-ui-tooling-preview must use version 1.10.0 (even though runtime Compose is 1.8.2) because 1.10.0+ provides unified KMP preview annotation support required for IntelliJ IDEA 2025.3+ preview functionality.

Applied to files:

  • sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/KotlinCodeViewer.kt
  • tools/idea-plugin/build.gradle.kts
  • sdk/compose/highlights-core/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/highlights/core/Common.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/PreviewAnnotationSection.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/ui/SelectableCard.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/SimpleConversionScreen.kt
  • sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeViewer.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/OutputFormatSection.kt
  • sdk/compose/codeviewer/api/codeviewer.api
📚 Learning: 2026-01-13T10:00:23.462Z
Learnt from: egorikftp
Repo: ComposeGears/Valkyrie PR: 807
File: tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/imagevectortoxml/conversion/ui/XmlCodeViewer.kt:19-22
Timestamp: 2026-01-13T10:00:23.462Z
Learning: The Highlights library used in the codebase does not support XML syntax highlighting. When displaying XML content (e.g., in XmlCodeViewer), Kotlin syntax highlighting is used as a fallback workaround.

Applied to files:

  • sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/KotlinCodeViewer.kt
  • sdk/compose/highlights-core/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/highlights/core/Common.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/ui/SelectableCard.kt
  • sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeViewer.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/imagevectortoxml/conversion/ui/XmlCodeViewer.kt
  • sdk/compose/highlights-core/api/highlights-core.api
  • sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeEditor.kt
  • tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/OutputFormatSection.kt
  • sdk/compose/codeviewer/api/codeviewer.api
🧬 Code graph analysis (2)
tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/imagevectortoxml/conversion/ui/XmlCodeViewer.kt (1)
sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/Common.kt (1)
  • rememberCodeHighlight (10-24)
tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/OutputFormatSection.kt (2)
sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/Common.kt (1)
  • rememberCodeHighlight (10-24)
tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/ui/SelectableCard.kt (1)
  • SelectableCard (24-58)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: build (ubuntu-latest)
🔇 Additional comments (19)
tools/idea-plugin/build.gradle.kts (1)

34-35: LGTM!

The dependency updates correctly reflect the module reorganization: codeviewer moved under sdk.compose and the new highlightsCore module is properly added as a dependency.

sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/KotlinCodeViewer.kt (1)

1-1: LGTM!

Package declaration correctly reflects the new module location under sdk.compose.codeviewer. The CodeEditor reference works without explicit import since it's now in the same package.

sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeViewer.kt (2)

1-11: LGTM!

Package relocation and new imports are correctly structured. The buildAnnotatedString extension is now properly imported from the highlights.core module.


40-42: Good addition for theming consistency.

Passing isLight to rememberCodeHighlight in the preview ensures the syntax highlighting theme matches the current MaterialTheme color scheme.

sdk/compose/highlights-core/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/highlights/core/Common.kt (2)

13-42: LGTM!

The buildAnnotatedString extension function is correctly implemented. Making it public aligns with the PR's goal of exposing this API from highlights-core.


44-56: LGTM!

The getEmphasisLocations utility cleanly finds all occurrences of a substring and returns them as PhraseLocation arrays for emphasis highlighting.

sdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeEditor.kt (3)

1-1: LGTM!

Package declaration correctly reflects the new module location under sdk.compose.codeviewer.


44-44: LGTM!

Import correctly references buildAnnotatedString from the new highlights.core module.


70-71: LGTM!

The initial text state and line count computation are correct. Using rememberMutableState and rememberMutableIntState from the SDK foundation is consistent with the project's patterns.

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/imagevectortoxml/conversion/ui/XmlCodeViewer.kt (1)

9-22: LGTM! Clean migration to the SDK codeviewer package.

The import updates and addition of the isLight parameter align correctly with the new rememberCodeHighlight API signature. The theme-aware highlighting will now properly adapt to light/dark mode.

Based on learnings, the use of Kotlin syntax highlighting for XML content is an expected workaround since the Highlights library doesn't support XML.

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/OutputFormatSection.kt (2)

16-21: LGTM! Import paths correctly updated to SDK package.

The migration to sdk.compose.codeviewer and addition of the isLight utility import are properly implemented.


51-61: LGTM! Theme-aware highlighting added to both format options.

Both SelectableCard instances now properly pass isLight = MaterialTheme.colorScheme.isLight, ensuring consistent theme-adaptive syntax highlighting across the backing property and lazy property format previews.

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/SimpleConversionScreen.kt (1)

17-17: LGTM! Import path updated to SDK package.

The KotlinCodeViewer import is correctly migrated to the new sdk.compose.codeviewer package location.

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/PreviewAnnotationSection.kt (2)

12-21: LGTM! Imports properly updated for SDK migration and theme support.

The addition of MaterialTheme, isLight, and the updated rememberCodeHighlight import align with the API changes.


57-90: LGTM! Both preview annotation options now use theme-aware highlighting.

The isLight parameter is correctly passed to both AndroidX and JetBrains preview code highlights, ensuring the syntax highlighting adapts to the current theme.

tools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/ui/SelectableCard.kt (2)

18-19: LGTM! Imports correctly updated for SDK migration.

The isLight utility and rememberCodeHighlight imports are properly migrated to their new package locations.


60-99: LGTM! Preview function updated to demonstrate theme-aware highlighting.

The preview correctly showcases both selected and unselected card states with the new isLight parameter, ensuring accurate preview rendering in both light and dark themes.

sdk/compose/highlights-core/api/highlights-core.api (1)

1-5: LGTM! Clean API surface for the new highlights-core module.

The public API exposes appropriate utilities:

  • buildAnnotatedString for converting Highlights to Compose's AnnotatedString
  • getEmphasisLocations relocated from codeviewer, which is a sensible placement in this core module
sdk/compose/codeviewer/api/codeviewer.api (1)

1-15: API relocation and signature changes look good.

The codeviewer module has been successfully relocated to the SDK package structure. Key changes:

  • Package moved from .compose.codeviewer.core to .sdk.compose.codeviewer
  • rememberCodeHighlight now accepts an isLight: Boolean parameter (line 10)
  • getEmphasisLocations removed (correctly relocated to highlights-core)

These are breaking changes for any external consumers. Please ensure migration documentation or deprecation notices are provided if this module has external users.

@egorikftp egorikftp merged commit f35a957 into main Jan 13, 2026
3 checks passed
@egorikftp egorikftp deleted the task/codeviewer-to-sdk branch January 13, 2026 10:17
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.

1 participant