diff --git a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/options/OptionScope.kt b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/options/OptionScope.kt new file mode 100644 index 000000000..761a0d040 --- /dev/null +++ b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/options/OptionScope.kt @@ -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() +} diff --git a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/vimscript/services/OptionService.kt b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/vimscript/services/OptionService.kt index 47accddce..f4ac5300a 100644 --- a/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/vimscript/services/OptionService.kt +++ b/vim-engine/src/main/kotlin/com/maddyhome/idea/vim/vimscript/services/OptionService.kt @@ -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) {