mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-05-30 04:34:08 +02:00
Bring back a method to keep the compatibility
This commit is contained in:
parent
b1b6b0bf80
commit
fe8bbcb11a
vim-engine/src/main/kotlin/com/maddyhome/idea/vim
@ -0,0 +1,15 @@
|
||||
/*
|
||||
* 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.options
|
||||
|
||||
@Deprecated("Use injector.optionGroup functions")
|
||||
// Keep it to keep the compatibility with which-key plugin
|
||||
public sealed class OptionScope {
|
||||
public object GLOBAL : OptionScope()
|
||||
}
|
@ -14,6 +14,7 @@ import com.maddyhome.idea.vim.api.setToggleOption
|
||||
import com.maddyhome.idea.vim.ex.ExException
|
||||
import com.maddyhome.idea.vim.ex.exExceptionMessage
|
||||
import com.maddyhome.idea.vim.options.OptionAccessScope
|
||||
import com.maddyhome.idea.vim.options.OptionScope
|
||||
import com.maddyhome.idea.vim.options.ToggleOption
|
||||
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimDataType
|
||||
|
||||
@ -35,7 +36,8 @@ public interface OptionService {
|
||||
* @throws ExException("E518: Unknown option: $token")
|
||||
*/
|
||||
// Used by which-key 0.8.0 - "which-key", "timeout" and "timeoutlen"
|
||||
public fun getOptionValue(scope: OptionAccessScope, optionName: String, token: String = optionName): VimDataType
|
||||
@Deprecated("Use injector.optionGroup functions")
|
||||
public fun getOptionValue(scope: OptionScope, optionName: String, token: String = optionName): VimDataType
|
||||
|
||||
/**
|
||||
* COMPATIBILITY-LAYER: New method added
|
||||
@ -58,9 +60,9 @@ public interface OptionService {
|
||||
|
||||
@Suppress("DEPRECATION")
|
||||
internal class OptionServiceImpl : OptionService {
|
||||
override fun getOptionValue(scope: OptionAccessScope, optionName: String, token: String): VimDataType {
|
||||
override fun getOptionValue(scope: OptionScope, optionName: String, token: String): VimDataType {
|
||||
val option = injector.optionGroup.getOption(optionName) ?: throw exExceptionMessage("E518", token)
|
||||
return injector.optionGroup.getOptionValue(option, scope)
|
||||
return injector.optionGroup.getOptionValue(option, OptionAccessScope.GLOBAL(null))
|
||||
}
|
||||
|
||||
override fun setOption(scope: OptionService.Scope, optionName: String, token: String) {
|
||||
|
Loading…
Reference in New Issue
Block a user