Move :codeviewer into sdk, introduce :hightlights-core#807
Conversation
egorikftp
commented
Jan 13, 2026
- ref: Migrate project structure to sdk approach #592
WalkthroughThe PR moves codeviewer functionality into 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
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. Comment |
There was a problem hiding this comment.
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
📒 Files selected for processing (23)
compose/codeviewer/api/codeviewer.klib.apisdk/compose/codeviewer/api/codeviewer.apisdk/compose/codeviewer/api/codeviewer.klib.apisdk/compose/codeviewer/build.gradle.ktssdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeEditor.ktsdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeViewer.ktsdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/Common.ktsdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/KotlinCodeViewer.ktsdk/compose/foundation/build.gradle.ktssdk/compose/highlights-core/api/highlights-core.apisdk/compose/highlights-core/api/highlights-core.klib.apisdk/compose/highlights-core/build.gradle.ktssdk/compose/highlights-core/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/highlights/core/Common.ktsettings.gradle.ktstools/idea-plugin/build.gradle.ktstools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/highlights/CodeViewerTooltip.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/creation/common/util/IconPackTooltipContent.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/imagevectortoxml/conversion/ui/XmlCodeViewer.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/SimpleConversionScreen.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/preview/CodePreviewScreen.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/OutputFormatSection.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/PreviewAnnotationSection.kttools/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.ktssdk/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.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/OutputFormatSection.kttools/idea-plugin/build.gradle.ktssdk/compose/highlights-core/build.gradle.ktstools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/preview/CodePreviewScreen.ktsdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/KotlinCodeViewer.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/highlights/CodeViewerTooltip.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/ui/SelectableCard.ktsdk/compose/codeviewer/build.gradle.ktstools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/SimpleConversionScreen.ktsdk/compose/highlights-core/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/highlights/core/Common.ktsdk/compose/codeviewer/api/codeviewer.klib.apitools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/PreviewAnnotationSection.ktsdk/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.codevieweraligns with the module move into the SDK namespace.
32-45:CodeEditoris correctly accessible from the same package.
CodeEditor.ktexists in the same packageio.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. TheisLightextension exists only in the non-SDKcompose.utilmodule and was not migrated to the SDK. Even SDK modules likeCodeViewer.ktimport from the same non-SDKcompose.utilpath, 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:composegroup, following the existing alphabetical ordering pattern. The reorganization aligns with the PR objective of moving:codeviewerinto 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(forisLight) andhighlights.core(forbuildAnnotatedString) align with the SDK structure.
41-42: Good addition of theme propagation.Passing
isLight = MaterialTheme.colorScheme.isLightensures 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.foundationprovides the necessary text APIs (AnnotatedString,SpanStyle)- Using
api(libs.highlights)correctly exposes the highlights library transitively, which is needed since consumer code references types likeHighlightsandPhraseLocationsdk/compose/codeviewer/build.gradle.kts (1)
11-11: LGTM!The dependency change from
api(libs.highlights)toimplementation(projects.sdk.compose.highlightsCore)is correct. Sincehighlights-coreexposes the highlights library viaapi(), consumers ofcodeviewerwill 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:
buildAnnotatedStringextension onHighlightsenables conversion to Compose'sAnnotatedStringgetEmphasisLocationsprovides utility for extracting code emphasis regionsThis 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
CodeViewerfrom 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
buildAnnotatedStringextension cleanly handles bothColorHighlightandBoldHighlighttypes. The single-character highlight skip on line 21 appears intentional to avoid styling noise.
44-65: LGTM!The
getEmphasisLocationsfunction and its helperallIndexesOfcorrectly identify all occurrences of the target substring, returning properly boundedPhraseLocationinstances.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
buildAnnotatedStringimport 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:
buildAnnotatedStringextension onHighlightsandgetEmphasisLocationsutility function. This aligns with the implementation inCommon.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, andrememberCodeHighlight.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
KotlinCodeViewerfrom 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.codeviewerforrememberCodeHighlightandcompose.utilforisLight).
51-58: LGTM!The
rememberCodeHighlightcalls are correctly updated to pass theisLightparameter usingMaterialTheme.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
rememberCodeHighlightandgetEmphasisLocations, with proper addition ofMaterialThemeandisLightimports for theme-aware highlighting.
30-37: LGTM!The
rememberCodeHighlightcall correctly uses named parameters to passisLightfor theme-aware syntax highlighting.
55-62: LGTM!Consistent with
buildPackPackageHighlight, theisLightparameter is properly passed usingMaterialTheme.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
MaterialThemeandisLightfor theme-aware code highlighting.
54-71: LGTM!The
rememberCodeHighlightcall for AndroidX Preview correctly passesisLightusingMaterialTheme.colorScheme.isLightfor proper theme adaptation.
73-90: LGTM!Consistent with the AndroidX preview card, the JetBrains Preview card correctly uses the new
isLightparameter.tools/idea-plugin/build.gradle.kts (1)
34-35: LGTM!Dependencies correctly updated to reference the new SDK module paths (
sdk.compose.codeviewerandsdk.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
isLightutility import enables theme-aware code highlighting.
70-78: LGTM!The
isLightparameter additions ensure that code highlighting colors in previews correctly adapt to the current theme. Both usages follow a consistent pattern usingMaterialTheme.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
rememberCodeHighlightsignature with theBooleanparameter 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.codeviewerpackage.rememberCodeHighlightsignature updated with the newBoolean(isLight) parameter.getEmphasisLocationsmoved to highlights-core module as expected.All usages of
rememberCodeHighlightthroughout the codebase have been properly updated to pass theisLightparameter.
8b87877 to
68a8d0a
Compare
68a8d0a to
b744cb3
Compare
There was a problem hiding this comment.
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
📒 Files selected for processing (23)
compose/codeviewer/api/codeviewer.klib.apisdk/compose/codeviewer/api/codeviewer.apisdk/compose/codeviewer/api/codeviewer.klib.apisdk/compose/codeviewer/build.gradle.ktssdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeEditor.ktsdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeViewer.ktsdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/Common.ktsdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/KotlinCodeViewer.ktsdk/compose/foundation/build.gradle.ktssdk/compose/highlights-core/api/highlights-core.apisdk/compose/highlights-core/api/highlights-core.klib.apisdk/compose/highlights-core/build.gradle.ktssdk/compose/highlights-core/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/highlights/core/Common.ktsettings.gradle.ktstools/idea-plugin/build.gradle.ktstools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/highlights/CodeViewerTooltip.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/creation/common/util/IconPackTooltipContent.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/imagevectortoxml/conversion/ui/XmlCodeViewer.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/SimpleConversionScreen.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/preview/CodePreviewScreen.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/OutputFormatSection.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/PreviewAnnotationSection.kttools/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.ktstools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/OutputFormatSection.ktsdk/compose/codeviewer/build.gradle.ktssdk/compose/codeviewer/api/codeviewer.klib.apisdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeViewer.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/PreviewAnnotationSection.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/ui/SelectableCard.ktsdk/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.apitools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/OutputFormatSection.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/imagevectortoxml/conversion/ui/XmlCodeViewer.ktsdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/Common.ktsdk/compose/highlights-core/api/highlights-core.apisdk/compose/codeviewer/api/codeviewer.klib.apisdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeViewer.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/ui/SelectableCard.ktsdk/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
codeviewerandhighlights-corefollow 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
highlightslibrary is now an internal implementation detail ofhighlights-core, andcodeviewerdepends 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
buildAnnotatedStringextension is correctly imported from the newhighlights-coremodule.
13-23: LGTM!The
CodeViewercomposable is clean and correctly uses thebuildAnnotatedStringextension onHighlights.
26-45: LGTM!The preview correctly demonstrates the updated API with the
isLightparameter derived fromMaterialTheme.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 (
buildAnnotatedStringandgetEmphasisLocations) 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
ColorHighlightandBoldHighlightinstances 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
getEmphasisLocationsfunction and its helperallIndexesOfcorrectly find all occurrences of a substring and return properly constructedPhraseLocationobjects. 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
buildAnnotatedStringandgetEmphasisLocationsas 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
rememberCodeHighlightfunction now accepts an explicitisLight: Booleanparameter, enabling theme-aware highlighting while keeping the function decoupled fromMaterialTheme.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
rememberCodeHighlightand add the necessaryisLightutility for theme-aware highlighting.Also applies to: 17-17, 21-21
54-71: LGTM!Both
SelectableCardinstances now properly passisLight = MaterialTheme.colorScheme.isLighttorememberCodeHighlight, 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
rememberCodeHighlightand add theisLightutility.Also applies to: 20-20
48-61: LGTM!Both
SelectableCardinstances for backing property and lazy property formats now correctly passisLight = 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
isLightutility is properly imported for theme-aware highlighting.
70-78: LGTM!The
isLightparameter is correctly derived fromMaterialTheme.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
rememberCodeHighlightcall correctly uses named parameters and derivesisLightfrom 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.
There was a problem hiding this comment.
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 != 1skips 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
📒 Files selected for processing (23)
compose/codeviewer/api/codeviewer.klib.apisdk/compose/codeviewer/api/codeviewer.apisdk/compose/codeviewer/api/codeviewer.klib.apisdk/compose/codeviewer/build.gradle.ktssdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeEditor.ktsdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeViewer.ktsdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/Common.ktsdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/KotlinCodeViewer.ktsdk/compose/foundation/build.gradle.ktssdk/compose/highlights-core/api/highlights-core.apisdk/compose/highlights-core/api/highlights-core.klib.apisdk/compose/highlights-core/build.gradle.ktssdk/compose/highlights-core/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/highlights/core/Common.ktsettings.gradle.ktstools/idea-plugin/build.gradle.ktstools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/foundation/highlights/CodeViewerTooltip.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/iconpack/creation/common/util/IconPackTooltipContent.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/imagevectortoxml/conversion/ui/XmlCodeViewer.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/SimpleConversionScreen.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/preview/CodePreviewScreen.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/OutputFormatSection.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/PreviewAnnotationSection.kttools/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.kttools/idea-plugin/build.gradle.ktssdk/compose/highlights-core/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/highlights/core/Common.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/PreviewAnnotationSection.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/ui/SelectableCard.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/simple/conversion/SimpleConversionScreen.ktsdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeViewer.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/OutputFormatSection.ktsdk/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.ktsdk/compose/highlights-core/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/highlights/core/Common.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/ui/SelectableCard.ktsdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeViewer.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/mode/imagevectortoxml/conversion/ui/XmlCodeViewer.ktsdk/compose/highlights-core/api/highlights-core.apisdk/compose/codeviewer/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/codeviewer/CodeEditor.kttools/idea-plugin/src/main/kotlin/io/github/composegears/valkyrie/ui/screen/settings/tabs/generator/OutputFormatSection.ktsdk/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:
codeviewermoved undersdk.composeand the newhighlightsCoremodule 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. TheCodeEditorreference 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
buildAnnotatedStringextension is now properly imported from thehighlights.coremodule.
40-42: Good addition for theming consistency.Passing
isLighttorememberCodeHighlightin the preview ensures the syntax highlighting theme matches the currentMaterialThemecolor scheme.sdk/compose/highlights-core/src/commonMain/kotlin/io/github/composegears/valkyrie/sdk/compose/highlights/core/Common.kt (2)
13-42: LGTM!The
buildAnnotatedStringextension function is correctly implemented. Making it public aligns with the PR's goal of exposing this API fromhighlights-core.
44-56: LGTM!The
getEmphasisLocationsutility cleanly finds all occurrences of a substring and returns them asPhraseLocationarrays 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
buildAnnotatedStringfrom the newhighlights.coremodule.
70-71: LGTM!The initial text state and line count computation are correct. Using
rememberMutableStateandrememberMutableIntStatefrom 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
isLightparameter align correctly with the newrememberCodeHighlightAPI 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.codeviewerand addition of theisLightutility import are properly implemented.
51-61: LGTM! Theme-aware highlighting added to both format options.Both
SelectableCardinstances now properly passisLight = 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
KotlinCodeViewerimport is correctly migrated to the newsdk.compose.codeviewerpackage 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 updatedrememberCodeHighlightimport align with the API changes.
57-90: LGTM! Both preview annotation options now use theme-aware highlighting.The
isLightparameter 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
isLightutility andrememberCodeHighlightimports 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
isLightparameter, 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:
buildAnnotatedStringfor convertingHighlightsto Compose'sAnnotatedStringgetEmphasisLocationsrelocated from codeviewer, which is a sensible placement in this core modulesdk/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.coreto.sdk.compose.codeviewerrememberCodeHighlightnow accepts anisLight: Booleanparameter (line 10)getEmphasisLocationsremoved (correctly relocated tohighlights-core)These are breaking changes for any external consumers. Please ensure migration documentation or deprecation notices are provided if this module has external users.