1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-07-23 09:59:02 +02:00

Update formatting

This commit is contained in:
Alex Plate 2022-04-24 00:15:29 +00:00
parent cf85e0f25e
commit ac41890759
3 changed files with 20 additions and 14 deletions
src/main/java/com/maddyhome/idea/vim

View File

@ -69,8 +69,7 @@ class OperatorAction : VimActionHandler.SingleExecution() {
if (range != null) {
val selectionType = if (argument.motion.isLinewiseMotion()) {
SelectionType.LINE_WISE
}
else {
} else {
SelectionType.CHARACTER_WISE
}
return doOperatorAction(editor, context, range, selectionType)
@ -82,7 +81,8 @@ class OperatorAction : VimActionHandler.SingleExecution() {
editor: VimEditor,
context: ExecutionContext,
argument: Argument,
operatorArguments: OperatorArguments): TextRange? {
operatorArguments: OperatorArguments
): TextRange? {
// Note that we're using getMotionRange2 in order to avoid normalising the linewise range into line start
// offsets that will be used to set the change marks. This affects things like the location of the caret in the
@ -106,7 +106,7 @@ class OperatorAction : VimActionHandler.SingleExecution() {
}
}
class VisualOperatorAction: VisualOperatorActionHandler.ForEachCaret() {
class VisualOperatorAction : VisualOperatorActionHandler.ForEachCaret() {
override val type: Command.Type = Command.Type.OTHER_SELF_SYNCHRONIZED
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_EXIT_VISUAL)
@ -121,4 +121,4 @@ class VisualOperatorAction: VisualOperatorActionHandler.ForEachCaret() {
): Boolean {
return doOperatorAction(editor, context, range.toVimTextRange(), range.type)
}
}
}

View File

@ -79,8 +79,8 @@ class CommentaryExtension : VimExtension {
listOf(IdeActions.ACTION_COMMENT_BLOCK, IdeActions.ACTION_COMMENT_LINE)
}
injector.actionExecutor.executeAction(actions[0], context)
|| injector.actionExecutor.executeAction(actions[1], context)
injector.actionExecutor.executeAction(actions[0], context) ||
injector.actionExecutor.executeAction(actions[1], context)
} finally {
// Remove the selection, if we added it
if (mode !== CommandState.Mode.VISUAL) {
@ -149,7 +149,7 @@ class CommentaryExtension : VimExtension {
*
* This object is both the `<Plug>Commentary` mapping handler and the text object handler
*/
private class CommentaryTextObjectMotionHandler: TextObjectActionHandler(), VimExtensionHandler {
private class CommentaryTextObjectMotionHandler : TextObjectActionHandler(), VimExtensionHandler {
override fun isRepeatable() = true
override fun execute(editor: Editor, context: DataContext) {
@ -157,8 +157,14 @@ class CommentaryExtension : VimExtension {
val count = maxOf(1, commandState.commandBuilder.count)
val textObjectHandler = this
commandState.commandBuilder.completeCommandPart(Argument(Command(count, textObjectHandler, Command.Type.MOTION,
EnumSet.noneOf(CommandFlags::class.java))))
commandState.commandBuilder.completeCommandPart(
Argument(
Command(
count, textObjectHandler, Command.Type.MOTION,
EnumSet.noneOf(CommandFlags::class.java)
)
)
)
}
override val visualType: TextObjectVisualType = TextObjectVisualType.LINE_WISE
@ -214,9 +220,9 @@ class CommentaryExtension : VimExtension {
*
* Used like `:1,3Commentary` or `g/fun/Commentary`
*/
private class CommentaryCommandAliasHandler: CommandAliasHandler {
override fun execute(command:String, ranges: Ranges, editor: VimEditor, context: ExecutionContext) {
private class CommentaryCommandAliasHandler : CommandAliasHandler {
override fun execute(command: String, ranges: Ranges, editor: VimEditor, context: ExecutionContext) {
doCommentary(editor, context, ranges.getTextRange(editor, -1), SelectionType.LINE_WISE, false)
}
}
}
}

View File

@ -153,4 +153,4 @@ private object AttributesCache {
}
@TestOnly
fun getGuiCursorMode(editor: Editor) = editor.guicursorMode()
fun getGuiCursorMode(editor: Editor) = editor.guicursorMode()