mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Java formatter: add space between type and name in pattern
GitOrigin-RevId: 0357190e17a3486c70b8e7d0fa418918193ea6d7
This commit is contained in:
committed by
intellij-monorepo-bot
parent
6eba89d142
commit
693ba01e83
@@ -664,6 +664,14 @@ public class JavaSpacePropertyProcessor extends JavaElementVisitor {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitPatternVariable(PsiPatternVariable variable) {
|
||||
super.visitPatternVariable(variable);
|
||||
if (myType1 == JavaElementType.TYPE && myType2 == JavaTokenType.IDENTIFIER) {
|
||||
createSpaceInCode(true);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitImportList(PsiImportList list) {
|
||||
if (ElementType.IMPORT_STATEMENT_BASE_BIT_SET.contains(myChild1.getElementType()) &&
|
||||
|
||||
@@ -3,7 +3,7 @@ import java.util.List;
|
||||
|
||||
class X {
|
||||
void test(Object obj) {
|
||||
if (obj instanceof List<?>list) {
|
||||
if (obj instanceof List<?> list) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,7 +3,7 @@ import java.util.*;
|
||||
|
||||
class X {
|
||||
void test(List<Integer> obj) {
|
||||
if (obj instanceof ArrayList<Integer>list) {
|
||||
if (obj instanceof ArrayList<Integer> list) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,9 +13,9 @@ import com.intellij.psi.JavaCodeFragmentFactory
|
||||
import com.intellij.psi.PsiElement
|
||||
import com.intellij.psi.codeStyle.CodeStyleManager
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings
|
||||
import com.intellij.util.IncorrectOperationException
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
|
||||
import com.intellij.testFramework.LightProjectDescriptor
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
|
||||
import com.intellij.util.IncorrectOperationException
|
||||
|
||||
/**
|
||||
* **Note:** this class is too huge and hard to use. It's tests are intended to be split in multiple more fine-grained
|
||||
@@ -3978,4 +3978,22 @@ public enum LevelCode {
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
|
||||
fun testInstanceofPatternWithGeneric() {
|
||||
|
||||
doTextTest("""
|
||||
class A{
|
||||
void foo(Object x) {
|
||||
if (x instanceof List<String> a) {}
|
||||
}
|
||||
}
|
||||
""".trimIndent(), """
|
||||
class A {
|
||||
void foo(Object x) {
|
||||
if (x instanceof List<String> a) {
|
||||
}
|
||||
}
|
||||
}
|
||||
""".trimIndent())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user