Skip to content

Commit e0171e6

Browse files
authored
fix: no longer timeout when a file is unchanged (#120)
1 parent a12decd commit e0171e6

3 files changed

Lines changed: 9 additions & 6 deletions

File tree

plugins/SpotlessIntegration/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
- only run daemon task in rootProject [#118](https://github.com/ghostflyby/IntelliJ-Plugins/pull/118)
1010

11+
### Fixed
12+
13+
- fix: no longer timeout when a file is unchanged [#120](https://github.com/ghostflyby/IntelliJ-Plugins/pull/120)
14+
1115
## [0.0.1] - 2025-12-12
1216

1317
### Added

plugins/SpotlessIntegration/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ plugins {
2828
id("repo.intellij-plugin")
2929
}
3030

31-
version = "0.0.1"
31+
version = "0.1.1"
3232

3333
buildLogic {
3434
pluginVersion = version.toString()

plugins/SpotlessIntegration/src/main/kotlin/dev/ghostflyby/spotless/SpotlessFormatingService.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ internal class SpotlessFormatingService : AsyncDocumentFormattingService() {
3838
override fun createFormattingTask(formattingRequest: AsyncFormattingRequest): FormattingTask? {
3939
val project = formattingRequest.context.project
4040
val virtualFile = formattingRequest.context.virtualFile ?: return null
41-
val spotless = service<Spotless>()
42-
if (!spotless.canFormatSync(project, virtualFile)) {
43-
return null
44-
}
4541
return SpotlessFormattingTask(project, virtualFile, formattingRequest)
4642
}
4743

@@ -66,7 +62,10 @@ internal class SpotlessFormatingService : AsyncDocumentFormattingService() {
6662
formattingRequest.documentText,
6763
)
6864
when (result) {
69-
SpotlessFormatResult.Clean, SpotlessFormatResult.NotCovered -> Unit
65+
SpotlessFormatResult.Clean, SpotlessFormatResult.NotCovered -> formattingRequest.onTextReady(
66+
null
67+
)
68+
7069
is SpotlessFormatResult.Dirty -> formattingRequest.onTextReady(result.content)
7170
is SpotlessFormatResult.Error -> formattingRequest.onError(
7271
Bundle.message("spotless.format.notification.error.title"),

0 commit comments

Comments
 (0)