mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-09-18 07:24:48 +02:00
Compare commits
1 Commits
customized
...
54c16c97b9
Author | SHA1 | Date | |
---|---|---|---|
54c16c97b9
|
1
.gitattributes
vendored
1
.gitattributes
vendored
@@ -1 +0,0 @@
|
||||
* text=auto eol=lf
|
10
.github/workflows/runUiOctopusTests.yml
vendored
10
.github/workflows/runUiOctopusTests.yml
vendored
@@ -11,12 +11,12 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Apply Patch
|
||||
run: |
|
||||
git apply tests/ui-ij-tests/src/test/kotlin/ui/octopus.patch
|
||||
git apply src/test/java/ui/octopus.patch
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: zulu
|
||||
java-version: 17
|
||||
java-version: 11
|
||||
- name: Setup FFmpeg
|
||||
uses: FedericoCarboni/setup-ffmpeg@v3
|
||||
with:
|
||||
@@ -30,7 +30,7 @@ jobs:
|
||||
- name: Run Idea
|
||||
run: |
|
||||
mkdir -p build/reports
|
||||
gradle runIdeForUiTests > build/reports/idea.log &
|
||||
gradle :runIdeForUiTests > build/reports/idea.log &
|
||||
- name: Wait for Idea started
|
||||
uses: jtalk/url-health-check-action@v3
|
||||
with:
|
||||
@@ -38,10 +38,10 @@ jobs:
|
||||
max-attempts: 20
|
||||
retry-delay: 10s
|
||||
- name: Tests
|
||||
run: gradle :tests:ui-ij-tests:testUi
|
||||
run: gradle :testUi
|
||||
- name: Move video
|
||||
if: always()
|
||||
run: mv tests/ui-ij-tests/video build/reports
|
||||
run: mv video build/reports
|
||||
- name: Move sandbox logs
|
||||
if: always()
|
||||
run: mv build/idea-sandbox/system/log sandbox-idea-log
|
||||
|
55
.github/workflows/runUiPyTests.yml
vendored
55
.github/workflows/runUiPyTests.yml
vendored
@@ -1,55 +0,0 @@
|
||||
name: Run UI PyCharm Tests
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 12 * * *'
|
||||
jobs:
|
||||
build-for-ui-test-mac-os:
|
||||
if: github.repository == 'JetBrains/ideavim'
|
||||
runs-on: macos-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Setup Java
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: zulu
|
||||
java-version: 17
|
||||
- uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.10'
|
||||
- name: Setup FFmpeg
|
||||
uses: FedericoCarboni/setup-ffmpeg@v3
|
||||
with:
|
||||
# Not strictly necessary, but it may prevent rate limit
|
||||
# errors especially on GitHub-hosted macos machines.
|
||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||
- name: Setup Gradle
|
||||
uses: gradle/gradle-build-action@v2.4.2
|
||||
- name: Build Plugin
|
||||
run: gradle :buildPlugin
|
||||
- name: Run Idea
|
||||
run: |
|
||||
mkdir -p build/reports
|
||||
gradle :runIdeForUiTests -PideaType=PC > build/reports/idea.log &
|
||||
- name: Wait for Idea started
|
||||
uses: jtalk/url-health-check-action@v3
|
||||
with:
|
||||
url: http://127.0.0.1:8082
|
||||
max-attempts: 20
|
||||
retry-delay: 10s
|
||||
- name: Tests
|
||||
run: gradle :tests:ui-py-tests:testUi
|
||||
- name: Move video
|
||||
if: always()
|
||||
run: mv tests/ui-py-tests/video build/reports
|
||||
- name: Move sandbox logs
|
||||
if: always()
|
||||
run: mv build/idea-sandbox/system/log sandbox-idea-log
|
||||
- name: Save report
|
||||
if: always()
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ui-test-fails-report-mac
|
||||
path: |
|
||||
build/reports
|
||||
sandbox-idea-log
|
8
.github/workflows/runUiTests.yml
vendored
8
.github/workflows/runUiTests.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: zulu
|
||||
java-version: 17
|
||||
java-version: 11
|
||||
- name: Setup FFmpeg
|
||||
uses: FedericoCarboni/setup-ffmpeg@v3
|
||||
with:
|
||||
@@ -27,7 +27,7 @@ jobs:
|
||||
- name: Run Idea
|
||||
run: |
|
||||
mkdir -p build/reports
|
||||
gradle runIdeForUiTests > build/reports/idea.log &
|
||||
gradle :runIdeForUiTests > build/reports/idea.log &
|
||||
- name: Wait for Idea started
|
||||
uses: jtalk/url-health-check-action@v3
|
||||
with:
|
||||
@@ -35,10 +35,10 @@ jobs:
|
||||
max-attempts: 20
|
||||
retry-delay: 10s
|
||||
- name: Tests
|
||||
run: gradle :tests:ui-ij-tests:testUi
|
||||
run: gradle :testUi
|
||||
- name: Move video
|
||||
if: always()
|
||||
run: mv tests/ui-ij-tests/video build/reports
|
||||
run: mv video build/reports
|
||||
- name: Move sandbox logs
|
||||
if: always()
|
||||
run: mv build/idea-sandbox/system/log sandbox-idea-log
|
||||
|
1
.idea/codeStyles/Project.xml
generated
1
.idea/codeStyles/Project.xml
generated
@@ -6,7 +6,6 @@
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="LINE_SEPARATOR" value=" " />
|
||||
<JavaCodeStyleSettings>
|
||||
<option name="FIELD_NAME_PREFIX" value="my" />
|
||||
<option name="STATIC_FIELD_NAME_PREFIX" value="our" />
|
||||
|
1
.teamcity/_Self/buildTypes/Compatibility.kt
vendored
1
.teamcity/_Self/buildTypes/Compatibility.kt
vendored
@@ -34,6 +34,7 @@ object Compatibility : IdeaVimBuildType({
|
||||
|
||||
java --version
|
||||
java -jar verifier1/verifier-cli-dev-all-1.jar check-plugin '${'$'}org.jetbrains.IdeaVim-EasyMotion' [latest-IU] -team-city
|
||||
java -jar verifier1/verifier-cli-dev-all-1.jar check-plugin '${'$'}io.github.mishkun.ideavimsneak' [latest-IU] -team-city
|
||||
java -jar verifier1/verifier-cli-dev-all-1.jar check-plugin '${'$'}eu.theblob42.idea.whichkey' [latest-IU] -team-city
|
||||
java -jar verifier1/verifier-cli-dev-all-1.jar check-plugin '${'$'}IdeaVimExtension' [latest-IU] -team-city
|
||||
# Outdated java -jar verifier/verifier-cli-dev-all.jar check-plugin '${'$'}github.zgqq.intellij-enhance' [latest-IU] -team-city
|
||||
|
2
.teamcity/_Self/buildTypes/LongRunning.kt
vendored
2
.teamcity/_Self/buildTypes/LongRunning.kt
vendored
@@ -25,7 +25,7 @@ object LongRunning : IdeaVimBuildType({
|
||||
|
||||
steps {
|
||||
gradle {
|
||||
tasks = "clean :tests:long-running-tests:testLongRunning"
|
||||
tasks = "clean testLongRunning"
|
||||
buildFile = ""
|
||||
enableStacktrace = true
|
||||
}
|
||||
|
2
.teamcity/_Self/buildTypes/Nvim.kt
vendored
2
.teamcity/_Self/buildTypes/Nvim.kt
vendored
@@ -39,7 +39,7 @@ object Nvim : IdeaVimBuildType({
|
||||
""".trimIndent()
|
||||
}
|
||||
gradle {
|
||||
tasks = "clean test -Dnvim"
|
||||
tasks = "clean testWithNeovim"
|
||||
buildFile = ""
|
||||
enableStacktrace = true
|
||||
}
|
||||
|
2
.teamcity/_Self/buildTypes/PropertyBased.kt
vendored
2
.teamcity/_Self/buildTypes/PropertyBased.kt
vendored
@@ -24,7 +24,7 @@ object PropertyBased : IdeaVimBuildType({
|
||||
|
||||
steps {
|
||||
gradle {
|
||||
tasks = "clean :tests:property-tests:testPropertyBased"
|
||||
tasks = "clean testPropertyBased"
|
||||
buildFile = ""
|
||||
enableStacktrace = true
|
||||
}
|
||||
|
@@ -1,19 +0,0 @@
|
||||
package patches.buildTypes
|
||||
|
||||
import jetbrains.buildServer.configs.kotlin.v2019_2.*
|
||||
import jetbrains.buildServer.configs.kotlin.v2019_2.ui.*
|
||||
|
||||
/*
|
||||
This patch script was generated by TeamCity on settings change in UI.
|
||||
To apply the patch, change the buildType with id = 'PublishVimEngine'
|
||||
accordingly, and delete the patch script.
|
||||
*/
|
||||
changeBuildType(RelativeId("PublishVimEngine")) {
|
||||
vcs {
|
||||
|
||||
check(branchFilter == "+:<default>") {
|
||||
"Unexpected option value: branchFilter = $branchFilter"
|
||||
}
|
||||
branchFilter = "+:fleet"
|
||||
}
|
||||
}
|
@@ -27,12 +27,9 @@ usual beta standards.
|
||||
|
||||
### Fixes:
|
||||
* [VIM-3055](https://youtrack.jetbrains.com/issue/VIM-3055) Fix the issue with double deleting after dot
|
||||
* [VIM-3291](https://youtrack.jetbrains.com/issue/VIM-3291) Remove sync of editor selection between different opened editors
|
||||
* [VIM-3234](https://youtrack.jetbrains.com/issue/VIM-3234) The space character won't mix in the tab chars after >> and << commands
|
||||
|
||||
### Merged PRs:
|
||||
* [725](https://github.com/JetBrains/ideavim/pull/725) by [Emanuel Gestosa](https://github.com/emanuelgestosa): Regex
|
||||
* [805](https://github.com/JetBrains/ideavim/pull/805) by [chylex](https://github.com/chylex): VIM-3238 Fix recording a macro that replays another macro
|
||||
|
||||
## 2.8.0, 2024-01-30
|
||||
|
||||
|
145
build.gradle.kts
145
build.gradle.kts
@@ -70,9 +70,12 @@ plugins {
|
||||
application
|
||||
id("java-test-fixtures")
|
||||
|
||||
id("org.jetbrains.intellij") version "1.17.1"
|
||||
id("org.jetbrains.intellij") version "1.17.0"
|
||||
id("org.jetbrains.changelog") version "2.2.0"
|
||||
|
||||
// ktlint linter - read more: https://github.com/JLLeitschuh/ktlint-gradle
|
||||
// id("org.jlleitschuh.gradle.ktlint") version "11.3.1"
|
||||
|
||||
id("org.jetbrains.kotlinx.kover") version "0.6.1"
|
||||
id("com.dorongold.task-tree") version "2.1.1"
|
||||
|
||||
@@ -101,8 +104,8 @@ val ideaVersion: String by project
|
||||
val ideaType: String by project
|
||||
val downloadIdeaSources: String by project
|
||||
val instrumentPluginCode: String by project
|
||||
val antlrVersion: String by project
|
||||
val remoteRobotVersion: String by project
|
||||
val antlrVersion: String by project
|
||||
|
||||
val publishChannels: String by project
|
||||
val publishToken: String by project
|
||||
@@ -144,6 +147,11 @@ dependencies {
|
||||
// https://mvnrepository.com/artifact/org.mockito.kotlin/mockito-kotlin
|
||||
testImplementation("org.mockito.kotlin:mockito-kotlin:5.2.1")
|
||||
|
||||
testImplementation("com.intellij.remoterobot:remote-robot:$remoteRobotVersion")
|
||||
testImplementation("com.intellij.remoterobot:remote-fixtures:$remoteRobotVersion")
|
||||
testImplementation("com.intellij.remoterobot:ide-launcher:$remoteRobotVersion")
|
||||
testImplementation("com.automation-remarks:video-recorder-junit5:2.0")
|
||||
|
||||
testImplementation("org.junit.jupiter:junit-jupiter-api:5.10.1")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter-engine:5.10.1")
|
||||
testImplementation("org.junit.jupiter:junit-jupiter-params:5.10.1")
|
||||
@@ -158,17 +166,74 @@ configurations {
|
||||
}
|
||||
}
|
||||
|
||||
// --- Compilation
|
||||
// This can be moved to other test registration when issue with tests in gradle will be fixed
|
||||
tasks.register<Test>("testWithNeovim") {
|
||||
group = "verification"
|
||||
systemProperty("ideavim.nvim.test", "true")
|
||||
exclude("/ui/**")
|
||||
exclude("**/longrunning/**")
|
||||
exclude("**/propertybased/**")
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
tasks.register<Test>("testPropertyBased") {
|
||||
group = "verification"
|
||||
// include("**/propertybased/**")
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
tasks.register<Test>("testLongRunning") {
|
||||
group = "verification"
|
||||
// include("**/longrunning/**")
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
tasks {
|
||||
test {
|
||||
// Issue in gradle 7.3
|
||||
val test by getting(Test::class) {
|
||||
isScanForTestClasses = false
|
||||
// Only run tests from classes that end with "Test"
|
||||
include("**/*Test.class")
|
||||
include("**/*test.class")
|
||||
include("**/*Tests.class")
|
||||
exclude("**/ParserTest.class")
|
||||
|
||||
// Set teamcity env variable locally to run additional tests for leaks.
|
||||
// By default, this test runs on TC only, but this test doesn't take a lot of time,
|
||||
// so we can turn it on for local development
|
||||
if (environment["TEAMCITY_VERSION"] == null) {
|
||||
println("Set env TEAMCITY_VERSION to X to enable project leak checks from the platform")
|
||||
println("Set env TEAMCITY_VERSION to X")
|
||||
environment("TEAMCITY_VERSION" to "X")
|
||||
}
|
||||
}
|
||||
|
||||
systemProperty("ideavim.nvim.test", System.getProperty("nvim") ?: false)
|
||||
val testWithNeovim by getting(Test::class) {
|
||||
isScanForTestClasses = false
|
||||
// Only run tests from classes that end with "Test"
|
||||
include("**/*Test.class")
|
||||
include("**/*test.class")
|
||||
include("**/*Tests.class")
|
||||
exclude("**/ParserTest.class")
|
||||
exclude("**/longrunning/**")
|
||||
exclude("**/propertybased/**")
|
||||
}
|
||||
|
||||
val testPropertyBased by getting(Test::class) {
|
||||
isScanForTestClasses = false
|
||||
// Only run tests from classes that end with "Test"
|
||||
include("**/propertybased/*Test.class")
|
||||
include("**/propertybased/*test.class")
|
||||
include("**/propertybased/*Tests.class")
|
||||
}
|
||||
|
||||
val testLongRunning by getting(Test::class) {
|
||||
isScanForTestClasses = false
|
||||
// Only run tests from classes that end with "Test"
|
||||
include("**/longrunning/**/*Test.class")
|
||||
include("**/longrunning/**/*test.class")
|
||||
include("**/longrunning/**/*Tests.class")
|
||||
exclude("**/longrunning/**/ParserTest.class")
|
||||
}
|
||||
|
||||
compileJava {
|
||||
@@ -188,7 +253,6 @@ tasks {
|
||||
// allWarningsAsErrors = true
|
||||
}
|
||||
}
|
||||
|
||||
compileTestKotlin {
|
||||
kotlinOptions {
|
||||
jvmTarget = javaVersion
|
||||
@@ -196,18 +260,6 @@ tasks {
|
||||
// allWarningsAsErrors = true
|
||||
}
|
||||
}
|
||||
|
||||
downloadRobotServerPlugin {
|
||||
version.set(remoteRobotVersion)
|
||||
}
|
||||
|
||||
runIdeForUiTests {
|
||||
systemProperty("robot-server.port", "8082")
|
||||
systemProperty("ide.mac.message.dialogs.as.sheets", "false")
|
||||
systemProperty("jb.privacy.policy.text", "<!--999.999-->")
|
||||
systemProperty("jb.consents.confirmation.enabled", "false")
|
||||
systemProperty("ide.show.tips.on.startup.default.value", "false")
|
||||
}
|
||||
}
|
||||
|
||||
java {
|
||||
@@ -234,7 +286,6 @@ gradle.projectsEvaluated {
|
||||
|
||||
intellij {
|
||||
version.set(ideaVersion)
|
||||
type.set(ideaType)
|
||||
pluginName.set("IdeaVim")
|
||||
|
||||
updateSinceUntilBuild.set(false)
|
||||
@@ -246,6 +297,10 @@ intellij {
|
||||
}
|
||||
|
||||
tasks {
|
||||
downloadRobotServerPlugin {
|
||||
version.set(remoteRobotVersion)
|
||||
}
|
||||
|
||||
publishPlugin {
|
||||
channels.set(publishChannels.split(","))
|
||||
token.set(publishToken)
|
||||
@@ -257,6 +312,14 @@ tasks {
|
||||
password.set(providers.environmentVariable("PRIVATE_KEY_PASSWORD"))
|
||||
}
|
||||
|
||||
runIdeForUiTests {
|
||||
systemProperty("robot-server.port", "8082")
|
||||
systemProperty("ide.mac.message.dialogs.as.sheets", "false")
|
||||
systemProperty("jb.privacy.policy.text", "<!--999.999-->")
|
||||
systemProperty("jb.consents.confirmation.enabled", "false")
|
||||
systemProperty("ide.show.tips.on.startup.default.value", "false")
|
||||
}
|
||||
|
||||
runPluginVerifier {
|
||||
downloadDir.set("${project.buildDir}/pluginVerifier/ides")
|
||||
teamCityOutputFormat.set(true)
|
||||
@@ -308,6 +371,8 @@ tasks {
|
||||
val pluginVersion = version
|
||||
// Don't forget to update plugin.xml
|
||||
patchPluginXml {
|
||||
sinceBuild.set("233.11799.30")
|
||||
|
||||
// Get the latest available change notes from the changelog file
|
||||
changeNotes.set(
|
||||
provider {
|
||||
@@ -327,14 +392,29 @@ tasks {
|
||||
}
|
||||
}
|
||||
|
||||
// --- Linting
|
||||
|
||||
//ktlint {
|
||||
// version.set("0.48.2")
|
||||
//}
|
||||
|
||||
// --- Tests
|
||||
|
||||
tasks {
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
exclude("**/propertybased/**")
|
||||
exclude("**/longrunning/**")
|
||||
exclude("/ui/**")
|
||||
}
|
||||
}
|
||||
|
||||
tasks.register<Test>("testUi") {
|
||||
group = "verification"
|
||||
useJUnitPlatform()
|
||||
include("/ui/**")
|
||||
}
|
||||
|
||||
// --- Changelog
|
||||
|
||||
changelog {
|
||||
@@ -353,6 +433,16 @@ koverMerged {
|
||||
enable()
|
||||
}
|
||||
|
||||
kover {
|
||||
instrumentation {
|
||||
// set of test tasks names to exclude from instrumentation. The results of their execution will not be presented in the report
|
||||
excludeTasks += "testPropertyBased"
|
||||
excludeTasks += "testLongRunning"
|
||||
excludeTasks += "testWithNeovim"
|
||||
excludeTasks += "testUi"
|
||||
}
|
||||
}
|
||||
|
||||
// --- Slack notification
|
||||
|
||||
tasks.register("slackNotification") {
|
||||
@@ -458,7 +548,7 @@ val fixVersionsElementType = "VersionBundleElement"
|
||||
tasks.register("releaseActions") {
|
||||
group = "other"
|
||||
doLast {
|
||||
val tickets = getYoutrackTicketsByQuery("%23%7BReady+To+Release%7D%20and%20tag:%20%7BIdeaVim%20Released%20In%20EAP%7D%20")
|
||||
val tickets = getYoutrackTicketsByQuery("%23%7BReady+To+Release%7D")
|
||||
if (tickets.isNotEmpty()) {
|
||||
println("Updating statuses for tickets: $tickets")
|
||||
setYoutrackStatus(tickets, "Fixed")
|
||||
@@ -546,8 +636,7 @@ fun addReleaseToYoutrack(name: String): String {
|
||||
println("Creating new release version in YouTrack: $name")
|
||||
|
||||
return runBlocking {
|
||||
val response =
|
||||
client.post("https://youtrack.jetbrains.com/api/admin/projects/$vimProjectId/customFields/$fixVersionsFieldId/bundle/values?fields=id,name") {
|
||||
val response = client.post("https://youtrack.jetbrains.com/api/admin/projects/$vimProjectId/customFields/$fixVersionsFieldId/bundle/values?fields=id,name") {
|
||||
contentType(ContentType.Application.Json)
|
||||
accept(ContentType.Application.Json)
|
||||
val request = buildJsonObject {
|
||||
@@ -564,8 +653,7 @@ fun getVersionIdByName(name: String): String? {
|
||||
val client = httpClient()
|
||||
|
||||
return runBlocking {
|
||||
val response =
|
||||
client.get("https://youtrack.jetbrains.com/api/admin/projects/$vimProjectId/customFields/$fixVersionsFieldId/bundle/values?fields=id,name&query=$name")
|
||||
val response = client.get("https://youtrack.jetbrains.com/api/admin/projects/$vimProjectId/customFields/$fixVersionsFieldId/bundle/values?fields=id,name&query=$name")
|
||||
response.body<JsonArray>().singleOrNull()?.jsonObject?.get("id")?.jsonPrimitive?.content
|
||||
}
|
||||
}
|
||||
@@ -603,8 +691,7 @@ fun setYoutrackStatus(tickets: Collection<String>, status: String) {
|
||||
runBlocking {
|
||||
for (ticket in tickets) {
|
||||
println("Try to set $ticket to $status")
|
||||
val response =
|
||||
client.post("https://youtrack.jetbrains.com/api/issues/$ticket?fields=customFields(id,name,value(id,name))") {
|
||||
val response = client.post("https://youtrack.jetbrains.com/api/issues/$ticket?fields=customFields(id,name,value(id,name))") {
|
||||
contentType(ContentType.Application.Json)
|
||||
accept(ContentType.Application.Json)
|
||||
val request = buildJsonObject {
|
||||
@@ -643,8 +730,7 @@ fun setYoutrackFixVersion(tickets: Collection<String>, version: String) {
|
||||
runBlocking {
|
||||
for (ticket in tickets) {
|
||||
println("Try to set fix version $version for $ticket")
|
||||
val response =
|
||||
client.post("https://youtrack.jetbrains.com/api/issues/$ticket?fields=customFields(id,name,value(id,name))") {
|
||||
val response = client.post("https://youtrack.jetbrains.com/api/issues/$ticket?fields=customFields(id,name,value(id,name))") {
|
||||
contentType(ContentType.Application.Json)
|
||||
accept(ContentType.Application.Json)
|
||||
val request = buildJsonObject {
|
||||
@@ -682,8 +768,7 @@ fun getYoutrackStatus(ticket: String): String {
|
||||
val client = httpClient()
|
||||
|
||||
return runBlocking {
|
||||
val response =
|
||||
client.get("https://youtrack.jetbrains.com/api/issues/$ticket/customFields/123-129?fields=value(name)")
|
||||
val response = client.get("https://youtrack.jetbrains.com/api/issues/$ticket/customFields/123-129?fields=value(name)")
|
||||
response.body<JsonObject>()["value"]!!.jsonObject.getValue("name").jsonPrimitive.content
|
||||
}
|
||||
}
|
||||
|
@@ -8,17 +8,16 @@
|
||||
|
||||
# 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
|
||||
ideaType=IC
|
||||
downloadIdeaSources=true
|
||||
instrumentPluginCode=true
|
||||
version=chylex-28
|
||||
version=SNAPSHOT
|
||||
javaVersion=17
|
||||
remoteRobotVersion=0.11.22
|
||||
remoteRobotVersion=0.11.21
|
||||
antlrVersion=4.10.1
|
||||
|
||||
kotlin.incremental.useClasspathSnapshot=false
|
||||
|
||||
# Please don't forget to update kotlin version in buildscript section
|
||||
# Also update kotlinxSerializationVersion version
|
||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -1,7 +1,6 @@
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
|
||||
networkTimeout=10000
|
||||
validateDistributionUrl=true
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
|
5
gradlew
vendored
5
gradlew
vendored
@@ -130,14 +130,11 @@ location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD=java
|
||||
if ! command -v java >/dev/null 2>&1
|
||||
then
|
||||
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||
|
@@ -13,8 +13,4 @@ include 'vim-engine'
|
||||
include 'scripts'
|
||||
include 'annotation-processors'
|
||||
include 'tests:java-tests'
|
||||
include 'tests:property-tests'
|
||||
include 'tests:long-running-tests'
|
||||
include 'tests:ui-ij-tests'
|
||||
include 'tests:ui-py-tests'
|
||||
include 'tests:ui-fixtures'
|
||||
|
||||
|
@@ -217,8 +217,6 @@ private object FileTypePatterns {
|
||||
|
||||
return if (fileTypeName in htmlLikeFileTypes) {
|
||||
this.htmlPatterns
|
||||
} else if (fileTypeName == "JAVA" || fileExtension == "java") {
|
||||
this.javaPatterns
|
||||
} else if (fileTypeName == "Ruby" || fileExtension == "rb") {
|
||||
this.rubyPatterns
|
||||
} else if (fileTypeName == "RHTML" || fileExtension == "erb") {
|
||||
@@ -233,7 +231,7 @@ private object FileTypePatterns {
|
||||
} else if (fileTypeName == "CMakeLists.txt" || fileName == "CMakeLists") {
|
||||
this.cMakePatterns
|
||||
} else {
|
||||
this.htmlPatterns
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,7 +242,6 @@ private object FileTypePatterns {
|
||||
)
|
||||
|
||||
private val htmlPatterns = createHtmlPatterns()
|
||||
private val javaPatterns = createJavaPatterns()
|
||||
private val rubyPatterns = createRubyPatterns()
|
||||
private val rubyAndHtmlPatterns = rubyPatterns + htmlPatterns
|
||||
private val phpPatterns = createPhpPatterns()
|
||||
@@ -274,14 +271,6 @@ private object FileTypePatterns {
|
||||
)
|
||||
}
|
||||
|
||||
private fun createJavaPatterns(): LanguagePatterns {
|
||||
return (
|
||||
LanguagePatterns("\\b(?<!else\\s+)if\\b", "\\belse\\s+if\\b", "\\belse(?!\\s+if)\\b") +
|
||||
LanguagePatterns("\\bdo\\b", "\\bwhile\\b") +
|
||||
LanguagePatterns("\\btry\\b", "\\bcatch\\b", "\\bfinally\\b")
|
||||
)
|
||||
}
|
||||
|
||||
private fun createRubyPatterns(): LanguagePatterns {
|
||||
// Original patterns: https://github.com/vim/vim/blob/master/runtime/ftplugin/ruby.vim
|
||||
// We use non-capturing groups (?:) since we don't need any back refs. The \\b marker takes care of word boundaries.
|
||||
|
@@ -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 {
|
||||
|
@@ -11,8 +11,8 @@ package com.maddyhome.idea.vim.extension.paragraphmotion
|
||||
import com.intellij.openapi.editor.Caret
|
||||
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||
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.normalizeOffset
|
||||
import com.maddyhome.idea.vim.command.MappingMode
|
||||
import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.extension.ExtensionHandler
|
||||
@@ -45,7 +45,8 @@ internal class ParagraphMotion : VimExtension {
|
||||
}
|
||||
|
||||
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) }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -9,6 +9,7 @@
|
||||
package com.maddyhome.idea.vim.extension.sneak
|
||||
|
||||
import com.intellij.openapi.actionSystem.DataContext
|
||||
import com.intellij.openapi.application.ApplicationManager
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.editor.ScrollType
|
||||
import com.intellij.openapi.editor.colors.EditorColors
|
||||
@@ -18,7 +19,6 @@ import com.intellij.openapi.editor.markup.HighlighterTargetArea
|
||||
import com.intellij.openapi.editor.markup.RangeHighlighter
|
||||
import com.intellij.openapi.editor.markup.TextAttributes
|
||||
import com.intellij.openapi.util.Disposer
|
||||
import com.maddyhome.idea.vim.VimPlugin
|
||||
import com.maddyhome.idea.vim.VimProjectService
|
||||
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||
import com.maddyhome.idea.vim.api.VimEditor
|
||||
@@ -30,16 +30,16 @@ import com.maddyhome.idea.vim.common.TextRange
|
||||
import com.maddyhome.idea.vim.extension.ExtensionHandler
|
||||
import com.maddyhome.idea.vim.extension.VimExtension
|
||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade
|
||||
import com.maddyhome.idea.vim.extension.VimExtensionFacade.putKeyMapping
|
||||
import com.maddyhome.idea.vim.extension.VimExtensionHandler
|
||||
import com.maddyhome.idea.vim.helper.StrictMode
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
import java.awt.Font
|
||||
import java.awt.event.KeyEvent
|
||||
import javax.swing.Timer
|
||||
import java.util.concurrent.Executors
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
|
||||
private const val DEFAULT_HIGHLIGHT_DURATION_SNEAK = 300
|
||||
private const val DEFAULT_HIGHLIGHT_DURATION_SNEAK: Long = 300
|
||||
|
||||
// By [Mikhail Levchenko](https://github.com/Mishkun)
|
||||
// Original repository with the plugin: https://github.com/Mishkun/ideavim-sneak
|
||||
@@ -250,13 +250,11 @@ internal class IdeaVimSneakExtension : VimExtension {
|
||||
}
|
||||
|
||||
private fun setClearHighlightRangeTimer(highlighter: RangeHighlighter) {
|
||||
val timer = Timer(DEFAULT_HIGHLIGHT_DURATION_SNEAK) {
|
||||
if (editor?.isDisposed != true) {
|
||||
editor?.markupModel?.removeHighlighter(highlighter)
|
||||
Executors.newSingleThreadScheduledExecutor().schedule({
|
||||
ApplicationManager.getApplication().invokeLater {
|
||||
editor?.markupModel?.removeHighlighter(highlighter) ?: StrictMode.fail("Highlighters without an editor")
|
||||
}
|
||||
}
|
||||
timer.isRepeats = false
|
||||
timer.start()
|
||||
}, DEFAULT_HIGHLIGHT_DURATION_SNEAK, TimeUnit.MILLISECONDS)
|
||||
}
|
||||
|
||||
private fun getHighlightTextAttributes() = TextAttributes(
|
||||
@@ -281,41 +279,13 @@ private fun VimExtension.mapToFunctionAndProvideKeys(keys: String, handler: Exte
|
||||
handler,
|
||||
false
|
||||
)
|
||||
VimExtensionFacade.putExtensionHandlerMapping(
|
||||
VimExtensionFacade.putKeyMapping(
|
||||
MappingMode.NXO,
|
||||
injector.parser.parseKeys(commandFromOriginalPlugin(keys)),
|
||||
injector.parser.parseKeys(keys),
|
||||
owner,
|
||||
handler,
|
||||
false
|
||||
)
|
||||
|
||||
// This is a combination to meet the following requirements:
|
||||
// - Now we should support mappings from sneak `Sneak_s` and mappings from the previous version of the plugin `(sneak-s)`
|
||||
// - The shortcut should not be registered if any of these mappings is overridden in .ideavimrc
|
||||
// - The shortcut should not be registered if some other shortcut for this key exists
|
||||
val fromKeys = injector.parser.parseKeys(keys)
|
||||
val filteredModes = MappingMode.NXO.filterNotTo(HashSet()) {
|
||||
VimPlugin.getKey().hasmapto(it, injector.parser.parseKeys(command(keys)))
|
||||
}
|
||||
val filteredModes2 = MappingMode.NXO.filterNotTo(HashSet()) {
|
||||
VimPlugin.getKey().hasmapto(it, injector.parser.parseKeys(commandFromOriginalPlugin(keys)))
|
||||
}
|
||||
val filteredFromModes = MappingMode.NXO.filterNotTo(HashSet()) {
|
||||
injector.keyGroup.hasmapfrom(it, fromKeys)
|
||||
}
|
||||
|
||||
val doubleFiltered = MappingMode.NXO
|
||||
.filter { it in filteredModes2 && it in filteredModes && it in filteredFromModes }
|
||||
.toSet()
|
||||
putKeyMapping(doubleFiltered, fromKeys, owner, injector.parser.parseKeys(command(keys)), true)
|
||||
putKeyMapping(
|
||||
doubleFiltered,
|
||||
fromKeys,
|
||||
owner,
|
||||
injector.parser.parseKeys(commandFromOriginalPlugin(keys)),
|
||||
injector.parser.parseKeys(command(keys)),
|
||||
true
|
||||
)
|
||||
}
|
||||
|
||||
private fun command(keys: String) = "<Plug>(sneak-$keys)"
|
||||
private fun commandFromOriginalPlugin(keys: String) = "<Plug>Sneak_$keys"
|
||||
|
@@ -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,7 +13,6 @@ import com.intellij.openapi.editor.Editor
|
||||
import com.maddyhome.idea.vim.VimPlugin
|
||||
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimChangeGroup
|
||||
import com.maddyhome.idea.vim.api.VimEditor
|
||||
import com.maddyhome.idea.vim.api.endsWithNewLine
|
||||
import com.maddyhome.idea.vim.api.getLeadingCharacterOffset
|
||||
@@ -32,10 +31,7 @@ import com.maddyhome.idea.vim.extension.VimExtensionFacade.putExtensionHandlerMa
|
||||
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.helper.runWithEveryCaretAndRestore
|
||||
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.vim
|
||||
import com.maddyhome.idea.vim.options.helpers.ClipboardOptionHelper
|
||||
@@ -84,7 +80,7 @@ internal class VimSurroundExtension : VimExtension {
|
||||
override val isRepeatable = true
|
||||
|
||||
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
|
||||
setOperatorFunction(Operator(supportsMultipleCursors = false, count = 1)) // TODO
|
||||
setOperatorFunction(Operator())
|
||||
executeNormalWithoutMapping(injector.parser.parseKeys("g@"), editor.ij)
|
||||
}
|
||||
}
|
||||
@@ -105,7 +101,7 @@ internal class VimSurroundExtension : VimExtension {
|
||||
val lastNonWhiteSpaceOffset = getLastNonWhitespaceCharacterOffset(editor.text(), lineStartOffset, lineEndOffset)
|
||||
if (lastNonWhiteSpaceOffset != null) {
|
||||
val range = TextRange(lineStartOffset, lastNonWhiteSpaceOffset + 1)
|
||||
performSurround(pair, range, it, count = operatorArguments.count1)
|
||||
performSurround(pair, range, it)
|
||||
}
|
||||
// it.moveToOffset(lineStartOffset)
|
||||
}
|
||||
@@ -125,13 +121,15 @@ internal class VimSurroundExtension : VimExtension {
|
||||
|
||||
private class VSurroundHandler : ExtensionHandler {
|
||||
override fun execute(editor: VimEditor, context: ExecutionContext, operatorArguments: OperatorArguments) {
|
||||
val selectionStart = editor.ij.caretModel.primaryCaret.selectionStart
|
||||
// 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
|
||||
}
|
||||
runWriteAction {
|
||||
// Leave visual mode
|
||||
executeNormalWithoutMapping(injector.parser.parseKeys("<Esc>"), editor.ij)
|
||||
editor.ij.caretModel.moveToOffset(selectionStart)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -152,10 +150,6 @@ internal class VimSurroundExtension : VimExtension {
|
||||
|
||||
companion object {
|
||||
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
|
||||
val surroundings = editor.sortedCarets()
|
||||
.map {
|
||||
@@ -263,40 +257,19 @@ internal class VimSurroundExtension : VimExtension {
|
||||
}
|
||||
}
|
||||
|
||||
private class Operator(private val supportsMultipleCursors: Boolean, private val count: Int) : OperatorFunction {
|
||||
override fun apply(vimEditor: VimEditor, context: ExecutionContext, selectionType: SelectionType?): Boolean {
|
||||
val editor = vimEditor.ij
|
||||
val c = getChar(editor)
|
||||
private class Operator : OperatorFunction {
|
||||
override fun apply(editor: VimEditor, context: ExecutionContext, selectionType: SelectionType?): Boolean {
|
||||
val ijEditor = editor.ij
|
||||
val c = getChar(ijEditor)
|
||||
if (c.code == 0) return true
|
||||
|
||||
val pair = getOrInputPair(c, editor) ?: 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) {
|
||||
val pair = getOrInputPair(c, ijEditor) ?: return false
|
||||
// XXX: Will it work with line-wise or block-wise selections?
|
||||
val primaryCaret = editor.caretModel.primaryCaret
|
||||
val range = getSurroundRange(primaryCaret.vim)
|
||||
if (range != null) {
|
||||
val start = RepeatedCharSequence.of(pair.first, count)
|
||||
val end = RepeatedCharSequence.of(pair.second, count)
|
||||
change.insertText(IjVimEditor(editor), IjVimCaret(primaryCaret), range.startOffset, start)
|
||||
change.insertText(IjVimEditor(editor), IjVimCaret(primaryCaret), range.endOffset + start.length, end)
|
||||
}
|
||||
val range = getSurroundRange(editor.currentCaret()) ?: return false
|
||||
performSurround(pair, range, editor.currentCaret(), selectionType == SelectionType.LINE_WISE)
|
||||
// Jump back to start
|
||||
executeNormalWithoutMapping(injector.parser.parseKeys("`["), ijEditor)
|
||||
return true
|
||||
}
|
||||
|
||||
private fun getSurroundRange(caret: VimCaret): TextRange? {
|
||||
@@ -381,15 +354,15 @@ private fun getChar(editor: Editor): Char {
|
||||
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 {
|
||||
val editor = caret.editor
|
||||
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 hasNewLine = editor.endsWithNewLine()
|
||||
val rightSurround = (if (tagsOnNewLines) {
|
||||
val rightSurround = if (tagsOnNewLines) {
|
||||
if (isEOF && !hasNewLine) {
|
||||
"\n" + pair.second
|
||||
} else {
|
||||
@@ -397,7 +370,7 @@ private fun performSurround(pair: Pair<String, String>, range: TextRange, caret:
|
||||
}
|
||||
} else {
|
||||
pair.second
|
||||
}).let { RepeatedCharSequence.of(it, count) }
|
||||
}
|
||||
|
||||
change.insertText(editor, caret, range.startOffset, leftSurround)
|
||||
change.insertText(editor, caret, range.endOffset + leftSurround.length, rightSurround)
|
||||
|
@@ -78,6 +78,7 @@ import java.math.BigInteger
|
||||
import java.util.*
|
||||
import java.util.function.Consumer
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
|
||||
/**
|
||||
* Provides all the insert/replace related functionality
|
||||
@@ -394,7 +395,6 @@ public class ChangeGroup : VimChangeGroupBase() {
|
||||
context: ExecutionContext,
|
||||
range: TextRange,
|
||||
) {
|
||||
val startPos = editor.offsetToBufferPosition(caret.offset.point)
|
||||
val startOffset = editor.getLineStartForOffset(range.startOffset)
|
||||
val endOffset = editor.getLineEndForOffset(range.endOffset)
|
||||
val ijEditor = (editor as IjVimEditor).editor
|
||||
@@ -419,7 +419,11 @@ public class ChangeGroup : VimChangeGroupBase() {
|
||||
}
|
||||
}
|
||||
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)
|
||||
}
|
||||
if (project != null) {
|
||||
@@ -531,7 +535,7 @@ public class ChangeGroup : VimChangeGroupBase() {
|
||||
val soff = editor.getLineStartOffset(l)
|
||||
val eoff = editor.getLineEndOffset(l, true)
|
||||
val woff = injector.motion.moveCaretToLineStartSkipLeading(editor, l)
|
||||
val col = editor.offsetToBufferPosition(woff).column
|
||||
val col = editor.offsetToVisualPosition(woff).column
|
||||
val limit = max(0.0, (col + dir * indentConfig.getTotalIndent(count)).toDouble())
|
||||
.toInt()
|
||||
if (col > 0 || soff != eoff) {
|
||||
|
@@ -83,7 +83,7 @@ public object IjOptions {
|
||||
public val trackactionids: ToggleOption = addOption(ToggleOption("trackactionids", GLOBAL, "tai", false))
|
||||
public val unifyjumps: ToggleOption = addOption(ToggleOption("unifyjumps", GLOBAL, "unifyjumps", true))
|
||||
public val visualdelay: UnsignedNumberOption = addOption(UnsignedNumberOption("visualdelay", GLOBAL, "visualdelay", 100))
|
||||
public val oldundo: ToggleOption = addOption(ToggleOption("oldundo", GLOBAL, "oldundo", true, isTemporary = true))
|
||||
public val oldundo: ToggleOption = addOption(ToggleOption("oldundo", GLOBAL, "oldundo", false, isTemporary = true))
|
||||
public val vimscriptFunctionAnnotation: ToggleOption = addOption(ToggleOption("vimscriptfunctionannotation", GLOBAL, "vimscriptfunctionannotation", true, isTemporary = true))
|
||||
public val commandOrMotionAnnotation: ToggleOption = addOption(ToggleOption("commandormotionannotation", GLOBAL, "commandormotionannotation", true, isTemporary = true))
|
||||
public val showmodewidget: ToggleOption = addOption(ToggleOption("showmodewidget", GLOBAL, "showmodewidget", false, isTemporary = true))
|
||||
|
@@ -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 }
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
@@ -21,7 +21,6 @@ import com.maddyhome.idea.vim.api.injector
|
||||
import com.maddyhome.idea.vim.helper.MessageHelper.message
|
||||
import com.maddyhome.idea.vim.macro.VimMacroBase
|
||||
import com.maddyhome.idea.vim.newapi.IjVimEditor
|
||||
import com.maddyhome.idea.vim.newapi.ij
|
||||
|
||||
/**
|
||||
* Used to handle playback of macros
|
||||
@@ -91,9 +90,6 @@ internal class MacroGroup : VimMacroBase() {
|
||||
} finally {
|
||||
keyStack.removeFirst()
|
||||
}
|
||||
if (!isInternalMacro) {
|
||||
MacroAutoImport.run(editor.ij, context.ij)
|
||||
}
|
||||
}
|
||||
|
||||
if (isInternalMacro) {
|
||||
|
@@ -214,8 +214,8 @@ public class SearchGroup extends IjVimSearchGroup implements PersistentStateComp
|
||||
* @param patternOffset The pattern offset, e.g. `/{pattern}/{offset}`
|
||||
* @param direction The direction to search
|
||||
*/
|
||||
@Override
|
||||
public void setLastSearchState(@SuppressWarnings("unused") @NotNull VimEditor editor, @NotNull String pattern,
|
||||
@TestOnly
|
||||
public void setLastSearchState(@SuppressWarnings("unused") @NotNull Editor editor, @NotNull String pattern,
|
||||
@NotNull String patternOffset, Direction direction) {
|
||||
if (globalIjOptions(injector).getUseNewRegex()) {
|
||||
super.setLastSearchState(pattern, patternOffset, direction);
|
||||
|
@@ -329,7 +329,7 @@ public class EditorHelper {
|
||||
|
||||
final int offset = y - ((screenHeight - lineHeight) / lineHeight / 2 * lineHeight);
|
||||
@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);
|
||||
|
||||
// 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.openapi.editor.Caret
|
||||
import com.intellij.openapi.editor.CaretState
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.editor.ex.util.EditorUtil
|
||||
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.group.IjOptionConstants
|
||||
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 javax.swing.JComponent
|
||||
import javax.swing.JTable
|
||||
@@ -96,41 +93,3 @@ internal val Caret.vimLine: Int
|
||||
*/
|
||||
internal val Editor.vimLine: Int
|
||||
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.options
|
||||
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.getApproximateScreenWidth
|
||||
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.scrollVisualLineToTopOfScreen
|
||||
import com.maddyhome.idea.vim.newapi.vim
|
||||
import com.maddyhome.idea.vim.state.VimStateMachine
|
||||
import kotlin.math.max
|
||||
import kotlin.math.min
|
||||
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.
|
||||
val topLine = getVisualLineAtTopOfScreen(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
|
||||
val scrollOffset = injector.options(vimEditor).scrolloff
|
||||
|
@@ -9,7 +9,6 @@
|
||||
package com.maddyhome.idea.vim.helper;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.intellij.codeInsight.daemon.impl.DaemonCodeAnalyzerEx;
|
||||
import com.intellij.lang.CodeDocumentationAwareCommenter;
|
||||
import com.intellij.lang.Commenter;
|
||||
import com.intellij.lang.Language;
|
||||
@@ -17,30 +16,22 @@ import com.intellij.lang.LanguageCommenters;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Caret;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiComment;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.spellchecker.SpellCheckerSeveritiesProvider;
|
||||
import com.maddyhome.idea.vim.VimPlugin;
|
||||
import com.maddyhome.idea.vim.api.EngineEditorHelperKt;
|
||||
import com.maddyhome.idea.vim.api.VimEditor;
|
||||
import com.maddyhome.idea.vim.regexp.*;
|
||||
import com.maddyhome.idea.vim.regexp.match.VimMatchResult;
|
||||
import com.maddyhome.idea.vim.state.mode.Mode;
|
||||
import com.maddyhome.idea.vim.state.VimStateMachine;
|
||||
import com.maddyhome.idea.vim.common.CharacterPosition;
|
||||
import com.maddyhome.idea.vim.common.Direction;
|
||||
import com.maddyhome.idea.vim.common.TextRange;
|
||||
import com.maddyhome.idea.vim.newapi.IjVimCaret;
|
||||
import com.maddyhome.idea.vim.newapi.IjVimEditor;
|
||||
import com.maddyhome.idea.vim.regexp.CharPointer;
|
||||
import com.maddyhome.idea.vim.regexp.RegExp;
|
||||
import com.maddyhome.idea.vim.state.VimStateMachine;
|
||||
import com.maddyhome.idea.vim.state.mode.Mode;
|
||||
import it.unimi.dsi.fastutil.ints.IntComparator;
|
||||
import it.unimi.dsi.fastutil.ints.IntIterator;
|
||||
import it.unimi.dsi.fastutil.ints.IntRBTreeSet;
|
||||
import it.unimi.dsi.fastutil.ints.IntSortedSet;
|
||||
import kotlin.Pair;
|
||||
import org.jetbrains.annotations.Contract;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -1582,42 +1573,6 @@ public class SearchHelper {
|
||||
return PsiHelper.findMethodEnd(editor, caret.getOffset(), count);
|
||||
}
|
||||
|
||||
public static int findMisspelledWords(@NotNull Editor editor,
|
||||
int startOffset,
|
||||
int endOffset,
|
||||
int skipCount,
|
||||
IntComparator offsetOrdering) {
|
||||
Project project = editor.getProject();
|
||||
if (project == null) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
IntSortedSet offsets = new IntRBTreeSet(offsetOrdering);
|
||||
DaemonCodeAnalyzerEx.processHighlights(editor.getDocument(), project, SpellCheckerSeveritiesProvider.TYPO,
|
||||
startOffset, endOffset, highlight -> {
|
||||
if (highlight.getSeverity() == SpellCheckerSeveritiesProvider.TYPO) {
|
||||
int offset = highlight.getStartOffset();
|
||||
if (offset >= startOffset && offset <= endOffset) {
|
||||
offsets.add(offset);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
if (offsets.isEmpty()) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (skipCount >= offsets.size()) {
|
||||
return offsets.lastInt();
|
||||
}
|
||||
else {
|
||||
IntIterator offsetIterator = offsets.iterator();
|
||||
offsetIterator.skip(skipCount);
|
||||
return offsetIterator.nextInt();
|
||||
}
|
||||
}
|
||||
|
||||
private static @NotNull String parseMatchPairsOption(final VimEditor vimEditor) {
|
||||
List<String> pairs = options(injector, vimEditor).getMatchpairs();
|
||||
StringBuilder res = new StringBuilder();
|
||||
|
@@ -14,7 +14,6 @@ import com.intellij.openapi.command.CommandProcessor
|
||||
import com.intellij.openapi.command.undo.UndoManager
|
||||
import com.intellij.openapi.components.Service
|
||||
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.VimEditor
|
||||
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.newapi.globalIjOptions
|
||||
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
|
||||
|
||||
/**
|
||||
@@ -42,7 +39,6 @@ internal class UndoRedoHelper : UndoRedoBase() {
|
||||
|
||||
if (injector.globalIjOptions().oldundo) {
|
||||
SelectionVimListenerSuppressor.lock().use { undoManager.undo(fileEditor) }
|
||||
restoreVisualMode(editor)
|
||||
} else {
|
||||
// TODO refactor me after VIM-308 when restoring selection and caret movement will be ignored by undo
|
||||
editor.runWithChangeTracking {
|
||||
@@ -78,7 +74,6 @@ internal class UndoRedoHelper : UndoRedoBase() {
|
||||
if (undoManager.isRedoAvailable(fileEditor)) {
|
||||
if (injector.globalIjOptions().oldundo) {
|
||||
SelectionVimListenerSuppressor.lock().use { undoManager.redo(fileEditor) }
|
||||
restoreVisualMode(editor)
|
||||
} else {
|
||||
undoManager.redo(fileEditor)
|
||||
CommandProcessor.getInstance().runUndoTransparentAction {
|
||||
@@ -136,21 +131,4 @@ internal class UndoRedoHelper : UndoRedoBase() {
|
||||
val hasChanges: Boolean
|
||||
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()
|
||||
}
|
||||
}
|
@@ -27,7 +27,6 @@ import com.intellij.openapi.actionSystem.CommonDataKeys
|
||||
import com.intellij.openapi.actionSystem.ex.AnActionListener
|
||||
import com.intellij.openapi.actionSystem.impl.ProxyShortcutSet
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.openapi.editor.impl.ScrollingModelImpl
|
||||
import com.intellij.openapi.project.DumbAwareToggleAction
|
||||
import com.intellij.openapi.util.TextRange
|
||||
import com.maddyhome.idea.vim.KeyHandler
|
||||
@@ -57,7 +56,6 @@ internal object IdeaSpecifics {
|
||||
private val surrounderAction =
|
||||
"com.intellij.codeInsight.generation.surroundWith.SurroundWithHandler\$InvokeSurrounderAction"
|
||||
private var editor: Editor? = null
|
||||
private var caretOffset = -1
|
||||
private var completionPrevDocumentLength: Int? = null
|
||||
private var completionPrevDocumentOffset: Int? = null
|
||||
override fun beforeActionPerformed(action: AnAction, event: AnActionEvent) {
|
||||
@@ -66,7 +64,6 @@ internal object IdeaSpecifics {
|
||||
val hostEditor = event.dataContext.getData(CommonDataKeys.HOST_EDITOR)
|
||||
if (hostEditor != null) {
|
||||
editor = hostEditor
|
||||
caretOffset = hostEditor.caretModel.offset
|
||||
}
|
||||
|
||||
val isVimAction = (action as? AnActionWrapper)?.delegate is VimShortcutKeyAction
|
||||
@@ -98,8 +95,7 @@ internal object IdeaSpecifics {
|
||||
if (VimPlugin.isNotEnabled()) return
|
||||
|
||||
val editor = editor
|
||||
if (editor != null) {
|
||||
if (action is ChooseItemAction && editor.vimStateMachine?.isRecording == true) {
|
||||
if (editor != null && action is ChooseItemAction && editor.vimStateMachine?.isRecording == true) {
|
||||
val prevDocumentLength = completionPrevDocumentLength
|
||||
val prevDocumentOffset = completionPrevDocumentOffset
|
||||
|
||||
@@ -126,28 +122,16 @@ internal object IdeaSpecifics {
|
||||
)
|
||||
}
|
||||
) {
|
||||
val commandState = editor.vim.vimStateMachine
|
||||
editor?.let {
|
||||
val commandState = it.vim.vimStateMachine
|
||||
commandState.mode = Mode.NORMAL()
|
||||
VimPlugin.getChange().insertBeforeCursor(editor.vim, event.dataContext.vim)
|
||||
KeyHandler.getInstance().reset(editor.vim)
|
||||
VimPlugin.getChange().insertBeforeCursor(it.vim, event.dataContext.vim)
|
||||
KeyHandler.getInstance().reset(it.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)
|
||||
}
|
||||
}
|
||||
|
||||
this.editor = null
|
||||
this.caretOffset = -1
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -66,13 +66,16 @@ import com.maddyhome.idea.vim.group.IjOptions
|
||||
import com.maddyhome.idea.vim.group.MotionGroup
|
||||
import com.maddyhome.idea.vim.group.OptionGroup
|
||||
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.VimVisualTimer
|
||||
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.keyCheckRequests
|
||||
import com.maddyhome.idea.vim.helper.GuicursorChangeListener
|
||||
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.exitVisualMode
|
||||
import com.maddyhome.idea.vim.helper.forceBarCursor
|
||||
@@ -89,8 +92,6 @@ import com.maddyhome.idea.vim.listener.MouseEventsDataHolder.skipNDragEvents
|
||||
import com.maddyhome.idea.vim.listener.VimListenerManager.EditorListeners.add
|
||||
import com.maddyhome.idea.vim.newapi.IjVimEditor
|
||||
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.mode
|
||||
import com.maddyhome.idea.vim.state.mode.selectionType
|
||||
@@ -304,16 +305,6 @@ internal object VimListenerManager {
|
||||
class VimFileEditorManagerListener : FileEditorManagerListener {
|
||||
override fun selectionChanged(event: FileEditorManagerEvent) {
|
||||
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)
|
||||
FileGroup.fileEditorManagerSelectionChangedCallback(event)
|
||||
VimPlugin.getSearch().fileEditorManagerSelectionChangedCallback(event)
|
||||
@@ -378,6 +369,8 @@ internal object VimListenerManager {
|
||||
|
||||
event.editor.putUserData(openingEditorKey, OpeningEditor(openingEditor, owningEditorWindow, isPreview, canBeReused))
|
||||
}
|
||||
|
||||
VimStandalonePluginUpdateChecker.instance.pluginUsed()
|
||||
}
|
||||
|
||||
override fun editorReleased(event: EditorFactoryEvent) {
|
||||
@@ -440,6 +433,8 @@ internal object VimListenerManager {
|
||||
}
|
||||
|
||||
private object EditorSelectionHandler : SelectionListener {
|
||||
private var myMakingChanges = false
|
||||
|
||||
/**
|
||||
* This event is executed for each caret using [com.intellij.openapi.editor.CaretModel.runForEachCaret]
|
||||
*/
|
||||
@@ -488,9 +483,22 @@ internal object VimListenerManager {
|
||||
IdeaSelectionControl.controlNonVimSelectionChange(editor)
|
||||
}
|
||||
|
||||
if (document is DocumentEx && document.isInEventsHandling) {
|
||||
if (myMakingChanges || document is DocumentEx && document.isInEventsHandling) {
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -32,7 +32,7 @@ import com.maddyhome.idea.vim.vimscript.parser.VimscriptParser.parseExpression
|
||||
import org.jetbrains.annotations.TestOnly
|
||||
import javax.swing.KeyStroke
|
||||
|
||||
public abstract class IjVimSearchGroup : VimSearchGroupBase() {
|
||||
public open class IjVimSearchGroup : VimSearchGroupBase() {
|
||||
|
||||
init {
|
||||
// TODO: Investigate migrating these listeners to use the effective value change listener
|
||||
|
@@ -29,8 +29,6 @@ import com.maddyhome.idea.vim.helper.checkInString
|
||||
import com.maddyhome.idea.vim.helper.fileSize
|
||||
import com.maddyhome.idea.vim.state.VimStateMachine.Companion.getInstance
|
||||
import com.maddyhome.idea.vim.state.mode.Mode.VISUAL
|
||||
import it.unimi.dsi.fastutil.ints.IntComparator
|
||||
import it.unimi.dsi.fastutil.ints.IntComparators
|
||||
import java.util.*
|
||||
import java.util.function.Function
|
||||
import java.util.regex.Pattern
|
||||
@@ -691,26 +689,4 @@ internal class IjVimSearchHelper : VimSearchHelperBase() {
|
||||
// End offset exclusive
|
||||
return TextRange(bstart, bend + 1)
|
||||
}
|
||||
|
||||
override fun findMisspelledWord(editor: VimEditor, caret: ImmutableVimCaret, count: Int): Int {
|
||||
val startOffset: Int
|
||||
val endOffset: Int
|
||||
val skipCount: Int
|
||||
val offsetOrdering: IntComparator
|
||||
|
||||
if (count < 0) {
|
||||
startOffset = 0
|
||||
endOffset = caret.offset.point - 1
|
||||
skipCount = -count - 1
|
||||
offsetOrdering = IntComparators.OPPOSITE_COMPARATOR
|
||||
}
|
||||
else {
|
||||
startOffset = caret.offset.point + 1
|
||||
endOffset = editor.ij.document.textLength
|
||||
skipCount = count - 1
|
||||
offsetOrdering = IntComparators.NATURAL_COMPARATOR
|
||||
}
|
||||
|
||||
return SearchHelper.findMisspelledWords(editor.ij, startOffset, endOffset, skipCount, offsetOrdering)
|
||||
}
|
||||
}
|
||||
|
@@ -333,7 +333,7 @@
|
||||
* |[m| {@link com.maddyhome.idea.vim.action.motion.text.MotionMethodPreviousStartAction}
|
||||
* |[p| {@link com.maddyhome.idea.vim.action.copy.PutVisualTextAfterCursorNoIndentAction}
|
||||
* |[p| {@link com.maddyhome.idea.vim.action.copy.PutTextAfterCursorNoIndentAction}
|
||||
* |[s| {@link com.maddyhome.idea.vim.action.motion.text.MotionMisspelledWordPreviousAction}
|
||||
* |[s| TO BE IMPLEMENTED
|
||||
* |[z| TO BE IMPLEMENTED
|
||||
* |[{| {@link com.maddyhome.idea.vim.action.motion.text.MotionUnmatchedBraceOpenAction}
|
||||
* |]_CTRL-D| TO BE IMPLEMENTED
|
||||
@@ -358,7 +358,7 @@
|
||||
* |]m| {@link com.maddyhome.idea.vim.action.motion.text.MotionMethodNextStartAction}
|
||||
* |]p| {@link com.maddyhome.idea.vim.action.copy.PutVisualTextAfterCursorNoIndentAction}
|
||||
* |]p| {@link com.maddyhome.idea.vim.action.copy.PutTextAfterCursorNoIndentAction}
|
||||
* |]s| {@link com.maddyhome.idea.vim.action.motion.text.MotionMisspelledWordNextAction}
|
||||
* |]s| TO BE IMPLEMENTED
|
||||
* |]z| TO BE IMPLEMENTED
|
||||
* |]}| {@link com.maddyhome.idea.vim.action.motion.text.MotionUnmatchedBraceCloseAction}
|
||||
*
|
||||
|
@@ -15,7 +15,7 @@ import com.intellij.internal.statistic.service.fus.collectors.CounterUsagesColle
|
||||
|
||||
internal class ActionTracker : CounterUsagesCollector() {
|
||||
companion object {
|
||||
private val GROUP = EventLogGroup("vim.actions", 1, "FUS")
|
||||
private val GROUP = EventLogGroup("vim.actions", 1)
|
||||
private val TRACKED_ACTIONS = GROUP.registerEvent(
|
||||
"tracked",
|
||||
EventFields.StringValidatedByCustomRule("action_id", ActionRuleValidator::class.java),
|
||||
|
@@ -48,7 +48,7 @@ internal class OptionsState : ApplicationUsagesCollector() {
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val GROUP = EventLogGroup("vim.options", 1, "FUS")
|
||||
private val GROUP = EventLogGroup("vim.options", 1)
|
||||
|
||||
private val IDEAJOIN = BooleanEventField(IjOptions.ideajoin.name)
|
||||
private val IDEAMARKS = BooleanEventField(IjOptions.ideamarks.name)
|
||||
|
@@ -31,7 +31,7 @@ internal class PluginState : ApplicationUsagesCollector() {
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val GROUP = EventLogGroup("vim.common", 1, "FUS")
|
||||
private val GROUP = EventLogGroup("vim.common", 1)
|
||||
|
||||
val extensionNames = listOf("textobj-entire", "argtextobj", "ReplaceWithRegister", "vim-paragraph-motion", "highlightedyank", "multiple-cursors", "exchange", "NERDTree", "surround", "commentary", "matchit", "textobj-indent")
|
||||
val enabledExtensions = HashSet<String>()
|
||||
|
@@ -72,7 +72,7 @@ internal class ShortcutConflictState : ApplicationUsagesCollector() {
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val GROUP = EventLogGroup("vim.handlers", 1, "FUS")
|
||||
private val GROUP = EventLogGroup("vim.handlers", 1)
|
||||
|
||||
private val keyStrokes = listOf(
|
||||
KeyStroke.getKeyStroke('1'.code, CTRL_DOWN_MASK),
|
||||
|
@@ -37,7 +37,7 @@ internal class VimscriptState : ApplicationUsagesCollector() {
|
||||
}
|
||||
|
||||
companion object {
|
||||
private val GROUP = EventLogGroup("vim.vimscript", 1, "FUS")
|
||||
private val GROUP = EventLogGroup("vim.vimscript", 1)
|
||||
|
||||
val sourcedFiles = HashSet<String>()
|
||||
val extensionsEnabledWithPlug = HashSet<String>()
|
||||
|
@@ -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>
|
||||
<id>IdeaVIM</id>
|
||||
<description><![CDATA[
|
||||
@@ -13,13 +21,13 @@
|
||||
<li><a href="https://youtrack.jetbrains.com/issues/VIM">Issue tracker</a>: feature requests and bug reports</li>
|
||||
</ul>
|
||||
]]></description>
|
||||
<version>chylex</version>
|
||||
<version>SNAPSHOT</version>
|
||||
<vendor>JetBrains</vendor>
|
||||
|
||||
<!-- Please search for "[VERSION UPDATE]" in project in case you update the since-build version -->
|
||||
<!-- Check for [Version Update] tag in YouTrack as well -->
|
||||
<!-- Also, please update the value in build.gradle.kts file-->
|
||||
<idea-version since-build="233"/>
|
||||
<idea-version since-build="233.11799.30"/>
|
||||
|
||||
<!-- Mark the plugin as compatible with RubyMine and other products based on the IntelliJ platform (including CWM) -->
|
||||
<depends>com.intellij.modules.platform</depends>
|
||||
@@ -150,6 +158,5 @@
|
||||
</group>
|
||||
|
||||
<action id="VimFindActionIdAction" class="com.maddyhome.idea.vim.listener.FindActionIdAction"/>
|
||||
<action id="VimJumpToSource" class="com.intellij.diff.actions.impl.OpenInEditorAction" />
|
||||
</actions>
|
||||
</idea-plugin>
|
||||
|
@@ -12,9 +12,8 @@ package org.jetbrains.plugins.ideavim.action.motion.gn
|
||||
|
||||
import com.maddyhome.idea.vim.VimPlugin
|
||||
import com.maddyhome.idea.vim.api.injector
|
||||
import com.maddyhome.idea.vim.common.Direction
|
||||
import com.maddyhome.idea.vim.newapi.vim
|
||||
import com.maddyhome.idea.vim.state.mode.Mode
|
||||
import com.maddyhome.idea.vim.common.Direction
|
||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||
@@ -86,7 +85,7 @@ class GnNextTextObjectTest : VimTestCase() {
|
||||
|
||||
private fun doTestWithSearch(keys: List<KeyStroke>, before: String, after: String) {
|
||||
configureByText(before)
|
||||
VimPlugin.getSearch().setLastSearchState(fixture.editor.vim, "test", "", Direction.FORWARDS)
|
||||
VimPlugin.getSearch().setLastSearchState(fixture.editor, "test", "", Direction.FORWARDS)
|
||||
typeText(keys)
|
||||
assertState(after)
|
||||
assertState(Mode.NORMAL())
|
||||
|
@@ -12,9 +12,8 @@ package org.jetbrains.plugins.ideavim.action.motion.gn
|
||||
|
||||
import com.maddyhome.idea.vim.VimPlugin
|
||||
import com.maddyhome.idea.vim.api.injector
|
||||
import com.maddyhome.idea.vim.common.Direction
|
||||
import com.maddyhome.idea.vim.newapi.vim
|
||||
import com.maddyhome.idea.vim.state.mode.Mode
|
||||
import com.maddyhome.idea.vim.common.Direction
|
||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||
@@ -64,7 +63,7 @@ class GnPreviousTextObjectTest : VimTestCase() {
|
||||
|
||||
private fun doTestWithSearch(keys: List<KeyStroke>, before: String, after: String) {
|
||||
configureByText(before)
|
||||
VimPlugin.getSearch().setLastSearchState(fixture.editor.vim, "test", "", Direction.FORWARDS)
|
||||
VimPlugin.getSearch().setLastSearchState(fixture.editor, "test", "", Direction.FORWARDS)
|
||||
typeText(keys)
|
||||
assertState(after)
|
||||
assertState(Mode.NORMAL())
|
||||
|
@@ -11,10 +11,9 @@ import com.intellij.idea.TestFor
|
||||
import com.maddyhome.idea.vim.VimPlugin
|
||||
import com.maddyhome.idea.vim.action.motion.search.SearchWholeWordForwardAction
|
||||
import com.maddyhome.idea.vim.api.injector
|
||||
import com.maddyhome.idea.vim.common.Direction
|
||||
import com.maddyhome.idea.vim.newapi.vim
|
||||
import com.maddyhome.idea.vim.state.mode.Mode
|
||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||
import com.maddyhome.idea.vim.common.Direction
|
||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||
@@ -58,7 +57,7 @@ class VisualSelectNextSearchTest : VimTestCase() {
|
||||
@Test
|
||||
fun testWithoutSpaces() {
|
||||
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"))
|
||||
assertOffset(7)
|
||||
assertSelection("test")
|
||||
|
@@ -11,10 +11,9 @@ import com.intellij.idea.TestFor
|
||||
import com.maddyhome.idea.vim.VimPlugin
|
||||
import com.maddyhome.idea.vim.action.motion.search.SearchWholeWordForwardAction
|
||||
import com.maddyhome.idea.vim.api.injector
|
||||
import com.maddyhome.idea.vim.common.Direction
|
||||
import com.maddyhome.idea.vim.newapi.vim
|
||||
import com.maddyhome.idea.vim.state.mode.Mode
|
||||
import com.maddyhome.idea.vim.state.mode.SelectionType
|
||||
import com.maddyhome.idea.vim.common.Direction
|
||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||
@@ -55,7 +54,7 @@ class VisualSelectPreviousSearchTest : VimTestCase() {
|
||||
@Test
|
||||
fun testWithoutSpaces() {
|
||||
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"))
|
||||
assertOffset(0)
|
||||
assertSelection("test")
|
||||
|
@@ -10,7 +10,6 @@ package org.jetbrains.plugins.ideavim.action.motion.search
|
||||
|
||||
import com.maddyhome.idea.vim.VimPlugin
|
||||
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.TestWithoutNeovim
|
||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||
@@ -168,7 +167,7 @@ class SearchAgainPreviousActionTest : VimTestCase() {
|
||||
|
||||
private fun doTestWithSearch(keys: String, before: String, after: String) {
|
||||
doTest(keys, before, after) {
|
||||
VimPlugin.getSearch().setLastSearchState(it.vim, "all", "", Direction.FORWARDS)
|
||||
VimPlugin.getSearch().setLastSearchState(it, "all", "", Direction.FORWARDS)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ class BasicStringFunctions : VimTestCase() {
|
||||
@Test
|
||||
fun `test tolower`() {
|
||||
configureByText("\n")
|
||||
typeText(commandToKeys("echo tolower('Vim is awesome')"))
|
||||
typeText(commandToKeys("echo toupper('Vim is awesome')"))
|
||||
assertExOutput("vim is awesome\n")
|
||||
}
|
||||
|
||||
|
@@ -8,7 +8,6 @@
|
||||
|
||||
package org.jetbrains.plugins.ideavim.extension.sneak
|
||||
|
||||
import com.maddyhome.idea.vim.api.keys
|
||||
import com.maddyhome.idea.vim.state.mode.Mode
|
||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||
import org.junit.jupiter.api.Test
|
||||
@@ -163,26 +162,4 @@ class IdeaVimSneakTest : VimTestCase() {
|
||||
|
||||
doTest("sa<ESC>sdw", before, after, Mode.NORMAL())
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testSneakForwardFromMapping() {
|
||||
val before = "som${c}e text"
|
||||
val after = "some te${c}xt"
|
||||
|
||||
doTest("fxt", before, after, Mode.NORMAL()) {
|
||||
// This should be fixed, but now we process `<Plug>` as a single key
|
||||
typeText(keys(":map f <") + keys("Plug>Sneak_s<CR>"))
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testSneakForwardFromMappingWithOldMappings() {
|
||||
val before = "som${c}e text"
|
||||
val after = "some te${c}xt"
|
||||
|
||||
doTest("fxt", before, after, Mode.NORMAL()) {
|
||||
// This should be fixed, but now we process `<Plug>` as a single key
|
||||
typeText(keys(":map f <") + keys("Plug>(sneak-s)<CR>"))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
* 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
|
||||
@@ -16,6 +16,7 @@ import org.jetbrains.plugins.ideavim.VimTestCase
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class MacroTest : VimTestCase() {
|
||||
|
||||
// was a problem on revision affec9bb61ea5e1e635673a0041d61f7af3722b2
|
||||
@TestWithoutNeovim(reason = SkipNeovimReason.NOT_VIM_TESTING)
|
||||
@Test
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
* 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
|
||||
@@ -15,6 +15,7 @@ import org.jetbrains.plugins.ideavim.VimTestCase
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class MapCommandTest : VimTestCase() {
|
||||
|
||||
@TestWithoutNeovim(reason = SkipNeovimReason.NOT_VIM_TESTING)
|
||||
@Test
|
||||
fun `test double recursion`() {
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
* 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
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
* 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
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
* 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
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
* 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
|
||||
@@ -11,6 +11,7 @@ package org.jetbrains.plugins.ideavim.propertybased
|
||||
import com.intellij.ide.IdeEventQueue
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.intellij.testFramework.PlatformTestUtil
|
||||
import com.maddyhome.idea.vim.action.change.LazyVimCommand
|
||||
import com.maddyhome.idea.vim.api.injector
|
||||
import com.maddyhome.idea.vim.helper.vimStateMachine
|
||||
import com.maddyhome.idea.vim.key.CommandNode
|
||||
@@ -19,8 +20,8 @@ import org.jetbrains.jetCheck.Generator
|
||||
import org.jetbrains.jetCheck.ImperativeCommand
|
||||
import org.jetbrains.jetCheck.PropertyChecker
|
||||
import org.jetbrains.plugins.ideavim.VimTestCase
|
||||
import org.jetbrains.plugins.ideavim.propertybased.samples.javaText
|
||||
import org.jetbrains.plugins.ideavim.propertybased.samples.loremText
|
||||
import org.junit.jupiter.api.Disabled
|
||||
import org.junit.jupiter.api.Test
|
||||
import java.awt.event.KeyEvent
|
||||
import javax.swing.KeyStroke
|
||||
@@ -62,18 +63,19 @@ class RandomActionsPropertyTest : VimPropertyTestBase() {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Disabled
|
||||
fun testRandomActionsOnJavaCode() {
|
||||
PropertyChecker.checkScenarios {
|
||||
ImperativeCommand { env ->
|
||||
val editor = configureByJavaText(javaText)
|
||||
try {
|
||||
moveCaretToRandomPlace(env, editor)
|
||||
env.executeCommands(Generator.sampledFrom(AvailableActions(editor)))
|
||||
} finally {
|
||||
reset(editor)
|
||||
}
|
||||
}
|
||||
}
|
||||
// PropertyChecker.checkScenarios {
|
||||
// ImperativeCommand { env ->
|
||||
// val editor = configureByJavaText(javaText)
|
||||
// try {
|
||||
// moveCaretToRandomPlace(env, editor)
|
||||
// env.executeCommands(Generator.sampledFrom(AvailableActions(editor)))
|
||||
// } finally {
|
||||
// reset(editor)
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
companion object {
|
||||
@@ -98,7 +100,7 @@ private class AvailableActions(private val editor: Editor) : ImperativeCommand {
|
||||
val usedKey = env.generateValue(keyGenerator, null)
|
||||
val node = currentNode[usedKey]
|
||||
|
||||
env.logMessage("Use command: ${injector.parser.toKeyNotation(usedKey)}. ${if (node is CommandNode) "Action: ${node.actionHolder.actionId}" else ""}")
|
||||
env.logMessage("Use command: ${injector.parser.toKeyNotation(usedKey)}. ${if (node is CommandNode) "Action: ${(node.actionHolder as LazyVimCommand).actionId}" else ""}")
|
||||
VimTestCase.typeText(listOf(usedKey), editor, editor.project)
|
||||
|
||||
IdeEventQueue.getInstance().flushQueue()
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
* 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
|
||||
@@ -8,7 +8,6 @@
|
||||
|
||||
package org.jetbrains.plugins.ideavim.propertybased
|
||||
|
||||
import com.intellij.ide.highlighter.JavaFileType
|
||||
import com.intellij.openapi.editor.Editor
|
||||
import com.maddyhome.idea.vim.KeyHandler
|
||||
import com.maddyhome.idea.vim.VimPlugin
|
||||
@@ -36,6 +35,4 @@ abstract class VimPropertyTestBase : VimTestCase() {
|
||||
VimPlugin.getSearch().resetState()
|
||||
VimPlugin.getChange().reset()
|
||||
}
|
||||
|
||||
protected fun configureByJavaText(content: String) = configureByText(JavaFileType.INSTANCE, content)
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
* 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
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
* 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
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
* 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
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
* 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
|
71
src/test/java/ui/PyCharmTest.kt
Normal file
71
src/test/java/ui/PyCharmTest.kt
Normal file
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style
|
||||
* license that can be found in the LICENSE.txt file or at
|
||||
* https://opensource.org/licenses/MIT.
|
||||
*/
|
||||
|
||||
package ui
|
||||
|
||||
import com.automation.remarks.junit5.Video
|
||||
import com.intellij.remoterobot.steps.CommonSteps
|
||||
import org.junit.jupiter.api.AfterAll
|
||||
import org.junit.jupiter.api.BeforeAll
|
||||
import org.junit.jupiter.api.Disabled
|
||||
import org.junit.jupiter.api.Test
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Path
|
||||
|
||||
class PyCharmTest {
|
||||
init {
|
||||
// StepsLogger.init()
|
||||
}
|
||||
|
||||
private lateinit var commonSteps: CommonSteps
|
||||
|
||||
companion object {
|
||||
private var ideaProcess: Process? = null
|
||||
private var tmpDir: Path = Files.createTempDirectory("launcher")
|
||||
|
||||
@BeforeAll
|
||||
@JvmStatic
|
||||
fun beforeAll() {
|
||||
// val client = OkHttpClient()
|
||||
// val ideDownloader = IdeDownloader(client)
|
||||
// val downloadedIdePath = ideDownloader.downloadAndExtractLatestEap(Ide.PYCHARM, tmpDir)
|
||||
// // This hack doesn't work because it breaks .app. Waiting for the new version of robot with the fix.
|
||||
//// if (Os.hostOS() == Os.MAC) {
|
||||
//// // Hack for the problem of double vmoptions file
|
||||
//// // The ides now have two vmoptions files: one for ide itself and one for jetbrains client
|
||||
//// // Because of some reason, when ide detects more than one vmoptions file, it tries to find one that ends on
|
||||
//// // "64". And since it doesn't find one, the robot fails.
|
||||
//// val dataPath = downloadedIdePath.resolve("Contents/bin")
|
||||
//// Files.list(dataPath).filter {
|
||||
//// it.fileName.toString().endsWith("jetbrains_client.vmoptions")
|
||||
//// }.forEach { Files.delete(it) }
|
||||
//// }
|
||||
// ideaProcess = IdeLauncher.launchIde(
|
||||
// downloadedIdePath,
|
||||
// mapOf("robot-server.port" to 8083),
|
||||
// emptyList(),
|
||||
// listOf(ideDownloader.downloadRobotPlugin(tmpDir)),
|
||||
// tmpDir
|
||||
// )
|
||||
}
|
||||
|
||||
@AfterAll
|
||||
@JvmStatic
|
||||
fun cleanUp() {
|
||||
// ideaProcess?.destroy()
|
||||
// tmpDir.toFile().deleteRecursively()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Video
|
||||
@Disabled("Waiting for the new version of the robot with fixes")
|
||||
fun run() {
|
||||
println("Hey")
|
||||
}
|
||||
}
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
* 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
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
* 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
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
* 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
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
* 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
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
* 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
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
* 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
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
* 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
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
* 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
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
* 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
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
* 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
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
* 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
|
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
* 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
|
@@ -31,7 +31,7 @@ import com.maddyhome.idea.vim.state.mode.toVimNotation
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.jupiter.api.TestInfo
|
||||
|
||||
object NeovimTesting {
|
||||
internal object NeovimTesting {
|
||||
private lateinit var neovimApi: NeovimApi
|
||||
private lateinit var neovim: Process
|
||||
|
||||
@@ -88,7 +88,7 @@ object NeovimTesting {
|
||||
val noBehaviourDiffers = !method.isAnnotationPresent(VimBehaviorDiffers::class.java)
|
||||
val noTestingWithoutNeovim = !method.isAnnotationPresent(TestWithoutNeovim::class.java) &&
|
||||
!test.javaClass.isAnnotationPresent(TestWithoutNeovim::class.java)
|
||||
val neovimTestingEnabled = isNeovimTestingEnabled()
|
||||
val neovimTestingEnabled = System.getProperty("ideavim.nvim.test", "false")!!.toBoolean()
|
||||
val notParserTest = "org.jetbrains.plugins.ideavim.ex.parser" !in test.javaClass.packageName
|
||||
val notScriptImplementation = "org.jetbrains.plugins.ideavim.ex.implementation" !in test.javaClass.packageName
|
||||
val notExtension = "org.jetbrains.plugins.ideavim.extension" !in test.javaClass.packageName
|
||||
@@ -104,12 +104,6 @@ object NeovimTesting {
|
||||
singleCaret
|
||||
}
|
||||
|
||||
fun isNeovimTestingEnabled(): Boolean {
|
||||
val property = System.getProperty("ideavim.nvim.test", "false")
|
||||
val neovimTestingEnabled = if (property.isBlank()) true else property.toBoolean()
|
||||
return neovimTestingEnabled
|
||||
}
|
||||
|
||||
fun setupEditor(editor: Editor, test: TestInfo) {
|
||||
if (!neovimEnabled(test, editor)) return
|
||||
neovimApi.currentBuffer.get().setLines(0, -1, false, editor.document.text.split("\n")).get()
|
||||
|
@@ -80,7 +80,6 @@ import com.maddyhome.idea.vim.vimscript.model.datatypes.VimFuncref
|
||||
import com.maddyhome.idea.vim.vimscript.parser.errors.IdeavimErrorListener
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.junit.jupiter.api.AfterEach
|
||||
import org.junit.jupiter.api.BeforeAll
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.TestInfo
|
||||
import org.junit.jupiter.api.assertThrows
|
||||
@@ -106,7 +105,7 @@ import kotlin.test.assertTrue
|
||||
abstract class VimTestCase {
|
||||
protected lateinit var fixture: CodeInsightTestFixture
|
||||
|
||||
lateinit var testInfo: TestInfo
|
||||
internal lateinit var testInfo: TestInfo
|
||||
|
||||
@BeforeEach
|
||||
open fun setUp(testInfo: TestInfo) {
|
||||
@@ -801,12 +800,6 @@ abstract class VimTestCase {
|
||||
const val s = EditorTestUtil.SELECTION_START_TAG
|
||||
const val se = EditorTestUtil.SELECTION_END_TAG
|
||||
|
||||
@BeforeAll
|
||||
@JvmStatic
|
||||
fun beforeAll() {
|
||||
println("Neovim testing: ${NeovimTesting.isNeovimTestingEnabled()}")
|
||||
}
|
||||
|
||||
fun typeText(keys: List<KeyStroke?>, editor: Editor, project: Project?) {
|
||||
val keyHandler = KeyHandler.getInstance()
|
||||
val dataContext = injector.executionContextManager.onEditor(editor.vim)
|
||||
|
@@ -12,6 +12,13 @@ plugins {
|
||||
id("org.jetbrains.intellij")
|
||||
}
|
||||
|
||||
group = "org.example"
|
||||
version = "SNAPSHOT"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
val kotlinVersion: String by project
|
||||
val ideaVersion: String by project
|
||||
val javaVersion: String by project
|
||||
@@ -22,30 +29,17 @@ repositories {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
||||
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
|
||||
testImplementation(platform("org.junit:junit-bom:5.10.0"))
|
||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
||||
testImplementation("org.jetbrains.kotlin:kotlin-test:$kotlinVersion")
|
||||
testImplementation(testFixtures(project(":"))) // The root project
|
||||
}
|
||||
|
||||
tasks {
|
||||
test {
|
||||
tasks.test {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
verifyPlugin {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
publishPlugin {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
runIde {
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
|
||||
intellij {
|
||||
version.set(ideaVersion)
|
||||
type.set("IC")
|
||||
|
@@ -1,52 +0,0 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style
|
||||
* license that can be found in the LICENSE.txt file or at
|
||||
* https://opensource.org/licenses/MIT.
|
||||
*/
|
||||
|
||||
package org.jetbrains.plugins.ideavim.action.change.shift
|
||||
|
||||
import com.intellij.application.options.CodeStyle
|
||||
import com.intellij.ide.highlighter.JavaFileType
|
||||
import org.jetbrains.plugins.ideavim.SkipNeovimReason
|
||||
import org.jetbrains.plugins.ideavim.TestWithoutNeovim
|
||||
import org.jetbrains.plugins.ideavim.VimJavaTestCase
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class ShiftRightLinesActionTest : VimJavaTestCase() {
|
||||
@TestWithoutNeovim(SkipNeovimReason.NOT_VIM_TESTING)
|
||||
@Test
|
||||
fun `add indent for java file`() {
|
||||
|
||||
val before = """
|
||||
|public class C {
|
||||
|.I${c}nteger a;
|
||||
|}
|
||||
""".trimMargin().dotToTab()
|
||||
val after = """
|
||||
|public class C {
|
||||
|.....Integer a;
|
||||
|}
|
||||
""".trimMargin().dotToTab()
|
||||
|
||||
usingTabs {
|
||||
configureByJavaText(before)
|
||||
typeText(">>".repeat(4))
|
||||
assertState(after)
|
||||
}
|
||||
}
|
||||
|
||||
private fun usingTabs(action: () -> Unit) {
|
||||
val testSettings = CodeStyle.createTestSettings()
|
||||
val javaSettings = testSettings.getIndentOptions(JavaFileType.INSTANCE)
|
||||
javaSettings.USE_TAB_CHARACTER = true
|
||||
CodeStyle.setTemporarySettings(fixture.project, testSettings)
|
||||
try {
|
||||
action()
|
||||
} finally {
|
||||
CodeStyle.dropTemporarySettings(fixture.project)
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,65 +0,0 @@
|
||||
plugins {
|
||||
java
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.intellij")
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url = uri("https://cache-redirector.jetbrains.com/intellij-dependencies") }
|
||||
}
|
||||
|
||||
val kotlinVersion: String by project
|
||||
val ideaVersion: String by project
|
||||
val javaVersion: String by project
|
||||
|
||||
dependencies {
|
||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
||||
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
|
||||
testImplementation("org.jetbrains.kotlin:kotlin-test:$kotlinVersion")
|
||||
testImplementation(testFixtures(project(":"))) // The root project
|
||||
}
|
||||
|
||||
tasks {
|
||||
// This task is disabled because it should be excluded from `gradle test` run (because it's slow)
|
||||
// I didn't find a better way to exclude except disabling and defining a new task with a different name
|
||||
test {
|
||||
enabled = false
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
register<Test>("testLongRunning") {
|
||||
group = "verification"
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
verifyPlugin {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
publishPlugin {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
runIde {
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
|
||||
intellij {
|
||||
version.set(ideaVersion)
|
||||
type.set("IC")
|
||||
plugins.set(listOf("java"))
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(javaVersion))
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(javaVersion))
|
||||
}
|
||||
}
|
@@ -1,65 +0,0 @@
|
||||
plugins {
|
||||
java
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.intellij")
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url = uri("https://cache-redirector.jetbrains.com/intellij-dependencies") }
|
||||
}
|
||||
|
||||
val kotlinVersion: String by project
|
||||
val ideaVersion: String by project
|
||||
val javaVersion: String by project
|
||||
|
||||
dependencies {
|
||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
||||
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
|
||||
testImplementation("org.jetbrains.kotlin:kotlin-test:$kotlinVersion")
|
||||
testImplementation(testFixtures(project(":"))) // The root project
|
||||
}
|
||||
|
||||
tasks {
|
||||
// This task is disabled because it should be excluded from `gradle test` run (because it's slow)
|
||||
// I didn't find a better way to exclude except disabling and defining a new task with a different name
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
enabled = false
|
||||
}
|
||||
|
||||
register<Test>("testPropertyBased") {
|
||||
group = "verification"
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
verifyPlugin {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
publishPlugin {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
runIde {
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
|
||||
intellij {
|
||||
version.set(ideaVersion)
|
||||
type.set("IC")
|
||||
plugins.set(listOf("java"))
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(javaVersion))
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(javaVersion))
|
||||
}
|
||||
}
|
@@ -1,47 +0,0 @@
|
||||
plugins {
|
||||
java
|
||||
kotlin("jvm")
|
||||
id("java-test-fixtures")
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url = uri("https://cache-redirector.jetbrains.com/intellij-dependencies") }
|
||||
}
|
||||
|
||||
val kotlinVersion: String by project
|
||||
val ideaVersion: String by project
|
||||
val javaVersion: String by project
|
||||
val remoteRobotVersion: String by project
|
||||
|
||||
dependencies {
|
||||
testFixturesImplementation("org.junit.jupiter:junit-jupiter:5.10.1")
|
||||
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
|
||||
testFixturesImplementation("org.jetbrains.kotlin:kotlin-test:$kotlinVersion")
|
||||
testFixturesImplementation(testFixtures(project(":"))) // The root project
|
||||
|
||||
testFixturesImplementation("com.intellij.remoterobot:remote-robot:$remoteRobotVersion")
|
||||
testFixturesImplementation("com.intellij.remoterobot:remote-fixtures:$remoteRobotVersion")
|
||||
testFixturesImplementation("com.intellij.remoterobot:ide-launcher:$remoteRobotVersion")
|
||||
}
|
||||
|
||||
tasks {
|
||||
// This task is disabled because it should be excluded from `gradle test` run (because it's slow)
|
||||
// I didn't find a better way to exclude except disabling and defining a new task with a different name
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
enabled = false
|
||||
}
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(javaVersion))
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(javaVersion))
|
||||
}
|
||||
}
|
@@ -1,57 +0,0 @@
|
||||
plugins {
|
||||
java
|
||||
kotlin("jvm")
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url = uri("https://cache-redirector.jetbrains.com/intellij-dependencies") }
|
||||
}
|
||||
|
||||
val kotlinVersion: String by project
|
||||
val ideaVersion: String by project
|
||||
val javaVersion: String by project
|
||||
val remoteRobotVersion: String by project
|
||||
|
||||
dependencies {
|
||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
||||
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
|
||||
testImplementation("org.jetbrains.kotlin:kotlin-test:$kotlinVersion")
|
||||
testImplementation(testFixtures(project(":"))) // The root project
|
||||
testImplementation(testFixtures(project(":tests:ui-fixtures"))) // The root project
|
||||
|
||||
testImplementation("com.intellij.remoterobot:remote-robot:$remoteRobotVersion")
|
||||
testImplementation("com.intellij.remoterobot:remote-fixtures:$remoteRobotVersion")
|
||||
testImplementation("com.automation-remarks:video-recorder-junit5:2.0")
|
||||
}
|
||||
|
||||
tasks {
|
||||
// This task is disabled because it should be excluded from `gradle test` run (because it's slow)
|
||||
// I didn't find a better way to exclude except disabling and defining a new task with a different name
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
enabled = false
|
||||
}
|
||||
|
||||
register<Test>("testUi") {
|
||||
group = "verification"
|
||||
useJUnitPlatform()
|
||||
|
||||
// This is needed for the robot to access the message of the exception
|
||||
// Usually these opens are provided by the intellij gradle plugin
|
||||
// https://github.com/JetBrains/gradle-intellij-plugin/blob/b21e3f382e9885948a6427001d5e64234c602613/src/main/kotlin/org/jetbrains/intellij/utils/OpenedPackages.kt#L26
|
||||
jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED")
|
||||
}
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(javaVersion))
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(javaVersion))
|
||||
}
|
||||
}
|
@@ -1,58 +0,0 @@
|
||||
plugins {
|
||||
java
|
||||
kotlin("jvm")
|
||||
}
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
maven { url = uri("https://cache-redirector.jetbrains.com/intellij-dependencies") }
|
||||
}
|
||||
|
||||
val kotlinVersion: String by project
|
||||
val ideaVersion: String by project
|
||||
val javaVersion: String by project
|
||||
val remoteRobotVersion: String by project
|
||||
|
||||
dependencies {
|
||||
testImplementation("org.junit.jupiter:junit-jupiter")
|
||||
compileOnly("org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion")
|
||||
testImplementation("org.jetbrains.kotlin:kotlin-test:$kotlinVersion")
|
||||
testImplementation(testFixtures(project(":"))) // The root project
|
||||
testImplementation(testFixtures(project(":tests:ui-fixtures")))
|
||||
|
||||
testImplementation("com.intellij.remoterobot:remote-robot:$remoteRobotVersion")
|
||||
testImplementation("com.intellij.remoterobot:remote-fixtures:$remoteRobotVersion")
|
||||
testImplementation("com.intellij.remoterobot:ide-launcher:$remoteRobotVersion")
|
||||
testImplementation("com.automation-remarks:video-recorder-junit5:2.0")
|
||||
}
|
||||
|
||||
tasks {
|
||||
// This task is disabled because it should be excluded from `gradle test` run (because it's slow)
|
||||
// I didn't find a better way to exclude except disabling and defining a new task with a different name
|
||||
test {
|
||||
useJUnitPlatform()
|
||||
enabled = false
|
||||
}
|
||||
|
||||
register<Test>("testUi") {
|
||||
group = "verification"
|
||||
useJUnitPlatform()
|
||||
|
||||
// This is needed for the robot to access the message of the exception
|
||||
// Usually these opens are provided by the intellij gradle plugin
|
||||
// https://github.com/JetBrains/gradle-intellij-plugin/blob/b21e3f382e9885948a6427001d5e64234c602613/src/main/kotlin/org/jetbrains/intellij/utils/OpenedPackages.kt#L26
|
||||
jvmArgs("--add-opens", "java.base/java.lang=ALL-UNNAMED")
|
||||
}
|
||||
}
|
||||
|
||||
java {
|
||||
toolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(javaVersion))
|
||||
}
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvmToolchain {
|
||||
languageVersion.set(JavaLanguageVersion.of(javaVersion))
|
||||
}
|
||||
}
|
@@ -1,64 +0,0 @@
|
||||
/*
|
||||
* Copyright 2003-2024 The IdeaVim authors
|
||||
*
|
||||
* Use of this source code is governed by an MIT-style
|
||||
* license that can be found in the LICENSE.txt file or at
|
||||
* https://opensource.org/licenses/MIT.
|
||||
*/
|
||||
|
||||
import com.automation.remarks.junit5.Video
|
||||
import com.intellij.remoterobot.RemoteRobot
|
||||
import com.intellij.remoterobot.steps.CommonSteps
|
||||
import com.intellij.remoterobot.utils.keyboard
|
||||
import com.intellij.remoterobot.utils.waitFor
|
||||
import org.junit.jupiter.api.Test
|
||||
import ui.pages.IdeaFrame
|
||||
import ui.pages.idea
|
||||
import ui.pages.welcomeFrame
|
||||
import ui.utils.StepsLogger
|
||||
import ui.utils.uiTest
|
||||
|
||||
class PyCharmTest {
|
||||
init {
|
||||
StepsLogger.init()
|
||||
}
|
||||
|
||||
private lateinit var commonSteps: CommonSteps
|
||||
|
||||
@Test
|
||||
@Video
|
||||
fun run() = uiTest("ideaVimTest") {
|
||||
commonSteps = CommonSteps(this)
|
||||
|
||||
startNewProject()
|
||||
Thread.sleep(1000)
|
||||
|
||||
idea {
|
||||
waitSmartMode()
|
||||
|
||||
testEnterWorksInPyConsole()
|
||||
}
|
||||
}
|
||||
|
||||
private fun IdeaFrame.testEnterWorksInPyConsole() {
|
||||
findText("Python Console").click()
|
||||
|
||||
Thread.sleep(10_000)
|
||||
|
||||
keyboard {
|
||||
enterText("print(123 + 321)")
|
||||
enter()
|
||||
}
|
||||
|
||||
waitFor {
|
||||
findAllText("444").isNotEmpty()
|
||||
}
|
||||
}
|
||||
|
||||
private fun RemoteRobot.startNewProject() {
|
||||
welcomeFrame {
|
||||
createNewProjectLink.click()
|
||||
button("Create").click()
|
||||
}
|
||||
}
|
||||
}
|
@@ -16,7 +16,7 @@ import com.maddyhome.idea.vim.command.Command
|
||||
import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||
|
||||
@CommandOrMotion(keys = ["U", "<C-R>"], modes = [Mode.NORMAL, Mode.VISUAL])
|
||||
@CommandOrMotion(keys = ["<C-R>"], modes = [Mode.NORMAL])
|
||||
public class RedoAction : VimActionHandler.SingleExecution() {
|
||||
override val type: Command.Type = Command.Type.OTHER_SELF_SYNCHRONIZED
|
||||
|
||||
|
@@ -16,7 +16,7 @@ import com.maddyhome.idea.vim.command.Command
|
||||
import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.VimActionHandler
|
||||
|
||||
@CommandOrMotion(keys = ["u", "<Undo>"], modes = [Mode.NORMAL, Mode.VISUAL])
|
||||
@CommandOrMotion(keys = ["u", "<Undo>"], modes = [Mode.NORMAL])
|
||||
public class UndoAction : VimActionHandler.SingleExecution() {
|
||||
override val type: Command.Type = Command.Type.OTHER_SELF_SYNCHRONIZED
|
||||
|
||||
|
@@ -8,6 +8,7 @@
|
||||
package com.maddyhome.idea.vim.action.change.change
|
||||
|
||||
import com.intellij.vim.annotations.CommandOrMotion
|
||||
import com.intellij.vim.annotations.Mode
|
||||
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimEditor
|
||||
@@ -21,7 +22,7 @@ import com.maddyhome.idea.vim.helper.CharacterHelper
|
||||
/**
|
||||
* @author vlan
|
||||
*/
|
||||
@CommandOrMotion(keys = [], modes = [])
|
||||
@CommandOrMotion(keys = ["u"], modes = [Mode.VISUAL])
|
||||
public class ChangeCaseLowerVisualAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
|
||||
|
@@ -8,6 +8,7 @@
|
||||
package com.maddyhome.idea.vim.action.change.change
|
||||
|
||||
import com.intellij.vim.annotations.CommandOrMotion
|
||||
import com.intellij.vim.annotations.Mode
|
||||
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||
import com.maddyhome.idea.vim.api.VimCaret
|
||||
import com.maddyhome.idea.vim.api.VimEditor
|
||||
@@ -21,7 +22,7 @@ import com.maddyhome.idea.vim.helper.CharacterHelper
|
||||
/**
|
||||
* @author vlan
|
||||
*/
|
||||
@CommandOrMotion(keys = [], modes = [])
|
||||
@CommandOrMotion(keys = ["U"], modes = [Mode.VISUAL])
|
||||
public class ChangeCaseUpperVisualAction : VisualOperatorActionHandler.ForEachCaret() {
|
||||
override val type: Command.Type = Command.Type.CHANGE
|
||||
|
||||
|
@@ -30,7 +30,6 @@ public class FilterVisualLinesAction : VimActionHandler.SingleExecution() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_MOT_LINEWISE)
|
||||
|
||||
override fun execute(editor: VimEditor, context: ExecutionContext, cmd: Command, operatorArguments: OperatorArguments): Boolean {
|
||||
injector.markService.setVisualSelectionMarks(editor)
|
||||
injector.processGroup.startFilterCommand(editor, context, cmd)
|
||||
editor.exitVisualMode()
|
||||
return true
|
||||
|
@@ -82,13 +82,6 @@ public sealed class TillCharacterMotion(
|
||||
)
|
||||
}
|
||||
injector.motion.setLastFTCmd(tillCharacterMotionType, argument.character)
|
||||
|
||||
val offset = if (!finishBeforeCharacter) ""
|
||||
else if (direction == Direction.FORWARDS) "s-1"
|
||||
else "s+1"
|
||||
|
||||
injector.searchGroup.setLastSearchState(editor, argument.character.let { if (it == '.') "\\." else it.toString() }, offset, direction)
|
||||
|
||||
return res.toMotionOrError()
|
||||
}
|
||||
}
|
||||
|
@@ -1,58 +0,0 @@
|
||||
/*
|
||||
* 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.action.motion.text
|
||||
|
||||
import com.intellij.vim.annotations.CommandOrMotion
|
||||
import com.intellij.vim.annotations.Mode
|
||||
import com.maddyhome.idea.vim.api.ExecutionContext
|
||||
import com.maddyhome.idea.vim.api.ImmutableVimCaret
|
||||
import com.maddyhome.idea.vim.api.VimEditor
|
||||
import com.maddyhome.idea.vim.api.injector
|
||||
import com.maddyhome.idea.vim.command.Argument
|
||||
import com.maddyhome.idea.vim.command.CommandFlags
|
||||
import com.maddyhome.idea.vim.command.MotionType
|
||||
import com.maddyhome.idea.vim.command.OperatorArguments
|
||||
import com.maddyhome.idea.vim.handler.Motion
|
||||
import com.maddyhome.idea.vim.handler.MotionActionHandler
|
||||
import com.maddyhome.idea.vim.handler.toMotionOrError
|
||||
import com.maddyhome.idea.vim.helper.enumSetOf
|
||||
import java.util.*
|
||||
|
||||
@CommandOrMotion(keys = ["]s"], modes = [Mode.NORMAL, Mode.VISUAL, Mode.OP_PENDING])
|
||||
public class MotionMisspelledWordNextAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: ImmutableVimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return injector.searchHelper.findMisspelledWord(editor, caret, operatorArguments.count1).toMotionOrError()
|
||||
}
|
||||
|
||||
override val motionType: MotionType = MotionType.EXCLUSIVE
|
||||
}
|
||||
|
||||
@CommandOrMotion(keys = ["[s"], modes = [Mode.NORMAL, Mode.VISUAL, Mode.OP_PENDING])
|
||||
public class MotionMisspelledWordPreviousAction : MotionActionHandler.ForEachCaret() {
|
||||
override val flags: EnumSet<CommandFlags> = enumSetOf(CommandFlags.FLAG_SAVE_JUMP)
|
||||
|
||||
override fun getOffset(
|
||||
editor: VimEditor,
|
||||
caret: ImmutableVimCaret,
|
||||
context: ExecutionContext,
|
||||
argument: Argument?,
|
||||
operatorArguments: OperatorArguments,
|
||||
): Motion {
|
||||
return injector.searchHelper.findMisspelledWord(editor, caret, -operatorArguments.count1).toMotionOrError()
|
||||
}
|
||||
|
||||
override val motionType: MotionType = MotionType.EXCLUSIVE
|
||||
}
|
@@ -145,7 +145,7 @@ public interface VimChangeGroup {
|
||||
operatorArguments: OperatorArguments,
|
||||
)
|
||||
|
||||
public fun insertText(editor: VimEditor, caret: VimCaret, offset: Int, str: CharSequence): VimCaret
|
||||
public fun insertText(editor: VimEditor, caret: VimCaret, offset: Int, str: String): VimCaret
|
||||
|
||||
public fun insertText(editor: VimEditor, caret: VimCaret, str: String): VimCaret
|
||||
|
||||
|
@@ -203,7 +203,7 @@ public abstract class VimChangeGroupBase : VimChangeGroup {
|
||||
* @param caret The caret to start insertion in
|
||||
* @param str The text to insert
|
||||
*/
|
||||
override fun insertText(editor: VimEditor, caret: VimCaret, offset: Int, str: CharSequence): VimCaret {
|
||||
override fun insertText(editor: VimEditor, caret: VimCaret, offset: Int, str: String): VimCaret {
|
||||
(editor as MutableVimEditor).insertText(Offset(offset), str)
|
||||
val newCaret = caret.moveToInlayAwareOffset(offset + str.length)
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user