1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-05-25 18:34:08 +02:00
IntelliJ-IdeaVim/src/main/java/com/maddyhome/idea/vim/VimProjectService.kt
2023-01-10 10:09:25 +02:00

34 lines
884 B
Kotlin

/*
* Copyright 2003-2023 The IdeaVim authors
*
* Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE.txt file or at
* https://opensource.org/licenses/MIT.
*/
package com.maddyhome.idea.vim
import com.intellij.openapi.Disposable
import com.intellij.openapi.components.Service
import com.intellij.openapi.components.service
import com.intellij.openapi.project.Project
import com.maddyhome.idea.vim.group.EditorHolderService
@Service
class VimProjectService(val project: Project) : Disposable {
override fun dispose() {
// Not sure if this is a best solution
EditorHolderService.getInstance().editor = null
}
companion object {
@JvmStatic
fun getInstance(project: Project): VimProjectService = project.service()
}
}
@Suppress("unused")
val Project.vimDisposable
get() = VimProjectService.getInstance(this)