1
0
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:
Alex Plate 2023-09-14 16:26:14 +03:00
parent b1b6b0bf80
commit fe8bbcb11a
No known key found for this signature in database
GPG Key ID: 0B97153C8FFEC09F
2 changed files with 20 additions and 3 deletions
vim-engine/src/main/kotlin/com/maddyhome/idea/vim
options
vimscript/services

View File

@ -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()
}

View File

@ -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) {