1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-05-21 16:34:05 +02:00

Group function handlers like in Vim help

See `:help function-list`
This commit is contained in:
Matt Ellis 2025-02-18 18:34:43 +00:00 committed by Alex Pláte
parent 1bd7a7596b
commit c631d0738e
14 changed files with 42 additions and 33 deletions

View File

@ -29,7 +29,7 @@ import com.maddyhome.idea.vim.regexp.match.VimMatchResult
import com.maddyhome.idea.vim.register.RegisterConstants import com.maddyhome.idea.vim.register.RegisterConstants
import com.maddyhome.idea.vim.state.mode.inVisualMode import com.maddyhome.idea.vim.state.mode.inVisualMode
import com.maddyhome.idea.vim.vimscript.model.VimLContext import com.maddyhome.idea.vim.vimscript.model.VimLContext
import com.maddyhome.idea.vim.vimscript.model.functions.handlers.SubmatchFunctionHandler import com.maddyhome.idea.vim.vimscript.model.functions.handlers.stringFunctions.SubmatchFunctionHandler
import org.jetbrains.annotations.TestOnly import org.jetbrains.annotations.TestOnly
import java.text.NumberFormat import java.text.NumberFormat
import java.text.ParsePosition import java.text.ParsePosition

View File

@ -1,12 +1,12 @@
/* /*
* Copyright 2003-2024 The IdeaVim authors * Copyright 2003-2025 The IdeaVim authors
* *
* Use of this source code is governed by an MIT-style * Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE.txt file or at * license that can be found in the LICENSE.txt file or at
* https://opensource.org/licenses/MIT. * https://opensource.org/licenses/MIT.
*/ */
package com.maddyhome.idea.vim.vimscript.model.functions.handlers package com.maddyhome.idea.vim.vimscript.model.functions.handlers.commandLineFunctions
import com.intellij.vim.annotations.VimscriptFunction import com.intellij.vim.annotations.VimscriptFunction
import com.maddyhome.idea.vim.api.ExecutionContext import com.maddyhome.idea.vim.api.ExecutionContext

View File

@ -6,7 +6,7 @@
* https://opensource.org/licenses/MIT. * https://opensource.org/licenses/MIT.
*/ */
package com.maddyhome.idea.vim.vimscript.model.functions.handlers package com.maddyhome.idea.vim.vimscript.model.functions.handlers.cursorFunctions
import com.intellij.vim.annotations.VimscriptFunction import com.intellij.vim.annotations.VimscriptFunction
import com.maddyhome.idea.vim.api.ExecutionContext import com.maddyhome.idea.vim.api.ExecutionContext

View File

@ -1,12 +1,12 @@
/* /*
* Copyright 2003-2023 The IdeaVim authors * Copyright 2003-2025 The IdeaVim authors
* *
* Use of this source code is governed by an MIT-style * Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE.txt file or at * license that can be found in the LICENSE.txt file or at
* https://opensource.org/licenses/MIT. * https://opensource.org/licenses/MIT.
*/ */
package com.maddyhome.idea.vim.vimscript.model.functions.handlers package com.maddyhome.idea.vim.vimscript.model.functions.handlers.floatFunctions
import com.intellij.vim.annotations.VimscriptFunction import com.intellij.vim.annotations.VimscriptFunction
import com.maddyhome.idea.vim.api.ExecutionContext import com.maddyhome.idea.vim.api.ExecutionContext

View File

@ -1,12 +1,12 @@
/* /*
* Copyright 2003-2023 The IdeaVim authors * Copyright 2003-2025 The IdeaVim authors
* *
* Use of this source code is governed by an MIT-style * Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE.txt file or at * license that can be found in the LICENSE.txt file or at
* https://opensource.org/licenses/MIT. * https://opensource.org/licenses/MIT.
*/ */
package com.maddyhome.idea.vim.vimscript.model.functions.handlers package com.maddyhome.idea.vim.vimscript.model.functions.handlers.floatFunctions
import com.intellij.vim.annotations.VimscriptFunction import com.intellij.vim.annotations.VimscriptFunction
import com.maddyhome.idea.vim.api.ExecutionContext import com.maddyhome.idea.vim.api.ExecutionContext

