Skip to content

Commit 4ae2899

Browse files
committed
fix: rollback does not work if editor is opened before vcs is initialized
1 parent e6936d8 commit 4ae2899

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/main/kotlin/com/github/blarc/sops/intellij/plugin/providers/SopsEditorProvider.kt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import com.intellij.openapi.util.Disposer
1616
import com.intellij.openapi.vfs.VirtualFile
1717
import com.intellij.psi.PsiManager
1818
import com.intellij.testFramework.LightVirtualFile
19-
import com.intellij.ui.EditorNotifications
2019
import kotlinx.coroutines.Dispatchers
2120
import kotlinx.coroutines.withContext
2221

src/main/kotlin/com/github/blarc/sops/intellij/plugin/services/SopsVcsService.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package com.github.blarc.sops.intellij.plugin.services
33
import com.github.blarc.sops.intellij.plugin.getLastCommitContent
44
import com.intellij.openapi.components.Service
55
import com.intellij.openapi.project.Project
6+
import com.intellij.openapi.vcs.ProjectLevelVcsManager
67
import com.intellij.openapi.vfs.VirtualFile
78
import kotlinx.coroutines.CoroutineScope
89
import kotlinx.coroutines.launch
@@ -15,8 +16,10 @@ class SopsVcsService(
1516
virtualFile: VirtualFile,
1617
onResult: suspend (content: String?) -> Unit
1718
) {
18-
cs.launch {
19-
onResult(virtualFile.getLastCommitContent(project))
19+
ProjectLevelVcsManager.getInstance(project).runAfterInitialization {
20+
cs.launch {
21+
onResult(virtualFile.getLastCommitContent(project))
22+
}
2023
}
2124
}
2225
}

0 commit comments

Comments
 (0)