Skip to content

Commit

Permalink
Add cache clear
Browse files Browse the repository at this point in the history
  • Loading branch information
seachicken committed Jun 22, 2024
1 parent e51f801 commit 950131e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/main/kotlin/inga/intellijinga/IngaConfigurable.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ class IngaConfigurable(private val project: Project) : Configurable {
cell(mountsTable(bindMounts)).align(AlignX.FILL)
}
}
row {
button("Clear Caches and Restart") {
project.service<IngaService>().clearCachesAndRestart()
}
}
}
}

Expand Down
7 changes: 7 additions & 0 deletions src/main/kotlin/inga/intellijinga/IngaService.kt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import com.intellij.openapi.application.PathManager
import com.intellij.openapi.components.Service
import com.intellij.openapi.components.service
import com.intellij.openapi.project.Project
import com.redhat.devtools.lsp4ij.LanguageServerManager
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import java.net.ServerSocket
Expand Down Expand Up @@ -67,6 +68,12 @@ class IngaService(private val project: Project) {
}
}

fun clearCachesAndRestart() {
LanguageServerManager.getInstance(project).stop("ingaLanguageServer");
Files.walk(ingaTempPath).map { it.toFile() }.forEach { it.delete() }
LanguageServerManager.getInstance(project).start("ingaLanguageServer");
}

private fun startIngaContainer(state: IngaSettingsState): String {
var ingaContainer = client
.listContainersCmd()
Expand Down

0 comments on commit 950131e

Please sign in to comment.