Skip to content

Commit d762692

Browse files
authored
Fix ignored patterns was not applied to window tool properly (#80)
1 parent 9b11da4 commit d762692

File tree

3 files changed

+36
-10
lines changed

3 files changed

+36
-10
lines changed

compose-stability-analyzer-idea/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ All notable changes to the IntelliJ IDEA plugin will be documented in this file.
1515
- Double-clicking on property names in tool window now navigates to correct source location
1616
- Extended source location search to include `KtProperty` declarations in addition to `KtNamedFunction`
1717

18+
### Improved
19+
- **Enhanced tool window handling of ignored type patterns** (Issue #74)
20+
- Ignored parameters are now displayed as stable instead of being hidden completely
21+
- Composable skippability is recalculated based on processed parameters after applying ignore patterns
22+
- Composables with only ignored unstable parameters now correctly show as skippable
23+
- Provides better visibility of composable signatures while respecting ignore patterns
24+
1825
---
1926

2027
## [0.6.1] - 2025-12-06

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ intellijPlatform {
7474
<b>0.6.2</b>
7575
<ul>
7676
<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+
<li><b>Improved ignored type pattern handling in tool window</b> (Issue #74) - Ignored parameters display as stable and composable skippability is recalculated accordingly</li>
7778
</ul>
7879
<b>0.6.1</b>
7980
<ul>

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

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -167,17 +167,35 @@ public class StabilityToolWindow(private val project: Project) {
167167
val settings = com.skydoves.compose.stability.idea.settings.StabilitySettingsState.getInstance()
168168
val ignoredPatterns = settings.getIgnoredPatternsAsRegex()
169169

170-
// Filter composables based on current filter type and ignored patterns
171-
val filteredComposables = when (currentFilter) {
172-
FilterType.ALL -> allComposables
173-
FilterType.SKIPPABLE -> allComposables.filter { it.isSkippable }
174-
FilterType.UNSKIPPABLE -> allComposables.filter { !it.isSkippable }
175-
}.map { composable ->
176-
// Filter out ignored parameters
177-
val filteredParameters = composable.parameters.filter { param ->
178-
!shouldIgnoreParameter(param.type, ignoredPatterns)
170+
// Process all composables: mark ignored parameters as stable and recalculate skippability
171+
val processedComposables = allComposables.map { composable ->
172+
// Mark ignored parameters as stable instead of removing them
173+
val processedParameters = composable.parameters.map { param ->
174+
if (shouldIgnoreParameter(param.type, ignoredPatterns)) {
175+
// Treat ignored parameters as stable
176+
param.copy(isStable = true, isRuntime = false)
177+
} else {
178+
param
179+
}
179180
}
180-
composable.copy(parameters = filteredParameters)
181+
182+
// Recalculate skippability: a composable is skippable if all parameters are stable
183+
// (after applying ignore patterns)
184+
val allParametersStable = processedParameters.all { it.isStable }
185+
val isSkippable = composable.isRestartable &&
186+
(processedParameters.isEmpty() || allParametersStable)
187+
188+
composable.copy(
189+
parameters = processedParameters,
190+
isSkippable = isSkippable,
191+
)
192+
}
193+
194+
// Filter composables based on current filter type
195+
val filteredComposables = when (currentFilter) {
196+
FilterType.ALL -> processedComposables
197+
FilterType.SKIPPABLE -> processedComposables.filter { it.isSkippable }
198+
FilterType.UNSKIPPABLE -> processedComposables.filter { !it.isSkippable }
181199
}
182200

183201
val stats = StabilityStats(

0 commit comments

Comments
 (0)