Skip to content

Commit 9b11da4

Browse files
authored
Extract properly the properties getter functions (#79)
1 parent 5472ee5 commit 9b11da4

File tree

5 files changed

+44
-5
lines changed

5 files changed

+44
-5
lines changed

app/src/main/kotlin/com/skydoves/myapplication/MainActivity.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ class MainActivity : ComponentActivity() {
7474
}
7575
}
7676

77+
private val String.Companion.ComposableValue
78+
@Composable
79+
get() = "ComposableValue"
80+
7781
data class UiResult<T>(
7882
val data: T,
7983
val isPending: Boolean,

compose-stability-analyzer-idea/CHANGELOG.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22

33
All notable changes to the IntelliJ IDEA plugin will be documented in this file.
44

5+
## [Unreleased]
6+
7+
---
8+
9+
## [0.6.2] - 2025-12-10
10+
11+
### Fixed
12+
- **Fixed property source file location and navigation in tool window** (Issue #67)
13+
- Tool window now correctly identifies source file for composable properties
14+
- Properties no longer show "Unknown.kt" as file name
15+
- Double-clicking on property names in tool window now navigates to correct source location
16+
- Extended source location search to include `KtProperty` declarations in addition to `KtNamedFunction`
17+
18+
---
19+
520
## [0.6.1] - 2025-12-06
621

722
### Added
@@ -20,10 +35,10 @@ All notable changes to the IntelliJ IDEA plugin will be documented in this file.
2035
- Excluded WASM infrastructure tasks (sync, webpack, executable, link, assemble) from task dependency matching
2136
- Resolves errors like "wasmJsBrowserProductionWebpack uses output from wasmJsDevelopmentExecutableCompileSync without declaring dependency"
2237
- WASM projects now build successfully without task dependency violations
23-
- **Fixed top-level property display in tool window and stability files** (Issue #67)
38+
- **Fixed property name display in tool window and stability files** (Issue #67)
2439
- Properties no longer show as `<get-propertyName>` in tool window and stability reports
25-
- Correctly extracts property names from getter functions
26-
- File attribution now shows correct file instead of "Unknown.kt"
40+
- Correctly extracts property names from getter functions in compiler plugin
41+
- Improved readability of property-based composables
2742

2843
### Improved
2944
- **Updated tool window icon to monochrome style**

compose-stability-analyzer-idea/build.gradle.kts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,16 @@ intellijPlatform {
7171
</ul>
7272
""".trimIndent()
7373
changeNotes = """
74+
<b>0.6.2</b>
75+
<ul>
76+
<li><b>Fixed property source file location and navigation in tool window</b> (Issue #67) - Properties now show correct file name and double-click navigation works</li>
77+
</ul>
7478
<b>0.6.1</b>
7579
<ul>
7680
<li><b>Added Settings icon in tool window toolbar</b> - Quick access to plugin settings via gear icon</li>
7781
<li><b>Fixed tool window ignore pattern filtering</b> (Issue #74) - Tool window now respects ignored type patterns</li>
7882
<li><b>Fixed WASM build failures</b> (Issue #70) - Excluded WASM infrastructure tasks from dependency matching</li>
79-
<li><b>Fixed top-level property display</b> (Issue #67) - Properties no longer show as &lt;get-propertyName&gt;</li>
83+
<li><b>Fixed property name display</b> (Issue #67) - Properties no longer show as <get-propertyName></li>
8084
<li>Updated tool window icon to monochrome style for better UI consistency</li>
8185
<li>Updated dependencies: Lint API, Nexus Plugin, AGP, Compose BOM, JetBrains Compose</li>
8286
</ul>

compose-stability-analyzer-idea/src/main/kotlin/com/skydoves/compose/stability/idea/toolwindow/ComposableStabilityCollector.kt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import com.skydoves.compose.stability.idea.settings.StabilitySettingsState
2828
import org.jetbrains.kotlin.idea.KotlinFileType
2929
import org.jetbrains.kotlin.psi.KtFile
3030
import org.jetbrains.kotlin.psi.KtNamedFunction
31+
import org.jetbrains.kotlin.psi.KtProperty
3132
import java.io.File
3233

3334
/**
@@ -156,6 +157,7 @@ public class ComposableStabilityCollector(private val project: Project) {
156157
continue
157158
}
158159

160+
// Search for named functions
159161
ktFile.declarations.filterIsInstance<KtNamedFunction>().forEach { function ->
160162
if (function.name == simpleName) {
161163
val line = try {
@@ -168,6 +170,20 @@ public class ComposableStabilityCollector(private val project: Project) {
168170
return Triple(virtualFile.path, virtualFile.name, line)
169171
}
170172
}
173+
174+
// Search for properties (for composable properties/getters)
175+
ktFile.declarations.filterIsInstance<KtProperty>().forEach { property ->
176+
if (property.name == simpleName) {
177+
val line = try {
178+
val document = com.intellij.psi.PsiDocumentManager.getInstance(project)
179+
.getDocument(ktFile)
180+
document?.getLineNumber(property.textOffset)?.plus(1) ?: 0
181+
} catch (e: Exception) {
182+
0
183+
}
184+
return Triple(virtualFile.path, virtualFile.name, line)
185+
}
186+
}
171187
}
172188

173189
return Triple("Unknown", "Unknown.kt", 0)

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ kotlin.mpp.androidGradlePluginCompatibility.nowarn=true
5151

5252
# Maven publishing
5353
GROUP=com.github.skydoves
54-
VERSION_NAME=0.6.1
54+
VERSION_NAME=0.6.2
5555

5656
POM_URL=https://github.com/skydoves/compose-stability-analyzer/
5757
POM_SCM_URL=https://github.com/skydoves/compose-stability-analyzer/

0 commit comments

Comments
 (0)