-
Notifications
You must be signed in to change notification settings - Fork 748
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into feature/gradle-intellij-plugin-v2
- Loading branch information
Showing
12 changed files
with
169 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
...st/java/org/jetbrains/plugins/ideavim/ex/implementation/commands/ClearJumpsCommandTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
/* | ||
* Copyright 2003-2024 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 org.jetbrains.plugins.ideavim.ex.implementation.commands | ||
|
||
import org.jetbrains.plugins.ideavim.VimTestCase | ||
import org.junit.jupiter.api.Test | ||
|
||
class ClearJumpsCommandTest : VimTestCase() { | ||
@Test | ||
fun `test clear jumps`() { | ||
configureByText( | ||
"""I found ${c}it in a legendary land | ||
|all rocks and lavender and tufted grass, | ||
|where it was settled on some sodden sand | ||
|hard by the torrent of a mountain pass. | ||
| | ||
|The features it combines mark it as new | ||
|to science: shape and shade -- the special tinge, | ||
|akin to moonlight, tempering its blue, | ||
|the dingy underside, the checquered fringe. | ||
""".trimMargin(), | ||
) | ||
|
||
enterSearch("sodden") | ||
enterSearch("shape") | ||
enterSearch("rocks", false) | ||
enterSearch("underside") | ||
|
||
enterCommand("jumps") | ||
assertExOutput( | ||
""" jump line col file/text | ||
| 4 1 8 I found it in a legendary land | ||
| 3 3 29 where it was settled on some sodden sand | ||
| 2 7 12 to science: shape and shade -- the special tinge, | ||
| 1 2 4 all rocks and lavender and tufted grass, | ||
|> | ||
| | ||
""".trimMargin(), | ||
) | ||
|
||
enterCommand("clearjumps") | ||
|
||
enterCommand("jumps") | ||
assertExOutput(" jump line col file/text\n>\n") | ||
} | ||
|
||
@Test | ||
fun `test clear jumps abbreviate`() { | ||
configureByText( | ||
"""I found ${c}it in a legendary land | ||
|all rocks and lavender and tufted grass, | ||
|where it was settled on some sodden sand | ||
|hard by the torrent of a mountain pass. | ||
| | ||
|The features it combines mark it as new | ||
|to science: shape and shade -- the special tinge, | ||
|akin to moonlight, tempering its blue, | ||
|the dingy underside, the checquered fringe. | ||
""".trimMargin(), | ||
) | ||
|
||
enterSearch("sodden") | ||
enterSearch("shape") | ||
enterSearch("rocks", false) | ||
enterSearch("underside") | ||
|
||
enterCommand("jumps") | ||
assertExOutput( | ||
""" jump line col file/text | ||
| 4 1 8 I found it in a legendary land | ||
| 3 3 29 where it was settled on some sodden sand | ||
| 2 7 12 to science: shape and shade -- the special tinge, | ||
| 1 2 4 all rocks and lavender and tufted grass, | ||
|> | ||
| | ||
""".trimMargin(), | ||
) | ||
|
||
enterCommand("clearju") | ||
|
||
enterCommand("jumps") | ||
assertExOutput(" jump line col file/text\n>\n") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
...gine/src/main/kotlin/com/maddyhome/idea/vim/vimscript/model/commands/ClearJumpsCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright 2003-2024 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.commands | ||
|
||
import com.intellij.vim.annotations.ExCommand | ||
import com.maddyhome.idea.vim.api.ExecutionContext | ||
import com.maddyhome.idea.vim.api.VimEditor | ||
import com.maddyhome.idea.vim.api.injector | ||
import com.maddyhome.idea.vim.command.OperatorArguments | ||
import com.maddyhome.idea.vim.ex.ranges.Range | ||
import com.maddyhome.idea.vim.vimscript.model.ExecutionResult | ||
|
||
@ExCommand(command = "cle[arjumps]") | ||
public data class ClearJumpsCommand(val range: Range, val argument: String) : Command.SingleExecution(range, argument) { | ||
override val argFlags: CommandHandlerFlags = flags( | ||
RangeFlag.RANGE_FORBIDDEN, | ||
ArgumentFlag.ARGUMENT_FORBIDDEN, | ||
Access.READ_ONLY | ||
) | ||
|
||
override fun processCommand( | ||
editor: VimEditor, | ||
context: ExecutionContext, | ||
operatorArguments: OperatorArguments, | ||
): ExecutionResult { | ||
injector.jumpService.clearJumps(editor.projectId) | ||
return ExecutionResult.Success | ||
} | ||
} |