View File

@ -6,7 +6,7 @@
* https://opensource.org/licenses/MIT. * https://opensource.org/licenses/MIT.
*/ */
package com.maddyhome.idea.vim.vimscript.model.functions.handlers package com.maddyhome.idea.vim.vimscript.model.functions.handlers.listFunctions
import com.intellij.vim.annotations.VimscriptFunction import com.intellij.vim.annotations.VimscriptFunction
import com.maddyhome.idea.vim.api.ExecutionContext import com.maddyhome.idea.vim.api.ExecutionContext

View File

@ -6,7 +6,7 @@
* https://opensource.org/licenses/MIT. * https://opensource.org/licenses/MIT.
*/ */
package com.maddyhome.idea.vim.vimscript.model.functions.handlers package com.maddyhome.idea.vim.vimscript.model.functions.handlers.listFunctions
import com.intellij.vim.annotations.VimscriptFunction import com.intellij.vim.annotations.VimscriptFunction
import com.maddyhome.idea.vim.api.ExecutionContext import com.maddyhome.idea.vim.api.ExecutionContext

View File

@ -1,4 +1,12 @@
package com.maddyhome.idea.vim.vimscript.model.functions.handlers /*
* Copyright 2003-2025 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.vimscript.model.functions.handlers.stringFunctions
import com.intellij.vim.annotations.VimscriptFunction import com.intellij.vim.annotations.VimscriptFunction
import com.maddyhome.idea.vim.api.ExecutionContext import com.maddyhome.idea.vim.api.ExecutionContext
@ -8,6 +16,7 @@ import com.maddyhome.idea.vim.vimscript.model.datatypes.VimDataType
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString import com.maddyhome.idea.vim.vimscript.model.datatypes.VimString
import com.maddyhome.idea.vim.vimscript.model.expressions.Expression import com.maddyhome.idea.vim.vimscript.model.expressions.Expression
import com.maddyhome.idea.vim.vimscript.model.functions.FunctionHandler import com.maddyhome.idea.vim.vimscript.model.functions.FunctionHandler
import kotlin.text.iterator
/** /**
* Implementation of Vim's escape() function. * Implementation of Vim's escape() function.
@ -42,4 +51,4 @@ internal class EscapeFunctionHandler : FunctionHandler() {
return VimString(result.toString()) return VimString(result.toString())
} }
} }

View File

@ -6,7 +6,7 @@
* https://opensource.org/licenses/MIT. * https://opensource.org/licenses/MIT.
*/ */
package com.maddyhome.idea.vim.vimscript.model.functions.handlers package com.maddyhome.idea.vim.vimscript.model.functions.handlers.stringFunctions
import com.intellij.vim.annotations.VimscriptFunction import com.intellij.vim.annotations.VimscriptFunction
import com.maddyhome.idea.vim.api.ExecutionContext import com.maddyhome.idea.vim.api.ExecutionContext

View File

@ -6,7 +6,7 @@
* https://opensource.org/licenses/MIT. * https://opensource.org/licenses/MIT.
*/ */
package com.maddyhome.idea.vim.vimscript.model.functions.handlers package com.maddyhome.idea.vim.vimscript.model.functions.handlers.stringFunctions
import com.intellij.vim.annotations.VimscriptFunction import com.intellij.vim.annotations.VimscriptFunction
import com.maddyhome.idea.vim.api.ExecutionContext import com.maddyhome.idea.vim.api.ExecutionContext

View File

@ -6,7 +6,7 @@
* https://opensource.org/licenses/MIT. * https://opensource.org/licenses/MIT.
*/ */
package com.maddyhome.idea.vim.vimscript.model.functions.handlers package com.maddyhome.idea.vim.vimscript.model.functions.handlers.stringFunctions
import com.intellij.vim.annotations.VimscriptFunction import com.intellij.vim.annotations.VimscriptFunction
import com.maddyhome.idea.vim.api.ExecutionContext import com.maddyhome.idea.vim.api.ExecutionContext

View File

