1
0
mirror of https://github.com/chylex/IntelliJ-IdeaVim.git synced 2025-09-14 14:32:10 +02:00

Compare commits

...

55 Commits

Author SHA1 Message Date
120d889dfb Implement motions to go to next/previous misspelled word 2024-02-23 10:16:31 +02:00
Matt Ellis
f439474b73 Fix set command tests
Also hides more feature flags and diagnostic settings from users and unit tests. Shows them when in internal mode.
2024-02-23 10:04:23 +02:00
Matt Ellis
d6cd92e256 Migrate extensions to use operatorfunc option 2024-02-23 10:04:23 +02:00
Matt Ellis
3a294268d9 Introduce operatorfunc option
Allows creating custom operators in script, as shown in JetBrains/ideavim#702
2024-02-23 10:04:23 +02:00
Alex Plate
9b81c7e650 Update junit version 2024-02-23 10:03:30 +02:00
Alex Plate
e229fb3ad7 Add new plugin that depends on IdeaVim 2024-02-23 09:26:46 +02:00
Alex Plate
720eae63fa Fix the incorrect condition in UI tests 2024-02-23 09:23:42 +02:00
Alex Plate
0df96a24bd Add a missing @BeforeEach in tests 2024-02-22 09:19:24 +02:00
Alex Plate
21a1588ede Increase wait timeout for UI tests 2024-02-22 09:02:03 +02:00
Alex Plate
7970006e8c Log the base commit during dev version calculation 2024-02-22 09:02:02 +02:00
dependabot[bot]
418d0cff7f Bump org.junit.jupiter:junit-jupiter from 5.10.1 to 5.10.2
Bumps [org.junit.jupiter:junit-jupiter](https://github.com/junit-team/junit5) from 5.10.1 to 5.10.2.
- [Release notes](https://github.com/junit-team/junit5/releases)
- [Commits](https://github.com/junit-team/junit5/compare/r5.10.1...r5.10.2)

---
updated-dependencies:
- dependency-name: org.junit.jupiter:junit-jupiter
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-21 17:42:43 +02:00
dependabot[bot]
7284360774 Bump org.jetbrains.intellij from 1.17.0 to 1.17.2
Bumps org.jetbrains.intellij from 1.17.0 to 1.17.2.

---
updated-dependencies:
- dependency-name: org.jetbrains.intellij
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-21 17:42:15 +02:00
dependabot[bot]
9fc3fadee8 Bump org.antlr:antlr4 from 4.10.1 to 4.13.1
Bumps [org.antlr:antlr4](https://github.com/antlr/antlr4) from 4.10.1 to 4.13.1.
- [Release notes](https://github.com/antlr/antlr4/releases)
- [Changelog](https://github.com/antlr/antlr4/blob/dev/CHANGES.txt)
- [Commits](https://github.com/antlr/antlr4/compare/4.10.1...4.13.1)

---
updated-dependencies:
- dependency-name: org.antlr:antlr4
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-21 17:42:05 +02:00
Alex Plate
3d2db56f63 Use sets during plugin detection to avoid sorting problems 2024-02-21 10:43:44 +02:00
Alex Plate
e9c7cb8670 Update logic of calculation of dev version 2024-02-21 10:40:20 +02:00
dependabot[bot]
87d19274c5 Bump io.ktor:ktor-client-content-negotiation from 2.3.7 to 2.3.8
Bumps [io.ktor:ktor-client-content-negotiation](https://github.com/ktorio/ktor) from 2.3.7 to 2.3.8.
- [Release notes](https://github.com/ktorio/ktor/releases)
- [Changelog](https://github.com/ktorio/ktor/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ktorio/ktor/commits)

---
updated-dependencies:
- dependency-name: io.ktor:ktor-client-content-negotiation
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-20 17:10:25 +02:00
dependabot[bot]
3161bf8ffd Bump io.ktor:ktor-client-core from 2.3.7 to 2.3.8
Bumps [io.ktor:ktor-client-core](https://github.com/ktorio/ktor) from 2.3.7 to 2.3.8.
- [Release notes](https://github.com/ktorio/ktor/releases)
- [Changelog](https://github.com/ktorio/ktor/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ktorio/ktor/commits)

---
updated-dependencies:
- dependency-name: io.ktor:ktor-client-core
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-20 17:10:21 +02:00
Alex Plate
b68865587e Wait up to 5 mins for initialization of PyCharm 2024-02-20 17:06:32 +02:00
dependabot[bot]
7dc0dbe944 Bump io.ktor:ktor-serialization-kotlinx-json from 2.3.7 to 2.3.8
Bumps [io.ktor:ktor-serialization-kotlinx-json](https://github.com/ktorio/ktor) from 2.3.7 to 2.3.8.
- [Release notes](https://github.com/ktorio/ktor/releases)
- [Changelog](https://github.com/ktorio/ktor/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ktorio/ktor/commits)

---
updated-dependencies:
- dependency-name: io.ktor:ktor-serialization-kotlinx-json
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-20 16:56:35 +02:00
dependabot[bot]
f50a363525 Bump io.ktor:ktor-client-cio from 2.3.7 to 2.3.8
Bumps [io.ktor:ktor-client-cio](https://github.com/ktorio/ktor) from 2.3.7 to 2.3.8.
- [Release notes](https://github.com/ktorio/ktor/releases)
- [Changelog](https://github.com/ktorio/ktor/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ktorio/ktor/commits)

---
updated-dependencies:
- dependency-name: io.ktor:ktor-client-cio
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-20 16:56:16 +02:00
Alex Plate
57ad4c70d1 Do not analyze test fixtures by qodana 2024-02-20 16:46:43 +02:00
Alex Plate
d3d93b898f Unregister NotificationService project service
It's not registered as a light service and doesn't need to be registered in xml files
2024-02-20 16:46:07 +02:00
Alex Plate
7d8973edb2 Add tests for new java matchit functionality
From PR https://github.com/JetBrains/ideavim/pull/802
2024-02-20 16:42:28 +02:00
dependabot[bot]
2302b576b0 Bump io.ktor:ktor-client-auth from 2.3.7 to 2.3.8
Bumps [io.ktor:ktor-client-auth](https://github.com/ktorio/ktor) from 2.3.7 to 2.3.8.
- [Release notes](https://github.com/ktorio/ktor/releases)
- [Changelog](https://github.com/ktorio/ktor/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ktorio/ktor/commits)

---
updated-dependencies:
- dependency-name: io.ktor:ktor-client-auth
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-02-20 16:42:07 +02:00
f4782630d4 Add Matchit support for Java statements 2024-02-20 16:41:34 +02:00
IdeaVim Bot
8c1a2a686f Update changelog after merging PR 2024-02-20 14:33:04 +00:00
32d5e1e6fa Enforce LF line separator in project code style 2024-02-20 16:31:36 +02:00
Alex Plate
a381a1cacc Wait till all toolwindows initialziation 2024-02-20 16:19:29 +02:00
Alex Plate
73c3c9f7fe Replace Enum.values() with Enum.entries, as suggested since 1.9 2024-02-20 16:12:34 +02:00
Alex Plate
67ef0a75d5 Update capitalization 2024-02-20 16:12:11 +02:00
Alex Plate
328bc5e95a Convert some services to light services 2024-02-20 16:10:07 +02:00
Alex Plate
7f8021e37e Update the function that waits for smart mode 2024-02-20 15:49:42 +02:00
Alex Plate
9701b7e79b Add test reports to artifacts 2024-02-20 15:10:15 +02:00
Alex Plate
7a52c6fec9 Cleanup tests 2024-02-20 14:51:13 +02:00
Alex Plate
1503639d4b Remove generated lexing from qodana analyze 2024-02-20 14:51:06 +02:00
Alex Plate
e82f19c852 Add test for checking an issue that
was caught by property tests
2024-02-20 13:52:17 +02:00
Alex Plate
edd69c9c25 Apply patch for qodata TC config 2024-02-20 13:12:14 +02:00
Alex Plate
fc61e369fb Fix some deprecated calls 2024-02-20 13:11:10 +02:00
aleksei.plate@jetbrains.com
113586b59b TeamCity change in 'Ideavim' project: runners of 'Qodana checks' build configuration were updated 2024-02-20 10:53:37 +00:00
Alex Plate
5dbd5e1c89 Update the changelog 2024-02-20 12:47:06 +02:00
IdeaVim Bot
04b7d9e2c3 Preparation to 2.9.0 release 2024-02-20 10:41:06 +00:00
Alex Plate
5f2743176a Update qodana configuration on TC 2024-02-20 12:18:24 +02:00
aleksei.plate@jetbrains.com
3723488617 TeamCity change in 'Ideavim' project: runners of 'Qodana checks' build configuration were updated 2024-02-20 10:16:06 +00:00
Alex Plate
0cc17a0791 Make a correct service level for VimProjectService 2024-02-20 12:12:50 +02:00
aleksei.plate@jetbrains.com
05a21e6091 TeamCity change in 'Ideavim' project: 'Qodana checks' build configuration settings were updated 2024-02-20 08:58:47 +00:00
Alex Plate
fc06bc7c6f Update the qodana baseline 2024-02-20 10:58:08 +02:00
Alex Plate
1bd005adc1 Fix the name of the compatibility function 2024-02-20 10:39:34 +02:00
Alex Plate
4f208d1577 Add new plugin to the list 2024-02-20 10:37:10 +02:00
aleksei.plate@jetbrains.com
eb6e0557a7 TeamCity change in 'Ideavim' project: runners of 'Qodana checks' build configuration were updated 2024-02-20 08:23:51 +00:00
Alex Plate
cf09d66be6 Prototype for vimscript inspection 2024-02-20 06:13:26 +02:00
Alex Plate
76cd127a8a Bring back function to fix compatibility 2024-02-20 05:25:22 +02:00
Alex Plate
f6dd2a9968 Do not call for setCaretVisible in tests as this causes project leak 2024-02-20 05:20:05 +02:00
aleksei.plate@jetbrains.com
ae05a33e14 TeamCity change in 'Ideavim' project: general settings of 'Tests for IntelliJ Latest EAP' build configuration were updated 2024-02-19 07:13:35 +00:00
aleksei.plate@jetbrains.com
b38fad323b TeamCity change in 'Ideavim' project: general settings of 'Tests for IntelliJ Latest EAP' build configuration were updated 2024-02-19 07:12:50 +00:00
Alex Plate
c6027fcf0f Add new plugin for compatibility checks 2024-02-19 09:01:10 +02:00
137 changed files with 90614 additions and 35686 deletions

View File

@@ -52,6 +52,7 @@ jobs:
name: ui-test-fails-report-mac
path: |
build/reports
tests/ui-ij-tests/build/reports
sandbox-idea-log
# build-for-ui-test-linux:
# runs-on: ubuntu-latest

View File

@@ -52,4 +52,5 @@ jobs:
name: ui-test-fails-report-mac
path: |
build/reports
tests/ui-py-tests/build/reports
sandbox-idea-log

View File

@@ -49,6 +49,7 @@ jobs:
name: ui-test-fails-report-mac
path: |
build/reports
tests/ui-ij-tests/build/reports
sandbox-idea-log
# build-for-ui-test-linux:
# runs-on: ubuntu-latest

View File

@@ -6,6 +6,7 @@
<option name="CONTINUATION_INDENT_SIZE" value="4" />
</value>
</option>
<option name="LINE_SEPARATOR" value="&#10;" />
<JavaCodeStyleSettings>
<option name="FIELD_NAME_PREFIX" value="my" />
<option name="STATIC_FIELD_NAME_PREFIX" value="our" />

View File

@@ -46,8 +46,8 @@ object Qodana : IdeaVimBuildType({
version = Qodana.JVMVersion.LATEST
}
reportAsTests = true
additionalDockerArguments = "-e QODANA_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJvcmdhbml6YXRpb24iOiIzUFZrQSIsInByb2plY3QiOiIzN1FlQSIsInRva2VuIjoiM0t2bXoifQ.uohp81tM7iAfvvB6k8faarfpV-OjusAaEbWQ8iNrOgs"
additionalQodanaArguments = "--baseline qodana.sarif.json"
cloudToken = "credentialsJSON:6b79412e-9198-4862-9223-c5019488f903"
}
}
@@ -63,7 +63,6 @@ object Qodana : IdeaVimBuildType({
timezone = "SERVER"
}
param("dayOfWeek", "Sunday")
enabled = false
}
}

View File

@@ -1,11 +1,9 @@
package patches.buildTypes
import jetbrains.buildServer.configs.kotlin.v2019_2.RelativeId
import jetbrains.buildServer.configs.kotlin.v2019_2.*
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.GradleBuildStep
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle
import jetbrains.buildServer.configs.kotlin.v2019_2.ui.changeBuildType
import jetbrains.buildServer.configs.kotlin.v2019_2.ui.expectSteps
import jetbrains.buildServer.configs.kotlin.v2019_2.ui.update
import jetbrains.buildServer.configs.kotlin.v2019_2.ui.*
/*
This patch script was generated by TeamCity on settings change in UI.
@@ -13,6 +11,18 @@ To apply the patch, change the buildType with id = 'IdeaVimTests_Latest_EAP'
accordingly, and delete the patch script.
*/
changeBuildType(RelativeId("IdeaVimTests_Latest_EAP")) {
check(artifactRules == """
+:build/reports => build/reports
+:/mnt/agent/temp/buildTmp/ => /mnt/agent/temp/buildTmp/
""".trimIndent()) {
"Unexpected option value: artifactRules = $artifactRules"
}
artifactRules = """
+:build/reports => build/reports
+:/mnt/agent/temp/buildTmp/ => /mnt/agent/temp/buildTmp/
+:tests/java-tests/build/reports => tests/java-tests/build/reports
""".trimIndent()
expectSteps {
gradle {
tasks = "clean test"

View File

@@ -26,12 +26,19 @@ usual beta standards.
## To Be Released
### Fixes:
* [VIM-3055](https://youtrack.jetbrains.com/issue/VIM-3055) Fix the issue with double deleting after dot
* [VIM-3291](https://youtrack.jetbrains.com/issue/VIM-3291) Remove sync of editor selection between different opened editors
* [VIM-3234](https://youtrack.jetbrains.com/issue/VIM-3234) The space character won't mix in the tab chars after >> and << commands
*
### Merged PRs:
* [805](https://github.com/JetBrains/ideavim/pull/805) by [chylex](https://github.com/chylex): VIM-3238 Fix recording a macro that replays another macro
* [806](https://github.com/JetBrains/ideavim/pull/806) by [chylex](https://github.com/chylex): Enforce LF line separator in project code style
## 2.9.0, 2024-02-20
### Fixes:
* [VIM-3055](https://youtrack.jetbrains.com/issue/VIM-3055) Fix the issue with double deleting after dot
### Merged PRs:
* [725](https://github.com/JetBrains/ideavim/pull/725) by [Emanuel Gestosa](https://github.com/emanuelgestosa): Regex
* [805](https://github.com/JetBrains/ideavim/pull/805) by [chylex](https://github.com/chylex): VIM-3238 Fix recording a macro that replays another macro
## 2.8.0, 2024-01-30

View File

@@ -52,11 +52,11 @@ buildscript {
classpath("org.eclipse.jgit:org.eclipse.jgit.ssh.apache:6.8.0.202311291450-r")
classpath("org.kohsuke:github-api:1.305")
classpath("io.ktor:ktor-client-core:2.3.7")
classpath("io.ktor:ktor-client-cio:2.3.7")
classpath("io.ktor:ktor-client-auth:2.3.7")
classpath("io.ktor:ktor-client-content-negotiation:2.3.7")
classpath("io.ktor:ktor-serialization-kotlinx-json:2.3.7")
classpath("io.ktor:ktor-client-core:2.3.8")
classpath("io.ktor:ktor-client-cio:2.3.8")
classpath("io.ktor:ktor-client-auth:2.3.8")
classpath("io.ktor:ktor-client-content-negotiation:2.3.8")
classpath("io.ktor:ktor-serialization-kotlinx-json:2.3.8")
// This comes from the changelog plugin
// classpath("org.jetbrains:markdown:0.3.1")
@@ -70,7 +70,7 @@ plugins {
application
id("java-test-fixtures")
id("org.jetbrains.intellij") version "1.17.0"
id("org.jetbrains.intellij") version "1.17.2"
id("org.jetbrains.changelog") version "2.2.0"
id("org.jetbrains.kotlinx.kover") version "0.6.1"
@@ -144,12 +144,12 @@ dependencies {
// https://mvnrepository.com/artifact/org.mockito.kotlin/mockito-kotlin
testImplementation("org.mockito.kotlin:mockito-kotlin:5.2.1")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.1")
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.10.1")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.1")
testFixturesImplementation("org.junit.jupiter:junit-jupiter-api:5.10.1")
testFixturesImplementation("org.junit.jupiter:junit-jupiter-engine:5.10.1")
testFixturesImplementation("org.junit.jupiter:junit-jupiter-params:5.10.1")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.2")
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.10.2")
testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.2")
testFixturesImplementation("org.junit.jupiter:junit-jupiter-api:5.10.2")
testFixturesImplementation("org.junit.jupiter:junit-jupiter-engine:5.10.2")
testFixturesImplementation("org.junit.jupiter:junit-jupiter-params:5.10.2")
}
configurations {
@@ -431,12 +431,14 @@ val prId: String by project
tasks.register("updateMergedPr") {
doLast {
if (project.hasProperty("prId")) {
println("Got pr id: $prId")
updateMergedPr(prId.toInt())
} else {
error("Cannot get prId")
}
val x = changelog.getUnreleased()
println("x")
// if (project.hasProperty("prId")) {
// println("Got pr id: $prId")
// updateMergedPr(prId.toInt())
// } else {
// error("Cannot get prId")
// }
}
}

File diff suppressed because one or more lines are too long

View File

@@ -21,6 +21,9 @@ exclude:
- src/test/java/org/jetbrains/plugins/ideavim/propertybased/samples/SimpleText.kt
- src/main/java/com/maddyhome/idea/vim/vimscript/parser/generated
- src/main/java/com/maddyhome/idea/vim/package-info.java
- vim-engine/src/main/java/com/maddyhome/idea/vim/regexp/parser/generated
- src/main/java/com/maddyhome/idea/vim/group/SearchGroup.java
- tests/ui-fixtures
dependencyIgnores:
- name: "acejump"
- name: "icu4j"

View File

@@ -22,11 +22,11 @@ repositories {
dependencies {
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:1.9.22")
implementation("io.ktor:ktor-client-core:2.3.7")
implementation("io.ktor:ktor-client-cio:2.3.7")
implementation("io.ktor:ktor-client-content-negotiation:2.3.7")
implementation("io.ktor:ktor-serialization-kotlinx-json:2.3.7")
implementation("io.ktor:ktor-client-auth:2.3.7")
implementation("io.ktor:ktor-client-core:2.3.8")
implementation("io.ktor:ktor-client-cio:2.3.8")
implementation("io.ktor:ktor-client-content-negotiation:2.3.8")
implementation("io.ktor:ktor-serialization-kotlinx-json:2.3.8")
implementation("io.ktor:ktor-client-auth:2.3.8")
implementation("org.eclipse.jgit:org.eclipse.jgit:6.6.0.202305301015-r")
// This is needed for jgit to connect to ssh

View File

@@ -22,7 +22,7 @@ import kotlinx.serialization.json.jsonPrimitive
*/
@Suppress("SpellCheckingInspection")
val knownPlugins = listOf(
val knownPlugins = setOf(
"IdeaVimExtension",
"github.zgqq.intellij-enhance",
"org.jetbrains.IdeaVim-EasyMotion",
@@ -31,7 +31,12 @@ val knownPlugins = listOf(
"com.github.copilot",
"com.github.dankinsoid.multicursor",
"com.joshestein.ideavim-quickscope",
"ca.alexgirard.HarpoonIJ",
"me.kyren223.harpoonforjb", // https://plugins.jetbrains.com/plugin/23771-harpoonforjb
"com.github.erotourtes.harpoon", // https://plugins.jetbrains.com/plugin/21796-harpooner
"me.kyren223.trident", // https://plugins.jetbrains.com/plugin/23818-trident
"com.protoseo.input-source-auto-converter",
// "cc.implicated.intellij.plugins.bunny", // I don't want to include this plugin in the list of IdeaVim plugins as I don't understand what this is for
@@ -42,7 +47,7 @@ suspend fun main() {
parameter("dependency", "IdeaVIM")
parameter("includeOptional", true)
}
val output = response.body<List<String>>()
val output = response.body<List<String>>().toSet()
println(output)
if (knownPlugins != output) {
val newPlugins = (output - knownPlugins).map { it to (getPluginLinkByXmlId(it) ?: "Can't find plugin link") }

View File

@@ -8,6 +8,12 @@
package scripts.release
import org.eclipse.jgit.lib.ObjectId
import org.eclipse.jgit.revwalk.RevCommit
import org.eclipse.jgit.revwalk.RevWalk
import org.eclipse.jgit.revwalk.filter.RevFilter
fun main(args: Array<String>) {
println("HI!")
val projectDir = args[0]
@@ -19,10 +25,12 @@ fun main(args: Array<String>) {
check(branch == "master") {
"We should be on master branch"
}
val mergeBaseCommit = getMergeBaseWithMaster(projectDir, objectId)
println("Base commit $mergeBaseCommit")
withGit(projectDir) { git ->
val log = git.log().setMaxCount(500).call().toList()
println("First commit hash in log: " + log.first().name + " log size: ${log.size}")
val logDiff = log.takeWhile { it.id.name != objectId.name }
val logDiff = log.takeWhile { it.id.name != mergeBaseCommit }
val numCommits = logDiff.size
println("Log diff size is $numCommits")
check(numCommits < 450) {
@@ -35,3 +43,18 @@ fun main(args: Array<String>) {
println("##teamcity[setParameter name='env.ORG_GRADLE_PROJECT_version' value='$nextVersion']")
}
}
private fun getMergeBaseWithMaster(projectDir: String, tag: ObjectId): String {
withRepo(projectDir) { repo ->
val master = repo.resolve("master")
RevWalk(repo).use { walk ->
val tagRevCommit = walk.parseCommit(tag)
val masterRevCommit = walk.parseCommit(master)
walk.setRevFilter(RevFilter.MERGE_BASE)
walk.markStart(tagRevCommit)
walk.markStart(masterRevCommit)
val mergeBase: RevCommit = walk.next()
return mergeBase.name
}
}
}

View File

@@ -14,7 +14,7 @@ import com.intellij.openapi.components.service
import com.intellij.openapi.project.Project
import com.maddyhome.idea.vim.group.EditorHolderService
@Service
@Service(Service.Level.PROJECT)
internal class VimProjectService(val project: Project) : Disposable {
override fun dispose() {
// Not sure if this is a best solution

View File

@@ -14,6 +14,7 @@ import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.ExecutionContext
import com.maddyhome.idea.vim.api.VimCaret
import com.maddyhome.idea.vim.api.VimEditor
import com.maddyhome.idea.vim.api.globalOptions
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.api.setChangeMarks
import com.maddyhome.idea.vim.command.Argument
@@ -21,6 +22,7 @@ import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.OperatorArguments
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.common.argumentCaptured
import com.maddyhome.idea.vim.ex.ExException
import com.maddyhome.idea.vim.group.MotionGroup
import com.maddyhome.idea.vim.group.visual.VimSelection
import com.maddyhome.idea.vim.handler.VimActionHandler
@@ -29,21 +31,67 @@ import com.maddyhome.idea.vim.helper.MessageHelper
import com.maddyhome.idea.vim.helper.vimStateMachine
import com.maddyhome.idea.vim.newapi.ij
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.vimscript.model.CommandLineVimLContext
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimFuncref
import com.maddyhome.idea.vim.vimscript.model.expressions.FunctionCallExpression
import com.maddyhome.idea.vim.vimscript.model.expressions.SimpleExpression
// todo make it multicaret
private fun doOperatorAction(editor: VimEditor, context: ExecutionContext, textRange: TextRange, selectionType: SelectionType): Boolean {
val operatorFunction = injector.keyGroup.operatorFunction
if (operatorFunction == null) {
val func = injector.globalOptions().operatorfunc
if (func.isEmpty()) {
VimPlugin.showMessage(MessageHelper.message("E774"))
return false
}
val scriptContext = CommandLineVimLContext
// The option value is either a function name, which should have a handler, or it might be a lambda expression, or a
// `function` or `funcref` call expression, all of which will return a funcref (with a handler)
var handler = injector.functionService.getFunctionHandlerOrNull(null, func, scriptContext)
if (handler == null) {
val expression = injector.vimscriptParser.parseExpression(func)
if (expression != null) {
try {
val value = expression.evaluate(editor, context, scriptContext)
if (value is VimFuncref) {
handler = value.handler
}
} catch (ex: ExException) {
// Get the argument for function('...') or funcref('...') for the error message
val functionName = if (expression is FunctionCallExpression && expression.arguments.size > 0) {
expression.arguments[0].evaluate(editor, context, scriptContext).toString()
}
else {
func
}
VimPlugin.showMessage("E117: Unknown function: $functionName")
return false
}
}
}
if (handler == null) {
VimPlugin.showMessage("E117: Unknown function: $func")
return false
}
val arg = when (selectionType) {
SelectionType.LINE_WISE -> "line"
SelectionType.CHARACTER_WISE -> "char"
SelectionType.BLOCK_WISE -> "block"
}
val saveRepeatHandler = VimRepeater.repeatHandler
injector.markService.setChangeMarks(editor.primaryCaret(), textRange)
KeyHandler.getInstance().reset(editor)
val result = operatorFunction.apply(editor, context, selectionType)
val arguments = listOf(SimpleExpression(arg))
handler.executeFunction(arguments, editor, context, scriptContext)
VimRepeater.repeatHandler = saveRepeatHandler
return result
return true
}
@CommandOrMotion(keys = ["g@"], modes = [Mode.NORMAL])

View File

@@ -23,17 +23,17 @@ public class CommandState(private val machine: VimStateMachine) {
public val isOperatorPending: Boolean
get() = machine.isOperatorPending
public val mode: CommandState.Mode
public val mode: Mode
get() {
val myMode = machine.mode
return when (myMode) {
is com.maddyhome.idea.vim.state.mode.Mode.CMD_LINE -> CommandState.Mode.CMD_LINE
com.maddyhome.idea.vim.state.mode.Mode.INSERT -> CommandState.Mode.INSERT
is com.maddyhome.idea.vim.state.mode.Mode.NORMAL -> CommandState.Mode.COMMAND
is com.maddyhome.idea.vim.state.mode.Mode.OP_PENDING -> CommandState.Mode.OP_PENDING
com.maddyhome.idea.vim.state.mode.Mode.REPLACE -> CommandState.Mode.REPLACE
is com.maddyhome.idea.vim.state.mode.Mode.SELECT -> CommandState.Mode.SELECT
is com.maddyhome.idea.vim.state.mode.Mode.VISUAL -> CommandState.Mode.VISUAL
is com.maddyhome.idea.vim.state.mode.Mode.CMD_LINE -> Mode.CMD_LINE
com.maddyhome.idea.vim.state.mode.Mode.INSERT -> Mode.INSERT
is com.maddyhome.idea.vim.state.mode.Mode.NORMAL -> Mode.COMMAND
is com.maddyhome.idea.vim.state.mode.Mode.OP_PENDING -> Mode.OP_PENDING
com.maddyhome.idea.vim.state.mode.Mode.REPLACE -> Mode.REPLACE
is com.maddyhome.idea.vim.state.mode.Mode.SELECT -> Mode.SELECT
is com.maddyhome.idea.vim.state.mode.Mode.VISUAL -> Mode.VISUAL
}
}

View File

@@ -14,21 +14,34 @@ import com.intellij.openapi.editor.Editor
import com.maddyhome.idea.vim.KeyHandler
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.action.change.Extension
import com.maddyhome.idea.vim.api.ExecutionContext
import com.maddyhome.idea.vim.api.ImmutableVimCaret
import com.maddyhome.idea.vim.api.VimCaret
import com.maddyhome.idea.vim.api.VimEditor
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.command.MappingMode
import com.maddyhome.idea.vim.common.CommandAlias
import com.maddyhome.idea.vim.common.CommandAliasHandler
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.helper.CommandLineHelper
import com.maddyhome.idea.vim.helper.TestInputModel
import com.maddyhome.idea.vim.helper.noneOfEnum
import com.maddyhome.idea.vim.helper.vimStateMachine
import com.maddyhome.idea.vim.key.MappingOwner
import com.maddyhome.idea.vim.key.OperatorFunction
import com.maddyhome.idea.vim.newapi.vim
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.ui.ModalEntry
import com.maddyhome.idea.vim.vimscript.model.Executable
import com.maddyhome.idea.vim.vimscript.model.ExecutionResult
import com.maddyhome.idea.vim.vimscript.model.VimLContext
import com.maddyhome.idea.vim.vimscript.model.datatypes.VimDataType
import com.maddyhome.idea.vim.vimscript.model.expressions.Expression
import com.maddyhome.idea.vim.vimscript.model.expressions.Scope
import com.maddyhome.idea.vim.vimscript.model.statements.FunctionDeclaration
import com.maddyhome.idea.vim.vimscript.model.statements.FunctionFlag
import java.awt.event.KeyEvent
import java.util.*
import javax.swing.KeyStroke
/**
@@ -120,12 +133,6 @@ public object VimExtensionFacade {
.setAlias(name, CommandAlias.Call(minimumNumberOfArguments, maximumNumberOfArguments, name, handler))
}
/** Sets the value of 'operatorfunc' to be used as the operator function in 'g@'. */
@JvmStatic
public fun setOperatorFunction(function: OperatorFunction) {
VimPlugin.getKey().operatorFunction = function
}
/**
* Runs normal mode commands similar to ':normal! {commands}'.
* Mappings doesn't work with this function
@@ -207,4 +214,65 @@ public object VimExtensionFacade {
public fun setRegister(register: Char, keys: List<KeyStroke?>?, type: SelectionType) {
VimPlugin.getRegister().setKeys(register, keys?.filterNotNull() ?: emptyList(), type)
}
@JvmStatic
public fun exportScriptFunction(
scope: Scope?,
name: String,
args: List<String>,
defaultArgs: List<Pair<String, Expression>>,
hasOptionalArguments: Boolean,
flags: EnumSet<FunctionFlag>,
function: ScriptFunction
) {
var functionDeclaration: FunctionDeclaration? = null
val body = listOf(object : Executable {
// This context is set to the function declaration during initialisation and then set to the function execution
// context during execution
override lateinit var vimContext: VimLContext
override var rangeInScript: TextRange = TextRange(0, 0)
override fun execute(editor: VimEditor, context: ExecutionContext): ExecutionResult {
return function.execute(editor, context, functionDeclaration!!.functionVariables)
}
})
functionDeclaration = FunctionDeclaration(
scope,
name,
args,
defaultArgs,
body,
replaceExisting = true,
flags,
hasOptionalArguments
)
functionDeclaration.rangeInScript = TextRange(0, 0)
body.forEach { it.vimContext = functionDeclaration }
injector.functionService.storeFunction(functionDeclaration)
}
}
public fun VimExtensionFacade.exportOperatorFunction(name: String, function: OperatorFunction) {
exportScriptFunction(null, name, listOf("type"), emptyList(), false, noneOfEnum()) {
editor, context, args ->
val type = args["type"]?.asString()
val selectionType = when (type) {
"line" -> SelectionType.LINE_WISE
"block" -> SelectionType.BLOCK_WISE
"char" -> SelectionType.CHARACTER_WISE
else -> return@exportScriptFunction ExecutionResult.Error
}
if (function.apply(editor, context, selectionType)) {
ExecutionResult.Success
}
else {
ExecutionResult.Error
}
}
}
public fun interface ScriptFunction {
public fun execute(editor: VimEditor, context: ExecutionContext, args: Map<String, VimDataType>): ExecutionResult
}

View File

@@ -22,26 +22,26 @@ import com.maddyhome.idea.vim.api.ExecutionContext
import com.maddyhome.idea.vim.api.ImmutableVimCaret
import com.maddyhome.idea.vim.api.VimEditor
import com.maddyhome.idea.vim.api.getLineEndOffset
import com.maddyhome.idea.vim.api.globalOptions
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.command.Argument
import com.maddyhome.idea.vim.command.Command
import com.maddyhome.idea.vim.command.CommandFlags
import com.maddyhome.idea.vim.command.MappingMode
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.command.OperatorArguments
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.command.TextObjectVisualType
import com.maddyhome.idea.vim.common.CommandAliasHandler
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.ex.ranges.Ranges
import com.maddyhome.idea.vim.extension.ExtensionHandler
import com.maddyhome.idea.vim.extension.VimExtension
import com.maddyhome.idea.vim.extension.VimExtensionFacade
import com.maddyhome.idea.vim.extension.VimExtensionFacade.addCommand
import com.maddyhome.idea.vim.extension.VimExtensionFacade.executeNormalWithoutMapping
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMapping
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMapping
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setOperatorFunction
import com.maddyhome.idea.vim.extension.exportOperatorFunction
import com.maddyhome.idea.vim.handler.TextObjectActionHandler
import com.maddyhome.idea.vim.helper.PsiHelper
import com.maddyhome.idea.vim.helper.vimStateMachine
@@ -49,17 +49,22 @@ import com.maddyhome.idea.vim.key.OperatorFunction
import com.maddyhome.idea.vim.newapi.IjVimEditor
import com.maddyhome.idea.vim.newapi.ij
import com.maddyhome.idea.vim.newapi.vim
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import java.util.*
internal class CommentaryExtension : VimExtension {
companion object {
private const val OPERATOR_FUNC = "CommentaryOperatorFunc"
fun doCommentary(
editor: VimEditor,
context: ExecutionContext,
range: TextRange,
selectionType: SelectionType,
resetCaret: Boolean,
resetCaret: Boolean = true,
): Boolean {
val mode = editor.vimStateMachine.mode
if (mode !is Mode.VISUAL) {
@@ -67,8 +72,7 @@ internal class CommentaryExtension : VimExtension {
}
return runWriteAction {
// Treat block- and character-wise selections as block comments. Be ready to fall back to if the first action
// isn't available
// Treat block- and character-wise selections as block comments. Fall back if the first action isn't available
val actions = if (selectionType === SelectionType.LINE_WISE) {
listOf(IdeActions.ACTION_COMMENT_LINE, IdeActions.ACTION_COMMENT_BLOCK)
} else {
@@ -113,6 +117,7 @@ internal class CommentaryExtension : VimExtension {
// first non-whitespace character, then the caret is in the right place. If it's inserted at the first column,
// then the caret is now in a bit of a weird place. We can't detect this scenario, so we just have to accept
// the difference
// TODO: If we don't move the caret to the start offset, we should maintain the current logical position
if (resetCaret) {
editor.primaryCaret().moveToOffset(range.startOffset)
}
@@ -145,6 +150,16 @@ internal class CommentaryExtension : VimExtension {
putKeyMapping(MappingMode.N, injector.parser.parseKeys("<Plug>(CommentLine)"), owner, plugCommentaryLineKeys, true)
addCommand("Commentary", CommentaryCommandAliasHandler())
VimExtensionFacade.exportOperatorFunction(OPERATOR_FUNC, CommentaryOperatorFunction())
}
private class CommentaryOperatorFunction : OperatorFunction {
// todo make it multicaret
override fun apply(editor: VimEditor, context: ExecutionContext, selectionType: SelectionType?): Boolean {
val range = injector.markService.getChangeMarks(editor.primaryCaret()) ?: return false
return doCommentary(editor, context, range, selectionType ?: SelectionType.CHARACTER_WISE, true)
}
}
/**
@@ -153,19 +168,13 @@ internal class CommentaryExtension : VimExtension {
* E.g. handles the `gc` in `gc_`, by setting the operator function, then invoking `g@` to receive the `_` motion to
* invoke the operator. This object is both the mapping handler and the operator function.
*/
private class CommentaryOperatorHandler : OperatorFunction, ExtensionHandler {
private class CommentaryOperatorHandler : ExtensionHandler {
override val isRepeatable = true
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
setOperatorFunction(this)
injector.globalOptions().operatorfunc = OPERATOR_FUNC
executeNormalWithoutMapping(injector.parser.parseKeys("g@"), editor.ij)
}
// todo make it multicaret
override fun apply(editor: VimEditor, context: ExecutionContext, selectionType: SelectionType?): Boolean {
val range = injector.markService.getChangeMarks(editor.primaryCaret()) ?: return false
return doCommentary(editor, context, range, selectionType ?: SelectionType.CHARACTER_WISE, true)
}
}
private class CommentaryMappingHandler : ExtensionHandler {

View File

@@ -19,22 +19,23 @@ import com.intellij.openapi.util.Key
import com.maddyhome.idea.vim.api.ExecutionContext
import com.maddyhome.idea.vim.api.VimEditor
import com.maddyhome.idea.vim.api.getOffset
import com.maddyhome.idea.vim.api.globalOptions
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.api.setChangeMarks
import com.maddyhome.idea.vim.command.MappingMode
import com.maddyhome.idea.vim.command.OperatorArguments
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.state.mode.SelectionType.CHARACTER_WISE
import com.maddyhome.idea.vim.state.mode.selectionType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.extension.ExtensionHandler
import com.maddyhome.idea.vim.extension.VimExtension
import com.maddyhome.idea.vim.extension.VimExtensionFacade
import com.maddyhome.idea.vim.extension.VimExtensionFacade.executeNormalWithoutMapping
import com.maddyhome.idea.vim.extension.VimExtensionFacade.getRegister
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMapping
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setOperatorFunction
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setRegister
import com.maddyhome.idea.vim.extension.exportOperatorFunction
import com.maddyhome.idea.vim.helper.fileSize
import com.maddyhome.idea.vim.state.mode.mode
import com.maddyhome.idea.vim.helper.moveToInlayAwareLogicalPosition
@@ -72,17 +73,15 @@ internal class VimExchangeExtension : VimExtension {
putKeyMappingIfMissing(MappingMode.X, injector.parser.parseKeys("X"), owner, injector.parser.parseKeys(EXCHANGE_CMD), true)
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("cxc"), owner, injector.parser.parseKeys(EXCHANGE_CLEAR_CMD), true)
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("cxx"), owner, injector.parser.parseKeys(EXCHANGE_LINE_CMD), true)
VimExtensionFacade.exportOperatorFunction(OPERATOR_FUNC, Operator())
}
companion object {
@NonNls
const val EXCHANGE_CMD = "<Plug>(Exchange)"
@NonNls
const val EXCHANGE_CLEAR_CMD = "<Plug>(ExchangeClear)"
@NonNls
const val EXCHANGE_LINE_CMD = "<Plug>(ExchangeLine)"
@NonNls private const val EXCHANGE_CMD = "<Plug>(Exchange)"
@NonNls private const val EXCHANGE_CLEAR_CMD = "<Plug>(ExchangeClear)"
@NonNls private const val EXCHANGE_LINE_CMD = "<Plug>(ExchangeLine)"
@NonNls private const val OPERATOR_FUNC = "ExchangeOperatorFunc"
val EXCHANGE_KEY = Key<Exchange>("exchange")
@@ -108,7 +107,7 @@ internal class VimExchangeExtension : VimExtension {
override val isRepeatable = true
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
setOperatorFunction(Operator(false))
injector.globalOptions().operatorfunc = OPERATOR_FUNC
executeNormalWithoutMapping(injector.parser.parseKeys(if (isLine) "g@_" else "g@"), editor.ij)
}
}
@@ -125,12 +124,12 @@ internal class VimExchangeExtension : VimExtension {
val mode = editor.mode
// Leave visual mode to create selection marks
executeNormalWithoutMapping(injector.parser.parseKeys("<Esc>"), editor.ij)
Operator(true).apply(editor, context, mode.selectionType ?: CHARACTER_WISE)
Operator(true).apply(editor, context, mode.selectionType ?: SelectionType.CHARACTER_WISE)
}
}
}
private class Operator(private val isVisual: Boolean) : OperatorFunction {
private class Operator(private val isVisual: Boolean = false) : OperatorFunction {
fun Editor.getMarkOffset(mark: Mark) = IjVimEditor(this).getOffset(mark.line, mark.col)
fun SelectionType.getString() = when (this) {
SelectionType.CHARACTER_WISE -> "v"
@@ -148,7 +147,7 @@ internal class VimExchangeExtension : VimExtension {
else -> HighlighterTargetArea.EXACT_RANGE
}
val isVisualLine = ex.type == SelectionType.LINE_WISE
val endAdj = if (!(isVisualLine) && (hlArea == HighlighterTargetArea.EXACT_RANGE || (isVisual))) 1 else 0
val endAdj = if (!(isVisualLine) && (hlArea == HighlighterTargetArea.EXACT_RANGE || isVisual)) 1 else 0
return ijEditor.markupModel.addRangeHighlighter(
ijEditor.getMarkOffset(ex.start),
(ijEditor.getMarkOffset(ex.end) + endAdj).coerceAtMost(ijEditor.fileSize),
@@ -158,7 +157,7 @@ internal class VimExchangeExtension : VimExtension {
)
}
val currentExchange = getExchange(ijEditor, isVisual, selectionType ?: CHARACTER_WISE)
val currentExchange = getExchange(ijEditor, isVisual, selectionType ?: SelectionType.CHARACTER_WISE)
val exchange1 = ijEditor.getUserData(EXCHANGE_KEY)
if (exchange1 == null) {
val highlighter = highlightExchange(currentExchange)

View File

@@ -217,6 +217,8 @@ private object FileTypePatterns {
return if (fileTypeName in htmlLikeFileTypes) {
this.htmlPatterns
} else if (fileTypeName == "JAVA" || fileExtension == "java") {
this.javaPatterns
} else if (fileTypeName == "Ruby" || fileExtension == "rb") {
this.rubyPatterns
} else if (fileTypeName == "RHTML" || fileExtension == "erb") {
@@ -242,6 +244,7 @@ private object FileTypePatterns {
)
private val htmlPatterns = createHtmlPatterns()
private val javaPatterns = createJavaPatterns()
private val rubyPatterns = createRubyPatterns()
private val rubyAndHtmlPatterns = rubyPatterns + htmlPatterns
private val phpPatterns = createPhpPatterns()
@@ -271,6 +274,14 @@ private object FileTypePatterns {
)
}
private fun createJavaPatterns(): LanguagePatterns {
return (
LanguagePatterns("\\b(?<!else\\s+)if\\b", "\\belse\\s+if\\b", "\\belse(?!\\s+if)\\b") +
LanguagePatterns("\\bdo\\b", "\\bwhile\\b") +
LanguagePatterns("\\btry\\b", "\\bcatch\\b", "\\bfinally\\b")
)
}
private fun createRubyPatterns(): LanguagePatterns {
// Original patterns: https://github.com/vim/vim/blob/master/runtime/ftplugin/ruby.vim
// We use non-capturing groups (?:) since we don't need any back refs. The \\b marker takes care of word boundaries.

View File

@@ -14,12 +14,12 @@ import com.maddyhome.idea.vim.api.ExecutionContext
import com.maddyhome.idea.vim.api.ImmutableVimCaret
import com.maddyhome.idea.vim.api.VimEditor
import com.maddyhome.idea.vim.api.getLineEndOffset
import com.maddyhome.idea.vim.api.globalOptions
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.command.MappingMode
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.command.OperatorArguments
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.state.mode.SelectionType.CHARACTER_WISE
import com.maddyhome.idea.vim.state.mode.isLine
import com.maddyhome.idea.vim.state.mode.selectionType
import com.maddyhome.idea.vim.common.TextRange
@@ -28,7 +28,7 @@ import com.maddyhome.idea.vim.extension.VimExtension
import com.maddyhome.idea.vim.extension.VimExtensionFacade
import com.maddyhome.idea.vim.extension.VimExtensionFacade.executeNormalWithoutMapping
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setOperatorFunction
import com.maddyhome.idea.vim.extension.exportOperatorFunction
import com.maddyhome.idea.vim.group.visual.VimSelection
import com.maddyhome.idea.vim.helper.exitVisualMode
import com.maddyhome.idea.vim.state.mode.mode
@@ -53,11 +53,13 @@ internal class ReplaceWithRegister : VimExtension {
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("gr"), owner, injector.parser.parseKeys(RWR_OPERATOR), true)
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("grr"), owner, injector.parser.parseKeys(RWR_LINE), true)
putKeyMappingIfMissing(MappingMode.X, injector.parser.parseKeys("gr"), owner, injector.parser.parseKeys(RWR_VISUAL), true)
VimExtensionFacade.exportOperatorFunction(OPERATOR_FUNC, Operator())
}
private class RwrVisual : ExtensionHandler {
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
val typeInEditor = editor.mode.selectionType ?: CHARACTER_WISE
val typeInEditor = editor.mode.selectionType ?: SelectionType.CHARACTER_WISE
editor.sortedCarets().forEach { caret ->
val selectionStart = caret.selectionStart
val selectionEnd = caret.selectionEnd
@@ -73,7 +75,7 @@ internal class ReplaceWithRegister : VimExtension {
override val isRepeatable: Boolean = true
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
setOperatorFunction(Operator())
injector.globalOptions().operatorfunc = OPERATOR_FUNC
executeNormalWithoutMapping(injector.parser.parseKeys("g@"), editor.ij)
}
}
@@ -112,11 +114,11 @@ internal class ReplaceWithRegister : VimExtension {
editor.primaryCaret() to VimSelection.create(
range.startOffset,
range.endOffset - 1,
selectionType ?: CHARACTER_WISE,
selectionType ?: SelectionType.CHARACTER_WISE,
editor,
),
),
selectionType ?: CHARACTER_WISE,
selectionType ?: SelectionType.CHARACTER_WISE,
)
// todo multicaret
doReplace(ijEditor, editor.primaryCaret(), visualSelection)
@@ -132,14 +134,10 @@ internal class ReplaceWithRegister : VimExtension {
}
companion object {
@NonNls
private const val RWR_OPERATOR = "<Plug>ReplaceWithRegisterOperator"
@NonNls
private const val RWR_LINE = "<Plug>ReplaceWithRegisterLine"
@NonNls
private const val RWR_VISUAL = "<Plug>ReplaceWithRegisterVisual"
@NonNls private const val RWR_OPERATOR = "<Plug>ReplaceWithRegisterOperator"
@NonNls private const val RWR_LINE = "<Plug>ReplaceWithRegisterLine"
@NonNls private const val RWR_VISUAL = "<Plug>ReplaceWithRegisterVisual"
@NonNls private const val OPERATOR_FUNC = "ReplaceWithRegisterOperatorFunc"
private fun doReplace(editor: Editor, caret: ImmutableVimCaret, visualSelection: PutData.VisualSelection) {
val registerGroup = injector.registerGroup

View File

@@ -16,6 +16,7 @@ import com.maddyhome.idea.vim.api.VimCaret
import com.maddyhome.idea.vim.api.VimEditor
import com.maddyhome.idea.vim.api.endsWithNewLine
import com.maddyhome.idea.vim.api.getLeadingCharacterOffset
import com.maddyhome.idea.vim.api.globalOptions
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.api.setChangeMarks
import com.maddyhome.idea.vim.command.MappingMode
@@ -23,14 +24,16 @@ import com.maddyhome.idea.vim.command.OperatorArguments
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.extension.ExtensionHandler
import com.maddyhome.idea.vim.extension.VimExtension
import com.maddyhome.idea.vim.extension.VimExtensionFacade
import com.maddyhome.idea.vim.extension.VimExtensionFacade.executeNormalWithoutMapping
import com.maddyhome.idea.vim.extension.VimExtensionFacade.getRegisterForCaret
import com.maddyhome.idea.vim.extension.VimExtensionFacade.inputKeyStroke
import com.maddyhome.idea.vim.extension.VimExtensionFacade.inputString
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMapping
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setOperatorFunction
import com.maddyhome.idea.vim.extension.VimExtensionFacade.setRegisterForCaret
import com.maddyhome.idea.vim.extension.exportOperatorFunction
import com.maddyhome.idea.vim.state.mode.mode
import com.maddyhome.idea.vim.key.OperatorFunction
import com.maddyhome.idea.vim.newapi.ij
import com.maddyhome.idea.vim.newapi.vim
@@ -74,13 +77,15 @@ internal class VimSurroundExtension : VimExtension {
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("ds"), owner, injector.parser.parseKeys("<Plug>DSurround"), true)
putKeyMappingIfMissing(MappingMode.XO, injector.parser.parseKeys("S"), owner, injector.parser.parseKeys("<Plug>VSurround"), true)
}
VimExtensionFacade.exportOperatorFunction(OPERATOR_FUNC, Operator())
}
private class YSurroundHandler : ExtensionHandler {
override val isRepeatable = true
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
setOperatorFunction(Operator())
injector.globalOptions().operatorfunc = OPERATOR_FUNC
executeNormalWithoutMapping(injector.parser.parseKeys("g@"), editor.ij)
}
}
@@ -288,7 +293,9 @@ private val LOG = logger<VimSurroundExtension>()
private const val REGISTER = '"'
private val tagNameAndAttributesCapturePattern = "(\\S+)([^>]*)>".toPattern()
private const val OPERATOR_FUNC = "SurroundOperatorFunc"
private val tagNameAndAttributesCapturePattern = "(\\S+)([^>]*)>".toPattern()
private val SURROUND_PAIRS = mapOf(
'b' to ("(" to ")"),

View File

@@ -8,9 +8,11 @@
package com.maddyhome.idea.vim.group
import com.intellij.openapi.components.Service
import com.maddyhome.idea.vim.api.VimCommandGroupBase
/**
* @author Elliot Courant
*/
@Service
internal class CommandGroup : VimCommandGroupBase()

View File

@@ -20,7 +20,6 @@ import com.maddyhome.idea.vim.options.OptionAccessScope
*/
@Suppress("SpellCheckingInspection")
public open class GlobalIjOptions(scope: OptionAccessScope) : OptionsPropertiesBase(scope) {
public var closenotebooks: Boolean by optionProperty(IjOptions.closenotebooks)
public var ide: String by optionProperty(IjOptions.ide)
public var ideamarks: Boolean by optionProperty(IjOptions.ideamarks)
public var ideastatusicon: String by optionProperty(IjOptions.ideastatusicon)
@@ -29,15 +28,16 @@ public open class GlobalIjOptions(scope: OptionAccessScope) : OptionsPropertiesB
public val lookupkeys: StringListOptionValue by optionProperty(IjOptions.lookupkeys)
public var trackactionids: Boolean by optionProperty(IjOptions.trackactionids)
public var visualdelay: Int by optionProperty(IjOptions.visualdelay)
public var showmodewidget: Boolean by optionProperty(IjOptions.showmodewidget)
// Temporary options to control work-in-progress behaviour
public var oldundo: Boolean by optionProperty(IjOptions.oldundo)
public var unifyjumps: Boolean by optionProperty(IjOptions.unifyjumps)
public var exCommandAnnotation: Boolean by optionProperty(IjOptions.exCommandAnnotation)
public var vimscriptFunctionAnnotation: Boolean by optionProperty(IjOptions.vimscriptFunctionAnnotation)
public var closenotebooks: Boolean by optionProperty(IjOptions.closenotebooks)
public var commandOrMotionAnnotation: Boolean by optionProperty(IjOptions.commandOrMotionAnnotation)
public var exCommandAnnotation: Boolean by optionProperty(IjOptions.exCommandAnnotation)
public var oldundo: Boolean by optionProperty(IjOptions.oldundo)
public var showmodewidget: Boolean by optionProperty(IjOptions.showmodewidget)
public var unifyjumps: Boolean by optionProperty(IjOptions.unifyjumps)
public var useNewRegex: Boolean by optionProperty(IjOptions.useNewRegex)
public var vimscriptFunctionAnnotation: Boolean by optionProperty(IjOptions.vimscriptFunctionAnnotation)
}
/**

View File

@@ -33,8 +33,6 @@ public object IjOptions {
Options.overrideDefaultValue(Options.clipboard, VimString("ideaput,autoselect,exclude:cons\\|linux"))
}
public val closenotebooks: ToggleOption = addOption(ToggleOption("closenotebooks", GLOBAL, "closenotebooks", true))
public val exCommandAnnotation: ToggleOption = addOption(ToggleOption("excommandannotation", GLOBAL, "excommandannotation", true))
public val ide: StringOption = addOption(
StringOption("ide", GLOBAL, "ide", ApplicationNamesInfo.getInstance().fullProductNameWithEdition)
)
@@ -81,13 +79,17 @@ public object IjOptions {
"<Tab>,<Down>,<Up>,<Enter>,<Left>,<Right>,<C-Down>,<C-Up>,<PageUp>,<PageDown>,<C-J>,<C-Q>")
)
public val trackactionids: ToggleOption = addOption(ToggleOption("trackactionids", GLOBAL, "tai", false))
public val unifyjumps: ToggleOption = addOption(ToggleOption("unifyjumps", GLOBAL, "unifyjumps", true))
public val visualdelay: UnsignedNumberOption = addOption(UnsignedNumberOption("visualdelay", GLOBAL, "visualdelay", 100))
public val oldundo: ToggleOption = addOption(ToggleOption("oldundo", GLOBAL, "oldundo", false, isTemporary = true))
public val vimscriptFunctionAnnotation: ToggleOption = addOption(ToggleOption("vimscriptfunctionannotation", GLOBAL, "vimscriptfunctionannotation", true, isTemporary = true))
public val commandOrMotionAnnotation: ToggleOption = addOption(ToggleOption("commandormotionannotation", GLOBAL, "commandormotionannotation", true, isTemporary = true))
public val showmodewidget: ToggleOption = addOption(ToggleOption("showmodewidget", GLOBAL, "showmodewidget", false, isTemporary = true))
public val useNewRegex: ToggleOption = addOption(ToggleOption("usenewregex", GLOBAL, "usenewregex", true, isTemporary = true))
// Temporary feature flags during development, not really intended for external use
public val closenotebooks: ToggleOption = addOption(ToggleOption("closenotebooks", GLOBAL, "closenotebooks", true, isHidden = true))
public val commandOrMotionAnnotation: ToggleOption = addOption(ToggleOption("commandormotionannotation", GLOBAL, "commandormotionannotation", true, isHidden = true))
public val exCommandAnnotation: ToggleOption = addOption(ToggleOption("excommandannotation", GLOBAL, "excommandannotation", true, isHidden = true))
public val oldundo: ToggleOption = addOption(ToggleOption("oldundo", GLOBAL, "oldundo", false, isHidden = true))
public val showmodewidget: ToggleOption = addOption(ToggleOption("showmodewidget", GLOBAL, "showmodewidget", false, isHidden = true))
public val unifyjumps: ToggleOption = addOption(ToggleOption("unifyjumps", GLOBAL, "unifyjumps", true, isHidden = true))
public val useNewRegex: ToggleOption = addOption(ToggleOption("usenewregex", GLOBAL, "usenewregex", true, isHidden = true))
public val vimscriptFunctionAnnotation: ToggleOption = addOption(ToggleOption("vimscriptfunctionannotation", GLOBAL, "vimscriptfunctionannotation", true, isHidden = true))
// This needs to be Option<out VimDataType> so that it can work with derived option types, such as NumberOption, which
// derives from Option<VimInt>

View File

@@ -10,6 +10,7 @@ package com.maddyhome.idea.vim.group
import com.intellij.codeInsight.completion.CompletionPhase
import com.intellij.codeInsight.completion.impl.CompletionServiceImpl
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.components.Service
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.progress.ProcessCanceledException
import com.intellij.openapi.progress.ProgressManager
@@ -25,6 +26,7 @@ import com.maddyhome.idea.vim.newapi.IjVimEditor
/**
* Used to handle playback of macros
*/
@Service
internal class MacroGroup : VimMacroBase() {
// If it's null, this is the top macro (as in most cases). If it's not null, this macro is executed from top macro

View File

@@ -8,6 +8,7 @@
package com.maddyhome.idea.vim.group
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.components.Service
import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.editor.LogicalPosition
@@ -83,6 +84,7 @@ import kotlin.math.min
/**
* This handles all motion related commands and marks
*/
@Service
internal class MotionGroup : VimMotionGroupBase() {
override fun onAppCodeMovement(editor: VimEditor, caret: VimCaret, offset: Int, oldOffset: Int) {
AppCodeTemplates.onMovement(editor.ij, caret.ij, oldOffset < offset)

View File

@@ -21,6 +21,7 @@ import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.KeyboardShortcut
import com.intellij.openapi.components.Service
import com.intellij.openapi.diagnostic.logger
import com.intellij.openapi.ide.CopyPasteManager
import com.intellij.openapi.keymap.KeymapUtil
@@ -55,6 +56,7 @@ import javax.swing.KeyStroke
* This service is can be used as application level and as project level service.
* If project is null, this means that this is an application level service and notification will be shown for all projects
*/
@Service(Service.Level.PROJECT, Service.Level.APP)
internal class NotificationService(private val project: Project?) {
// This constructor is used to create an applicationService
@Suppress("unused")

View File

@@ -8,9 +8,11 @@
package com.maddyhome.idea.vim.group
import com.intellij.openapi.components.Service
import org.apache.commons.codec.binary.Base64
import org.jdom.Element
@Service
internal class XMLGroup {
/**
* Set the text of an XML element, safely encode it if needed.

View File

@@ -14,6 +14,7 @@ import com.intellij.ide.DataManager
import com.intellij.ide.PasteProvider
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.actionSystem.PlatformDataKeys
import com.intellij.openapi.components.Service
import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.RangeMarker
import com.intellij.openapi.editor.ex.EditorEx
@@ -51,6 +52,7 @@ import com.maddyhome.idea.vim.state.mode.isChar
import com.maddyhome.idea.vim.state.mode.isLine
import java.awt.datatransfer.DataFlavor
@Service
internal class PutGroup : VimPutBase() {
override fun getProviderForPasteViaIde(

View File

@@ -8,6 +8,7 @@
package com.maddyhome.idea.vim.helper
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.diagnostic.thisLogger
import com.intellij.openapi.editor.Caret
import com.intellij.openapi.editor.CaretVisualAttributes
@@ -85,7 +86,10 @@ private fun Editor.updatePrimaryCaretVisualAttributes() {
caretModel.primaryCaret.visualAttributes = AttributesCache.getCaretVisualAttributes(this)
// Make sure the caret is visible as soon as it's set. It might be invisible while blinking
(this as? EditorEx)?.setCaretVisible(true)
// NOTE: At the moment, this causes project leak in tests
if (!ApplicationManager.getApplication().isUnitTestMode) {
(this as? EditorEx)?.setCaretVisible(true)
}
}
private fun Editor.updateSecondaryCaretsVisualAttributes() {

View File

@@ -9,6 +9,7 @@
package com.maddyhome.idea.vim.helper;
import com.google.common.collect.Lists;
import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerEx;
import com.intellij.lang.CodeDocumentationAwareCommenter;
import com.intellij.lang.Commenter;
import com.intellij.lang.Language;
@@ -16,22 +17,28 @@ import com.intellij.lang.LanguageCommenters;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Caret;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiComment;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.spellchecker.SpellCheckerSeveritiesProvider;
import com.maddyhome.idea.vim.VimPlugin;
import com.maddyhome.idea.vim.api.EngineEditorHelperKt;
import com.maddyhome.idea.vim.api.VimEditor;
import com.maddyhome.idea.vim.regexp.*;
import com.maddyhome.idea.vim.regexp.match.VimMatchResult;
import com.maddyhome.idea.vim.state.mode.Mode;
import com.maddyhome.idea.vim.state.VimStateMachine;
import com.maddyhome.idea.vim.common.CharacterPosition;
import com.maddyhome.idea.vim.common.Direction;
import com.maddyhome.idea.vim.common.TextRange;
import com.maddyhome.idea.vim.newapi.IjVimCaret;
import com.maddyhome.idea.vim.newapi.IjVimEditor;
import com.maddyhome.idea.vim.regexp.*;
import com.maddyhome.idea.vim.regexp.match.VimMatchResult;
import com.maddyhome.idea.vim.state.VimStateMachine;
import com.maddyhome.idea.vim.state.mode.Mode;
import it.unimi.dsi.fastutil.ints.IntComparator;
import it.unimi.dsi.fastutil.ints.IntIterator;
import it.unimi.dsi.fastutil.ints.IntRBTreeSet;
import it.unimi.dsi.fastutil.ints.IntSortedSet;
import kotlin.Pair;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
@@ -1573,6 +1580,42 @@ public class SearchHelper {
return PsiHelper.findMethodEnd(editor, caret.getOffset(), count);
}
public static int findMisspelledWords(@NotNull Editor editor,
int startOffset,
int endOffset,
int skipCount,
IntComparator offsetOrdering) {
Project project = editor.getProject();
if (project == null) {
return -1;
}
IntSortedSet offsets = new IntRBTreeSet(offsetOrdering);
DaemonCodeAnalyzerEx.processHighlights(editor.getDocument(), project, SpellCheckerSeveritiesProvider.TYPO,
startOffset, endOffset, highlight -> {
if (highlight.getSeverity() == SpellCheckerSeveritiesProvider.TYPO) {
int offset = highlight.getStartOffset();
if (offset >= startOffset && offset <= endOffset) {
offsets.add(offset);
}
}
return true;
});
if (offsets.isEmpty()) {
return -1;
}
if (skipCount >= offsets.size()) {
return offsets.lastInt();
}
else {
IntIterator offsetIterator = offsets.iterator();
offsetIterator.skip(skipCount);
return offsetIterator.nextInt();
}
}
private static @NotNull String parseMatchPairsOption(final VimEditor vimEditor) {
List<String> pairs = options(injector, vimEditor).getMatchpairs();
StringBuilder res = new StringBuilder();

View File

@@ -31,4 +31,8 @@ public object StringHelper {
return Arrays.stream(string).flatMap { o: String -> injector.parser.parseKeys(o).stream() }
.collect(Collectors.toList())
}
@JvmStatic
@Deprecated("Use key.isCloseKeyStroke()", ReplaceWith("key.isCloseKeyStroke()"))
public fun isCloseKeyStroke(key: KeyStroke): Boolean = key.isCloseKeyStroke()
}

View File

@@ -21,6 +21,6 @@ public final class VimIcons {
public static final @NotNull Icon YOUTRACK = load("/icons/youtrack.svg");
private static @NotNull Icon load(@NotNull @NonNls String path) {
return IconManager.getInstance().getIcon(path, VimIcons.class);
return IconManager.getInstance().getIcon(path, VimIcons.class.getClassLoader());
}
}

View File

@@ -9,11 +9,19 @@
package com.maddyhome.idea.vim.inspections
import com.intellij.codeInspection.LocalInspectionTool
import com.intellij.codeInspection.LocalQuickFix
import com.intellij.codeInspection.ProblemDescriptor
import com.intellij.codeInspection.ProblemsHolder
import com.intellij.openapi.project.Project
import com.intellij.openapi.util.TextRange
import com.intellij.psi.PsiElement
import com.intellij.psi.PsiElementVisitor
import com.intellij.psi.impl.source.tree.LeafPsiElement
import com.intellij.psi.util.PsiEditorUtil
import com.maddyhome.idea.vim.extension.ExtensionBeanClass
import com.maddyhome.idea.vim.extension.VimExtension
import com.maddyhome.idea.vim.vimscript.model.commands.SetCommand
import com.maddyhome.idea.vim.vimscript.parser.VimscriptParser
internal class UsePlugSyntaxInspection : LocalInspectionTool() {
override fun getGroupDisplayName(): String {
@@ -23,11 +31,54 @@ internal class UsePlugSyntaxInspection : LocalInspectionTool() {
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor {
val file = holder.file
if (file.name != ".ideavimrc" && file.name != "_ideavimrc") return PsiElementVisitor.EMPTY_VISITOR
val plugins = buildPlugins()
return object : PsiElementVisitor() {
override fun visitElement(element: PsiElement) {
if (element !is LeafPsiElement) return
holder.registerProblem(element, TextRange.create(10, 20), "Hi there")
val myScript = VimscriptParser.parse(element.text)
myScript.units.forEach { unit ->
if (unit is SetCommand) {
val argument = unit.argument
val alias = plugins[argument]
if (alias != null) {
holder.registerProblem(
element,
unit.rangeInScript.let { TextRange(it.startOffset, it.endOffset - 1) },
"""
Use `Plug` syntax for defining extensions
""".trimIndent(),
object : LocalQuickFix {
override fun getFamilyName(): String {
return "Use Plug syntax"
}
override fun applyFix(p0: Project, p1: ProblemDescriptor) {
val editor = PsiEditorUtil.findEditor(file)
editor?.document?.replaceString(
unit.rangeInScript.startOffset,
unit.rangeInScript.endOffset - 1,
"Plug '$alias'"
)
}
}
)
}
}
}
}
}
}
private fun buildPlugins(): HashMap<String, String> {
val res = HashMap<String, String>()
VimExtension.EP_NAME.extensions.forEach { extension: ExtensionBeanClass ->
val alias = extension.aliases?.first { it.name?.count { it == '/' } == 1 }?.name
?: extension.aliases?.firstOrNull()?.name
val name = extension.name
if (alias != null && name != null) {
res[name] = alias
}
}
return res
}
}

View File

@@ -8,7 +8,7 @@
package com.maddyhome.idea.vim.listener
import com.intellij.openapi.components.ServiceManager
import com.intellij.openapi.application.ApplicationManager
import com.intellij.openapi.editor.Editor
import org.acejump.session.SessionManager
@@ -16,12 +16,11 @@ import org.acejump.session.SessionManager
* Key handling for IdeaVim should be updated to editorHandler usage. In this case this class can be safely removed.
*/
@Suppress("DEPRECATION")
internal interface AceJumpService {
fun isActive(editor: Editor): Boolean
companion object {
fun getInstance(): AceJumpService? = ServiceManager.getService(AceJumpService::class.java)
fun getInstance(): AceJumpService? = ApplicationManager.getApplication().getService(AceJumpService::class.java)
}
}

View File

@@ -43,6 +43,10 @@ internal class IjVimApplication : VimApplicationBase() {
return ApplicationManager.getApplication().isUnitTestMode
}
override fun isInternal(): Boolean {
return ApplicationManager.getApplication().isInternal
}
override fun postKey(stroke: KeyStroke, editor: VimEditor) {
val component: Component = SwingUtilities.getAncestorOfClass(Window::class.java, editor.ij.component)
val event = createKeyEvent(stroke, component)

View File

@@ -29,6 +29,8 @@ import com.maddyhome.idea.vim.helper.checkInString
import com.maddyhome.idea.vim.helper.fileSize
import com.maddyhome.idea.vim.state.VimStateMachine.Companion.getInstance
import com.maddyhome.idea.vim.state.mode.Mode.VISUAL
import it.unimi.dsi.fastutil.ints.IntComparator
import it.unimi.dsi.fastutil.ints.IntComparators
import java.util.*
import java.util.function.Function
import java.util.regex.Pattern
@@ -689,4 +691,26 @@ internal class IjVimSearchHelper : VimSearchHelperBase() {
// End offset exclusive
return TextRange(bstart, bend + 1)
}
override fun findMisspelledWord(editor: VimEditor, caret: ImmutableVimCaret, count: Int): Int {
val startOffset: Int
val endOffset: Int
val skipCount: Int
val offsetOrdering: IntComparator
if (count < 0) {
startOffset = 0
endOffset = caret.offset.point - 1
skipCount = -count - 1
offsetOrdering = IntComparators.OPPOSITE_COMPARATOR
}
else {
startOffset = caret.offset.point + 1
endOffset = editor.ij.document.textLength
skipCount = count - 1
offsetOrdering = IntComparators.NATURAL_COMPARATOR
}
return SearchHelper.findMisspelledWords(editor.ij, startOffset, endOffset, skipCount, offsetOrdering)
}
}

View File

@@ -333,7 +333,7 @@
* |[m| {@link com.maddyhome.idea.vim.action.motion.text.MotionMethodPreviousStartAction}
* |[p| {@link com.maddyhome.idea.vim.action.copy.PutVisualTextAfterCursorNoIndentAction}
* |[p| {@link com.maddyhome.idea.vim.action.copy.PutTextAfterCursorNoIndentAction}
* |[s| TO BE IMPLEMENTED
* |[s| {@link com.maddyhome.idea.vim.action.motion.text.MotionMisspelledWordPreviousAction}
* |[z| TO BE IMPLEMENTED
* |[{| {@link com.maddyhome.idea.vim.action.motion.text.MotionUnmatchedBraceOpenAction}
* |]_CTRL-D| TO BE IMPLEMENTED
@@ -358,7 +358,7 @@
* |]m| {@link com.maddyhome.idea.vim.action.motion.text.MotionMethodNextStartAction}
* |]p| {@link com.maddyhome.idea.vim.action.copy.PutVisualTextAfterCursorNoIndentAction}
* |]p| {@link com.maddyhome.idea.vim.action.copy.PutTextAfterCursorNoIndentAction}
* |]s| TO BE IMPLEMENTED
* |]s| {@link com.maddyhome.idea.vim.action.motion.text.MotionMisspelledWordNextAction}
* |]z| TO BE IMPLEMENTED
* |]}| {@link com.maddyhome.idea.vim.action.motion.text.MotionUnmatchedBraceCloseAction}
*

View File

@@ -31,7 +31,7 @@ internal class Troubleshooter {
fun findIncorrectMappings(): List<Problem> {
val problems = ArrayList<Problem>()
MappingMode.values().forEach { mode ->
MappingMode.entries.forEach { mode ->
injector.keyGroup.getKeyMapping(mode).getByOwner(MappingOwner.IdeaVim.InitScript).forEach { (_, to) ->
if (to is ToKeysMappingInfo) {
if (":action" in to.toKeys.joinToString { it.keyChar.toString() }) {

View File

@@ -12,6 +12,7 @@ import com.intellij.icons.AllIcons
import com.intellij.openapi.Disposable
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.DataContext
import com.intellij.openapi.actionSystem.DefaultActionGroup
import com.intellij.openapi.actionSystem.PlatformDataKeys
import com.intellij.openapi.diagnostic.logger
@@ -159,8 +160,8 @@ internal class ReloadVimRc : DumbAwareAction() {
internal class ReloadFloatingToolbar : AbstractFloatingToolbarProvider(ACTION_GROUP) {
override val autoHideable: Boolean = false
override fun register(component: FloatingToolbarComponent, parentDisposable: Disposable) {
super.register(component, parentDisposable)
override fun register(dataContext: DataContext, component: FloatingToolbarComponent, parentDisposable: Disposable) {
super.register(dataContext, component, parentDisposable)
val action = {
component.scheduleShow()
}

View File

@@ -9,15 +9,16 @@ package com.maddyhome.idea.vim.ui
import com.intellij.icons.AllIcons
import com.intellij.openapi.actionSystem.ActionToolbarPosition
import com.intellij.openapi.actionSystem.ActionUpdateThread
import com.intellij.openapi.actionSystem.AnAction
import com.intellij.openapi.actionSystem.AnActionEvent
import com.intellij.openapi.actionSystem.KeyboardShortcut
import com.intellij.openapi.keymap.KeymapUtil
import com.intellij.openapi.options.Configurable
import com.intellij.openapi.project.DumbAwareAction
import com.intellij.openapi.ui.ComboBoxTableRenderer
import com.intellij.openapi.ui.StripeTable
import com.intellij.openapi.wm.IdeFocusManager
import com.intellij.ui.DumbAwareActionButton
import com.intellij.ui.HyperlinkLabel
import com.intellij.ui.IdeBorderFactory
import com.intellij.ui.JBColor
@@ -169,7 +170,7 @@ internal class VimEmulationConfigurable : Configurable {
return getColumnModel().getColumn(column.index)
}
private class ShortcutOwnerRenderer : ComboBoxTableRenderer<ShortcutOwner>(ShortcutOwner.values()) {
private class ShortcutOwnerRenderer : ComboBoxTableRenderer<ShortcutOwner>(ShortcutOwner.entries.toTypedArray()) {
override fun customizeComponent(owner: ShortcutOwner, table: JTable, isSelected: Boolean) {
super.customizeComponent(owner, table, isSelected)
if (owner == ShortcutOwner.UNDEFINED) {
@@ -192,7 +193,7 @@ internal class VimEmulationConfigurable : Configurable {
private val ourMembers: MutableMap<Int, Column> = HashMap()
init {
for (column in values()) {
for (column in entries) {
ourMembers[column.index] = column
}
}
@@ -224,7 +225,7 @@ internal class VimEmulationConfigurable : Configurable {
}
override fun getColumnCount(): Int {
return Column.values().size
return Column.entries.size
}
override fun getValueAt(rowIndex: Int, columnIndex: Int): Any? {
@@ -294,19 +295,21 @@ internal class VimEmulationConfigurable : Configurable {
private class CopyForRcAction(
private val myModel: VimShortcutConflictsTable.Model,
) : DumbAwareActionButton(
) : DumbAwareAction(
"Copy Config for .ideavimrc",
"Copy config for .ideavimrc in sethandler format",
AllIcons.Actions.Copy,
) {
override fun updateButton(e: AnActionEvent) {
override fun update(e: AnActionEvent) {
val enabled: Boolean = myModel.rows.stream().anyMatch {
it.owner is AllModes && (it.owner as AllModes).owner != ShortcutOwner.UNDEFINED
}
e.presentation.isEnabled = enabled
}
override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.EDT
override fun actionPerformed(e: AnActionEvent) {
val stringBuilder = StringBuilder()
for (row in myModel.rows) {
@@ -328,14 +331,16 @@ internal class VimEmulationConfigurable : Configurable {
class ResetHandlersAction(
private val myModel: VimShortcutConflictsTable.Model,
private val myTable: VimShortcutConflictsTable,
) : DumbAwareActionButton("Reset Handlers", "Reset handlers", AllIcons.General.Reset) {
override fun updateButton(e: AnActionEvent) {
) : DumbAwareAction("Reset Handlers", "Reset handlers", AllIcons.General.Reset) {
override fun update(e: AnActionEvent) {
val enabled: Boolean = myModel.rows.stream().anyMatch {
it.owner is AllModes && (it.owner as AllModes).owner != ShortcutOwner.UNDEFINED
}
e.presentation.isEnabled = enabled
}
override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.EDT
override fun actionPerformed(e: AnActionEvent) {
TableUtil.stopEditing(myTable)
for (row in myModel.rows) {

View File

@@ -121,16 +121,11 @@ public class ExTextField extends JTextField {
}
void setType(@NotNull String type) {
String hkey = null;
switch (type.charAt(0)) {
case '/':
case '?':
hkey = HistoryConstants.SEARCH;
break;
case ':':
hkey = HistoryConstants.COMMAND;
break;
}
String hkey = switch (type.charAt(0)) {
case '/', '?' -> HistoryConstants.SEARCH;
case ':' -> HistoryConstants.COMMAND;
default -> null;
};
if (hkey != null) {
history = VimPlugin.getHistory().getEntries(hkey, 0, 0);
@@ -140,7 +135,7 @@ public class ExTextField extends JTextField {
/**
* Stores the current text for use in filtering history. Required for scrolling through multiple history entries
*
* <p>
* Called whenever the text is changed, either by typing, or by special characters altering the text (e.g. Delete)
*/
void saveLastEntry() {
@@ -304,7 +299,10 @@ public class ExTextField extends JTextField {
*/
void cancel() {
clearCurrentAction();
VimPlugin.getProcess().cancelExEntry(new IjVimEditor(EditorHolderService.getInstance().getEditor()), true);
Editor editor = EditorHolderService.getInstance().getEditor();
if (editor != null) {
VimPlugin.getProcess().cancelExEntry(new IjVimEditor(editor), true);
}
}
public void setCurrentAction(@NotNull MultiStepAction action, char pendingIndicator) {
@@ -322,7 +320,7 @@ public class ExTextField extends JTextField {
/**
* Text to show while composing a digraph or inserting a literal or register
*
* <p>
* The prompt character is inserted directly into the text of the text field, rather than drawn over the top of the
* current character. When the action has been completed, the new character(s) are either inserted or overwritten,
* depending on the insert/overwrite status of the text field. This mimics Vim's behaviour.
@@ -491,7 +489,7 @@ public class ExTextField extends JTextField {
/**
* Updates the bounds of the caret and repaints those bounds.
*
* <p>
* This method is not guaranteed to be called before paint(). The bounds are for use by repaint().
*
* @param r The current location of the caret, usually provided by MapToView. The x and y appear to be the upper

View File

@@ -153,7 +153,7 @@ public class ModeWidgetPopup : AnAction() {
group {
row {
label(MessageHelper.getMessage("widget.mode.popup.field.theme"))
comboBox(ModeWidgetTheme.values().toList()).bindItem(modeColors::theme.toNullableProperty())
comboBox(ModeWidgetTheme.entries).bindItem(modeColors::theme.toNullableProperty())
}
row { browserLink("Suggest your theme", "https://youtrack.jetbrains.com/issue/VIM-1377/Normal-mode-needs-to-be-more-obvious") }
}.topGap(TopGap.NONE).visibleIf(!advancedSettings.selected)
@@ -360,7 +360,7 @@ public enum class ModeWidgetTheme(private var value: String) {
public companion object {
public fun parseString(string: String): ModeWidgetTheme? {
return ModeWidgetTheme.values().firstOrNull { it.value == string }
return entries.firstOrNull { it.value == string }
}
public fun getDefaultTheme(): ModeWidgetTheme = TERM

View File

@@ -8,24 +8,20 @@
<idea-plugin>
<extensions defaultExtensionNs="com.intellij">
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.MotionGroup"/>
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.ScrollGroup"
serviceInterface="com.maddyhome.idea.vim.api.VimScrollGroup"/>
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.ChangeGroup"
serviceInterface="com.maddyhome.idea.vim.api.VimChangeGroup"/>
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.CommandGroup"/>
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.VimMarkServiceImpl"
serviceInterface="com.maddyhome.idea.vim.api.VimMarkService"/>
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.VimJumpServiceImpl"
serviceInterface="com.maddyhome.idea.vim.api.VimJumpService"/>
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.RegisterGroup"
serviceInterface="com.maddyhome.idea.vim.register.VimRegisterGroup"/>
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.XMLGroup"/>
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.FileGroup"/>
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.SearchGroup"/>
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.ProcessGroup"
serviceInterface="com.maddyhome.idea.vim.api.VimProcessGroup"/>
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.MacroGroup"/>
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.DigraphGroup"
serviceInterface="com.maddyhome.idea.vim.api.VimDigraphGroup"/>
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.HistoryGroup"/>
@@ -38,7 +34,6 @@
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.visual.VisualMotionGroup"
serviceInterface="com.maddyhome.idea.vim.api.VimVisualMotionGroup"/>
<applicationService serviceImplementation="com.maddyhome.idea.vim.yank.YankGroupBase"/>
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.copy.PutGroup"/>
<applicationService serviceImplementation="com.maddyhome.idea.vim.vimscript.services.IjVariableService"
serviceInterface="com.maddyhome.idea.vim.vimscript.services.VariableService"/>
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.IjStatisticsService"
@@ -53,6 +48,5 @@
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.IjVimSystemInfoService"
serviceInterface="com.maddyhome.idea.vim.api.SystemInfoService"/>
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.NotificationService"/>
</extensions>
</idea-plugin>

View File

@@ -62,7 +62,6 @@
<extensions defaultExtensionNs="com.intellij">
<applicationConfigurable groupId="editor" instance="com.maddyhome.idea.vim.ui.VimEmulationConfigurable"/>
<projectService serviceImplementation="com.maddyhome.idea.vim.group.NotificationService"/>
<projectService serviceImplementation="com.maddyhome.idea.vim.group.LastTabService"/>
<statusBarWidgetFactory id="IdeaVimMode" implementation="com.maddyhome.idea.vim.ui.widgets.mode.ModeWidgetFactory" order="last, before Memory"/>
<statusBarWidgetFactory id="IdeaVim-Icon" implementation="com.maddyhome.idea.vim.ui.StatusBarIconFactory" order="last, before IdeaVimMode"/>

View File

@@ -137,7 +137,7 @@ widget.mode.popup.tab.dark=Dark Theme
widget.mode.popup.color.instruction=Use HEX color values for exact colors; use v:status_bar_bg to use your IDE's status bar background color and v:status_bar_fg for the foreground
widget.mode.popup.field.theme=Widget theme:
widget.mode.popup.field.advanced.settings=Full color customization (advanced)
widget.mode.popup.group.title.full.customization=Full customization
widget.mode.popup.group.title.full.customization=Full Customization
widget.mode.popup.group.normal.title=Normal Mode
widget.mode.popup.group.insert.title=Insert Mode
widget.mode.popup.group.replace.title=Replace Mode

View File

@@ -9,10 +9,10 @@ package org.jetbrains.plugins.ideavim.action
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
import com.maddyhome.idea.vim.helper.vimStateMachine
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase

View File

@@ -15,6 +15,7 @@ import com.maddyhome.idea.vim.key.MappingOwner
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
class RepeatActionTest : VimTestCase() {
@@ -110,4 +111,20 @@ class RepeatActionTest : VimTestCase() {
)
}
}
@Test
@Disabled("This test throws `Recursive runForEachCaret invocations are not allowed`")
fun `repeat command with execution of ij action`() {
doTest(
"c<C-End><C-I><esc>.",
"""
${c}1234567890
${c}1234567890
""".trimIndent(),
"""
${c}1234567890
${c}1234567890
""".trimIndent()
)
}
}

View File

@@ -11,8 +11,8 @@ package org.jetbrains.plugins.ideavim.action
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.command.MappingMode
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.key.MappingOwner
import com.maddyhome.idea.vim.state.mode.Mode
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase

View File

@@ -0,0 +1,150 @@
/*
* 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 org.jetbrains.plugins.ideavim.action.change
import org.jetbrains.plugins.ideavim.VimTestCase
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test
class OperatorActionTest : VimTestCase() {
@Test
fun `test operator action throws error if operatorfunc is empty`() {
doTest("g@w", "lorem ipsum", "lorem ipsum")
assertPluginErrorMessageContains("E774: 'operatorfunc' is empty")
}
@Test
fun `test operator action throws error if operatorfunc is name of unknown function`() {
doTest("g@w", "lorem ipsum", "lorem ipsum") {
enterCommand("set operatorfunc=Foo")
}
assertPluginErrorMessageContains("E117: Unknown function: Foo")
}
@Test
fun `test operator action with function name`() {
doTest("gxe",
"lorem ipsum dolor sit amet",
"xxxxx ipsum dolor sit amet"
) {
executeVimscript("""function! Redact(type)
| execute "normal `[v`]rx"
|endfunction
""".trimMargin())
enterCommand("noremap gx :set opfunc=Redact<CR>g@")
}
}
@Test
fun `test operator action with character wise motion`() {
doTest("gxe",
"lorem ipsum dolor sit amet",
"charlorem ipsum dolor sit amet"
) {
executeVimscript("""function! Redact(type)
| execute "normal i" . a:type
|endfunction
""".trimMargin())
enterCommand("noremap gx :set opfunc=Redact<CR>g@")
}
}
@Test
fun `test operator action with linewise motion`() {
doTest("Vgx",
"lorem ipsum dolor sit amet",
"linelorem ipsum dolor sit amet"
) {
executeVimscript("""function! Redact(type)
| execute "normal i" . a:type
|endfunction
""".trimMargin())
enterCommand("noremap gx <Esc>:set opfunc=Redact<CR>gvg@")
}
}
@Test
fun `test operator action with blockwise motion`() {
doTest("<C-V>gx",
"lorem ipsum dolor sit amet",
"blocklorem ipsum dolor sit amet"
) {
executeVimscript("""function! Redact(type)
| execute "normal i" . a:type
|endfunction
""".trimMargin())
enterCommand("noremap gx <Esc>:set opfunc=Redact<CR>gvg@")
}
}
@Test
fun `test operator action with function`() {
doTest("gxe",
"lorem ipsum dolor sit amet",
"xxxxx ipsum dolor sit amet"
) {
executeVimscript("""function! Redact(type)
| execute "normal `[v`]rx"
|endfunction
""".trimMargin())
enterCommand("noremap gx :set opfunc=function('Redact')<CR>g@")
}
}
@Test
fun `test operator action throws error with unknown function`() {
doTest("gxe",
"lorem ipsum dolor sit amet",
"lorem ipsum dolor sit amet"
) {
enterCommand("noremap gx :set opfunc=function('Foo')<CR>g@")
}
assertPluginErrorMessageContains("E117: Unknown function: Foo")
}
@Test
fun `test operator function with funcref`() {
doTest("gxe",
"lorem ipsum dolor sit amet",
"xxxxx ipsum dolor sit amet"
) {
executeVimscript("""function! Redact(type)
| execute "normal `[v`]rx"
|endfunction
""".trimMargin())
enterCommand("noremap gx :set opfunc=funcref('Redact')<CR>g@")
}
}
@Test
fun `test operator action throws error with unknown function ref`() {
doTest("gxe",
"lorem ipsum dolor sit amet",
"lorem ipsum dolor sit amet"
) {
enterCommand("noremap gx :set opfunc=funcref('Foo')<CR>g@")
}
assertPluginErrorMessageContains("E117: Unknown function: Foo")
}
@Test
@Disabled(":set does not correctly parse the quotes in the lambda syntax")
// The parser is treating the second double-quote char as a comment. The argument to the command is parsed as:
// opfunc={ arg -> execute "`[v`]rx
// The map command is properly handled - the `<CR>g@` is correctly understood, and the full lambda is passed to the
// parser, but the parser does not fully handle the text
fun `test operator function with lambda`() {
doTest("gxe",
"lorem ipsum dolor sit amet",
"lorem ipsum dolor sit amet"
) {
enterCommand("noremap gx :set opfunc={ arg -> execute \"`[v`]rx\" }<CR>g@")
}
}
}

View File

@@ -10,9 +10,9 @@ package org.jetbrains.plugins.ideavim.action.change
import com.intellij.idea.TestFor
import com.maddyhome.idea.vim.state.mode.Mode
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.VimTestCase
import org.junit.jupiter.api.Test

View File

@@ -11,9 +11,9 @@
package org.jetbrains.plugins.ideavim.action.change.delete
import com.maddyhome.idea.vim.VimPlugin
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.VimTestCase
import org.junit.jupiter.api.Test
import org.junit.jupiter.params.ParameterizedTest

View File

@@ -9,9 +9,9 @@
package org.jetbrains.plugins.ideavim.action.change.delete
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.group.visual.IdeaSelectionControl
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.group.visual.IdeaSelectionControl
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase

View File

@@ -10,8 +10,8 @@
package org.jetbrains.plugins.ideavim.action.change.delete
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.options.OptionConstants
import com.maddyhome.idea.vim.state.mode.Mode
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestOptionConstants
import org.jetbrains.plugins.ideavim.TestWithoutNeovim

View File

@@ -13,10 +13,10 @@ import com.intellij.notification.EventLog
import com.intellij.notification.Notification
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.group.NotificationService
import com.maddyhome.idea.vim.newapi.vim
import com.maddyhome.idea.vim.options.OptionConstants
import com.maddyhome.idea.vim.state.mode.SelectionType
import org.jetbrains.plugins.ideavim.TestOptionConstants
import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.impl.OptionTest

View File

@@ -18,11 +18,11 @@ import com.intellij.testFramework.ExtensionTestUtil
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.globalOptions
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.newapi.vim
import com.maddyhome.idea.vim.options.OptionConstants
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import com.maddyhome.idea.vim.newapi.vim
import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.rangeOf
import org.junit.jupiter.api.Test

View File

@@ -9,8 +9,8 @@
package org.jetbrains.plugins.ideavim.action.copy
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.newapi.vim
import com.maddyhome.idea.vim.state.mode.SelectionType
import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.rangeOf
import org.junit.jupiter.api.Test

View File

@@ -13,9 +13,9 @@ import com.intellij.ide.CopyPasteManagerEx
import com.intellij.openapi.ide.CopyPasteManager
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.newapi.vim
import com.maddyhome.idea.vim.options.OptionConstants
import com.maddyhome.idea.vim.state.mode.SelectionType
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestOptionConstants
import org.jetbrains.plugins.ideavim.TestWithoutNeovim

View File

@@ -12,11 +12,11 @@ package org.jetbrains.plugins.ideavim.action.copy
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.state.mode.SelectionType
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import com.maddyhome.idea.vim.newapi.vim
import com.maddyhome.idea.vim.state.mode.SelectionType
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.annotations.TestWithoutPrimaryClipboard
import org.jetbrains.plugins.ideavim.rangeOf

View File

@@ -10,12 +10,12 @@ package org.jetbrains.plugins.ideavim.action.copy
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.common.TextRange
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import com.maddyhome.idea.vim.newapi.vim
import com.maddyhome.idea.vim.state.mode.SelectionType
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.annotations.TestWithoutPrimaryClipboard
import org.junit.Ignore

View File

@@ -12,11 +12,11 @@ package org.jetbrains.plugins.ideavim.action.copy
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.state.mode.SelectionType
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import com.maddyhome.idea.vim.newapi.vim
import com.maddyhome.idea.vim.state.mode.SelectionType
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.VimTestCase
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Test

View File

@@ -12,8 +12,8 @@ package org.jetbrains.plugins.ideavim.action.motion.gn
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.common.Direction
import com.maddyhome.idea.vim.state.mode.Mode
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase

View File

@@ -12,8 +12,8 @@ package org.jetbrains.plugins.ideavim.action.motion.gn
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.common.Direction
import com.maddyhome.idea.vim.state.mode.Mode
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase

View File

@@ -11,9 +11,9 @@ import com.intellij.idea.TestFor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.action.motion.search.SearchWholeWordForwardAction
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.common.Direction
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.common.Direction
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase

View File

@@ -11,9 +11,9 @@ import com.intellij.idea.TestFor
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.action.motion.search.SearchWholeWordForwardAction
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.common.Direction
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.common.Direction
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase

View File

@@ -11,9 +11,9 @@
package org.jetbrains.plugins.ideavim.action.motion.leftright
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.options.OptionConstants
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestOptionConstants
import org.jetbrains.plugins.ideavim.TestWithoutNeovim

View File

@@ -11,9 +11,9 @@
package org.jetbrains.plugins.ideavim.action.motion.leftright
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.options.OptionConstants
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestOptionConstants
import org.jetbrains.plugins.ideavim.TestWithoutNeovim

View File

@@ -10,9 +10,9 @@
package org.jetbrains.plugins.ideavim.action.motion.leftright
import com.maddyhome.idea.vim.options.OptionConstants
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestOptionConstants
import org.jetbrains.plugins.ideavim.TestWithoutNeovim

View File

@@ -10,9 +10,9 @@
package org.jetbrains.plugins.ideavim.action.motion.leftright
import com.maddyhome.idea.vim.options.OptionConstants
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestOptionConstants
import org.jetbrains.plugins.ideavim.TestWithoutNeovim

View File

@@ -12,9 +12,9 @@ package org.jetbrains.plugins.ideavim.action.motion.leftright
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.VimTestCase
import org.junit.jupiter.api.Test

View File

@@ -10,9 +10,9 @@
package org.jetbrains.plugins.ideavim.action.motion.leftright
import com.maddyhome.idea.vim.options.OptionConstants
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestOptionConstants
import org.jetbrains.plugins.ideavim.TestWithoutNeovim

View File

@@ -11,9 +11,9 @@
package org.jetbrains.plugins.ideavim.action.motion.leftright
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.options.OptionConstants
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestOptionConstants
import org.jetbrains.plugins.ideavim.TestWithoutNeovim

View File

@@ -11,9 +11,9 @@
package org.jetbrains.plugins.ideavim.action.motion.leftright
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.options.OptionConstants
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestOptionConstants
import org.jetbrains.plugins.ideavim.TestWithoutNeovim

View File

@@ -10,9 +10,9 @@
package org.jetbrains.plugins.ideavim.action.motion.leftright
import com.maddyhome.idea.vim.options.OptionConstants
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestOptionConstants
import org.jetbrains.plugins.ideavim.TestWithoutNeovim

View File

@@ -10,9 +10,9 @@
package org.jetbrains.plugins.ideavim.action.motion.leftright
import com.maddyhome.idea.vim.options.OptionConstants
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestOptionConstants
import org.jetbrains.plugins.ideavim.TestWithoutNeovim

View File

@@ -8,11 +8,8 @@
package org.jetbrains.plugins.ideavim.action.motion.search
import com.maddyhome.idea.vim.api.getVisualLineCount
import com.maddyhome.idea.vim.newapi.IjVimEditor
import org.jetbrains.plugins.ideavim.VimTestCase
import org.junit.jupiter.api.Test
import kotlin.test.assertEquals
class SearchAgainNextActionTest : VimTestCase() {
@Test

View File

@@ -9,9 +9,9 @@
package org.jetbrains.plugins.ideavim.action.motion.select
import com.maddyhome.idea.vim.state.mode.Mode
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.VimTestCase
import org.junit.jupiter.api.Test

View File

@@ -12,9 +12,9 @@ package org.jetbrains.plugins.ideavim.action.motion.select
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.VimTestCase
import org.junit.jupiter.api.Test

View File

@@ -10,9 +10,9 @@
package org.jetbrains.plugins.ideavim.action.motion.select.motion
import com.maddyhome.idea.vim.options.OptionConstants
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestOptionConstants
import org.jetbrains.plugins.ideavim.TestWithoutNeovim

View File

@@ -10,9 +10,9 @@
package org.jetbrains.plugins.ideavim.action.motion.select.motion
import com.maddyhome.idea.vim.options.OptionConstants
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestOptionConstants
import org.jetbrains.plugins.ideavim.TestWithoutNeovim

View File

@@ -10,9 +10,9 @@
package org.jetbrains.plugins.ideavim.action.motion.updown
import com.maddyhome.idea.vim.options.OptionConstants
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestOptionConstants
import org.jetbrains.plugins.ideavim.TestWithoutNeovim

View File

@@ -10,9 +10,9 @@
package org.jetbrains.plugins.ideavim.action.motion.updown
import com.maddyhome.idea.vim.options.OptionConstants
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestOptionConstants
import org.jetbrains.plugins.ideavim.TestWithoutNeovim

View File

@@ -10,9 +10,9 @@
package org.jetbrains.plugins.ideavim.action.motion.updown
import com.maddyhome.idea.vim.options.OptionConstants
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestOptionConstants
import org.jetbrains.plugins.ideavim.TestWithoutNeovim

View File

@@ -10,9 +10,9 @@
package org.jetbrains.plugins.ideavim.action.motion.updown
import com.maddyhome.idea.vim.options.OptionConstants
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.options.OptionConstants
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestOptionConstants
import org.jetbrains.plugins.ideavim.TestWithoutNeovim

View File

@@ -10,10 +10,10 @@
package org.jetbrains.plugins.ideavim.action.motion.visual
import com.maddyhome.idea.vim.helper.vimSelectionStart
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.state.mode.SelectionType
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import com.maddyhome.idea.vim.helper.vimSelectionStart
import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.rangeOf
import org.junit.jupiter.api.Test

View File

@@ -8,9 +8,9 @@
package org.jetbrains.plugins.ideavim.action.scroll
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.VimTestCase
import org.junit.jupiter.api.Test

View File

@@ -8,9 +8,9 @@
package org.jetbrains.plugins.ideavim.action.scroll
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.VimTestCase
import org.junit.jupiter.api.Test

View File

@@ -8,9 +8,9 @@
package org.jetbrains.plugins.ideavim.action.scroll
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.VimTestCase
import org.junit.jupiter.api.Test

View File

@@ -8,9 +8,9 @@
package org.jetbrains.plugins.ideavim.action.scroll
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.VimTestCase
import org.junit.jupiter.api.Test

View File

@@ -8,9 +8,9 @@
package org.jetbrains.plugins.ideavim.action.scroll
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.VimTestCase
import org.junit.jupiter.api.Test

View File

@@ -8,9 +8,9 @@
package org.jetbrains.plugins.ideavim.action.scroll
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.VimTestCase
import org.junit.jupiter.api.Test

View File

@@ -10,12 +10,12 @@ package org.jetbrains.plugins.ideavim.ex
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.injector
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import com.maddyhome.idea.vim.newapi.vim
import com.maddyhome.idea.vim.ui.ex.ExDocument
import com.maddyhome.idea.vim.ui.ex.ExEntryPanel
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
import org.jetbrains.plugins.ideavim.VimTestCase
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test

View File

@@ -10,11 +10,11 @@ package org.jetbrains.plugins.ideavim.ex
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.common.TextRange
import com.maddyhome.idea.vim.helper.StringHelper.parseKeys
import com.maddyhome.idea.vim.newapi.vim
import com.maddyhome.idea.vim.options.OptionConstants
import com.maddyhome.idea.vim.state.mode.SelectionType
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestOptionConstants
import org.jetbrains.plugins.ideavim.TestWithoutNeovim

View File

@@ -28,7 +28,7 @@ class BufferListCommandTest : VimTestCase() {
val output = getInstance(fixture.editor).text
kotlin.test.assertNotNull<Any>(output)
val displayedLines = output!!.split("\n".toRegex()).toTypedArray()
val displayedLines = output.split("\n".toRegex()).toTypedArray()
kotlin.test.assertEquals(DEFAULT_LS_OUTPUT, displayedLines[0])
assertPluginError(false)
@@ -41,7 +41,7 @@ class BufferListCommandTest : VimTestCase() {
val output = getInstance(fixture.editor).text
kotlin.test.assertNotNull<Any>(output)
val displayedLines = output!!.split("\n".toRegex()).toTypedArray()
val displayedLines = output.split("\n".toRegex()).toTypedArray()
kotlin.test.assertEquals(" 1 %a \"/src/aaaaaaaaaaaaaaaaaaaaaaaaaaaaa.txt\" line: 1", displayedLines[0])
assertPluginError(false)
@@ -69,7 +69,7 @@ class BufferListCommandTest : VimTestCase() {
val output = getInstance(fixture.editor).text
kotlin.test.assertNotNull<Any>(output)
val displayedLines = output!!.split("\n".toRegex()).toTypedArray()
val displayedLines = output.split("\n".toRegex()).toTypedArray()
// Ignore buffer number because IJ sometimes returns different order of buffers
val line = displayedLines[0].replaceRange(3, 4, "_")
@@ -85,7 +85,7 @@ class BufferListCommandTest : VimTestCase() {
val output = getInstance(fixture.editor).text
kotlin.test.assertNotNull<Any>(output)
val displayedLines = output!!.split("\n".toRegex()).toTypedArray()
val displayedLines = output.split("\n".toRegex()).toTypedArray()
kotlin.test.assertEquals("", displayedLines[0])
assertPluginError(false)
@@ -98,7 +98,7 @@ class BufferListCommandTest : VimTestCase() {
val output = getInstance(fixture.editor).text
kotlin.test.assertNotNull<Any>(output)
val displayedLines = output!!.split("\n".toRegex()).toTypedArray()
val displayedLines = output.split("\n".toRegex()).toTypedArray()
kotlin.test.assertEquals(DEFAULT_LS_OUTPUT, displayedLines[0])
assertPluginError(false)

View File

@@ -9,8 +9,8 @@
package org.jetbrains.plugins.ideavim.ex.implementation.commands
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.state.mode.Mode
import com.maddyhome.idea.vim.history.HistoryConstants
import com.maddyhome.idea.vim.state.mode.Mode
import org.jetbrains.plugins.ideavim.SkipNeovimReason
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
import org.jetbrains.plugins.ideavim.VimTestCase

View File

@@ -10,8 +10,8 @@ package org.jetbrains.plugins.ideavim.ex.implementation.commands
import com.maddyhome.idea.vim.VimPlugin
import com.maddyhome.idea.vim.api.injector
import com.maddyhome.idea.vim.state.mode.SelectionType
import com.maddyhome.idea.vim.register.Register
import com.maddyhome.idea.vim.state.mode.SelectionType
import org.jetbrains.plugins.ideavim.VimTestCase
import org.jetbrains.plugins.ideavim.annotations.TestWithPrimaryClipboard
import org.jetbrains.plugins.ideavim.annotations.TestWithoutPrimaryClipboard

View File

@@ -153,7 +153,7 @@ class SetCommandTest : VimTestCase() {
assertCommandOutput("set",
"""
|--- Options ---
| ideastrictmode number relativenumber
| number relativenumber
|
""".trimMargin())
}
@@ -164,22 +164,20 @@ class SetCommandTest : VimTestCase() {
assertCommandOutput("set all",
"""
|--- Options ---
|noargtextobj ideawrite=all scrolloff=0 notextobj-indent
| closenotebooks noignorecase selectmode= timeout
|nocommentary noincsearch shellcmdflag=-x timeoutlen=1000
|nodigraph nomatchit shellxescape=@ notrackactionids
|noexchange maxmapdepth=20 shellxquote={ undolevels=1000
|nogdefault more showcmd unifyjumps
|nohighlightedyank nomultiple-cursors showmode virtualedit=
| history=50 noNERDTree sidescroll=0 novisualbell
|nohlsearch nrformats=hex sidescrolloff=0 visualdelay=100
|noideaglobalmode nonumber nosmartcase whichwrap=b,s
|noideajoin octopushandler nosneak wrapscan
| ideamarks norelativenumber startofline
| ideastrictmode scroll=0 nosurround
|noideatracetime scrolljump=1 notextobj-entire
|noargtextobj noincsearch selectmode= notextobj-indent
|nocommentary nomatchit shellcmdflag=-x timeout
|nodigraph maxmapdepth=20 shellxescape=@ timeoutlen=1000
|noexchange more shellxquote={ notrackactionids
|nogdefault nomultiple-cursors showcmd undolevels=1000
|nohighlightedyank noNERDTree showmode virtualedit=
| history=50 nrformats=hex sidescroll=0 novisualbell
|nohlsearch nonumber sidescrolloff=0 visualdelay=100
|noideaglobalmode operatorfunc= nosmartcase whichwrap=b,s
|noideajoin norelativenumber nosneak wrapscan
| ideamarks scroll=0 startofline
| ideawrite=all scrolljump=1 nosurround
|noignorecase scrolloff=0 notextobj-entire
| clipboard=ideaput,autoselect,exclude:cons\|linux
| excommandannotation
| guicursor=n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
| ide=IntelliJ IDEA Community Edition
|noideacopypreprocess
@@ -213,7 +211,6 @@ class SetCommandTest : VimTestCase() {
assertCommandOutput("set!",
"""
|--- Options ---
| ideastrictmode
| number
| relativenumber
|""".trimMargin()
@@ -227,11 +224,9 @@ class SetCommandTest : VimTestCase() {
|--- Options ---
|noargtextobj
| clipboard=ideaput,autoselect,exclude:cons\|linux
| closenotebooks
|nocommentary
|nodigraph
|noexchange
| excommandannotation
|nogdefault
| guicursor=n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
|nohighlightedyank
@@ -244,8 +239,6 @@ class SetCommandTest : VimTestCase() {
| ideamarks
| idearefactormode=select
| ideastatusicon=enabled
| ideastrictmode
|noideatracetime
| ideavimsupport=dialog
| ideawrite=all
|noignorecase
@@ -261,7 +254,7 @@ class SetCommandTest : VimTestCase() {
|noNERDTree
| nrformats=hex
|nonumber
| octopushandler
| operatorfunc=
|norelativenumber
|noReplaceWithRegister
| scroll=0
@@ -287,7 +280,6 @@ class SetCommandTest : VimTestCase() {
| timeoutlen=1000
|notrackactionids
| undolevels=1000
| unifyjumps
|novim-paragraph-motion
| viminfo='100,<50,s10,h
| virtualedit=

View File

@@ -328,7 +328,6 @@ class SetglobalCommandTest : VimTestCase() {
fun `test show all modified global option values`() {
assertCommandOutput("setglobal", """
|--- Global option values ---
| ideastrictmode
|""".trimMargin()
)
}
@@ -338,8 +337,7 @@ class SetglobalCommandTest : VimTestCase() {
enterCommand("setglobal number relativenumber scrolloff=10 nrformats=alpha,hex,octal sidescrolloff=10")
assertCommandOutput("setglobal", """
|--- Global option values ---
| ideastrictmode relativenumber sidescrolloff=10
| number scrolloff=10
| number relativenumber scrolloff=10 sidescrolloff=10
| nrformats=alpha,hex,octal
|""".trimMargin()
)
@@ -350,22 +348,20 @@ class SetglobalCommandTest : VimTestCase() {
setOsSpecificOptionsToSafeValues()
assertCommandOutput("setglobal all", """
|--- Global option values ---
|noargtextobj ideawrite=all scrolloff=0 notextobj-indent
| closenotebooks noignorecase selectmode= timeout
|nocommentary noincsearch shellcmdflag=-x timeoutlen=1000
|nodigraph nomatchit shellxescape=@ notrackactionids
|noexchange maxmapdepth=20 shellxquote={ undolevels=1000
|nogdefault more showcmd unifyjumps
|nohighlightedyank nomultiple-cursors showmode virtualedit=
| history=50 noNERDTree sidescroll=0 novisualbell
|nohlsearch nrformats=hex sidescrolloff=0 visualdelay=100
|noideaglobalmode nonumber nosmartcase whichwrap=b,s
|noideajoin octopushandler nosneak wrapscan
| ideamarks norelativenumber startofline
| ideastrictmode scroll=0 nosurround
|noideatracetime scrolljump=1 notextobj-entire
|noargtextobj noincsearch selectmode= notextobj-indent
|nocommentary nomatchit shellcmdflag=-x timeout
|nodigraph maxmapdepth=20 shellxescape=@ timeoutlen=1000
|noexchange more shellxquote={ notrackactionids
|nogdefault nomultiple-cursors showcmd undolevels=1000
|nohighlightedyank noNERDTree showmode virtualedit=
| history=50 nrformats=hex sidescroll=0 novisualbell
|nohlsearch nonumber sidescrolloff=0 visualdelay=100
|noideaglobalmode operatorfunc= nosmartcase whichwrap=b,s
|noideajoin norelativenumber nosneak wrapscan
| ideamarks scroll=0 startofline
| ideawrite=all scrolljump=1 nosurround
|noignorecase scrolloff=0 notextobj-entire
| clipboard=ideaput,autoselect,exclude:cons\|linux
| excommandannotation
| guicursor=n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
| ide=IntelliJ IDEA Community Edition
|noideacopypreprocess
@@ -397,7 +393,20 @@ class SetglobalCommandTest : VimTestCase() {
fun `test show all modified global option values in single column`() {
assertCommandOutput("setglobal!", """
|--- Global option values ---
| ideastrictmode
|""".trimMargin()
)
}
@Test
fun `test show all modified global option values in single column 2`() {
enterCommand("setglobal number relativenumber scrolloff=10 nrformats=alpha,hex,octal sidescrolloff=10")
assertCommandOutput("setglobal!", """
|--- Global option values ---
| nrformats=alpha,hex,octal
| number
| relativenumber
| scrolloff=10
| sidescrolloff=10
|""".trimMargin()
)
}
@@ -409,11 +418,9 @@ class SetglobalCommandTest : VimTestCase() {
|--- Global option values ---
|noargtextobj
| clipboard=ideaput,autoselect,exclude:cons\|linux
| closenotebooks
|nocommentary
|nodigraph
|noexchange
| excommandannotation
|nogdefault
| guicursor=n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
|nohighlightedyank
@@ -426,8 +433,6 @@ class SetglobalCommandTest : VimTestCase() {
| ideamarks
| idearefactormode=select
| ideastatusicon=enabled
| ideastrictmode
|noideatracetime
| ideavimsupport=dialog
| ideawrite=all
|noignorecase
@@ -443,7 +448,7 @@ class SetglobalCommandTest : VimTestCase() {
|noNERDTree
| nrformats=hex
|nonumber
| octopushandler
| operatorfunc=
|norelativenumber
|noReplaceWithRegister
| scroll=0
@@ -469,7 +474,6 @@ class SetglobalCommandTest : VimTestCase() {
| timeoutlen=1000
|notrackactionids
| undolevels=1000
| unifyjumps
|novim-paragraph-motion
| viminfo='100,<50,s10,h
| virtualedit=

View File

@@ -355,8 +355,7 @@ class SetlocalCommandTest : VimTestCase() {
fun `test show all modified local option and unset global-local values`() {
assertCommandOutput("setlocal", """
|--- Local option values ---
|--ideajoin ideastrictmode sidescrolloff=-1
| idearefactormode= scrolloff=-1
|--ideajoin idearefactormode= scrolloff=-1 sidescrolloff=-1
|--ideacopypreprocess
| undolevels=-123456
|""".trimMargin()
@@ -368,8 +367,8 @@ class SetlocalCommandTest : VimTestCase() {
enterCommand("setlocal number relativenumber scrolloff=10 nrformats=alpha,hex,octal sidescrolloff=10")
assertCommandOutput("setlocal", """
|--- Local option values ---
|--ideajoin ideastrictmode relativenumber sidescrolloff=10
| idearefactormode= number scrolloff=10
|--ideajoin number scrolloff=10
| idearefactormode= relativenumber sidescrolloff=10
|--ideacopypreprocess
| nrformats=alpha,hex,octal
| undolevels=-123456
@@ -382,22 +381,20 @@ class SetlocalCommandTest : VimTestCase() {
setOsSpecificOptionsToSafeValues()
assertCommandOutput("setlocal all", """
|--- Local option values ---
|noargtextobj noideatracetime scrolljump=1 notextobj-entire
| closenotebooks ideawrite=all scrolloff=-1 notextobj-indent
|nocommentary noignorecase selectmode= timeout
|nodigraph noincsearch shellcmdflag=-x timeoutlen=1000
|noexchange nomatchit shellxescape=@ notrackactionids
|nogdefault maxmapdepth=20 shellxquote={ unifyjumps
|nohighlightedyank more showcmd virtualedit=
| history=50 nomultiple-cursors showmode novisualbell
|nohlsearch noNERDTree sidescroll=0 visualdelay=100
|noideaglobalmode nrformats=hex sidescrolloff=-1 whichwrap=b,s
|--ideajoin nonumber nosmartcase wrapscan
| ideamarks octopushandler nosneak
| idearefactormode= norelativenumber startofline
| ideastrictmode scroll=0 nosurround
|noargtextobj noignorecase scrolloff=-1 notextobj-entire
|nocommentary noincsearch selectmode= notextobj-indent
|nodigraph nomatchit shellcmdflag=-x timeout
|noexchange maxmapdepth=20 shellxescape=@ timeoutlen=1000
|nogdefault more shellxquote={ notrackactionids
|nohighlightedyank nomultiple-cursors showcmd virtualedit=
| history=50 noNERDTree showmode novisualbell
|nohlsearch nrformats=hex sidescroll=0 visualdelay=100
|noideaglobalmode nonumber sidescrolloff=-1 whichwrap=b,s
|--ideajoin operatorfunc= nosmartcase wrapscan
| ideamarks norelativenumber nosneak
| idearefactormode= scroll=0 startofline
| ideawrite=all scrolljump=1 nosurround
| clipboard=ideaput,autoselect,exclude:cons\|linux
| excommandannotation
| guicursor=n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
| ide=IntelliJ IDEA Community Edition
|--ideacopypreprocess
@@ -432,7 +429,6 @@ class SetlocalCommandTest : VimTestCase() {
|--ideacopypreprocess
|--ideajoin
| idearefactormode=
| ideastrictmode
| scrolloff=-1
| sidescrolloff=-1
| undolevels=-123456
@@ -447,11 +443,9 @@ class SetlocalCommandTest : VimTestCase() {
|--- Local option values ---
|noargtextobj
| clipboard=ideaput,autoselect,exclude:cons\|linux
| closenotebooks
|nocommentary
|nodigraph
|noexchange
| excommandannotation
|nogdefault
| guicursor=n-v-c:block-Cursor/lCursor,ve:ver35-Cursor,o:hor50-Cursor,i-ci:ver25-Cursor/lCursor,r-cr:hor20-Cursor/lCursor,sm:block-Cursor-blinkwait175-blinkoff150-blinkon175
|nohighlightedyank
@@ -464,8 +458,6 @@ class SetlocalCommandTest : VimTestCase() {
| ideamarks
| idearefactormode=
| ideastatusicon=enabled
| ideastrictmode
|noideatracetime
| ideavimsupport=dialog
| ideawrite=all
|noignorecase
@@ -481,7 +473,7 @@ class SetlocalCommandTest : VimTestCase() {
|noNERDTree
| nrformats=hex
|nonumber
| octopushandler
| operatorfunc=
|norelativenumber
|noReplaceWithRegister
| scroll=0
@@ -507,7 +499,6 @@ class SetlocalCommandTest : VimTestCase() {
| timeoutlen=1000
|notrackactionids
| undolevels=-123456
| unifyjumps
|novim-paragraph-motion
| viminfo='100,<50,s10,h
| virtualedit=

Some files were not shown because too many files have changed in this diff Show More