mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-09-14 05:32:10 +02:00
Compare commits
63 Commits
customized
...
120d889dfb
Author | SHA1 | Date | |
---|---|---|---|
120d889dfb | |||
![]() |
f439474b73 | ||
![]() |
d6cd92e256 | ||
![]() |
3a294268d9 | ||
![]() |
9b81c7e650 | ||
![]() |
e229fb3ad7 | ||
![]() |
720eae63fa | ||
![]() |
0df96a24bd | ||
![]() |
21a1588ede | ||
![]() |
7970006e8c | ||
![]() |
418d0cff7f | ||
![]() |
7284360774 | ||
![]() |
9fc3fadee8 | ||
![]() |
3d2db56f63 | ||
![]() |
e9c7cb8670 | ||
![]() |
87d19274c5 | ||
![]() |
3161bf8ffd | ||
![]() |
b68865587e | ||
![]() |
7dc0dbe944 | ||
![]() |
f50a363525 | ||
![]() |
57ad4c70d1 | ||
![]() |
d3d93b898f | ||
![]() |
7d8973edb2 | ||
![]() |
2302b576b0 | ||
f4782630d4 | |||
![]() |
8c1a2a686f | ||
32d5e1e6fa | |||
![]() |
a381a1cacc | ||
![]() |
73c3c9f7fe | ||
![]() |
67ef0a75d5 | ||
![]() |
328bc5e95a | ||
![]() |
7f8021e37e | ||
![]() |
9701b7e79b | ||
![]() |
7a52c6fec9 | ||
![]() |
1503639d4b | ||
![]() |
e82f19c852 | ||
![]() |
edd69c9c25 | ||
![]() |
fc61e369fb | ||
![]() |
113586b59b | ||
![]() |
5dbd5e1c89 | ||
![]() |
04b7d9e2c3 | ||
![]() |
5f2743176a | ||
![]() |
3723488617 | ||
![]() |
0cc17a0791 | ||
![]() |
05a21e6091 | ||
![]() |
fc06bc7c6f | ||
![]() |
1bd005adc1 | ||
![]() |
4f208d1577 | ||
![]() |
eb6e0557a7 | ||
![]() |
cf09d66be6 | ||
![]() |
76cd127a8a | ||
![]() |
f6dd2a9968 | ||
![]() |
ae05a33e14 | ||
![]() |
b38fad323b | ||
![]() |
c6027fcf0f | ||
![]() |
f4cf06a50e | ||
![]() |
86bf8dcc60 | ||
![]() |
d37898b6d3 | ||
![]() |
1edd6a9002 | ||
![]() |
f7fa0dcbd1 | ||
![]() |
4f0a95a803 | ||
![]() |
e443cb0d3c | ||
![]() |
6fa228ee08 |
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -1 +0,0 @@
|
|||||||
* text=auto eol=lf
|
|
1
.github/workflows/runUiOctopusTests.yml
vendored
1
.github/workflows/runUiOctopusTests.yml
vendored
@@ -52,6 +52,7 @@ jobs:
|
|||||||
name: ui-test-fails-report-mac
|
name: ui-test-fails-report-mac
|
||||||
path: |
|
path: |
|
||||||
build/reports
|
build/reports
|
||||||
|
tests/ui-ij-tests/build/reports
|
||||||
sandbox-idea-log
|
sandbox-idea-log
|
||||||
# build-for-ui-test-linux:
|
# build-for-ui-test-linux:
|
||||||
# runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
|
1
.github/workflows/runUiPyTests.yml
vendored
1
.github/workflows/runUiPyTests.yml
vendored
@@ -52,4 +52,5 @@ jobs:
|
|||||||
name: ui-test-fails-report-mac
|
name: ui-test-fails-report-mac
|
||||||
path: |
|
path: |
|
||||||
build/reports
|
build/reports
|
||||||
|
tests/ui-py-tests/build/reports
|
||||||
sandbox-idea-log
|
sandbox-idea-log
|
1
.github/workflows/runUiTests.yml
vendored
1
.github/workflows/runUiTests.yml
vendored
@@ -49,6 +49,7 @@ jobs:
|
|||||||
name: ui-test-fails-report-mac
|
name: ui-test-fails-report-mac
|
||||||
path: |
|
path: |
|
||||||
build/reports
|
build/reports
|
||||||
|
tests/ui-ij-tests/build/reports
|
||||||
sandbox-idea-log
|
sandbox-idea-log
|
||||||
# build-for-ui-test-linux:
|
# build-for-ui-test-linux:
|
||||||
# runs-on: ubuntu-latest
|
# runs-on: ubuntu-latest
|
||||||
|
3
.teamcity/_Self/buildTypes/Qodana.kt
vendored
3
.teamcity/_Self/buildTypes/Qodana.kt
vendored
@@ -46,8 +46,8 @@ object Qodana : IdeaVimBuildType({
|
|||||||
version = Qodana.JVMVersion.LATEST
|
version = Qodana.JVMVersion.LATEST
|
||||||
}
|
}
|
||||||
reportAsTests = true
|
reportAsTests = true
|
||||||
additionalDockerArguments = "-e QODANA_TOKEN=eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJvcmdhbml6YXRpb24iOiIzUFZrQSIsInByb2plY3QiOiIzN1FlQSIsInRva2VuIjoiM0t2bXoifQ.uohp81tM7iAfvvB6k8faarfpV-OjusAaEbWQ8iNrOgs"
|
|
||||||
additionalQodanaArguments = "--baseline qodana.sarif.json"
|
additionalQodanaArguments = "--baseline qodana.sarif.json"
|
||||||
|
cloudToken = "credentialsJSON:6b79412e-9198-4862-9223-c5019488f903"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +63,6 @@ object Qodana : IdeaVimBuildType({
|
|||||||
timezone = "SERVER"
|
timezone = "SERVER"
|
||||||
}
|
}
|
||||||
param("dayOfWeek", "Sunday")
|
param("dayOfWeek", "Sunday")
|
||||||
enabled = false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -1,11 +1,9 @@
|
|||||||
package patches.buildTypes
|
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.GradleBuildStep
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.buildSteps.gradle
|
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.*
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.ui.expectSteps
|
|
||||||
import jetbrains.buildServer.configs.kotlin.v2019_2.ui.update
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This patch script was generated by TeamCity on settings change in 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.
|
accordingly, and delete the patch script.
|
||||||
*/
|
*/
|
||||||
changeBuildType(RelativeId("IdeaVimTests_Latest_EAP")) {
|
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 {
|
expectSteps {
|
||||||
gradle {
|
gradle {
|
||||||
tasks = "clean test"
|
tasks = "clean test"
|
||||||
|
11
CHANGES.md
11
CHANGES.md
@@ -25,11 +25,20 @@ usual beta standards.
|
|||||||
|
|
||||||
## To Be Released
|
## To Be Released
|
||||||
|
|
||||||
|
### Fixes:
|
||||||
|
* [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:
|
### Fixes:
|
||||||
* [VIM-3055](https://youtrack.jetbrains.com/issue/VIM-3055) Fix the issue with double deleting after dot
|
* [VIM-3055](https://youtrack.jetbrains.com/issue/VIM-3055) Fix the issue with double deleting after dot
|
||||||
|
|
||||||
### Merged PRs:
|
### 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
|
* [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
|
## 2.8.0, 2024-01-30
|
||||||
|
@@ -52,11 +52,11 @@ buildscript {
|
|||||||
classpath("org.eclipse.jgit:org.eclipse.jgit.ssh.apache:6.8.0.202311291450-r")
|
classpath("org.eclipse.jgit:org.eclipse.jgit.ssh.apache:6.8.0.202311291450-r")
|
||||||
classpath("org.kohsuke:github-api:1.305")
|
classpath("org.kohsuke:github-api:1.305")
|
||||||
|
|
||||||
classpath("io.ktor:ktor-client-core:2.3.7")
|
classpath("io.ktor:ktor-client-core:2.3.8")
|
||||||
classpath("io.ktor:ktor-client-cio:2.3.7")
|
classpath("io.ktor:ktor-client-cio:2.3.8")
|
||||||
classpath("io.ktor:ktor-client-auth:2.3.7")
|
classpath("io.ktor:ktor-client-auth:2.3.8")
|
||||||
classpath("io.ktor:ktor-client-content-negotiation:2.3.7")
|
classpath("io.ktor:ktor-client-content-negotiation:2.3.8")
|
||||||
classpath("io.ktor:ktor-serialization-kotlinx-json:2.3.7")
|
classpath("io.ktor:ktor-serialization-kotlinx-json:2.3.8")
|
||||||
|
|
||||||
// This comes from the changelog plugin
|
// This comes from the changelog plugin
|
||||||
// classpath("org.jetbrains:markdown:0.3.1")
|
// classpath("org.jetbrains:markdown:0.3.1")
|
||||||
@@ -70,7 +70,7 @@ plugins {
|
|||||||
application
|
application
|
||||||
id("java-test-fixtures")
|
id("java-test-fixtures")
|
||||||
|
|
||||||
id("org.jetbrains.intellij") version "1.17.1"
|
id("org.jetbrains.intellij") version "1.17.2"
|
||||||
id("org.jetbrains.changelog") version "2.2.0"
|
id("org.jetbrains.changelog") version "2.2.0"
|
||||||
|
|
||||||
id("org.jetbrains.kotlinx.kover") version "0.6.1"
|
id("org.jetbrains.kotlinx.kover") version "0.6.1"
|
||||||
@@ -144,12 +144,12 @@ dependencies {
|
|||||||
// https://mvnrepository.com/artifact/org.mockito.kotlin/mockito-kotlin
|
// https://mvnrepository.com/artifact/org.mockito.kotlin/mockito-kotlin
|
||||||
testImplementation("org.mockito.kotlin:mockito-kotlin:5.2.1")
|
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-api:5.10.2")
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.10.1")
|
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.10.2")
|
||||||
testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.1")
|
testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.2")
|
||||||
testFixturesImplementation("org.junit.jupiter:junit-jupiter-api:5.10.1")
|
testFixturesImplementation("org.junit.jupiter:junit-jupiter-api:5.10.2")
|
||||||
testFixturesImplementation("org.junit.jupiter:junit-jupiter-engine:5.10.1")
|
testFixturesImplementation("org.junit.jupiter:junit-jupiter-engine:5.10.2")
|
||||||
testFixturesImplementation("org.junit.jupiter:junit-jupiter-params:5.10.1")
|
testFixturesImplementation("org.junit.jupiter:junit-jupiter-params:5.10.2")
|
||||||
}
|
}
|
||||||
|
|
||||||
configurations {
|
configurations {
|
||||||
@@ -305,26 +305,28 @@ tasks {
|
|||||||
from(createOpenApiSourceJar) { into("lib/src") }
|
from(createOpenApiSourceJar) { into("lib/src") }
|
||||||
}
|
}
|
||||||
|
|
||||||
val pluginVersion = version
|
val pluginVersion = version
|
||||||
// Don't forget to update plugin.xml
|
// Don't forget to update plugin.xml
|
||||||
patchPluginXml {
|
patchPluginXml {
|
||||||
// Get the latest available change notes from the changelog file
|
sinceBuild.set("233.11799.30")
|
||||||
changeNotes.set(
|
|
||||||
provider {
|
// Get the latest available change notes from the changelog file
|
||||||
with(changelog) {
|
changeNotes.set(
|
||||||
val log = try {
|
provider {
|
||||||
getUnreleased()
|
with(changelog) {
|
||||||
} catch (e: MissingVersionException) {
|
val log = try {
|
||||||
getOrNull(pluginVersion.toString()) ?: getLatest()
|
getUnreleased()
|
||||||
}
|
} catch (e: MissingVersionException) {
|
||||||
renderItem(
|
getOrNull(pluginVersion.toString()) ?: getLatest()
|
||||||
log,
|
}
|
||||||
org.jetbrains.changelog.Changelog.OutputType.HTML,
|
renderItem(
|
||||||
)
|
log,
|
||||||
}
|
org.jetbrains.changelog.Changelog.OutputType.HTML,
|
||||||
},
|
)
|
||||||
)
|
}
|
||||||
}
|
},
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// --- Tests
|
// --- Tests
|
||||||
@@ -429,12 +431,14 @@ val prId: String by project
|
|||||||
|
|
||||||
tasks.register("updateMergedPr") {
|
tasks.register("updateMergedPr") {
|
||||||
doLast {
|
doLast {
|
||||||
if (project.hasProperty("prId")) {
|
val x = changelog.getUnreleased()
|
||||||
println("Got pr id: $prId")
|
println("x")
|
||||||
updateMergedPr(prId.toInt())
|
// if (project.hasProperty("prId")) {
|
||||||
} else {
|
// println("Got pr id: $prId")
|
||||||
error("Cannot get prId")
|
// updateMergedPr(prId.toInt())
|
||||||
}
|
// } else {
|
||||||
|
// error("Cannot get prId")
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -458,7 +462,7 @@ val fixVersionsElementType = "VersionBundleElement"
|
|||||||
tasks.register("releaseActions") {
|
tasks.register("releaseActions") {
|
||||||
group = "other"
|
group = "other"
|
||||||
doLast {
|
doLast {
|
||||||
val tickets = getYoutrackTicketsByQuery("%23%7BReady+To+Release%7D")
|
val tickets = getYoutrackTicketsByQuery("%23%7BReady+To+Release%7D%20and%20tag:%20%7BIdeaVim%20Released%20In%20EAP%7D%20")
|
||||||
if (tickets.isNotEmpty()) {
|
if (tickets.isNotEmpty()) {
|
||||||
println("Updating statuses for tickets: $tickets")
|
println("Updating statuses for tickets: $tickets")
|
||||||
setYoutrackStatus(tickets, "Fixed")
|
setYoutrackStatus(tickets, "Fixed")
|
||||||
|
@@ -8,17 +8,16 @@
|
|||||||
|
|
||||||
# suppress inspection "UnusedProperty" for whole file
|
# suppress inspection "UnusedProperty" for whole file
|
||||||
|
|
||||||
ideaVersion=2023.3.3
|
ideaVersion=2023.3.2
|
||||||
# Values for type: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#intellij-extension-type
|
# Values for type: https://plugins.jetbrains.com/docs/intellij/tools-gradle-intellij-plugin.html#intellij-extension-type
|
||||||
ideaType=IC
|
ideaType=IC
|
||||||
downloadIdeaSources=true
|
downloadIdeaSources=true
|
||||||
instrumentPluginCode=true
|
instrumentPluginCode=true
|
||||||
version=chylex-27
|
version=SNAPSHOT
|
||||||
javaVersion=17
|
javaVersion=17
|
||||||
remoteRobotVersion=0.11.22
|
remoteRobotVersion=0.11.22
|
||||||
antlrVersion=4.10.1
|
antlrVersion=4.10.1
|
||||||
|
|
||||||
kotlin.incremental.useClasspathSnapshot=false
|
|
||||||
|
|
||||||
# Please don't forget to update kotlin version in buildscript section
|
# Please don't forget to update kotlin version in buildscript section
|
||||||
# Also update kotlinxSerializationVersion version
|
# Also update kotlinxSerializationVersion version
|
||||||
@@ -40,4 +39,4 @@ org.gradle.jvmargs='-Dfile.encoding=UTF-8'
|
|||||||
kotlin.stdlib.default.dependency=false
|
kotlin.stdlib.default.dependency=false
|
||||||
|
|
||||||
# Disable incremental annotation processing
|
# Disable incremental annotation processing
|
||||||
ksp.incremental=false
|
ksp.incremental=false
|
124814
qodana.sarif.json
124814
qodana.sarif.json
File diff suppressed because one or more lines are too long
@@ -21,6 +21,9 @@ exclude:
|
|||||||
- src/test/java/org/jetbrains/plugins/ideavim/propertybased/samples/SimpleText.kt
|
- 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/vimscript/parser/generated
|
||||||
- src/main/java/com/maddyhome/idea/vim/package-info.java
|
- 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:
|
dependencyIgnores:
|
||||||
- name: "acejump"
|
- name: "acejump"
|
||||||
- name: "icu4j"
|
- name: "icu4j"
|
||||||
|
@@ -22,11 +22,11 @@ repositories {
|
|||||||
dependencies {
|
dependencies {
|
||||||
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:1.9.22")
|
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:1.9.22")
|
||||||
|
|
||||||
implementation("io.ktor:ktor-client-core:2.3.7")
|
implementation("io.ktor:ktor-client-core:2.3.8")
|
||||||
implementation("io.ktor:ktor-client-cio:2.3.7")
|
implementation("io.ktor:ktor-client-cio:2.3.8")
|
||||||
implementation("io.ktor:ktor-client-content-negotiation:2.3.7")
|
implementation("io.ktor:ktor-client-content-negotiation:2.3.8")
|
||||||
implementation("io.ktor:ktor-serialization-kotlinx-json:2.3.7")
|
implementation("io.ktor:ktor-serialization-kotlinx-json:2.3.8")
|
||||||
implementation("io.ktor:ktor-client-auth:2.3.7")
|
implementation("io.ktor:ktor-client-auth:2.3.8")
|
||||||
implementation("org.eclipse.jgit:org.eclipse.jgit:6.6.0.202305301015-r")
|
implementation("org.eclipse.jgit:org.eclipse.jgit:6.6.0.202305301015-r")
|
||||||
|
|
||||||
// This is needed for jgit to connect to ssh
|
// This is needed for jgit to connect to ssh
|
||||||
|
@@ -22,7 +22,7 @@ import kotlinx.serialization.json.jsonPrimitive
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@Suppress("SpellCheckingInspection")
|
@Suppress("SpellCheckingInspection")
|
||||||
val knownPlugins = listOf(
|
val knownPlugins = setOf(
|
||||||
"IdeaVimExtension",
|
"IdeaVimExtension",
|
||||||
"github.zgqq.intellij-enhance",
|
"github.zgqq.intellij-enhance",
|
||||||
"org.jetbrains.IdeaVim-EasyMotion",
|
"org.jetbrains.IdeaVim-EasyMotion",
|
||||||
@@ -31,7 +31,12 @@ val knownPlugins = listOf(
|
|||||||
"com.github.copilot",
|
"com.github.copilot",
|
||||||
"com.github.dankinsoid.multicursor",
|
"com.github.dankinsoid.multicursor",
|
||||||
"com.joshestein.ideavim-quickscope",
|
"com.joshestein.ideavim-quickscope",
|
||||||
|
|
||||||
"ca.alexgirard.HarpoonIJ",
|
"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",
|
"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
|
// "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("dependency", "IdeaVIM")
|
||||||
parameter("includeOptional", true)
|
parameter("includeOptional", true)
|
||||||
}
|
}
|
||||||
val output = response.body<List<String>>()
|
val output = response.body<List<String>>().toSet()
|
||||||
println(output)
|
println(output)
|
||||||
if (knownPlugins != output) {
|
if (knownPlugins != output) {
|
||||||
val newPlugins = (output - knownPlugins).map { it to (getPluginLinkByXmlId(it) ?: "Can't find plugin link") }
|
val newPlugins = (output - knownPlugins).map { it to (getPluginLinkByXmlId(it) ?: "Can't find plugin link") }
|
||||||
|
@@ -8,6 +8,12 @@
|
|||||||
|
|
||||||
package scripts.release
|
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>) {
|
fun main(args: Array<String>) {
|
||||||
println("HI!")
|
println("HI!")
|
||||||
val projectDir = args[0]
|
val projectDir = args[0]
|
||||||
@@ -19,10 +25,12 @@ fun main(args: Array<String>) {
|
|||||||
check(branch == "master") {
|
check(branch == "master") {
|
||||||
"We should be on master branch"
|
"We should be on master branch"
|
||||||
}
|
}
|
||||||
|
val mergeBaseCommit = getMergeBaseWithMaster(projectDir, objectId)
|
||||||
|
println("Base commit $mergeBaseCommit")
|
||||||
withGit(projectDir) { git ->
|
withGit(projectDir) { git ->
|
||||||
val log = git.log().setMaxCount(500).call().toList()
|
val log = git.log().setMaxCount(500).call().toList()
|
||||||
println("First commit hash in log: " + log.first().name + " log size: ${log.size}")
|
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
|
val numCommits = logDiff.size
|
||||||
println("Log diff size is $numCommits")
|
println("Log diff size is $numCommits")
|
||||||
check(numCommits < 450) {
|
check(numCommits < 450) {
|
||||||
@@ -35,3 +43,18 @@ fun main(args: Array<String>) {
|
|||||||
println("##teamcity[setParameter name='env.ORG_GRADLE_PROJECT_version' value='$nextVersion']")
|
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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@@ -14,7 +14,7 @@ import com.intellij.openapi.components.service
|
|||||||
import com.intellij.openapi.project.Project
|
import com.intellij.openapi.project.Project
|
||||||
import com.maddyhome.idea.vim.group.EditorHolderService
|
import com.maddyhome.idea.vim.group.EditorHolderService
|
||||||
|
|
||||||
@Service
|
@Service(Service.Level.PROJECT)
|
||||||
internal class VimProjectService(val project: Project) : Disposable {
|
internal class VimProjectService(val project: Project) : Disposable {
|
||||||
override fun dispose() {
|
override fun dispose() {
|
||||||
// Not sure if this is a best solution
|
// Not sure if this is a best solution
|
||||||
|
@@ -14,6 +14,7 @@ import com.maddyhome.idea.vim.VimPlugin
|
|||||||
import com.maddyhome.idea.vim.api.ExecutionContext
|
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||||
import com.maddyhome.idea.vim.api.VimCaret
|
import com.maddyhome.idea.vim.api.VimCaret
|
||||||
import com.maddyhome.idea.vim.api.VimEditor
|
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.injector
|
||||||
import com.maddyhome.idea.vim.api.setChangeMarks
|
import com.maddyhome.idea.vim.api.setChangeMarks
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
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.command.OperatorArguments
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.common.argumentCaptured
|
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.MotionGroup
|
||||||
import com.maddyhome.idea.vim.group.visual.VimSelection
|
import com.maddyhome.idea.vim.group.visual.VimSelection
|
||||||
import com.maddyhome.idea.vim.handler.VimActionHandler
|
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.helper.vimStateMachine
|
||||||
import com.maddyhome.idea.vim.newapi.ij
|
import com.maddyhome.idea.vim.newapi.ij
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
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
|
// todo make it multicaret
|
||||||
private fun doOperatorAction(editor: VimEditor, context: ExecutionContext, textRange: TextRange, selectionType: SelectionType): Boolean {
|
private fun doOperatorAction(editor: VimEditor, context: ExecutionContext, textRange: TextRange, selectionType: SelectionType): Boolean {
|
||||||
val operatorFunction = injector.keyGroup.operatorFunction
|
val func = injector.globalOptions().operatorfunc
|
||||||
if (operatorFunction == null) {
|
if (func.isEmpty()) {
|
||||||
VimPlugin.showMessage(MessageHelper.message("E774"))
|
VimPlugin.showMessage(MessageHelper.message("E774"))
|
||||||
return false
|
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
|
val saveRepeatHandler = VimRepeater.repeatHandler
|
||||||
injector.markService.setChangeMarks(editor.primaryCaret(), textRange)
|
injector.markService.setChangeMarks(editor.primaryCaret(), textRange)
|
||||||
KeyHandler.getInstance().reset(editor)
|
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
|
VimRepeater.repeatHandler = saveRepeatHandler
|
||||||
return result
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@CommandOrMotion(keys = ["g@"], modes = [Mode.NORMAL])
|
@CommandOrMotion(keys = ["g@"], modes = [Mode.NORMAL])
|
||||||
|
@@ -23,17 +23,17 @@ public class CommandState(private val machine: VimStateMachine) {
|
|||||||
public val isOperatorPending: Boolean
|
public val isOperatorPending: Boolean
|
||||||
get() = machine.isOperatorPending
|
get() = machine.isOperatorPending
|
||||||
|
|
||||||
public val mode: CommandState.Mode
|
public val mode: Mode
|
||||||
get() {
|
get() {
|
||||||
val myMode = machine.mode
|
val myMode = machine.mode
|
||||||
return when (myMode) {
|
return when (myMode) {
|
||||||
is com.maddyhome.idea.vim.state.mode.Mode.CMD_LINE -> CommandState.Mode.CMD_LINE
|
is com.maddyhome.idea.vim.state.mode.Mode.CMD_LINE -> Mode.CMD_LINE
|
||||||
com.maddyhome.idea.vim.state.mode.Mode.INSERT -> CommandState.Mode.INSERT
|
com.maddyhome.idea.vim.state.mode.Mode.INSERT -> Mode.INSERT
|
||||||
is com.maddyhome.idea.vim.state.mode.Mode.NORMAL -> CommandState.Mode.COMMAND
|
is com.maddyhome.idea.vim.state.mode.Mode.NORMAL -> Mode.COMMAND
|
||||||
is com.maddyhome.idea.vim.state.mode.Mode.OP_PENDING -> CommandState.Mode.OP_PENDING
|
is com.maddyhome.idea.vim.state.mode.Mode.OP_PENDING -> Mode.OP_PENDING
|
||||||
com.maddyhome.idea.vim.state.mode.Mode.REPLACE -> CommandState.Mode.REPLACE
|
com.maddyhome.idea.vim.state.mode.Mode.REPLACE -> Mode.REPLACE
|
||||||
is com.maddyhome.idea.vim.state.mode.Mode.SELECT -> CommandState.Mode.SELECT
|
is com.maddyhome.idea.vim.state.mode.Mode.SELECT -> Mode.SELECT
|
||||||
is com.maddyhome.idea.vim.state.mode.Mode.VISUAL -> CommandState.Mode.VISUAL
|
is com.maddyhome.idea.vim.state.mode.Mode.VISUAL -> Mode.VISUAL
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -14,21 +14,34 @@ import com.intellij.openapi.editor.Editor
|
|||||||
import com.maddyhome.idea.vim.KeyHandler
|
import com.maddyhome.idea.vim.KeyHandler
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.action.change.Extension
|
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.ImmutableVimCaret
|
||||||
import com.maddyhome.idea.vim.api.VimCaret
|
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.api.injector
|
||||||
import com.maddyhome.idea.vim.command.MappingMode
|
import com.maddyhome.idea.vim.command.MappingMode
|
||||||
import com.maddyhome.idea.vim.common.CommandAlias
|
import com.maddyhome.idea.vim.common.CommandAlias
|
||||||
import com.maddyhome.idea.vim.common.CommandAliasHandler
|
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.CommandLineHelper
|
||||||
import com.maddyhome.idea.vim.helper.TestInputModel
|
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.helper.vimStateMachine
|
||||||
import com.maddyhome.idea.vim.key.MappingOwner
|
import com.maddyhome.idea.vim.key.MappingOwner
|
||||||
import com.maddyhome.idea.vim.key.OperatorFunction
|
import com.maddyhome.idea.vim.key.OperatorFunction
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import com.maddyhome.idea.vim.ui.ModalEntry
|
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.awt.event.KeyEvent
|
||||||
|
import java.util.*
|
||||||
import javax.swing.KeyStroke
|
import javax.swing.KeyStroke
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -120,12 +133,6 @@ public object VimExtensionFacade {
|
|||||||
.setAlias(name, CommandAlias.Call(minimumNumberOfArguments, maximumNumberOfArguments, name, handler))
|
.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}'.
|
* Runs normal mode commands similar to ':normal! {commands}'.
|
||||||
* Mappings doesn't work with this function
|
* Mappings doesn't work with this function
|
||||||
@@ -207,4 +214,65 @@ public object VimExtensionFacade {
|
|||||||
public fun setRegister(register: Char, keys: List<KeyStroke?>?, type: SelectionType) {
|
public fun setRegister(register: Char, keys: List<KeyStroke?>?, type: SelectionType) {
|
||||||
VimPlugin.getRegister().setKeys(register, keys?.filterNotNull() ?: emptyList(), type)
|
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
|
||||||
|
}
|
@@ -22,26 +22,26 @@ import com.maddyhome.idea.vim.api.ExecutionContext
|
|||||||
import com.maddyhome.idea.vim.api.ImmutableVimCaret
|
import com.maddyhome.idea.vim.api.ImmutableVimCaret
|
||||||
import com.maddyhome.idea.vim.api.VimEditor
|
import com.maddyhome.idea.vim.api.VimEditor
|
||||||
import com.maddyhome.idea.vim.api.getLineEndOffset
|
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.api.injector
|
||||||
import com.maddyhome.idea.vim.command.Argument
|
import com.maddyhome.idea.vim.command.Argument
|
||||||
import com.maddyhome.idea.vim.command.Command
|
import com.maddyhome.idea.vim.command.Command
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
import com.maddyhome.idea.vim.command.MappingMode
|
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.command.OperatorArguments
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
|
||||||
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
import com.maddyhome.idea.vim.command.TextObjectVisualType
|
||||||
import com.maddyhome.idea.vim.common.CommandAliasHandler
|
import com.maddyhome.idea.vim.common.CommandAliasHandler
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.ex.ranges.Ranges
|
import com.maddyhome.idea.vim.ex.ranges.Ranges
|
||||||
import com.maddyhome.idea.vim.extension.ExtensionHandler
|
import com.maddyhome.idea.vim.extension.ExtensionHandler
|
||||||
import com.maddyhome.idea.vim.extension.VimExtension
|
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.addCommand
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.executeNormalWithoutMapping
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.executeNormalWithoutMapping
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMapping
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMapping
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMapping
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMapping
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
|
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.handler.TextObjectActionHandler
|
||||||
import com.maddyhome.idea.vim.helper.PsiHelper
|
import com.maddyhome.idea.vim.helper.PsiHelper
|
||||||
import com.maddyhome.idea.vim.helper.vimStateMachine
|
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.IjVimEditor
|
||||||
import com.maddyhome.idea.vim.newapi.ij
|
import com.maddyhome.idea.vim.newapi.ij
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
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.*
|
import java.util.*
|
||||||
|
|
||||||
internal class CommentaryExtension : VimExtension {
|
internal class CommentaryExtension : VimExtension {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
|
||||||
|
private const val OPERATOR_FUNC = "CommentaryOperatorFunc"
|
||||||
|
|
||||||
fun doCommentary(
|
fun doCommentary(
|
||||||
editor: VimEditor,
|
editor: VimEditor,
|
||||||
context: ExecutionContext,
|
context: ExecutionContext,
|
||||||
range: TextRange,
|
range: TextRange,
|
||||||
selectionType: SelectionType,
|
selectionType: SelectionType,
|
||||||
resetCaret: Boolean,
|
resetCaret: Boolean = true,
|
||||||
): Boolean {
|
): Boolean {
|
||||||
val mode = editor.vimStateMachine.mode
|
val mode = editor.vimStateMachine.mode
|
||||||
if (mode !is Mode.VISUAL) {
|
if (mode !is Mode.VISUAL) {
|
||||||
@@ -67,8 +72,7 @@ internal class CommentaryExtension : VimExtension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return runWriteAction {
|
return runWriteAction {
|
||||||
// Treat block- and character-wise selections as block comments. Be ready to fall back to if the first action
|
// Treat block- and character-wise selections as block comments. Fall back if the first action isn't available
|
||||||
// isn't available
|
|
||||||
val actions = if (selectionType === SelectionType.LINE_WISE) {
|
val actions = if (selectionType === SelectionType.LINE_WISE) {
|
||||||
listOf(IdeActions.ACTION_COMMENT_LINE, IdeActions.ACTION_COMMENT_BLOCK)
|
listOf(IdeActions.ACTION_COMMENT_LINE, IdeActions.ACTION_COMMENT_BLOCK)
|
||||||
} else {
|
} 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,
|
// 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
|
// 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
|
// the difference
|
||||||
|
// TODO: If we don't move the caret to the start offset, we should maintain the current logical position
|
||||||
if (resetCaret) {
|
if (resetCaret) {
|
||||||
editor.primaryCaret().moveToOffset(range.startOffset)
|
editor.primaryCaret().moveToOffset(range.startOffset)
|
||||||
}
|
}
|
||||||
@@ -145,6 +150,16 @@ internal class CommentaryExtension : VimExtension {
|
|||||||
putKeyMapping(MappingMode.N, injector.parser.parseKeys("<Plug>(CommentLine)"), owner, plugCommentaryLineKeys, true)
|
putKeyMapping(MappingMode.N, injector.parser.parseKeys("<Plug>(CommentLine)"), owner, plugCommentaryLineKeys, true)
|
||||||
|
|
||||||
addCommand("Commentary", CommentaryCommandAliasHandler())
|
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
|
* 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.
|
* 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 val isRepeatable = true
|
||||||
|
|
||||||
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
|
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
|
||||||
setOperatorFunction(this)
|
injector.globalOptions().operatorfunc = OPERATOR_FUNC
|
||||||
executeNormalWithoutMapping(injector.parser.parseKeys("g@"), editor.ij)
|
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 {
|
private class CommentaryMappingHandler : ExtensionHandler {
|
||||||
|
@@ -19,22 +19,23 @@ import com.intellij.openapi.util.Key
|
|||||||
import com.maddyhome.idea.vim.api.ExecutionContext
|
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||||
import com.maddyhome.idea.vim.api.VimEditor
|
import com.maddyhome.idea.vim.api.VimEditor
|
||||||
import com.maddyhome.idea.vim.api.getOffset
|
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.injector
|
||||||
import com.maddyhome.idea.vim.api.setChangeMarks
|
import com.maddyhome.idea.vim.api.setChangeMarks
|
||||||
import com.maddyhome.idea.vim.command.MappingMode
|
import com.maddyhome.idea.vim.command.MappingMode
|
||||||
import com.maddyhome.idea.vim.command.OperatorArguments
|
import com.maddyhome.idea.vim.command.OperatorArguments
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
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.state.mode.selectionType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.extension.ExtensionHandler
|
import com.maddyhome.idea.vim.extension.ExtensionHandler
|
||||||
import com.maddyhome.idea.vim.extension.VimExtension
|
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.executeNormalWithoutMapping
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.getRegister
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.getRegister
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMapping
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMapping
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
|
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.VimExtensionFacade.setRegister
|
||||||
|
import com.maddyhome.idea.vim.extension.exportOperatorFunction
|
||||||
import com.maddyhome.idea.vim.helper.fileSize
|
import com.maddyhome.idea.vim.helper.fileSize
|
||||||
import com.maddyhome.idea.vim.state.mode.mode
|
import com.maddyhome.idea.vim.state.mode.mode
|
||||||
import com.maddyhome.idea.vim.helper.moveToInlayAwareLogicalPosition
|
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.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("cxc"), owner, injector.parser.parseKeys(EXCHANGE_CLEAR_CMD), true)
|
||||||
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("cxx"), owner, injector.parser.parseKeys(EXCHANGE_LINE_CMD), true)
|
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("cxx"), owner, injector.parser.parseKeys(EXCHANGE_LINE_CMD), true)
|
||||||
|
|
||||||
|
VimExtensionFacade.exportOperatorFunction(OPERATOR_FUNC, Operator())
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@NonNls
|
@NonNls private const val EXCHANGE_CMD = "<Plug>(Exchange)"
|
||||||
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
|
@NonNls private const val OPERATOR_FUNC = "ExchangeOperatorFunc"
|
||||||
const val EXCHANGE_CLEAR_CMD = "<Plug>(ExchangeClear)"
|
|
||||||
|
|
||||||
@NonNls
|
|
||||||
const val EXCHANGE_LINE_CMD = "<Plug>(ExchangeLine)"
|
|
||||||
|
|
||||||
val EXCHANGE_KEY = Key<Exchange>("exchange")
|
val EXCHANGE_KEY = Key<Exchange>("exchange")
|
||||||
|
|
||||||
@@ -108,7 +107,7 @@ internal class VimExchangeExtension : VimExtension {
|
|||||||
override val isRepeatable = true
|
override val isRepeatable = true
|
||||||
|
|
||||||
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
|
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)
|
executeNormalWithoutMapping(injector.parser.parseKeys(if (isLine) "g@_" else "g@"), editor.ij)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,12 +124,12 @@ internal class VimExchangeExtension : VimExtension {
|
|||||||
val mode = editor.mode
|
val mode = editor.mode
|
||||||
// Leave visual mode to create selection marks
|
// Leave visual mode to create selection marks
|
||||||
executeNormalWithoutMapping(injector.parser.parseKeys("<Esc>"), editor.ij)
|
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 Editor.getMarkOffset(mark: Mark) = IjVimEditor(this).getOffset(mark.line, mark.col)
|
||||||
fun SelectionType.getString() = when (this) {
|
fun SelectionType.getString() = when (this) {
|
||||||
SelectionType.CHARACTER_WISE -> "v"
|
SelectionType.CHARACTER_WISE -> "v"
|
||||||
@@ -148,7 +147,7 @@ internal class VimExchangeExtension : VimExtension {
|
|||||||
else -> HighlighterTargetArea.EXACT_RANGE
|
else -> HighlighterTargetArea.EXACT_RANGE
|
||||||
}
|
}
|
||||||
val isVisualLine = ex.type == SelectionType.LINE_WISE
|
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(
|
return ijEditor.markupModel.addRangeHighlighter(
|
||||||
ijEditor.getMarkOffset(ex.start),
|
ijEditor.getMarkOffset(ex.start),
|
||||||
(ijEditor.getMarkOffset(ex.end) + endAdj).coerceAtMost(ijEditor.fileSize),
|
(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)
|
val exchange1 = ijEditor.getUserData(EXCHANGE_KEY)
|
||||||
if (exchange1 == null) {
|
if (exchange1 == null) {
|
||||||
val highlighter = highlightExchange(currentExchange)
|
val highlighter = highlightExchange(currentExchange)
|
||||||
|
@@ -233,7 +233,7 @@ private object FileTypePatterns {
|
|||||||
} else if (fileTypeName == "CMakeLists.txt" || fileName == "CMakeLists") {
|
} else if (fileTypeName == "CMakeLists.txt" || fileName == "CMakeLists") {
|
||||||
this.cMakePatterns
|
this.cMakePatterns
|
||||||
} else {
|
} else {
|
||||||
this.htmlPatterns
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -502,13 +502,6 @@ internal class NerdTree : VimExtension {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
for (c in ('a'..'z') + ('A'..'Z')) {
|
|
||||||
val ks = KeyStroke.getKeyStroke(c)
|
|
||||||
if (ks !in actionsRoot) {
|
|
||||||
registerCommand(c.toString(), NerdAction.Code { _, _, _ -> })
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
@@ -11,8 +11,8 @@ package com.maddyhome.idea.vim.extension.paragraphmotion
|
|||||||
import com.intellij.openapi.editor.Caret
|
import com.intellij.openapi.editor.Caret
|
||||||
import com.maddyhome.idea.vim.api.ExecutionContext
|
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||||
import com.maddyhome.idea.vim.api.VimEditor
|
import com.maddyhome.idea.vim.api.VimEditor
|
||||||
import com.maddyhome.idea.vim.api.getLineEndForOffset
|
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
|
import com.maddyhome.idea.vim.api.normalizeOffset
|
||||||
import com.maddyhome.idea.vim.command.MappingMode
|
import com.maddyhome.idea.vim.command.MappingMode
|
||||||
import com.maddyhome.idea.vim.command.OperatorArguments
|
import com.maddyhome.idea.vim.command.OperatorArguments
|
||||||
import com.maddyhome.idea.vim.extension.ExtensionHandler
|
import com.maddyhome.idea.vim.extension.ExtensionHandler
|
||||||
@@ -45,7 +45,8 @@ internal class ParagraphMotion : VimExtension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun moveCaretToNextParagraph(editor: VimEditor, caret: Caret, count: Int): Int? {
|
fun moveCaretToNextParagraph(editor: VimEditor, caret: Caret, count: Int): Int? {
|
||||||
return injector.searchHelper.findNextParagraph(editor, caret.vim, count, true)?.let(editor::getLineEndForOffset)
|
return injector.searchHelper.findNextParagraph(editor, caret.vim, count, true)
|
||||||
|
?.let { editor.normalizeOffset(it, true) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -14,12 +14,12 @@ import com.maddyhome.idea.vim.api.ExecutionContext
|
|||||||
import com.maddyhome.idea.vim.api.ImmutableVimCaret
|
import com.maddyhome.idea.vim.api.ImmutableVimCaret
|
||||||
import com.maddyhome.idea.vim.api.VimEditor
|
import com.maddyhome.idea.vim.api.VimEditor
|
||||||
import com.maddyhome.idea.vim.api.getLineEndOffset
|
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.api.injector
|
||||||
import com.maddyhome.idea.vim.command.MappingMode
|
import com.maddyhome.idea.vim.command.MappingMode
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.command.OperatorArguments
|
import com.maddyhome.idea.vim.command.OperatorArguments
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
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.isLine
|
||||||
import com.maddyhome.idea.vim.state.mode.selectionType
|
import com.maddyhome.idea.vim.state.mode.selectionType
|
||||||
import com.maddyhome.idea.vim.common.TextRange
|
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
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.executeNormalWithoutMapping
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.executeNormalWithoutMapping
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
|
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.group.visual.VimSelection
|
||||||
import com.maddyhome.idea.vim.helper.exitVisualMode
|
import com.maddyhome.idea.vim.helper.exitVisualMode
|
||||||
import com.maddyhome.idea.vim.state.mode.mode
|
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("gr"), owner, injector.parser.parseKeys(RWR_OPERATOR), true)
|
||||||
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("grr"), owner, injector.parser.parseKeys(RWR_LINE), 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)
|
putKeyMappingIfMissing(MappingMode.X, injector.parser.parseKeys("gr"), owner, injector.parser.parseKeys(RWR_VISUAL), true)
|
||||||
|
|
||||||
|
VimExtensionFacade.exportOperatorFunction(OPERATOR_FUNC, Operator())
|
||||||
}
|
}
|
||||||
|
|
||||||
private class RwrVisual : ExtensionHandler {
|
private class RwrVisual : ExtensionHandler {
|
||||||
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
|
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 ->
|
editor.sortedCarets().forEach { caret ->
|
||||||
val selectionStart = caret.selectionStart
|
val selectionStart = caret.selectionStart
|
||||||
val selectionEnd = caret.selectionEnd
|
val selectionEnd = caret.selectionEnd
|
||||||
@@ -73,7 +75,7 @@ internal class ReplaceWithRegister : VimExtension {
|
|||||||
override val isRepeatable: Boolean = true
|
override val isRepeatable: Boolean = true
|
||||||
|
|
||||||
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
|
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
|
||||||
setOperatorFunction(Operator())
|
injector.globalOptions().operatorfunc = OPERATOR_FUNC
|
||||||
executeNormalWithoutMapping(injector.parser.parseKeys("g@"), editor.ij)
|
executeNormalWithoutMapping(injector.parser.parseKeys("g@"), editor.ij)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -112,11 +114,11 @@ internal class ReplaceWithRegister : VimExtension {
|
|||||||
editor.primaryCaret() to VimSelection.create(
|
editor.primaryCaret() to VimSelection.create(
|
||||||
range.startOffset,
|
range.startOffset,
|
||||||
range.endOffset - 1,
|
range.endOffset - 1,
|
||||||
selectionType ?: CHARACTER_WISE,
|
selectionType ?: SelectionType.CHARACTER_WISE,
|
||||||
editor,
|
editor,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
selectionType ?: CHARACTER_WISE,
|
selectionType ?: SelectionType.CHARACTER_WISE,
|
||||||
)
|
)
|
||||||
// todo multicaret
|
// todo multicaret
|
||||||
doReplace(ijEditor, editor.primaryCaret(), visualSelection)
|
doReplace(ijEditor, editor.primaryCaret(), visualSelection)
|
||||||
@@ -132,14 +134,10 @@ internal class ReplaceWithRegister : VimExtension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
@NonNls
|
@NonNls private const val RWR_OPERATOR = "<Plug>ReplaceWithRegisterOperator"
|
||||||
private const val RWR_OPERATOR = "<Plug>ReplaceWithRegisterOperator"
|
@NonNls private const val RWR_LINE = "<Plug>ReplaceWithRegisterLine"
|
||||||
|
@NonNls private const val RWR_VISUAL = "<Plug>ReplaceWithRegisterVisual"
|
||||||
@NonNls
|
@NonNls private const val OPERATOR_FUNC = "ReplaceWithRegisterOperatorFunc"
|
||||||
private const val RWR_LINE = "<Plug>ReplaceWithRegisterLine"
|
|
||||||
|
|
||||||
@NonNls
|
|
||||||
private const val RWR_VISUAL = "<Plug>ReplaceWithRegisterVisual"
|
|
||||||
|
|
||||||
private fun doReplace(editor: Editor, caret: ImmutableVimCaret, visualSelection: PutData.VisualSelection) {
|
private fun doReplace(editor: Editor, caret: ImmutableVimCaret, visualSelection: PutData.VisualSelection) {
|
||||||
val registerGroup = injector.registerGroup
|
val registerGroup = injector.registerGroup
|
||||||
|
@@ -1,30 +0,0 @@
|
|||||||
package com.maddyhome.idea.vim.extension.surround
|
|
||||||
|
|
||||||
import com.intellij.util.text.CharSequenceSubSequence
|
|
||||||
|
|
||||||
internal data class RepeatedCharSequence(val text: CharSequence, val count: Int) : CharSequence {
|
|
||||||
override val length = text.length * count
|
|
||||||
|
|
||||||
override fun get(index: Int): Char {
|
|
||||||
if (index < 0 || index >= length) throw IndexOutOfBoundsException()
|
|
||||||
return text[index % text.length]
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun subSequence(startIndex: Int, endIndex: Int): CharSequence {
|
|
||||||
return CharSequenceSubSequence(this, startIndex, endIndex)
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun toString(): String {
|
|
||||||
return text.repeat(count)
|
|
||||||
}
|
|
||||||
|
|
||||||
companion object {
|
|
||||||
fun of(text: CharSequence, count: Int): CharSequence {
|
|
||||||
return when (count) {
|
|
||||||
0 -> ""
|
|
||||||
1 -> text
|
|
||||||
else -> RepeatedCharSequence(text, count)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@@ -13,10 +13,10 @@ import com.intellij.openapi.editor.Editor
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.ExecutionContext
|
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||||
import com.maddyhome.idea.vim.api.VimCaret
|
import com.maddyhome.idea.vim.api.VimCaret
|
||||||
import com.maddyhome.idea.vim.api.VimChangeGroup
|
|
||||||
import com.maddyhome.idea.vim.api.VimEditor
|
import com.maddyhome.idea.vim.api.VimEditor
|
||||||
import com.maddyhome.idea.vim.api.endsWithNewLine
|
import com.maddyhome.idea.vim.api.endsWithNewLine
|
||||||
import com.maddyhome.idea.vim.api.getLeadingCharacterOffset
|
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.injector
|
||||||
import com.maddyhome.idea.vim.api.setChangeMarks
|
import com.maddyhome.idea.vim.api.setChangeMarks
|
||||||
import com.maddyhome.idea.vim.command.MappingMode
|
import com.maddyhome.idea.vim.command.MappingMode
|
||||||
@@ -24,18 +24,17 @@ import com.maddyhome.idea.vim.command.OperatorArguments
|
|||||||
import com.maddyhome.idea.vim.common.TextRange
|
import com.maddyhome.idea.vim.common.TextRange
|
||||||
import com.maddyhome.idea.vim.extension.ExtensionHandler
|
import com.maddyhome.idea.vim.extension.ExtensionHandler
|
||||||
import com.maddyhome.idea.vim.extension.VimExtension
|
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.executeNormalWithoutMapping
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.getRegisterForCaret
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.getRegisterForCaret
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.inputKeyStroke
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.inputKeyStroke
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.inputString
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.inputString
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMapping
|
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMapping
|
||||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMappingIfMissing
|
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.VimExtensionFacade.setRegisterForCaret
|
||||||
import com.maddyhome.idea.vim.helper.runWithEveryCaretAndRestore
|
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.key.OperatorFunction
|
||||||
import com.maddyhome.idea.vim.newapi.IjVimCaret
|
|
||||||
import com.maddyhome.idea.vim.newapi.IjVimEditor
|
|
||||||
import com.maddyhome.idea.vim.newapi.ij
|
import com.maddyhome.idea.vim.newapi.ij
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import com.maddyhome.idea.vim.options.helpers.ClipboardOptionHelper
|
import com.maddyhome.idea.vim.options.helpers.ClipboardOptionHelper
|
||||||
@@ -78,13 +77,15 @@ internal class VimSurroundExtension : VimExtension {
|
|||||||
putKeyMappingIfMissing(MappingMode.N, injector.parser.parseKeys("ds"), owner, injector.parser.parseKeys("<Plug>DSurround"), true)
|
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)
|
putKeyMappingIfMissing(MappingMode.XO, injector.parser.parseKeys("S"), owner, injector.parser.parseKeys("<Plug>VSurround"), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VimExtensionFacade.exportOperatorFunction(OPERATOR_FUNC, Operator())
|
||||||
}
|
}
|
||||||
|
|
||||||
private class YSurroundHandler : ExtensionHandler {
|
private class YSurroundHandler : ExtensionHandler {
|
||||||
override val isRepeatable = true
|
override val isRepeatable = true
|
||||||
|
|
||||||
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
|
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
|
||||||
setOperatorFunction(Operator(supportsMultipleCursors = false, count = 1)) // TODO
|
injector.globalOptions().operatorfunc = OPERATOR_FUNC
|
||||||
executeNormalWithoutMapping(injector.parser.parseKeys("g@"), editor.ij)
|
executeNormalWithoutMapping(injector.parser.parseKeys("g@"), editor.ij)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -105,7 +106,7 @@ internal class VimSurroundExtension : VimExtension {
|
|||||||
val lastNonWhiteSpaceOffset = getLastNonWhitespaceCharacterOffset(editor.text(), lineStartOffset, lineEndOffset)
|
val lastNonWhiteSpaceOffset = getLastNonWhitespaceCharacterOffset(editor.text(), lineStartOffset, lineEndOffset)
|
||||||
if (lastNonWhiteSpaceOffset != null) {
|
if (lastNonWhiteSpaceOffset != null) {
|
||||||
val range = TextRange(lineStartOffset, lastNonWhiteSpaceOffset + 1)
|
val range = TextRange(lineStartOffset, lastNonWhiteSpaceOffset + 1)
|
||||||
performSurround(pair, range, it, count = operatorArguments.count1)
|
performSurround(pair, range, it)
|
||||||
}
|
}
|
||||||
// it.moveToOffset(lineStartOffset)
|
// it.moveToOffset(lineStartOffset)
|
||||||
}
|
}
|
||||||
@@ -125,13 +126,15 @@ internal class VimSurroundExtension : VimExtension {
|
|||||||
|
|
||||||
private class VSurroundHandler : ExtensionHandler {
|
private class VSurroundHandler : ExtensionHandler {
|
||||||
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
|
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
|
||||||
|
val selectionStart = editor.ij.caretModel.primaryCaret.selectionStart
|
||||||
// NB: Operator ignores SelectionType anyway
|
// NB: Operator ignores SelectionType anyway
|
||||||
if (!Operator(supportsMultipleCursors = true, count = operatorArguments.count1).apply(editor, context, editor.mode.selectionType)) {
|
if (!Operator().apply(editor, context, editor.mode.selectionType)) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
runWriteAction {
|
runWriteAction {
|
||||||
// Leave visual mode
|
// Leave visual mode
|
||||||
executeNormalWithoutMapping(injector.parser.parseKeys("<Esc>"), editor.ij)
|
executeNormalWithoutMapping(injector.parser.parseKeys("<Esc>"), editor.ij)
|
||||||
|
editor.ij.caretModel.moveToOffset(selectionStart)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -152,10 +155,6 @@ internal class VimSurroundExtension : VimExtension {
|
|||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun change(editor: VimEditor, context: ExecutionContext, charFrom: Char, newSurround: Pair<String, String>?) {
|
fun change(editor: VimEditor, context: ExecutionContext, charFrom: Char, newSurround: Pair<String, String>?) {
|
||||||
editor.ij.runWithEveryCaretAndRestore { changeAtCaret(editor, context, charFrom, newSurround) }
|
|
||||||
}
|
|
||||||
|
|
||||||
fun changeAtCaret(editor: VimEditor, context: ExecutionContext, charFrom: Char, newSurround: Pair<String, String>?) {
|
|
||||||
// Save old register values for carets
|
// Save old register values for carets
|
||||||
val surroundings = editor.sortedCarets()
|
val surroundings = editor.sortedCarets()
|
||||||
.map {
|
.map {
|
||||||
@@ -263,40 +262,19 @@ internal class VimSurroundExtension : VimExtension {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class Operator(private val supportsMultipleCursors: Boolean, private val count: Int) : OperatorFunction {
|
private class Operator : OperatorFunction {
|
||||||
override fun apply(vimEditor: VimEditor, context: ExecutionContext, selectionType: SelectionType?): Boolean {
|
override fun apply(editor: VimEditor, context: ExecutionContext, selectionType: SelectionType?): Boolean {
|
||||||
val editor = vimEditor.ij
|
val ijEditor = editor.ij
|
||||||
val c = getChar(editor)
|
val c = getChar(ijEditor)
|
||||||
if (c.code == 0) return true
|
if (c.code == 0) return true
|
||||||
|
|
||||||
val pair = getOrInputPair(c, editor) ?: return false
|
val pair = getOrInputPair(c, ijEditor) ?: return false
|
||||||
|
|
||||||
runWriteAction {
|
|
||||||
val change = VimPlugin.getChange()
|
|
||||||
if (supportsMultipleCursors) {
|
|
||||||
editor.runWithEveryCaretAndRestore {
|
|
||||||
applyOnce(editor, change, pair, count)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
applyOnce(editor, change, pair, count)
|
|
||||||
// Jump back to start
|
|
||||||
executeNormalWithoutMapping(injector.parser.parseKeys("`["), editor)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun applyOnce(editor: Editor, change: VimChangeGroup, pair: Pair<String, String>, count: Int) {
|
|
||||||
// XXX: Will it work with line-wise or block-wise selections?
|
// XXX: Will it work with line-wise or block-wise selections?
|
||||||
val primaryCaret = editor.caretModel.primaryCaret
|
val range = getSurroundRange(editor.currentCaret()) ?: return false
|
||||||
val range = getSurroundRange(primaryCaret.vim)
|
performSurround(pair, range, editor.currentCaret(), selectionType == SelectionType.LINE_WISE)
|
||||||
if (range != null) {
|
// Jump back to start
|
||||||
val start = RepeatedCharSequence.of(pair.first, count)
|
executeNormalWithoutMapping(injector.parser.parseKeys("`["), ijEditor)
|
||||||
val end = RepeatedCharSequence.of(pair.second, count)
|
return true
|
||||||
change.insertText(IjVimEditor(editor), IjVimCaret(primaryCaret), range.startOffset, start)
|
|
||||||
change.insertText(IjVimEditor(editor), IjVimCaret(primaryCaret), range.endOffset + start.length, end)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getSurroundRange(caret: VimCaret): TextRange? {
|
private fun getSurroundRange(caret: VimCaret): TextRange? {
|
||||||
@@ -315,7 +293,9 @@ private val LOG = logger<VimSurroundExtension>()
|
|||||||
|
|
||||||
private const val REGISTER = '"'
|
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(
|
private val SURROUND_PAIRS = mapOf(
|
||||||
'b' to ("(" to ")"),
|
'b' to ("(" to ")"),
|
||||||
@@ -381,15 +361,15 @@ private fun getChar(editor: Editor): Char {
|
|||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun performSurround(pair: Pair<String, String>, range: TextRange, caret: VimCaret, count: Int, tagsOnNewLines: Boolean = false) {
|
private fun performSurround(pair: Pair<String, String>, range: TextRange, caret: VimCaret, tagsOnNewLines: Boolean = false) {
|
||||||
runWriteAction {
|
runWriteAction {
|
||||||
val editor = caret.editor
|
val editor = caret.editor
|
||||||
val change = VimPlugin.getChange()
|
val change = VimPlugin.getChange()
|
||||||
val leftSurround = RepeatedCharSequence.of(pair.first + if (tagsOnNewLines) "\n" else "", count)
|
val leftSurround = pair.first + if (tagsOnNewLines) "\n" else ""
|
||||||
|
|
||||||
val isEOF = range.endOffset == editor.text().length
|
val isEOF = range.endOffset == editor.text().length
|
||||||
val hasNewLine = editor.endsWithNewLine()
|
val hasNewLine = editor.endsWithNewLine()
|
||||||
val rightSurround = (if (tagsOnNewLines) {
|
val rightSurround = if (tagsOnNewLines) {
|
||||||
if (isEOF && !hasNewLine) {
|
if (isEOF && !hasNewLine) {
|
||||||
"\n" + pair.second
|
"\n" + pair.second
|
||||||
} else {
|
} else {
|
||||||
@@ -397,7 +377,7 @@ private fun performSurround(pair: Pair<String, String>, range: TextRange, caret:
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
pair.second
|
pair.second
|
||||||
}).let { RepeatedCharSequence.of(it, count) }
|
}
|
||||||
|
|
||||||
change.insertText(editor, caret, range.startOffset, leftSurround)
|
change.insertText(editor, caret, range.startOffset, leftSurround)
|
||||||
change.insertText(editor, caret, range.endOffset + leftSurround.length, rightSurround)
|
change.insertText(editor, caret, range.endOffset + leftSurround.length, rightSurround)
|
||||||
|
@@ -78,6 +78,7 @@ import java.math.BigInteger
|
|||||||
import java.util.*
|
import java.util.*
|
||||||
import java.util.function.Consumer
|
import java.util.function.Consumer
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
|
import kotlin.math.min
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides all the insert/replace related functionality
|
* Provides all the insert/replace related functionality
|
||||||
@@ -394,7 +395,6 @@ public class ChangeGroup : VimChangeGroupBase() {
|
|||||||
context: ExecutionContext,
|
context: ExecutionContext,
|
||||||
range: TextRange,
|
range: TextRange,
|
||||||
) {
|
) {
|
||||||
val startPos = editor.offsetToBufferPosition(caret.offset.point)
|
|
||||||
val startOffset = editor.getLineStartForOffset(range.startOffset)
|
val startOffset = editor.getLineStartForOffset(range.startOffset)
|
||||||
val endOffset = editor.getLineEndForOffset(range.endOffset)
|
val endOffset = editor.getLineEndForOffset(range.endOffset)
|
||||||
val ijEditor = (editor as IjVimEditor).editor
|
val ijEditor = (editor as IjVimEditor).editor
|
||||||
@@ -419,7 +419,11 @@ public class ChangeGroup : VimChangeGroupBase() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
val afterAction = {
|
val afterAction = {
|
||||||
caret.moveToOffset(injector.motion.moveCaretToLineStartSkipLeading(editor, startPos.line))
|
val firstLine = editor.offsetToBufferPosition(
|
||||||
|
min(startOffset.toDouble(), endOffset.toDouble()).toInt()
|
||||||
|
).line
|
||||||
|
val newOffset = injector.motion.moveCaretToLineStartSkipLeading(editor, firstLine)
|
||||||
|
caret.moveToOffset(newOffset)
|
||||||
restoreCursor(editor, caret, (caret as IjVimCaret).caret.logicalPosition.line)
|
restoreCursor(editor, caret, (caret as IjVimCaret).caret.logicalPosition.line)
|
||||||
}
|
}
|
||||||
if (project != null) {
|
if (project != null) {
|
||||||
@@ -531,7 +535,7 @@ public class ChangeGroup : VimChangeGroupBase() {
|
|||||||
val soff = editor.getLineStartOffset(l)
|
val soff = editor.getLineStartOffset(l)
|
||||||
val eoff = editor.getLineEndOffset(l, true)
|
val eoff = editor.getLineEndOffset(l, true)
|
||||||
val woff = injector.motion.moveCaretToLineStartSkipLeading(editor, l)
|
val woff = injector.motion.moveCaretToLineStartSkipLeading(editor, l)
|
||||||
val col = editor.offsetToVisualPosition(woff).column
|
val col = editor.offsetToBufferPosition(woff).column
|
||||||
val limit = max(0.0, (col + dir * indentConfig.getTotalIndent(count)).toDouble())
|
val limit = max(0.0, (col + dir * indentConfig.getTotalIndent(count)).toDouble())
|
||||||
.toInt()
|
.toInt()
|
||||||
if (col > 0 || soff != eoff) {
|
if (col > 0 || soff != eoff) {
|
||||||
|
@@ -8,9 +8,11 @@
|
|||||||
|
|
||||||
package com.maddyhome.idea.vim.group
|
package com.maddyhome.idea.vim.group
|
||||||
|
|
||||||
|
import com.intellij.openapi.components.Service
|
||||||
import com.maddyhome.idea.vim.api.VimCommandGroupBase
|
import com.maddyhome.idea.vim.api.VimCommandGroupBase
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Elliot Courant
|
* @author Elliot Courant
|
||||||
*/
|
*/
|
||||||
|
@Service
|
||||||
internal class CommandGroup : VimCommandGroupBase()
|
internal class CommandGroup : VimCommandGroupBase()
|
||||||
|
@@ -20,7 +20,6 @@ import com.maddyhome.idea.vim.options.OptionAccessScope
|
|||||||
*/
|
*/
|
||||||
@Suppress("SpellCheckingInspection")
|
@Suppress("SpellCheckingInspection")
|
||||||
public open class GlobalIjOptions(scope: OptionAccessScope) : OptionsPropertiesBase(scope) {
|
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 ide: String by optionProperty(IjOptions.ide)
|
||||||
public var ideamarks: Boolean by optionProperty(IjOptions.ideamarks)
|
public var ideamarks: Boolean by optionProperty(IjOptions.ideamarks)
|
||||||
public var ideastatusicon: String by optionProperty(IjOptions.ideastatusicon)
|
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 val lookupkeys: StringListOptionValue by optionProperty(IjOptions.lookupkeys)
|
||||||
public var trackactionids: Boolean by optionProperty(IjOptions.trackactionids)
|
public var trackactionids: Boolean by optionProperty(IjOptions.trackactionids)
|
||||||
public var visualdelay: Int by optionProperty(IjOptions.visualdelay)
|
public var visualdelay: Int by optionProperty(IjOptions.visualdelay)
|
||||||
public var showmodewidget: Boolean by optionProperty(IjOptions.showmodewidget)
|
|
||||||
|
|
||||||
// Temporary options to control work-in-progress behaviour
|
// Temporary options to control work-in-progress behaviour
|
||||||
public var oldundo: Boolean by optionProperty(IjOptions.oldundo)
|
public var closenotebooks: Boolean by optionProperty(IjOptions.closenotebooks)
|
||||||
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 commandOrMotionAnnotation: Boolean by optionProperty(IjOptions.commandOrMotionAnnotation)
|
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 useNewRegex: Boolean by optionProperty(IjOptions.useNewRegex)
|
||||||
|
public var vimscriptFunctionAnnotation: Boolean by optionProperty(IjOptions.vimscriptFunctionAnnotation)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -33,8 +33,6 @@ public object IjOptions {
|
|||||||
Options.overrideDefaultValue(Options.clipboard, VimString("ideaput,autoselect,exclude:cons\\|linux"))
|
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(
|
public val ide: StringOption = addOption(
|
||||||
StringOption("ide", GLOBAL, "ide", ApplicationNamesInfo.getInstance().fullProductNameWithEdition)
|
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>")
|
"<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 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 visualdelay: UnsignedNumberOption = addOption(UnsignedNumberOption("visualdelay", GLOBAL, "visualdelay", 100))
|
||||||
public val oldundo: ToggleOption = addOption(ToggleOption("oldundo", GLOBAL, "oldundo", true, isTemporary = true))
|
|
||||||
public val vimscriptFunctionAnnotation: ToggleOption = addOption(ToggleOption("vimscriptfunctionannotation", GLOBAL, "vimscriptfunctionannotation", true, isTemporary = true))
|
// Temporary feature flags during development, not really intended for external use
|
||||||
public val commandOrMotionAnnotation: ToggleOption = addOption(ToggleOption("commandormotionannotation", GLOBAL, "commandormotionannotation", true, isTemporary = true))
|
public val closenotebooks: ToggleOption = addOption(ToggleOption("closenotebooks", GLOBAL, "closenotebooks", true, isHidden = true))
|
||||||
public val showmodewidget: ToggleOption = addOption(ToggleOption("showmodewidget", GLOBAL, "showmodewidget", false, isTemporary = true))
|
public val commandOrMotionAnnotation: ToggleOption = addOption(ToggleOption("commandormotionannotation", GLOBAL, "commandormotionannotation", true, isHidden = true))
|
||||||
public val useNewRegex: ToggleOption = addOption(ToggleOption("usenewregex", GLOBAL, "usenewregex", true, isTemporary = 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
|
// This needs to be Option<out VimDataType> so that it can work with derived option types, such as NumberOption, which
|
||||||
// derives from Option<VimInt>
|
// derives from Option<VimInt>
|
||||||
|
@@ -1,68 +0,0 @@
|
|||||||
package com.maddyhome.idea.vim.group
|
|
||||||
|
|
||||||
import com.intellij.codeInsight.daemon.ReferenceImporter
|
|
||||||
import com.intellij.openapi.actionSystem.CommonDataKeys
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext
|
|
||||||
import com.intellij.openapi.application.ApplicationManager
|
|
||||||
import com.intellij.openapi.application.ReadAction
|
|
||||||
import com.intellij.openapi.command.WriteCommandAction
|
|
||||||
import com.intellij.openapi.editor.Editor
|
|
||||||
import com.intellij.openapi.fileEditor.FileDocumentManager
|
|
||||||
import com.intellij.openapi.progress.ProgressIndicator
|
|
||||||
import com.intellij.openapi.progress.ProgressManager
|
|
||||||
import com.intellij.openapi.progress.Task
|
|
||||||
import com.intellij.psi.PsiDocumentManager
|
|
||||||
import com.intellij.psi.PsiElement
|
|
||||||
import com.intellij.psi.PsiRecursiveElementWalkingVisitor
|
|
||||||
import java.util.function.BooleanSupplier
|
|
||||||
|
|
||||||
internal object MacroAutoImport {
|
|
||||||
fun run(editor: Editor, dataContext: DataContext) {
|
|
||||||
val project = CommonDataKeys.PROJECT.getData(dataContext) ?: return
|
|
||||||
val file = PsiDocumentManager.getInstance(project).getPsiFile(editor.document) ?: return
|
|
||||||
|
|
||||||
if (!FileDocumentManager.getInstance().requestWriting(editor.document, project)) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
val importers = ReferenceImporter.EP_NAME.extensionList
|
|
||||||
if (importers.isEmpty()) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
ProgressManager.getInstance().run(object : Task.Backgroundable(project, "Auto import", true) {
|
|
||||||
override fun run(indicator: ProgressIndicator) {
|
|
||||||
val fixes = ReadAction.nonBlocking<List<BooleanSupplier>> {
|
|
||||||
val fixes = mutableListOf<BooleanSupplier>()
|
|
||||||
|
|
||||||
file.accept(object : PsiRecursiveElementWalkingVisitor() {
|
|
||||||
override fun visitElement(element: PsiElement) {
|
|
||||||
for (reference in element.references) {
|
|
||||||
if (reference.resolve() != null) {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
for (importer in importers) {
|
|
||||||
importer.computeAutoImportAtOffset(editor, file, element.textRange.startOffset, true)
|
|
||||||
?.let(fixes::add)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
super.visitElement(element)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
return@nonBlocking fixes
|
|
||||||
}.executeSynchronously()
|
|
||||||
|
|
||||||
ApplicationManager.getApplication().invokeAndWait {
|
|
||||||
WriteCommandAction.writeCommandAction(project)
|
|
||||||
.withName("Auto Import")
|
|
||||||
.withGroupId("IdeaVimAutoImportAfterMacro")
|
|
||||||
.shouldRecordActionForActiveDocument(true)
|
|
||||||
.run<RuntimeException> {
|
|
||||||
fixes.forEach { it.asBoolean }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
@@ -7,7 +7,10 @@
|
|||||||
*/
|
*/
|
||||||
package com.maddyhome.idea.vim.group
|
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.application.ApplicationManager
|
||||||
|
import com.intellij.openapi.components.Service
|
||||||
import com.intellij.openapi.diagnostic.logger
|
import com.intellij.openapi.diagnostic.logger
|
||||||
import com.intellij.openapi.progress.ProcessCanceledException
|
import com.intellij.openapi.progress.ProcessCanceledException
|
||||||
import com.intellij.openapi.progress.ProgressManager
|
import com.intellij.openapi.progress.ProgressManager
|
||||||
@@ -19,11 +22,11 @@ import com.maddyhome.idea.vim.api.injector
|
|||||||
import com.maddyhome.idea.vim.helper.MessageHelper.message
|
import com.maddyhome.idea.vim.helper.MessageHelper.message
|
||||||
import com.maddyhome.idea.vim.macro.VimMacroBase
|
import com.maddyhome.idea.vim.macro.VimMacroBase
|
||||||
import com.maddyhome.idea.vim.newapi.IjVimEditor
|
import com.maddyhome.idea.vim.newapi.IjVimEditor
|
||||||
import com.maddyhome.idea.vim.newapi.ij
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Used to handle playback of macros
|
* Used to handle playback of macros
|
||||||
*/
|
*/
|
||||||
|
@Service
|
||||||
internal class MacroGroup : VimMacroBase() {
|
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
|
// 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
|
||||||
@@ -77,7 +80,7 @@ internal class MacroGroup : VimMacroBase() {
|
|||||||
ProgressManager.getInstance().executeNonCancelableSection {
|
ProgressManager.getInstance().executeNonCancelableSection {
|
||||||
// Prevent autocompletion during macros.
|
// Prevent autocompletion during macros.
|
||||||
// See https://github.com/JetBrains/ideavim/pull/772 for details
|
// See https://github.com/JetBrains/ideavim/pull/772 for details
|
||||||
// CompletionServiceImpl.setCompletionPhase(CompletionPhase.NoCompletion)
|
CompletionServiceImpl.setCompletionPhase(CompletionPhase.NoCompletion)
|
||||||
getInstance().handleKey(editor, key, context)
|
getInstance().handleKey(editor, key, context)
|
||||||
}
|
}
|
||||||
if (injector.messages.isError()) return@runnable
|
if (injector.messages.isError()) return@runnable
|
||||||
@@ -89,9 +92,6 @@ internal class MacroGroup : VimMacroBase() {
|
|||||||
} finally {
|
} finally {
|
||||||
keyStack.removeFirst()
|
keyStack.removeFirst()
|
||||||
}
|
}
|
||||||
if (!isInternalMacro) {
|
|
||||||
MacroAutoImport.run(editor.ij, context.ij)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isInternalMacro) {
|
if (isInternalMacro) {
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
package com.maddyhome.idea.vim.group
|
package com.maddyhome.idea.vim.group
|
||||||
|
|
||||||
import com.intellij.openapi.actionSystem.DataContext
|
import com.intellij.openapi.actionSystem.DataContext
|
||||||
|
import com.intellij.openapi.components.Service
|
||||||
import com.intellij.openapi.editor.Caret
|
import com.intellij.openapi.editor.Caret
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.editor.LogicalPosition
|
import com.intellij.openapi.editor.LogicalPosition
|
||||||
@@ -83,6 +84,7 @@ import kotlin.math.min
|
|||||||
/**
|
/**
|
||||||
* This handles all motion related commands and marks
|
* This handles all motion related commands and marks
|
||||||
*/
|
*/
|
||||||
|
@Service
|
||||||
internal class MotionGroup : VimMotionGroupBase() {
|
internal class MotionGroup : VimMotionGroupBase() {
|
||||||
override fun onAppCodeMovement(editor: VimEditor, caret: VimCaret, offset: Int, oldOffset: Int) {
|
override fun onAppCodeMovement(editor: VimEditor, caret: VimCaret, offset: Int, oldOffset: Int) {
|
||||||
AppCodeTemplates.onMovement(editor.ij, caret.ij, oldOffset < offset)
|
AppCodeTemplates.onMovement(editor.ij, caret.ij, oldOffset < offset)
|
||||||
|
@@ -21,6 +21,7 @@ import com.intellij.openapi.actionSystem.ActionUpdateThread
|
|||||||
import com.intellij.openapi.actionSystem.AnAction
|
import com.intellij.openapi.actionSystem.AnAction
|
||||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||||
import com.intellij.openapi.actionSystem.KeyboardShortcut
|
import com.intellij.openapi.actionSystem.KeyboardShortcut
|
||||||
|
import com.intellij.openapi.components.Service
|
||||||
import com.intellij.openapi.diagnostic.logger
|
import com.intellij.openapi.diagnostic.logger
|
||||||
import com.intellij.openapi.ide.CopyPasteManager
|
import com.intellij.openapi.ide.CopyPasteManager
|
||||||
import com.intellij.openapi.keymap.KeymapUtil
|
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.
|
* 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
|
* 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?) {
|
internal class NotificationService(private val project: Project?) {
|
||||||
// This constructor is used to create an applicationService
|
// This constructor is used to create an applicationService
|
||||||
@Suppress("unused")
|
@Suppress("unused")
|
||||||
|
@@ -214,8 +214,8 @@ public class SearchGroup extends IjVimSearchGroup implements PersistentStateComp
|
|||||||
* @param patternOffset The pattern offset, e.g. `/{pattern}/{offset}`
|
* @param patternOffset The pattern offset, e.g. `/{pattern}/{offset}`
|
||||||
* @param direction The direction to search
|
* @param direction The direction to search
|
||||||
*/
|
*/
|
||||||
@Override
|
@TestOnly
|
||||||
public void setLastSearchState(@SuppressWarnings("unused") @NotNull VimEditor editor, @NotNull String pattern,
|
public void setLastSearchState(@SuppressWarnings("unused") @NotNull Editor editor, @NotNull String pattern,
|
||||||
@NotNull String patternOffset, Direction direction) {
|
@NotNull String patternOffset, Direction direction) {
|
||||||
if (globalIjOptions(injector).getUseNewRegex()) {
|
if (globalIjOptions(injector).getUseNewRegex()) {
|
||||||
super.setLastSearchState(pattern, patternOffset, direction);
|
super.setLastSearchState(pattern, patternOffset, direction);
|
||||||
|
@@ -8,9 +8,11 @@
|
|||||||
|
|
||||||
package com.maddyhome.idea.vim.group
|
package com.maddyhome.idea.vim.group
|
||||||
|
|
||||||
|
import com.intellij.openapi.components.Service
|
||||||
import org.apache.commons.codec.binary.Base64
|
import org.apache.commons.codec.binary.Base64
|
||||||
import org.jdom.Element
|
import org.jdom.Element
|
||||||
|
|
||||||
|
@Service
|
||||||
internal class XMLGroup {
|
internal class XMLGroup {
|
||||||
/**
|
/**
|
||||||
* Set the text of an XML element, safely encode it if needed.
|
* Set the text of an XML element, safely encode it if needed.
|
||||||
|
@@ -14,6 +14,7 @@ import com.intellij.ide.DataManager
|
|||||||
import com.intellij.ide.PasteProvider
|
import com.intellij.ide.PasteProvider
|
||||||
import com.intellij.openapi.actionSystem.DataContext
|
import com.intellij.openapi.actionSystem.DataContext
|
||||||
import com.intellij.openapi.actionSystem.PlatformDataKeys
|
import com.intellij.openapi.actionSystem.PlatformDataKeys
|
||||||
|
import com.intellij.openapi.components.Service
|
||||||
import com.intellij.openapi.editor.Caret
|
import com.intellij.openapi.editor.Caret
|
||||||
import com.intellij.openapi.editor.RangeMarker
|
import com.intellij.openapi.editor.RangeMarker
|
||||||
import com.intellij.openapi.editor.ex.EditorEx
|
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 com.maddyhome.idea.vim.state.mode.isLine
|
||||||
import java.awt.datatransfer.DataFlavor
|
import java.awt.datatransfer.DataFlavor
|
||||||
|
|
||||||
|
@Service
|
||||||
internal class PutGroup : VimPutBase() {
|
internal class PutGroup : VimPutBase() {
|
||||||
|
|
||||||
override fun getProviderForPasteViaIde(
|
override fun getProviderForPasteViaIde(
|
||||||
|
@@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
package com.maddyhome.idea.vim.helper
|
package com.maddyhome.idea.vim.helper
|
||||||
|
|
||||||
|
import com.intellij.openapi.application.ApplicationManager
|
||||||
import com.intellij.openapi.diagnostic.thisLogger
|
import com.intellij.openapi.diagnostic.thisLogger
|
||||||
import com.intellij.openapi.editor.Caret
|
import com.intellij.openapi.editor.Caret
|
||||||
import com.intellij.openapi.editor.CaretVisualAttributes
|
import com.intellij.openapi.editor.CaretVisualAttributes
|
||||||
@@ -85,7 +86,10 @@ private fun Editor.updatePrimaryCaretVisualAttributes() {
|
|||||||
caretModel.primaryCaret.visualAttributes = AttributesCache.getCaretVisualAttributes(this)
|
caretModel.primaryCaret.visualAttributes = AttributesCache.getCaretVisualAttributes(this)
|
||||||
|
|
||||||
// Make sure the caret is visible as soon as it's set. It might be invisible while blinking
|
// 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() {
|
private fun Editor.updateSecondaryCaretsVisualAttributes() {
|
||||||
|
@@ -329,7 +329,7 @@ public class EditorHelper {
|
|||||||
|
|
||||||
final int offset = y - ((screenHeight - lineHeight) / lineHeight / 2 * lineHeight);
|
final int offset = y - ((screenHeight - lineHeight) / lineHeight / 2 * lineHeight);
|
||||||
@NotNull final VimEditor editor1 = new IjVimEditor(editor);
|
@NotNull final VimEditor editor1 = new IjVimEditor(editor);
|
||||||
final int lastVisualLine = EngineEditorHelperKt.getVisualLineCount(editor1) + editor.getSettings().getAdditionalLinesCount();
|
final int lastVisualLine = EngineEditorHelperKt.getVisualLineCount(editor1) - 1;
|
||||||
final int offsetForLastLineAtBottom = getOffsetToScrollVisualLineToBottomOfScreen(editor, lastVisualLine);
|
final int offsetForLastLineAtBottom = getOffsetToScrollVisualLineToBottomOfScreen(editor, lastVisualLine);
|
||||||
|
|
||||||
// For `zz`, we want to use virtual space and move any line, including the last one, to the middle of the screen.
|
// For `zz`, we want to use virtual space and move any line, including the last one, to the middle of the screen.
|
||||||
|
@@ -12,7 +12,6 @@ package com.maddyhome.idea.vim.helper
|
|||||||
|
|
||||||
import com.intellij.codeWithMe.ClientId
|
import com.intellij.codeWithMe.ClientId
|
||||||
import com.intellij.openapi.editor.Caret
|
import com.intellij.openapi.editor.Caret
|
||||||
import com.intellij.openapi.editor.CaretState
|
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.editor.ex.util.EditorUtil
|
import com.intellij.openapi.editor.ex.util.EditorUtil
|
||||||
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx
|
import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx
|
||||||
@@ -20,8 +19,6 @@ import com.intellij.util.ui.table.JBTableRowEditor
|
|||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.group.IjOptionConstants
|
import com.maddyhome.idea.vim.group.IjOptionConstants
|
||||||
import com.maddyhome.idea.vim.newapi.globalIjOptions
|
import com.maddyhome.idea.vim.newapi.globalIjOptions
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
|
||||||
import com.maddyhome.idea.vim.state.mode.inBlockSelection
|
|
||||||
import java.awt.Component
|
import java.awt.Component
|
||||||
import javax.swing.JComponent
|
import javax.swing.JComponent
|
||||||
import javax.swing.JTable
|
import javax.swing.JTable
|
||||||
@@ -96,41 +93,3 @@ internal val Caret.vimLine: Int
|
|||||||
*/
|
*/
|
||||||
internal val Editor.vimLine: Int
|
internal val Editor.vimLine: Int
|
||||||
get() = this.caretModel.currentCaret.vimLine
|
get() = this.caretModel.currentCaret.vimLine
|
||||||
|
|
||||||
internal inline fun Editor.runWithEveryCaretAndRestore(action: () -> Unit) {
|
|
||||||
val caretModel = this.caretModel
|
|
||||||
val carets = if (this.vim.inBlockSelection) null else caretModel.allCarets
|
|
||||||
if (carets == null || carets.size == 1) {
|
|
||||||
action()
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
var initialDocumentSize = this.document.textLength
|
|
||||||
var documentSizeDifference = 0
|
|
||||||
|
|
||||||
val caretOffsets = carets.map { it.selectionStart to it.selectionEnd }
|
|
||||||
val restoredCarets = mutableListOf<CaretState>()
|
|
||||||
|
|
||||||
caretModel.removeSecondaryCarets()
|
|
||||||
|
|
||||||
for ((selectionStart, selectionEnd) in caretOffsets) {
|
|
||||||
if (selectionStart == selectionEnd) {
|
|
||||||
caretModel.primaryCaret.moveToOffset(selectionStart + documentSizeDifference)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
caretModel.primaryCaret.setSelection(
|
|
||||||
selectionStart + documentSizeDifference,
|
|
||||||
selectionEnd + documentSizeDifference
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
action()
|
|
||||||
restoredCarets.add(caretModel.caretsAndSelections.single())
|
|
||||||
|
|
||||||
val documentLength = this.document.textLength
|
|
||||||
documentSizeDifference += documentLength - initialDocumentSize
|
|
||||||
initialDocumentSize = documentLength
|
|
||||||
}
|
|
||||||
|
|
||||||
caretModel.caretsAndSelections = restoredCarets
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@@ -14,6 +14,7 @@ import com.maddyhome.idea.vim.api.injector
|
|||||||
import com.maddyhome.idea.vim.api.normalizeVisualColumn
|
import com.maddyhome.idea.vim.api.normalizeVisualColumn
|
||||||
import com.maddyhome.idea.vim.api.options
|
import com.maddyhome.idea.vim.api.options
|
||||||
import com.maddyhome.idea.vim.command.CommandFlags
|
import com.maddyhome.idea.vim.command.CommandFlags
|
||||||
|
import com.maddyhome.idea.vim.state.VimStateMachine
|
||||||
import com.maddyhome.idea.vim.helper.EditorHelper.getApproximateScreenHeight
|
import com.maddyhome.idea.vim.helper.EditorHelper.getApproximateScreenHeight
|
||||||
import com.maddyhome.idea.vim.helper.EditorHelper.getApproximateScreenWidth
|
import com.maddyhome.idea.vim.helper.EditorHelper.getApproximateScreenWidth
|
||||||
import com.maddyhome.idea.vim.helper.EditorHelper.getNonNormalizedVisualLineAtBottomOfScreen
|
import com.maddyhome.idea.vim.helper.EditorHelper.getNonNormalizedVisualLineAtBottomOfScreen
|
||||||
@@ -28,7 +29,6 @@ import com.maddyhome.idea.vim.helper.EditorHelper.scrollVisualLineToBottomOfScre
|
|||||||
import com.maddyhome.idea.vim.helper.EditorHelper.scrollVisualLineToMiddleOfScreen
|
import com.maddyhome.idea.vim.helper.EditorHelper.scrollVisualLineToMiddleOfScreen
|
||||||
import com.maddyhome.idea.vim.helper.EditorHelper.scrollVisualLineToTopOfScreen
|
import com.maddyhome.idea.vim.helper.EditorHelper.scrollVisualLineToTopOfScreen
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import com.maddyhome.idea.vim.state.VimStateMachine
|
|
||||||
import kotlin.math.max
|
import kotlin.math.max
|
||||||
import kotlin.math.min
|
import kotlin.math.min
|
||||||
import kotlin.math.roundToInt
|
import kotlin.math.roundToInt
|
||||||
@@ -56,7 +56,7 @@ internal object ScrollViewHelper {
|
|||||||
// that this needs to be replaced as a more or less dumb line for line rewrite.
|
// that this needs to be replaced as a more or less dumb line for line rewrite.
|
||||||
val topLine = getVisualLineAtTopOfScreen(editor)
|
val topLine = getVisualLineAtTopOfScreen(editor)
|
||||||
val bottomLine = getVisualLineAtBottomOfScreen(editor)
|
val bottomLine = getVisualLineAtBottomOfScreen(editor)
|
||||||
val lastLine = vimEditor.getVisualLineCount() + editor.settings.additionalLinesCount
|
val lastLine = vimEditor.getVisualLineCount() - 1
|
||||||
|
|
||||||
// We need the non-normalised value here, so we can handle cases such as so=999 to keep the current line centred
|
// We need the non-normalised value here, so we can handle cases such as so=999 to keep the current line centred
|
||||||
val scrollOffset = injector.options(vimEditor).scrolloff
|
val scrollOffset = injector.options(vimEditor).scrolloff
|
||||||
|
@@ -26,15 +26,13 @@ import com.intellij.spellchecker.SpellCheckerSeveritiesProvider;
|
|||||||
import com.maddyhome.idea.vim.VimPlugin;
|
import com.maddyhome.idea.vim.VimPlugin;
|
||||||
import com.maddyhome.idea.vim.api.EngineEditorHelperKt;
|
import com.maddyhome.idea.vim.api.EngineEditorHelperKt;
|
||||||
import com.maddyhome.idea.vim.api.VimEditor;
|
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.common.CharacterPosition;
|
import com.maddyhome.idea.vim.common.CharacterPosition;
|
||||||
import com.maddyhome.idea.vim.common.Direction;
|
import com.maddyhome.idea.vim.common.Direction;
|
||||||
import com.maddyhome.idea.vim.common.TextRange;
|
import com.maddyhome.idea.vim.common.TextRange;
|
||||||
import com.maddyhome.idea.vim.newapi.IjVimCaret;
|
import com.maddyhome.idea.vim.newapi.IjVimCaret;
|
||||||
import com.maddyhome.idea.vim.newapi.IjVimEditor;
|
import com.maddyhome.idea.vim.newapi.IjVimEditor;
|
||||||
import com.maddyhome.idea.vim.regexp.CharPointer;
|
import com.maddyhome.idea.vim.regexp.*;
|
||||||
import com.maddyhome.idea.vim.regexp.RegExp;
|
import com.maddyhome.idea.vim.regexp.match.VimMatchResult;
|
||||||
import com.maddyhome.idea.vim.state.VimStateMachine;
|
import com.maddyhome.idea.vim.state.VimStateMachine;
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode;
|
import com.maddyhome.idea.vim.state.mode.Mode;
|
||||||
import it.unimi.dsi.fastutil.ints.IntComparator;
|
import it.unimi.dsi.fastutil.ints.IntComparator;
|
||||||
@@ -1603,11 +1601,11 @@ public class SearchHelper {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (offsets.isEmpty()) {
|
if (offsets.isEmpty()) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (skipCount >= offsets.size()) {
|
if (skipCount >= offsets.size()) {
|
||||||
return offsets.lastInt();
|
return offsets.lastInt();
|
||||||
}
|
}
|
||||||
|
@@ -31,4 +31,8 @@ public object StringHelper {
|
|||||||
return Arrays.stream(string).flatMap { o: String -> injector.parser.parseKeys(o).stream() }
|
return Arrays.stream(string).flatMap { o: String -> injector.parser.parseKeys(o).stream() }
|
||||||
.collect(Collectors.toList())
|
.collect(Collectors.toList())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
@Deprecated("Use key.isCloseKeyStroke()", ReplaceWith("key.isCloseKeyStroke()"))
|
||||||
|
public fun isCloseKeyStroke(key: KeyStroke): Boolean = key.isCloseKeyStroke()
|
||||||
}
|
}
|
||||||
|
@@ -14,7 +14,6 @@ import com.intellij.openapi.command.CommandProcessor
|
|||||||
import com.intellij.openapi.command.undo.UndoManager
|
import com.intellij.openapi.command.undo.UndoManager
|
||||||
import com.intellij.openapi.components.Service
|
import com.intellij.openapi.components.Service
|
||||||
import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider
|
import com.intellij.openapi.fileEditor.impl.text.TextEditorProvider
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
|
||||||
import com.maddyhome.idea.vim.api.ExecutionContext
|
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||||
import com.maddyhome.idea.vim.api.VimEditor
|
import com.maddyhome.idea.vim.api.VimEditor
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
@@ -22,8 +21,6 @@ import com.maddyhome.idea.vim.common.ChangesListener
|
|||||||
import com.maddyhome.idea.vim.listener.SelectionVimListenerSuppressor
|
import com.maddyhome.idea.vim.listener.SelectionVimListenerSuppressor
|
||||||
import com.maddyhome.idea.vim.newapi.globalIjOptions
|
import com.maddyhome.idea.vim.newapi.globalIjOptions
|
||||||
import com.maddyhome.idea.vim.newapi.ij
|
import com.maddyhome.idea.vim.newapi.ij
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
|
||||||
import com.maddyhome.idea.vim.state.mode.inVisualMode
|
|
||||||
import com.maddyhome.idea.vim.undo.UndoRedoBase
|
import com.maddyhome.idea.vim.undo.UndoRedoBase
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,7 +39,6 @@ internal class UndoRedoHelper : UndoRedoBase() {
|
|||||||
|
|
||||||
if (injector.globalIjOptions().oldundo) {
|
if (injector.globalIjOptions().oldundo) {
|
||||||
SelectionVimListenerSuppressor.lock().use { undoManager.undo(fileEditor) }
|
SelectionVimListenerSuppressor.lock().use { undoManager.undo(fileEditor) }
|
||||||
restoreVisualMode(editor)
|
|
||||||
} else {
|
} else {
|
||||||
// TODO refactor me after VIM-308 when restoring selection and caret movement will be ignored by undo
|
// TODO refactor me after VIM-308 when restoring selection and caret movement will be ignored by undo
|
||||||
editor.runWithChangeTracking {
|
editor.runWithChangeTracking {
|
||||||
@@ -78,7 +74,6 @@ internal class UndoRedoHelper : UndoRedoBase() {
|
|||||||
if (undoManager.isRedoAvailable(fileEditor)) {
|
if (undoManager.isRedoAvailable(fileEditor)) {
|
||||||
if (injector.globalIjOptions().oldundo) {
|
if (injector.globalIjOptions().oldundo) {
|
||||||
SelectionVimListenerSuppressor.lock().use { undoManager.redo(fileEditor) }
|
SelectionVimListenerSuppressor.lock().use { undoManager.redo(fileEditor) }
|
||||||
restoreVisualMode(editor)
|
|
||||||
} else {
|
} else {
|
||||||
undoManager.redo(fileEditor)
|
undoManager.redo(fileEditor)
|
||||||
CommandProcessor.getInstance().runUndoTransparentAction {
|
CommandProcessor.getInstance().runUndoTransparentAction {
|
||||||
@@ -136,21 +131,4 @@ internal class UndoRedoHelper : UndoRedoBase() {
|
|||||||
val hasChanges: Boolean
|
val hasChanges: Boolean
|
||||||
get() = changeListener.hasChanged || initialPath != editor.getPath()
|
get() = changeListener.hasChanged || initialPath != editor.getPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun restoreVisualMode(editor: VimEditor) {
|
|
||||||
if (!editor.inVisualMode && editor.getSelectionModel().hasSelection()) {
|
|
||||||
val detectedMode = VimPlugin.getVisualMotion().autodetectVisualSubmode(editor)
|
|
||||||
|
|
||||||
// Visual block selection is restored into multiple carets, so multi-carets that form a block are always
|
|
||||||
// identified as visual block mode, leading to false positives.
|
|
||||||
// Since I use visual block mode much less often than multi-carets, this is a judgment call to never restore
|
|
||||||
// visual block mode.
|
|
||||||
val wantedMode = if (detectedMode == SelectionType.BLOCK_WISE)
|
|
||||||
SelectionType.CHARACTER_WISE
|
|
||||||
else
|
|
||||||
detectedMode
|
|
||||||
|
|
||||||
VimPlugin.getVisualMotion().enterVisualMode(editor, wantedMode)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@@ -0,0 +1,32 @@
|
|||||||
|
/*
|
||||||
|
* Copyright 2003-2023 The IdeaVim authors
|
||||||
|
*
|
||||||
|
* Use of this source code is governed by an MIT-style
|
||||||
|
* license that can be found in the LICENSE.txt file or at
|
||||||
|
* https://opensource.org/licenses/MIT.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package com.maddyhome.idea.vim.helper
|
||||||
|
|
||||||
|
import com.intellij.ide.plugins.StandalonePluginUpdateChecker
|
||||||
|
import com.intellij.openapi.components.Service
|
||||||
|
import com.intellij.openapi.components.service
|
||||||
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
|
import com.maddyhome.idea.vim.group.NotificationService
|
||||||
|
import com.maddyhome.idea.vim.icons.VimIcons
|
||||||
|
|
||||||
|
@Service(Service.Level.APP)
|
||||||
|
internal class VimStandalonePluginUpdateChecker : StandalonePluginUpdateChecker(
|
||||||
|
VimPlugin.getPluginId(),
|
||||||
|
updateTimestampProperty = PROPERTY_NAME,
|
||||||
|
NotificationService.IDEAVIM_STICKY_GROUP,
|
||||||
|
VimIcons.IDEAVIM,
|
||||||
|
) {
|
||||||
|
|
||||||
|
override fun skipUpdateCheck(): Boolean = VimPlugin.isNotEnabled() || "dev" in VimPlugin.getVersion()
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
private const val PROPERTY_NAME = "ideavim.statistics.timestamp"
|
||||||
|
val instance: VimStandalonePluginUpdateChecker = service()
|
||||||
|
}
|
||||||
|
}
|
@@ -21,6 +21,6 @@ public final class VimIcons {
|
|||||||
public static final @NotNull Icon YOUTRACK = load("/icons/youtrack.svg");
|
public static final @NotNull Icon YOUTRACK = load("/icons/youtrack.svg");
|
||||||
|
|
||||||
private static @NotNull Icon load(@NotNull @NonNls String path) {
|
private static @NotNull Icon load(@NotNull @NonNls String path) {
|
||||||
return IconManager.getInstance().getIcon(path, VimIcons.class);
|
return IconManager.getInstance().getIcon(path, VimIcons.class.getClassLoader());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9,11 +9,19 @@
|
|||||||
package com.maddyhome.idea.vim.inspections
|
package com.maddyhome.idea.vim.inspections
|
||||||
|
|
||||||
import com.intellij.codeInspection.LocalInspectionTool
|
import com.intellij.codeInspection.LocalInspectionTool
|
||||||
|
import com.intellij.codeInspection.LocalQuickFix
|
||||||
|
import com.intellij.codeInspection.ProblemDescriptor
|
||||||
import com.intellij.codeInspection.ProblemsHolder
|
import com.intellij.codeInspection.ProblemsHolder
|
||||||
|
import com.intellij.openapi.project.Project
|
||||||
import com.intellij.openapi.util.TextRange
|
import com.intellij.openapi.util.TextRange
|
||||||
import com.intellij.psi.PsiElement
|
import com.intellij.psi.PsiElement
|
||||||
import com.intellij.psi.PsiElementVisitor
|
import com.intellij.psi.PsiElementVisitor
|
||||||
import com.intellij.psi.impl.source.tree.LeafPsiElement
|
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() {
|
internal class UsePlugSyntaxInspection : LocalInspectionTool() {
|
||||||
override fun getGroupDisplayName(): String {
|
override fun getGroupDisplayName(): String {
|
||||||
@@ -23,11 +31,54 @@ internal class UsePlugSyntaxInspection : LocalInspectionTool() {
|
|||||||
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor {
|
override fun buildVisitor(holder: ProblemsHolder, isOnTheFly: Boolean): PsiElementVisitor {
|
||||||
val file = holder.file
|
val file = holder.file
|
||||||
if (file.name != ".ideavimrc" && file.name != "_ideavimrc") return PsiElementVisitor.EMPTY_VISITOR
|
if (file.name != ".ideavimrc" && file.name != "_ideavimrc") return PsiElementVisitor.EMPTY_VISITOR
|
||||||
|
val plugins = buildPlugins()
|
||||||
return object : PsiElementVisitor() {
|
return object : PsiElementVisitor() {
|
||||||
override fun visitElement(element: PsiElement) {
|
override fun visitElement(element: PsiElement) {
|
||||||
if (element !is LeafPsiElement) return
|
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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
package com.maddyhome.idea.vim.listener
|
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 com.intellij.openapi.editor.Editor
|
||||||
import org.acejump.session.SessionManager
|
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.
|
* Key handling for IdeaVim should be updated to editorHandler usage. In this case this class can be safely removed.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@Suppress("DEPRECATION")
|
|
||||||
internal interface AceJumpService {
|
internal interface AceJumpService {
|
||||||
fun isActive(editor: Editor): Boolean
|
fun isActive(editor: Editor): Boolean
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun getInstance(): AceJumpService? = ServiceManager.getService(AceJumpService::class.java)
|
fun getInstance(): AceJumpService? = ApplicationManager.getApplication().getService(AceJumpService::class.java)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -27,7 +27,6 @@ import com.intellij.openapi.actionSystem.CommonDataKeys
|
|||||||
import com.intellij.openapi.actionSystem.ex.AnActionListener
|
import com.intellij.openapi.actionSystem.ex.AnActionListener
|
||||||
import com.intellij.openapi.actionSystem.impl.ProxyShortcutSet
|
import com.intellij.openapi.actionSystem.impl.ProxyShortcutSet
|
||||||
import com.intellij.openapi.editor.Editor
|
import com.intellij.openapi.editor.Editor
|
||||||
import com.intellij.openapi.editor.impl.ScrollingModelImpl
|
|
||||||
import com.intellij.openapi.project.DumbAwareToggleAction
|
import com.intellij.openapi.project.DumbAwareToggleAction
|
||||||
import com.intellij.openapi.util.TextRange
|
import com.intellij.openapi.util.TextRange
|
||||||
import com.maddyhome.idea.vim.KeyHandler
|
import com.maddyhome.idea.vim.KeyHandler
|
||||||
@@ -57,7 +56,6 @@ internal object IdeaSpecifics {
|
|||||||
private val surrounderAction =
|
private val surrounderAction =
|
||||||
"com.intellij.codeInsight.generation.surroundWith.SurroundWithHandler\$InvokeSurrounderAction"
|
"com.intellij.codeInsight.generation.surroundWith.SurroundWithHandler\$InvokeSurrounderAction"
|
||||||
private var editor: Editor? = null
|
private var editor: Editor? = null
|
||||||
private var caretOffset = -1
|
|
||||||
private var completionPrevDocumentLength: Int? = null
|
private var completionPrevDocumentLength: Int? = null
|
||||||
private var completionPrevDocumentOffset: Int? = null
|
private var completionPrevDocumentOffset: Int? = null
|
||||||
override fun beforeActionPerformed(action: AnAction, event: AnActionEvent) {
|
override fun beforeActionPerformed(action: AnAction, event: AnActionEvent) {
|
||||||
@@ -66,7 +64,6 @@ internal object IdeaSpecifics {
|
|||||||
val hostEditor = event.dataContext.getData(CommonDataKeys.HOST_EDITOR)
|
val hostEditor = event.dataContext.getData(CommonDataKeys.HOST_EDITOR)
|
||||||
if (hostEditor != null) {
|
if (hostEditor != null) {
|
||||||
editor = hostEditor
|
editor = hostEditor
|
||||||
caretOffset = hostEditor.caretModel.offset
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val isVimAction = (action as? AnActionWrapper)?.delegate is VimShortcutKeyAction
|
val isVimAction = (action as? AnActionWrapper)?.delegate is VimShortcutKeyAction
|
||||||
@@ -98,56 +95,43 @@ internal object IdeaSpecifics {
|
|||||||
if (VimPlugin.isNotEnabled()) return
|
if (VimPlugin.isNotEnabled()) return
|
||||||
|
|
||||||
val editor = editor
|
val editor = editor
|
||||||
if (editor != null) {
|
if (editor != null && action is ChooseItemAction && editor.vimStateMachine?.isRecording == true) {
|
||||||
if (action is ChooseItemAction && editor.vimStateMachine?.isRecording == true) {
|
val prevDocumentLength = completionPrevDocumentLength
|
||||||
val prevDocumentLength = completionPrevDocumentLength
|
val prevDocumentOffset = completionPrevDocumentOffset
|
||||||
val prevDocumentOffset = completionPrevDocumentOffset
|
|
||||||
|
|
||||||
if (prevDocumentLength != null && prevDocumentOffset != null) {
|
if (prevDocumentLength != null && prevDocumentOffset != null) {
|
||||||
val register = VimPlugin.getRegister()
|
val register = VimPlugin.getRegister()
|
||||||
val addedTextLength = editor.document.textLength - prevDocumentLength
|
val addedTextLength = editor.document.textLength - prevDocumentLength
|
||||||
val caretShift = addedTextLength - (editor.caretModel.primaryCaret.offset - prevDocumentOffset)
|
val caretShift = addedTextLength - (editor.caretModel.primaryCaret.offset - prevDocumentOffset)
|
||||||
val leftArrow = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0)
|
val leftArrow = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0)
|
||||||
|
|
||||||
register.recordText(editor.document.getText(TextRange(prevDocumentOffset, prevDocumentOffset + addedTextLength)))
|
register.recordText(editor.document.getText(TextRange(prevDocumentOffset, prevDocumentOffset + addedTextLength)))
|
||||||
repeat(caretShift.coerceAtLeast(0)) {
|
repeat(caretShift.coerceAtLeast(0)) {
|
||||||
register.recordKeyStroke(leftArrow)
|
register.recordKeyStroke(leftArrow)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.completionPrevDocumentLength = null
|
this.completionPrevDocumentLength = null
|
||||||
this.completionPrevDocumentOffset = null
|
this.completionPrevDocumentOffset = null
|
||||||
}
|
|
||||||
|
|
||||||
//region Enter insert mode after surround with if
|
|
||||||
if (surrounderAction == action.javaClass.name && surrounderItems.any {
|
|
||||||
action.templatePresentation.text.endsWith(
|
|
||||||
it,
|
|
||||||
)
|
|
||||||
}
|
|
||||||
) {
|
|
||||||
val commandState = editor.vim.vimStateMachine
|
|
||||||
commandState.mode = Mode.NORMAL()
|
|
||||||
VimPlugin.getChange().insertBeforeCursor(editor.vim, event.dataContext.vim)
|
|
||||||
KeyHandler.getInstance().reset(editor.vim)
|
|
||||||
}
|
|
||||||
//endregion
|
|
||||||
|
|
||||||
if (caretOffset != -1 && caretOffset != editor.caretModel.offset) {
|
|
||||||
val scrollModel = editor.scrollingModel as ScrollingModelImpl
|
|
||||||
if (scrollModel.isScrollingNow) {
|
|
||||||
val v = scrollModel.verticalScrollOffset
|
|
||||||
val h = scrollModel.horizontalScrollOffset
|
|
||||||
scrollModel.finishAnimation()
|
|
||||||
scrollModel.scroll(h, v)
|
|
||||||
scrollModel.finishAnimation()
|
|
||||||
}
|
|
||||||
injector.scroll.scrollCaretIntoView(editor.vim)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//region Enter insert mode after surround with if
|
||||||
|
if (surrounderAction == action.javaClass.name && surrounderItems.any {
|
||||||
|
action.templatePresentation.text.endsWith(
|
||||||
|
it,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
) {
|
||||||
|
editor?.let {
|
||||||
|
val commandState = it.vim.vimStateMachine
|
||||||
|
commandState.mode = Mode.NORMAL()
|
||||||
|
VimPlugin.getChange().insertBeforeCursor(it.vim, event.dataContext.vim)
|
||||||
|
KeyHandler.getInstance().reset(it.vim)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//endregion
|
||||||
|
|
||||||
this.editor = null
|
this.editor = null
|
||||||
this.caretOffset = -1
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -66,15 +66,14 @@ import com.maddyhome.idea.vim.group.IjOptions
|
|||||||
import com.maddyhome.idea.vim.group.MotionGroup
|
import com.maddyhome.idea.vim.group.MotionGroup
|
||||||
import com.maddyhome.idea.vim.group.OptionGroup
|
import com.maddyhome.idea.vim.group.OptionGroup
|
||||||
import com.maddyhome.idea.vim.group.ScrollGroup
|
import com.maddyhome.idea.vim.group.ScrollGroup
|
||||||
import com.maddyhome.idea.vim.group.SearchGroup
|
|
||||||
import com.maddyhome.idea.vim.group.visual.IdeaSelectionControl
|
import com.maddyhome.idea.vim.group.visual.IdeaSelectionControl
|
||||||
import com.maddyhome.idea.vim.group.visual.VimVisualTimer
|
import com.maddyhome.idea.vim.group.visual.VimVisualTimer
|
||||||
import com.maddyhome.idea.vim.group.visual.moveCaretOneCharLeftFromSelectionEnd
|
import com.maddyhome.idea.vim.group.visual.moveCaretOneCharLeftFromSelectionEnd
|
||||||
import com.maddyhome.idea.vim.group.visual.vimSetSystemSelectionSilently
|
|
||||||
import com.maddyhome.idea.vim.handler.correctorRequester
|
import com.maddyhome.idea.vim.handler.correctorRequester
|
||||||
import com.maddyhome.idea.vim.handler.keyCheckRequests
|
import com.maddyhome.idea.vim.handler.keyCheckRequests
|
||||||
import com.maddyhome.idea.vim.helper.GuicursorChangeListener
|
import com.maddyhome.idea.vim.helper.GuicursorChangeListener
|
||||||
import com.maddyhome.idea.vim.helper.StrictMode
|
import com.maddyhome.idea.vim.helper.StrictMode
|
||||||
|
import com.maddyhome.idea.vim.helper.VimStandalonePluginUpdateChecker
|
||||||
import com.maddyhome.idea.vim.helper.exitSelectMode
|
import com.maddyhome.idea.vim.helper.exitSelectMode
|
||||||
import com.maddyhome.idea.vim.helper.exitVisualMode
|
import com.maddyhome.idea.vim.helper.exitVisualMode
|
||||||
import com.maddyhome.idea.vim.helper.forceBarCursor
|
import com.maddyhome.idea.vim.helper.forceBarCursor
|
||||||
@@ -91,8 +90,6 @@ import com.maddyhome.idea.vim.listener.MouseEventsDataHolder.skipNDragEvents
|
|||||||
import com.maddyhome.idea.vim.listener.VimListenerManager.EditorListeners.add
|
import com.maddyhome.idea.vim.listener.VimListenerManager.EditorListeners.add
|
||||||
import com.maddyhome.idea.vim.newapi.IjVimEditor
|
import com.maddyhome.idea.vim.newapi.IjVimEditor
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import com.maddyhome.idea.vim.state.VimStateMachine
|
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
|
||||||
import com.maddyhome.idea.vim.state.mode.inSelectMode
|
import com.maddyhome.idea.vim.state.mode.inSelectMode
|
||||||
import com.maddyhome.idea.vim.state.mode.mode
|
import com.maddyhome.idea.vim.state.mode.mode
|
||||||
import com.maddyhome.idea.vim.state.mode.selectionType
|
import com.maddyhome.idea.vim.state.mode.selectionType
|
||||||
@@ -306,16 +303,6 @@ internal object VimListenerManager {
|
|||||||
class VimFileEditorManagerListener : FileEditorManagerListener {
|
class VimFileEditorManagerListener : FileEditorManagerListener {
|
||||||
override fun selectionChanged(event: FileEditorManagerEvent) {
|
override fun selectionChanged(event: FileEditorManagerEvent) {
|
||||||
if (VimPlugin.isNotEnabled()) return
|
if (VimPlugin.isNotEnabled()) return
|
||||||
|
|
||||||
val newEditor = event.newEditor
|
|
||||||
if (newEditor is TextEditor) {
|
|
||||||
val editor = newEditor.editor
|
|
||||||
if (editor.isInsertMode) {
|
|
||||||
VimStateMachine.getInstance(editor).mode = Mode.NORMAL()
|
|
||||||
KeyHandler.getInstance().reset(editor.vim)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
MotionGroup.fileEditorManagerSelectionChangedCallback(event)
|
MotionGroup.fileEditorManagerSelectionChangedCallback(event)
|
||||||
FileGroup.fileEditorManagerSelectionChangedCallback(event)
|
FileGroup.fileEditorManagerSelectionChangedCallback(event)
|
||||||
VimPlugin.getSearch().fileEditorManagerSelectionChangedCallback(event)
|
VimPlugin.getSearch().fileEditorManagerSelectionChangedCallback(event)
|
||||||
@@ -380,6 +367,8 @@ internal object VimListenerManager {
|
|||||||
|
|
||||||
event.editor.putUserData(openingEditorKey, OpeningEditor(openingEditor, owningEditorWindow, isPreview, canBeReused))
|
event.editor.putUserData(openingEditorKey, OpeningEditor(openingEditor, owningEditorWindow, isPreview, canBeReused))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
VimStandalonePluginUpdateChecker.instance.pluginUsed()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun editorReleased(event: EditorFactoryEvent) {
|
override fun editorReleased(event: EditorFactoryEvent) {
|
||||||
@@ -442,8 +431,6 @@ internal object VimListenerManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private object EditorSelectionHandler : SelectionListener {
|
private object EditorSelectionHandler : SelectionListener {
|
||||||
private var myMakingChanges = false
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This event is executed for each caret using [com.intellij.openapi.editor.CaretModel.runForEachCaret]
|
* This event is executed for each caret using [com.intellij.openapi.editor.CaretModel.runForEachCaret]
|
||||||
*/
|
*/
|
||||||
@@ -492,22 +479,9 @@ internal object VimListenerManager {
|
|||||||
IdeaSelectionControl.controlNonVimSelectionChange(editor)
|
IdeaSelectionControl.controlNonVimSelectionChange(editor)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myMakingChanges || document is DocumentEx && document.isInEventsHandling) {
|
if (document is DocumentEx && document.isInEventsHandling) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
myMakingChanges = true
|
|
||||||
try {
|
|
||||||
// Synchronize selections between editors
|
|
||||||
val newRange = selectionEvent.newRange
|
|
||||||
for (e in localEditors(document)) {
|
|
||||||
if (e != editor) {
|
|
||||||
e.selectionModel.vimSetSystemSelectionSilently(newRange.startOffset, newRange.endOffset)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
myMakingChanges = false
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -43,6 +43,10 @@ internal class IjVimApplication : VimApplicationBase() {
|
|||||||
return ApplicationManager.getApplication().isUnitTestMode
|
return ApplicationManager.getApplication().isUnitTestMode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun isInternal(): Boolean {
|
||||||
|
return ApplicationManager.getApplication().isInternal
|
||||||
|
}
|
||||||
|
|
||||||
override fun postKey(stroke: KeyStroke, editor: VimEditor) {
|
override fun postKey(stroke: KeyStroke, editor: VimEditor) {
|
||||||
val component: Component = SwingUtilities.getAncestorOfClass(Window::class.java, editor.ij.component)
|
val component: Component = SwingUtilities.getAncestorOfClass(Window::class.java, editor.ij.component)
|
||||||
val event = createKeyEvent(stroke, component)
|
val event = createKeyEvent(stroke, component)
|
||||||
|
@@ -32,7 +32,7 @@ import com.maddyhome.idea.vim.vimscript.parser.VimscriptParser.parseExpression
|
|||||||
import org.jetbrains.annotations.TestOnly
|
import org.jetbrains.annotations.TestOnly
|
||||||
import javax.swing.KeyStroke
|
import javax.swing.KeyStroke
|
||||||
|
|
||||||
public abstract class IjVimSearchGroup : VimSearchGroupBase() {
|
public open class IjVimSearchGroup : VimSearchGroupBase() {
|
||||||
|
|
||||||
init {
|
init {
|
||||||
// TODO: Investigate migrating these listeners to use the effective value change listener
|
// TODO: Investigate migrating these listeners to use the effective value change listener
|
||||||
@@ -178,4 +178,4 @@ public abstract class IjVimSearchGroup : VimSearchGroupBase() {
|
|||||||
showSearchHighlight = false
|
showSearchHighlight = false
|
||||||
updateSearchHighlights(false)
|
updateSearchHighlights(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -697,7 +697,7 @@ internal class IjVimSearchHelper : VimSearchHelperBase() {
|
|||||||
val endOffset: Int
|
val endOffset: Int
|
||||||
val skipCount: Int
|
val skipCount: Int
|
||||||
val offsetOrdering: IntComparator
|
val offsetOrdering: IntComparator
|
||||||
|
|
||||||
if (count < 0) {
|
if (count < 0) {
|
||||||
startOffset = 0
|
startOffset = 0
|
||||||
endOffset = caret.offset.point - 1
|
endOffset = caret.offset.point - 1
|
||||||
|
@@ -15,7 +15,7 @@ import com.intellij.internal.statistic.service.fus.collectors.CounterUsagesColle
|
|||||||
|
|
||||||
internal class ActionTracker : CounterUsagesCollector() {
|
internal class ActionTracker : CounterUsagesCollector() {
|
||||||
companion object {
|
companion object {
|
||||||
private val GROUP = EventLogGroup("vim.actions", 1)
|
private val GROUP = EventLogGroup("vim.actions", 1, "FUS")
|
||||||
private val TRACKED_ACTIONS = GROUP.registerEvent(
|
private val TRACKED_ACTIONS = GROUP.registerEvent(
|
||||||
"tracked",
|
"tracked",
|
||||||
EventFields.StringValidatedByCustomRule("action_id", ActionRuleValidator::class.java),
|
EventFields.StringValidatedByCustomRule("action_id", ActionRuleValidator::class.java),
|
||||||
|
@@ -48,7 +48,7 @@ internal class OptionsState : ApplicationUsagesCollector() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val GROUP = EventLogGroup("vim.options", 1)
|
private val GROUP = EventLogGroup("vim.options", 1, "FUS")
|
||||||
|
|
||||||
private val IDEAJOIN = BooleanEventField(IjOptions.ideajoin.name)
|
private val IDEAJOIN = BooleanEventField(IjOptions.ideajoin.name)
|
||||||
private val IDEAMARKS = BooleanEventField(IjOptions.ideamarks.name)
|
private val IDEAMARKS = BooleanEventField(IjOptions.ideamarks.name)
|
||||||
|
@@ -31,7 +31,7 @@ internal class PluginState : ApplicationUsagesCollector() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val GROUP = EventLogGroup("vim.common", 1)
|
private val GROUP = EventLogGroup("vim.common", 1, "FUS")
|
||||||
|
|
||||||
val extensionNames = listOf("textobj-entire", "argtextobj", "ReplaceWithRegister", "vim-paragraph-motion", "highlightedyank", "multiple-cursors", "exchange", "NERDTree", "surround", "commentary", "matchit", "textobj-indent")
|
val extensionNames = listOf("textobj-entire", "argtextobj", "ReplaceWithRegister", "vim-paragraph-motion", "highlightedyank", "multiple-cursors", "exchange", "NERDTree", "surround", "commentary", "matchit", "textobj-indent")
|
||||||
val enabledExtensions = HashSet<String>()
|
val enabledExtensions = HashSet<String>()
|
||||||
|
@@ -72,7 +72,7 @@ internal class ShortcutConflictState : ApplicationUsagesCollector() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val GROUP = EventLogGroup("vim.handlers", 1)
|
private val GROUP = EventLogGroup("vim.handlers", 1, "FUS")
|
||||||
|
|
||||||
private val keyStrokes = listOf(
|
private val keyStrokes = listOf(
|
||||||
KeyStroke.getKeyStroke('1'.code, CTRL_DOWN_MASK),
|
KeyStroke.getKeyStroke('1'.code, CTRL_DOWN_MASK),
|
||||||
|
@@ -37,7 +37,7 @@ internal class VimscriptState : ApplicationUsagesCollector() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val GROUP = EventLogGroup("vim.vimscript", 1)
|
private val GROUP = EventLogGroup("vim.vimscript", 1, "FUS")
|
||||||
|
|
||||||
val sourcedFiles = HashSet<String>()
|
val sourcedFiles = HashSet<String>()
|
||||||
val extensionsEnabledWithPlug = HashSet<String>()
|
val extensionsEnabledWithPlug = HashSet<String>()
|
||||||
|
@@ -31,7 +31,7 @@ internal class Troubleshooter {
|
|||||||
|
|
||||||
fun findIncorrectMappings(): List<Problem> {
|
fun findIncorrectMappings(): List<Problem> {
|
||||||
val problems = ArrayList<Problem>()
|
val problems = ArrayList<Problem>()
|
||||||
MappingMode.values().forEach { mode ->
|
MappingMode.entries.forEach { mode ->
|
||||||
injector.keyGroup.getKeyMapping(mode).getByOwner(MappingOwner.IdeaVim.InitScript).forEach { (_, to) ->
|
injector.keyGroup.getKeyMapping(mode).getByOwner(MappingOwner.IdeaVim.InitScript).forEach { (_, to) ->
|
||||||
if (to is ToKeysMappingInfo) {
|
if (to is ToKeysMappingInfo) {
|
||||||
if (":action" in to.toKeys.joinToString { it.keyChar.toString() }) {
|
if (":action" in to.toKeys.joinToString { it.keyChar.toString() }) {
|
||||||
|
@@ -12,6 +12,7 @@ import com.intellij.icons.AllIcons
|
|||||||
import com.intellij.openapi.Disposable
|
import com.intellij.openapi.Disposable
|
||||||
import com.intellij.openapi.actionSystem.ActionUpdateThread
|
import com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||||
|
import com.intellij.openapi.actionSystem.DataContext
|
||||||
import com.intellij.openapi.actionSystem.DefaultActionGroup
|
import com.intellij.openapi.actionSystem.DefaultActionGroup
|
||||||
import com.intellij.openapi.actionSystem.PlatformDataKeys
|
import com.intellij.openapi.actionSystem.PlatformDataKeys
|
||||||
import com.intellij.openapi.diagnostic.logger
|
import com.intellij.openapi.diagnostic.logger
|
||||||
@@ -159,8 +160,8 @@ internal class ReloadVimRc : DumbAwareAction() {
|
|||||||
internal class ReloadFloatingToolbar : AbstractFloatingToolbarProvider(ACTION_GROUP) {
|
internal class ReloadFloatingToolbar : AbstractFloatingToolbarProvider(ACTION_GROUP) {
|
||||||
override val autoHideable: Boolean = false
|
override val autoHideable: Boolean = false
|
||||||
|
|
||||||
override fun register(component: FloatingToolbarComponent, parentDisposable: Disposable) {
|
override fun register(dataContext: DataContext, component: FloatingToolbarComponent, parentDisposable: Disposable) {
|
||||||
super.register(component, parentDisposable)
|
super.register(dataContext, component, parentDisposable)
|
||||||
val action = {
|
val action = {
|
||||||
component.scheduleShow()
|
component.scheduleShow()
|
||||||
}
|
}
|
||||||
|
@@ -9,15 +9,16 @@ package com.maddyhome.idea.vim.ui
|
|||||||
|
|
||||||
import com.intellij.icons.AllIcons
|
import com.intellij.icons.AllIcons
|
||||||
import com.intellij.openapi.actionSystem.ActionToolbarPosition
|
import com.intellij.openapi.actionSystem.ActionToolbarPosition
|
||||||
|
import com.intellij.openapi.actionSystem.ActionUpdateThread
|
||||||
import com.intellij.openapi.actionSystem.AnAction
|
import com.intellij.openapi.actionSystem.AnAction
|
||||||
import com.intellij.openapi.actionSystem.AnActionEvent
|
import com.intellij.openapi.actionSystem.AnActionEvent
|
||||||
import com.intellij.openapi.actionSystem.KeyboardShortcut
|
import com.intellij.openapi.actionSystem.KeyboardShortcut
|
||||||
import com.intellij.openapi.keymap.KeymapUtil
|
import com.intellij.openapi.keymap.KeymapUtil
|
||||||
import com.intellij.openapi.options.Configurable
|
import com.intellij.openapi.options.Configurable
|
||||||
|
import com.intellij.openapi.project.DumbAwareAction
|
||||||
import com.intellij.openapi.ui.ComboBoxTableRenderer
|
import com.intellij.openapi.ui.ComboBoxTableRenderer
|
||||||
import com.intellij.openapi.ui.StripeTable
|
import com.intellij.openapi.ui.StripeTable
|
||||||
import com.intellij.openapi.wm.IdeFocusManager
|
import com.intellij.openapi.wm.IdeFocusManager
|
||||||
import com.intellij.ui.DumbAwareActionButton
|
|
||||||
import com.intellij.ui.HyperlinkLabel
|
import com.intellij.ui.HyperlinkLabel
|
||||||
import com.intellij.ui.IdeBorderFactory
|
import com.intellij.ui.IdeBorderFactory
|
||||||
import com.intellij.ui.JBColor
|
import com.intellij.ui.JBColor
|
||||||
@@ -169,7 +170,7 @@ internal class VimEmulationConfigurable : Configurable {
|
|||||||
return getColumnModel().getColumn(column.index)
|
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) {
|
override fun customizeComponent(owner: ShortcutOwner, table: JTable, isSelected: Boolean) {
|
||||||
super.customizeComponent(owner, table, isSelected)
|
super.customizeComponent(owner, table, isSelected)
|
||||||
if (owner == ShortcutOwner.UNDEFINED) {
|
if (owner == ShortcutOwner.UNDEFINED) {
|
||||||
@@ -192,7 +193,7 @@ internal class VimEmulationConfigurable : Configurable {
|
|||||||
private val ourMembers: MutableMap<Int, Column> = HashMap()
|
private val ourMembers: MutableMap<Int, Column> = HashMap()
|
||||||
|
|
||||||
init {
|
init {
|
||||||
for (column in values()) {
|
for (column in entries) {
|
||||||
ourMembers[column.index] = column
|
ourMembers[column.index] = column
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -224,7 +225,7 @@ internal class VimEmulationConfigurable : Configurable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun getColumnCount(): Int {
|
override fun getColumnCount(): Int {
|
||||||
return Column.values().size
|
return Column.entries.size
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getValueAt(rowIndex: Int, columnIndex: Int): Any? {
|
override fun getValueAt(rowIndex: Int, columnIndex: Int): Any? {
|
||||||
@@ -294,19 +295,21 @@ internal class VimEmulationConfigurable : Configurable {
|
|||||||
|
|
||||||
private class CopyForRcAction(
|
private class CopyForRcAction(
|
||||||
private val myModel: VimShortcutConflictsTable.Model,
|
private val myModel: VimShortcutConflictsTable.Model,
|
||||||
) : DumbAwareActionButton(
|
) : DumbAwareAction(
|
||||||
"Copy Config for .ideavimrc",
|
"Copy Config for .ideavimrc",
|
||||||
"Copy config for .ideavimrc in sethandler format",
|
"Copy config for .ideavimrc in sethandler format",
|
||||||
AllIcons.Actions.Copy,
|
AllIcons.Actions.Copy,
|
||||||
) {
|
) {
|
||||||
|
|
||||||
override fun updateButton(e: AnActionEvent) {
|
override fun update(e: AnActionEvent) {
|
||||||
val enabled: Boolean = myModel.rows.stream().anyMatch {
|
val enabled: Boolean = myModel.rows.stream().anyMatch {
|
||||||
it.owner is AllModes && (it.owner as AllModes).owner != ShortcutOwner.UNDEFINED
|
it.owner is AllModes && (it.owner as AllModes).owner != ShortcutOwner.UNDEFINED
|
||||||
}
|
}
|
||||||
e.presentation.isEnabled = enabled
|
e.presentation.isEnabled = enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.EDT
|
||||||
|
|
||||||
override fun actionPerformed(e: AnActionEvent) {
|
override fun actionPerformed(e: AnActionEvent) {
|
||||||
val stringBuilder = StringBuilder()
|
val stringBuilder = StringBuilder()
|
||||||
for (row in myModel.rows) {
|
for (row in myModel.rows) {
|
||||||
@@ -328,14 +331,16 @@ internal class VimEmulationConfigurable : Configurable {
|
|||||||
class ResetHandlersAction(
|
class ResetHandlersAction(
|
||||||
private val myModel: VimShortcutConflictsTable.Model,
|
private val myModel: VimShortcutConflictsTable.Model,
|
||||||
private val myTable: VimShortcutConflictsTable,
|
private val myTable: VimShortcutConflictsTable,
|
||||||
) : DumbAwareActionButton("Reset Handlers", "Reset handlers", AllIcons.General.Reset) {
|
) : DumbAwareAction("Reset Handlers", "Reset handlers", AllIcons.General.Reset) {
|
||||||
override fun updateButton(e: AnActionEvent) {
|
override fun update(e: AnActionEvent) {
|
||||||
val enabled: Boolean = myModel.rows.stream().anyMatch {
|
val enabled: Boolean = myModel.rows.stream().anyMatch {
|
||||||
it.owner is AllModes && (it.owner as AllModes).owner != ShortcutOwner.UNDEFINED
|
it.owner is AllModes && (it.owner as AllModes).owner != ShortcutOwner.UNDEFINED
|
||||||
}
|
}
|
||||||
e.presentation.isEnabled = enabled
|
e.presentation.isEnabled = enabled
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun getActionUpdateThread(): ActionUpdateThread = ActionUpdateThread.EDT
|
||||||
|
|
||||||
override fun actionPerformed(e: AnActionEvent) {
|
override fun actionPerformed(e: AnActionEvent) {
|
||||||
TableUtil.stopEditing(myTable)
|
TableUtil.stopEditing(myTable)
|
||||||
for (row in myModel.rows) {
|
for (row in myModel.rows) {
|
||||||
|
@@ -121,16 +121,11 @@ public class ExTextField extends JTextField {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void setType(@NotNull String type) {
|
void setType(@NotNull String type) {
|
||||||
String hkey = null;
|
String hkey = switch (type.charAt(0)) {
|
||||||
switch (type.charAt(0)) {
|
case '/', '?' -> HistoryConstants.SEARCH;
|
||||||
case '/':
|
case ':' -> HistoryConstants.COMMAND;
|
||||||
case '?':
|
default -> null;
|
||||||
hkey = HistoryConstants.SEARCH;
|
};
|
||||||
break;
|
|
||||||
case ':':
|
|
||||||
hkey = HistoryConstants.COMMAND;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hkey != null) {
|
if (hkey != null) {
|
||||||
history = VimPlugin.getHistory().getEntries(hkey, 0, 0);
|
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
|
* 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)
|
* Called whenever the text is changed, either by typing, or by special characters altering the text (e.g. Delete)
|
||||||
*/
|
*/
|
||||||
void saveLastEntry() {
|
void saveLastEntry() {
|
||||||
@@ -304,7 +299,10 @@ public class ExTextField extends JTextField {
|
|||||||
*/
|
*/
|
||||||
void cancel() {
|
void cancel() {
|
||||||
clearCurrentAction();
|
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) {
|
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
|
* 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
|
* 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,
|
* 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.
|
* 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.
|
* 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().
|
* 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
|
* @param r The current location of the caret, usually provided by MapToView. The x and y appear to be the upper
|
||||||
|
@@ -153,7 +153,7 @@ public class ModeWidgetPopup : AnAction() {
|
|||||||
group {
|
group {
|
||||||
row {
|
row {
|
||||||
label(MessageHelper.getMessage("widget.mode.popup.field.theme"))
|
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") }
|
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)
|
}.topGap(TopGap.NONE).visibleIf(!advancedSettings.selected)
|
||||||
@@ -360,7 +360,7 @@ public enum class ModeWidgetTheme(private var value: String) {
|
|||||||
|
|
||||||
public companion object {
|
public companion object {
|
||||||
public fun parseString(string: String): ModeWidgetTheme? {
|
public fun parseString(string: String): ModeWidgetTheme? {
|
||||||
return ModeWidgetTheme.values().firstOrNull { it.value == string }
|
return entries.firstOrNull { it.value == string }
|
||||||
}
|
}
|
||||||
|
|
||||||
public fun getDefaultTheme(): ModeWidgetTheme = TERM
|
public fun getDefaultTheme(): ModeWidgetTheme = TERM
|
||||||
|
@@ -8,24 +8,20 @@
|
|||||||
|
|
||||||
<idea-plugin>
|
<idea-plugin>
|
||||||
<extensions defaultExtensionNs="com.intellij">
|
<extensions defaultExtensionNs="com.intellij">
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.MotionGroup"/>
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.ScrollGroup"
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.ScrollGroup"
|
||||||
serviceInterface="com.maddyhome.idea.vim.api.VimScrollGroup"/>
|
serviceInterface="com.maddyhome.idea.vim.api.VimScrollGroup"/>
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.ChangeGroup"
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.ChangeGroup"
|
||||||
serviceInterface="com.maddyhome.idea.vim.api.VimChangeGroup"/>
|
serviceInterface="com.maddyhome.idea.vim.api.VimChangeGroup"/>
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.CommandGroup"/>
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.VimMarkServiceImpl"
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.VimMarkServiceImpl"
|
||||||
serviceInterface="com.maddyhome.idea.vim.api.VimMarkService"/>
|
serviceInterface="com.maddyhome.idea.vim.api.VimMarkService"/>
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.VimJumpServiceImpl"
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.VimJumpServiceImpl"
|
||||||
serviceInterface="com.maddyhome.idea.vim.api.VimJumpService"/>
|
serviceInterface="com.maddyhome.idea.vim.api.VimJumpService"/>
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.RegisterGroup"
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.RegisterGroup"
|
||||||
serviceInterface="com.maddyhome.idea.vim.register.VimRegisterGroup"/>
|
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.FileGroup"/>
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.SearchGroup"/>
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.SearchGroup"/>
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.ProcessGroup"
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.ProcessGroup"
|
||||||
serviceInterface="com.maddyhome.idea.vim.api.VimProcessGroup"/>
|
serviceInterface="com.maddyhome.idea.vim.api.VimProcessGroup"/>
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.MacroGroup"/>
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.DigraphGroup"
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.DigraphGroup"
|
||||||
serviceInterface="com.maddyhome.idea.vim.api.VimDigraphGroup"/>
|
serviceInterface="com.maddyhome.idea.vim.api.VimDigraphGroup"/>
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.HistoryGroup"/>
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.HistoryGroup"/>
|
||||||
@@ -38,7 +34,6 @@
|
|||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.visual.VisualMotionGroup"
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.visual.VisualMotionGroup"
|
||||||
serviceInterface="com.maddyhome.idea.vim.api.VimVisualMotionGroup"/>
|
serviceInterface="com.maddyhome.idea.vim.api.VimVisualMotionGroup"/>
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.yank.YankGroupBase"/>
|
<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"
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.vimscript.services.IjVariableService"
|
||||||
serviceInterface="com.maddyhome.idea.vim.vimscript.services.VariableService"/>
|
serviceInterface="com.maddyhome.idea.vim.vimscript.services.VariableService"/>
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.IjStatisticsService"
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.IjStatisticsService"
|
||||||
@@ -53,6 +48,5 @@
|
|||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.IjVimSystemInfoService"
|
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.IjVimSystemInfoService"
|
||||||
serviceInterface="com.maddyhome.idea.vim.api.SystemInfoService"/>
|
serviceInterface="com.maddyhome.idea.vim.api.SystemInfoService"/>
|
||||||
|
|
||||||
<applicationService serviceImplementation="com.maddyhome.idea.vim.group.NotificationService"/>
|
|
||||||
</extensions>
|
</extensions>
|
||||||
</idea-plugin>
|
</idea-plugin>
|
||||||
|
@@ -1,4 +1,12 @@
|
|||||||
<idea-plugin xmlns:xi="http://www.w3.org/2001/XInclude">
|
<!--
|
||||||
|
~ 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<idea-plugin url="https://plugins.jetbrains.com/plugin/164" xmlns:xi="http://www.w3.org/2001/XInclude">
|
||||||
<name>IdeaVim</name>
|
<name>IdeaVim</name>
|
||||||
<id>IdeaVIM</id>
|
<id>IdeaVIM</id>
|
||||||
<description><![CDATA[
|
<description><![CDATA[
|
||||||
@@ -13,13 +21,13 @@
|
|||||||
<li><a href="https://youtrack.jetbrains.com/issues/VIM">Issue tracker</a>: feature requests and bug reports</li>
|
<li><a href="https://youtrack.jetbrains.com/issues/VIM">Issue tracker</a>: feature requests and bug reports</li>
|
||||||
</ul>
|
</ul>
|
||||||
]]></description>
|
]]></description>
|
||||||
<version>chylex</version>
|
<version>SNAPSHOT</version>
|
||||||
<vendor>JetBrains</vendor>
|
<vendor>JetBrains</vendor>
|
||||||
|
|
||||||
<!-- Please search for "[VERSION UPDATE]" in project in case you update the since-build version -->
|
<!-- Please search for "[VERSION UPDATE]" in project in case you update the since-build version -->
|
||||||
<!-- Check for [Version Update] tag in YouTrack as well -->
|
<!-- Check for [Version Update] tag in YouTrack as well -->
|
||||||
<!-- Also, please update the value in build.gradle.kts file-->
|
<!-- Also, please update the value in build.gradle.kts file-->
|
||||||
<idea-version since-build="232"/>
|
<idea-version since-build="233.11799.30"/>
|
||||||
|
|
||||||
<!-- Mark the plugin as compatible with RubyMine and other products based on the IntelliJ platform (including CWM) -->
|
<!-- Mark the plugin as compatible with RubyMine and other products based on the IntelliJ platform (including CWM) -->
|
||||||
<depends>com.intellij.modules.platform</depends>
|
<depends>com.intellij.modules.platform</depends>
|
||||||
@@ -54,7 +62,6 @@
|
|||||||
|
|
||||||
<extensions defaultExtensionNs="com.intellij">
|
<extensions defaultExtensionNs="com.intellij">
|
||||||
<applicationConfigurable groupId="editor" instance="com.maddyhome.idea.vim.ui.VimEmulationConfigurable"/>
|
<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"/>
|
<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="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"/>
|
<statusBarWidgetFactory id="IdeaVim-Icon" implementation="com.maddyhome.idea.vim.ui.StatusBarIconFactory" order="last, before IdeaVimMode"/>
|
||||||
@@ -150,6 +157,5 @@
|
|||||||
</group>
|
</group>
|
||||||
|
|
||||||
<action id="VimFindActionIdAction" class="com.maddyhome.idea.vim.listener.FindActionIdAction"/>
|
<action id="VimFindActionIdAction" class="com.maddyhome.idea.vim.listener.FindActionIdAction"/>
|
||||||
<action id="VimJumpToSource" class="com.intellij.diff.actions.impl.OpenInEditorAction" />
|
|
||||||
</actions>
|
</actions>
|
||||||
</idea-plugin>
|
</idea-plugin>
|
||||||
|
@@ -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.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.theme=Widget theme:
|
||||||
widget.mode.popup.field.advanced.settings=Full color customization (advanced)
|
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.normal.title=Normal Mode
|
||||||
widget.mode.popup.group.insert.title=Insert Mode
|
widget.mode.popup.group.insert.title=Insert Mode
|
||||||
widget.mode.popup.group.replace.title=Replace Mode
|
widget.mode.popup.group.replace.title=Replace Mode
|
||||||
|
@@ -9,10 +9,10 @@ package org.jetbrains.plugins.ideavim.action
|
|||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
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.StringHelper.parseKeys
|
||||||
import com.maddyhome.idea.vim.helper.vimStateMachine
|
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.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
@@ -15,6 +15,7 @@ import com.maddyhome.idea.vim.key.MappingOwner
|
|||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
import org.junit.jupiter.api.Disabled
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class RepeatActionTest : VimTestCase() {
|
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()
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -11,8 +11,8 @@ package org.jetbrains.plugins.ideavim.action
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.command.MappingMode
|
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.key.MappingOwner
|
||||||
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
@@ -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@")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -10,9 +10,9 @@ package org.jetbrains.plugins.ideavim.action.change
|
|||||||
|
|
||||||
import com.intellij.idea.TestFor
|
import com.intellij.idea.TestFor
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
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.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
@@ -11,9 +11,9 @@
|
|||||||
package org.jetbrains.plugins.ideavim.action.change.delete
|
package org.jetbrains.plugins.ideavim.action.change.delete
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.junit.jupiter.params.ParameterizedTest
|
import org.junit.jupiter.params.ParameterizedTest
|
||||||
|
@@ -9,9 +9,9 @@
|
|||||||
package org.jetbrains.plugins.ideavim.action.change.delete
|
package org.jetbrains.plugins.ideavim.action.change.delete
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.api.injector
|
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.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
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.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
|
@@ -10,8 +10,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.change.delete
|
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.options.OptionConstants
|
||||||
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -13,10 +13,10 @@ import com.intellij.notification.EventLog
|
|||||||
import com.intellij.notification.Notification
|
import com.intellij.notification.Notification
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
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.group.NotificationService
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
import com.maddyhome.idea.vim.newapi.vim
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
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.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.jetbrains.plugins.ideavim.impl.OptionTest
|
import org.jetbrains.plugins.ideavim.impl.OptionTest
|
||||||
|
@@ -18,11 +18,11 @@ import com.intellij.testFramework.ExtensionTestUtil
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.globalOptions
|
import com.maddyhome.idea.vim.api.globalOptions
|
||||||
import com.maddyhome.idea.vim.api.injector
|
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.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
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.VimTestCase
|
||||||
import org.jetbrains.plugins.ideavim.rangeOf
|
import org.jetbrains.plugins.ideavim.rangeOf
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
@@ -9,8 +9,8 @@
|
|||||||
package org.jetbrains.plugins.ideavim.action.copy
|
package org.jetbrains.plugins.ideavim.action.copy
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.api.injector
|
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.newapi.vim
|
||||||
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.jetbrains.plugins.ideavim.rangeOf
|
import org.jetbrains.plugins.ideavim.rangeOf
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
@@ -13,9 +13,9 @@ import com.intellij.ide.CopyPasteManagerEx
|
|||||||
import com.intellij.openapi.ide.CopyPasteManager
|
import com.intellij.openapi.ide.CopyPasteManager
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
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.newapi.vim
|
||||||
import com.maddyhome.idea.vim.options.OptionConstants
|
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.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -12,11 +12,11 @@ package org.jetbrains.plugins.ideavim.action.copy
|
|||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
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.newapi.vim
|
||||||
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.jetbrains.plugins.ideavim.annotations.TestWithoutPrimaryClipboard
|
import org.jetbrains.plugins.ideavim.annotations.TestWithoutPrimaryClipboard
|
||||||
import org.jetbrains.plugins.ideavim.rangeOf
|
import org.jetbrains.plugins.ideavim.rangeOf
|
||||||
|
@@ -10,12 +10,12 @@ package org.jetbrains.plugins.ideavim.action.copy
|
|||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
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.common.TextRange
|
||||||
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
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.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.jetbrains.plugins.ideavim.annotations.TestWithoutPrimaryClipboard
|
import org.jetbrains.plugins.ideavim.annotations.TestWithoutPrimaryClipboard
|
||||||
import org.junit.Ignore
|
import org.junit.Ignore
|
||||||
|
@@ -12,11 +12,11 @@ package org.jetbrains.plugins.ideavim.action.copy
|
|||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
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.newapi.vim
|
||||||
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.junit.jupiter.api.Disabled
|
import org.junit.jupiter.api.Disabled
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
@@ -13,7 +13,6 @@ package org.jetbrains.plugins.ideavim.action.motion.gn
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.common.Direction
|
import com.maddyhome.idea.vim.common.Direction
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
@@ -86,7 +85,7 @@ class GnNextTextObjectTest : VimTestCase() {
|
|||||||
|
|
||||||
private fun doTestWithSearch(keys: List<KeyStroke>, before: String, after: String) {
|
private fun doTestWithSearch(keys: List<KeyStroke>, before: String, after: String) {
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
VimPlugin.getSearch().setLastSearchState(fixture.editor.vim, "test", "", Direction.FORWARDS)
|
VimPlugin.getSearch().setLastSearchState(fixture.editor, "test", "", Direction.FORWARDS)
|
||||||
typeText(keys)
|
typeText(keys)
|
||||||
assertState(after)
|
assertState(after)
|
||||||
assertState(Mode.NORMAL())
|
assertState(Mode.NORMAL())
|
||||||
|
@@ -13,7 +13,6 @@ package org.jetbrains.plugins.ideavim.action.motion.gn
|
|||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.common.Direction
|
import com.maddyhome.idea.vim.common.Direction
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
@@ -64,7 +63,7 @@ class GnPreviousTextObjectTest : VimTestCase() {
|
|||||||
|
|
||||||
private fun doTestWithSearch(keys: List<KeyStroke>, before: String, after: String) {
|
private fun doTestWithSearch(keys: List<KeyStroke>, before: String, after: String) {
|
||||||
configureByText(before)
|
configureByText(before)
|
||||||
VimPlugin.getSearch().setLastSearchState(fixture.editor.vim, "test", "", Direction.FORWARDS)
|
VimPlugin.getSearch().setLastSearchState(fixture.editor, "test", "", Direction.FORWARDS)
|
||||||
typeText(keys)
|
typeText(keys)
|
||||||
assertState(after)
|
assertState(after)
|
||||||
assertState(Mode.NORMAL())
|
assertState(Mode.NORMAL())
|
||||||
|
@@ -12,7 +12,6 @@ import com.maddyhome.idea.vim.VimPlugin
|
|||||||
import com.maddyhome.idea.vim.action.motion.search.SearchWholeWordForwardAction
|
import com.maddyhome.idea.vim.action.motion.search.SearchWholeWordForwardAction
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.common.Direction
|
import com.maddyhome.idea.vim.common.Direction
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
@@ -58,7 +57,7 @@ class VisualSelectNextSearchTest : VimTestCase() {
|
|||||||
@Test
|
@Test
|
||||||
fun testWithoutSpaces() {
|
fun testWithoutSpaces() {
|
||||||
configureByText("test<caret>test")
|
configureByText("test<caret>test")
|
||||||
VimPlugin.getSearch().setLastSearchState(fixture.editor.vim, "test", "", Direction.FORWARDS)
|
VimPlugin.getSearch().setLastSearchState(fixture.editor, "test", "", Direction.FORWARDS)
|
||||||
typeText(injector.parser.parseKeys("gn"))
|
typeText(injector.parser.parseKeys("gn"))
|
||||||
assertOffset(7)
|
assertOffset(7)
|
||||||
assertSelection("test")
|
assertSelection("test")
|
||||||
|
@@ -12,7 +12,6 @@ import com.maddyhome.idea.vim.VimPlugin
|
|||||||
import com.maddyhome.idea.vim.action.motion.search.SearchWholeWordForwardAction
|
import com.maddyhome.idea.vim.action.motion.search.SearchWholeWordForwardAction
|
||||||
import com.maddyhome.idea.vim.api.injector
|
import com.maddyhome.idea.vim.api.injector
|
||||||
import com.maddyhome.idea.vim.common.Direction
|
import com.maddyhome.idea.vim.common.Direction
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
import com.maddyhome.idea.vim.state.mode.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
@@ -55,7 +54,7 @@ class VisualSelectPreviousSearchTest : VimTestCase() {
|
|||||||
@Test
|
@Test
|
||||||
fun testWithoutSpaces() {
|
fun testWithoutSpaces() {
|
||||||
configureByText("tes<caret>ttest")
|
configureByText("tes<caret>ttest")
|
||||||
VimPlugin.getSearch().setLastSearchState(fixture.editor.vim, "test", "", Direction.FORWARDS)
|
VimPlugin.getSearch().setLastSearchState(fixture.editor, "test", "", Direction.FORWARDS)
|
||||||
typeText(injector.parser.parseKeys("gN"))
|
typeText(injector.parser.parseKeys("gN"))
|
||||||
assertOffset(0)
|
assertOffset(0)
|
||||||
assertSelection("test")
|
assertSelection("test")
|
||||||
|
@@ -11,9 +11,9 @@
|
|||||||
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.api.injector
|
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.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
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.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -11,9 +11,9 @@
|
|||||||
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.api.injector
|
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.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
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.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
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.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
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.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
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.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
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.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -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.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
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.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
@@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
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.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
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.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -11,9 +11,9 @@
|
|||||||
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.api.injector
|
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.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
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.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -11,9 +11,9 @@
|
|||||||
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.api.injector
|
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.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
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.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
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.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
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.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.motion.leftright
|
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.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
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.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
@@ -8,11 +8,8 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.motion.search
|
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.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import kotlin.test.assertEquals
|
|
||||||
|
|
||||||
class SearchAgainNextActionTest : VimTestCase() {
|
class SearchAgainNextActionTest : VimTestCase() {
|
||||||
@Test
|
@Test
|
||||||
|
@@ -10,7 +10,6 @@ package org.jetbrains.plugins.ideavim.action.motion.search
|
|||||||
|
|
||||||
import com.maddyhome.idea.vim.VimPlugin
|
import com.maddyhome.idea.vim.VimPlugin
|
||||||
import com.maddyhome.idea.vim.common.Direction
|
import com.maddyhome.idea.vim.common.Direction
|
||||||
import com.maddyhome.idea.vim.newapi.vim
|
|
||||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
@@ -168,7 +167,7 @@ class SearchAgainPreviousActionTest : VimTestCase() {
|
|||||||
|
|
||||||
private fun doTestWithSearch(keys: String, before: String, after: String) {
|
private fun doTestWithSearch(keys: String, before: String, after: String) {
|
||||||
doTest(keys, before, after) {
|
doTest(keys, before, after) {
|
||||||
VimPlugin.getSearch().setLastSearchState(it.vim, "all", "", Direction.FORWARDS)
|
VimPlugin.getSearch().setLastSearchState(it, "all", "", Direction.FORWARDS)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -9,9 +9,9 @@
|
|||||||
package org.jetbrains.plugins.ideavim.action.motion.select
|
package org.jetbrains.plugins.ideavim.action.motion.select
|
||||||
|
|
||||||
import com.maddyhome.idea.vim.state.mode.Mode
|
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.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
@@ -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.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
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.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
import org.jetbrains.plugins.ideavim.VimBehaviorDiffers
|
||||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
|
@@ -10,9 +10,9 @@
|
|||||||
|
|
||||||
package org.jetbrains.plugins.ideavim.action.motion.select.motion
|
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.Mode
|
||||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
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.SkipNeovimReason
|
||||||
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
import org.jetbrains.plugins.ideavim.TestOptionConstants
|
||||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user