@ -6,7 +6,7 @@
* https://opensource.org/licenses/MIT. * https://opensource.org/licenses/MIT.
*/ */
package com.maddyhome.idea.vim.vimscript.model.functions.handlers package com.maddyhome.idea.vim.vimscript.model.functions.handlers.varFunctions
import com.intellij.vim.annotations.VimscriptFunction import com.intellij.vim.annotations.VimscriptFunction
import com.maddyhome.idea.vim.api.ExecutionContext import com.maddyhome.idea.vim.api.ExecutionContext

View File

@ -1,12 +1,12 @@
/* /*
* Copyright 2003-2023 The IdeaVim authors * Copyright 2003-2025 The IdeaVim authors
* *
* Use of this source code is governed by an MIT-style * Use of this source code is governed by an MIT-style
* license that can be found in the LICENSE.txt file or at * license that can be found in the LICENSE.txt file or at
* https://opensource.org/licenses/MIT. * https://opensource.org/licenses/MIT.
*/ */
package com.maddyhome.idea.vim.vimscript.model.functions.handlers package com.maddyhome.idea.vim.vimscript.model.functions.handlers.variousFunctions
import com.intellij.vim.annotations.VimscriptFunction import com.intellij.vim.annotations.VimscriptFunction
import com.maddyhome.idea.vim.api.ExecutionContext import com.maddyhome.idea.vim.api.ExecutionContext
@ -45,6 +45,6 @@ internal class ExistsFunctionHandler : FunctionHandler() {
else -> throw ExException("exists function is not fully implemented") else -> throw ExException("exists function is not fully implemented")
} }
return if (result) VimInt.ONE else VimInt.ZERO return if (result) VimInt.Companion.ONE else VimInt.Companion.ZERO
} }
} }

View File

@ -1,23 +1,23 @@
{ {
"abs": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.AbsFunctionHandler", "abs": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.floatFunctions.AbsFunctionHandler",
"and": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.bitwiseFunctions.AndFunctionHandler", "and": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.bitwiseFunctions.AndFunctionHandler",
"col": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.ColFunctionHandler", "col": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.cursorFunctions.ColFunctionHandler",
"empty": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.EmptyFunctionHandler", "empty": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.EmptyFunctionHandler",
"escape": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.EscapeFunctionHandler", "escape": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.stringFunctions.EscapeFunctionHandler",
"exists": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.ExistsFunctionHandler", "exists": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.variousFunctions.ExistsFunctionHandler",
"funcref": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.FuncrefFunctionHandler", "funcref": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.varFunctions.FuncrefFunctionHandler",
"function": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.FunctionFunctionHandler", "function": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.varFunctions.FunctionFunctionHandler",
"get": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.GetFunctionHandler", "get": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.GetFunctionHandler",
"getcmdtype": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.GetCmdTypeFunctionHandler", "getcmdtype": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.commandLineFunctions.GetCmdTypeFunctionHandler",
"invert": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.bitwiseFunctions.InvertFunctionHandler", "invert": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.bitwiseFunctions.InvertFunctionHandler",
"join": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.JoinFunctionHandler", "join": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.listFunctions.JoinFunctionHandler",
"len": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.LenFunctionHandler", "len": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.LenFunctionHandler",
"line": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.LineFunctionHandler", "line": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.cursorFunctions.LineFunctionHandler",
"or": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.bitwiseFunctions.OrFunctionHandler", "or": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.bitwiseFunctions.OrFunctionHandler",
"sin": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.SinFunctionHandler", "sin": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.floatFunctions.SinFunctionHandler",
"split": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.SplitFunctionHandler", "split": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.listFunctions.SplitFunctionHandler",
"submatch": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.SubmatchFunctionHandler", "submatch": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.stringFunctions.SubmatchFunctionHandler",
"tolower": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.TolowerFunctionHandler", "tolower": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.stringFunctions.TolowerFunctionHandler",
"toupper": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.ToupperFunctionHandler", "toupper": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.stringFunctions.ToupperFunctionHandler",
"xor": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.bitwiseFunctions.XorFunctionHandler" "xor": "com.maddyhome.idea.vim.vimscript.model.functions.handlers.bitwiseFunctions.XorFunctionHandler"
} }