mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[command-completion] IDEA-385364 Generation doesn't work on a new line with tabs
GitOrigin-RevId: 36a9526f790baae02f68afdc7e7bbfe5bde75217
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5cc59f26f8
commit
3ffc1737dc
+28
-1
@@ -8,7 +8,7 @@ import com.intellij.openapi.util.registry.Registry
|
||||
import com.intellij.testFramework.NeedsIndex
|
||||
|
||||
@NeedsIndex.SmartMode(reason = "it requires highlighting")
|
||||
class JavaCommandsCompletionGenerateConstructorsTest : LightFixtureCompletionTestCase() {
|
||||
class JavaCommandsCompletionGenerateTest : LightFixtureCompletionTestCase() {
|
||||
|
||||
override fun setUp() {
|
||||
super.setUp()
|
||||
@@ -16,6 +16,33 @@ class JavaCommandsCompletionGenerateConstructorsTest : LightFixtureCompletionTes
|
||||
Registry.get("ide.completion.command.force.enabled").setValue(true, getTestRootDisposable())
|
||||
}
|
||||
|
||||
fun testGenerateWithTabs() {
|
||||
//don't move, there are tabs instead of spaces
|
||||
val text = """
|
||||
package org.test;
|
||||
|
||||
public class Test {
|
||||
private Integer num;
|
||||
|
||||
|
||||
ge<caret>
|
||||
}""".trimIndent()
|
||||
myFixture.configureByText(JavaFileType.INSTANCE, text)
|
||||
val elements = myFixture.completeBasic()
|
||||
selectItem(elements.first { element -> element.lookupString.contains("Generate 'No-Args Constructor'", ignoreCase = true) })
|
||||
NonBlockingReadActionImpl.waitForAsyncTaskCompletion()
|
||||
myFixture.checkResult("""
|
||||
package org.test;
|
||||
|
||||
public class Test {
|
||||
private Integer num;
|
||||
|
||||
|
||||
public Test() {
|
||||
}
|
||||
}""".trimIndent())
|
||||
}
|
||||
|
||||
fun testGenerateNoArgsConstructor() {
|
||||
myFixture.configureByText(JavaFileType.INSTANCE, """
|
||||
class A {
|
||||
+1
@@ -614,6 +614,7 @@ internal fun findActualIndex(suffix: String, text: CharSequence, offset: Int): I
|
||||
var currentIndex = 1
|
||||
while (text.getOrNull(offset - currentIndex)?.isLetter() == true ||
|
||||
text.getOrNull(offset - currentIndex) == ' ' ||
|
||||
text.getOrNull(offset - currentIndex) == '\t' ||
|
||||
text.getOrNull(offset - currentIndex) == '\''
|
||||
) {
|
||||
currentIndex++
|
||||
|
||||
Reference in New Issue
Block a user