mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Add folding for record header
GitOrigin-RevId: b33bba12bc7e9bffddff6e8c613bfd507aad4cd8
This commit is contained in:
committed by
intellij-monorepo-bot
parent
74f10408aa
commit
1c050eb2b6
+4
-15
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.codeInsight.folding.impl;
|
||||
|
||||
import com.intellij.codeInsight.daemon.impl.CollectHighlightsUtil;
|
||||
@@ -503,6 +489,9 @@ public abstract class JavaFoldingBuilderBase extends CustomFoldingBuilder implem
|
||||
else if (child instanceof PsiComment) {
|
||||
addCommentToFold(list, (PsiComment)child, document, processedComments);
|
||||
}
|
||||
else if (child instanceof PsiRecordHeader) {
|
||||
addToFold(list, child, document, false, "(...)", child.getTextRange(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.java.codeInsight.folding
|
||||
|
||||
import com.intellij.testFramework.LightProjectDescriptor
|
||||
import com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase
|
||||
|
||||
class JavaFolding14Test : JavaFoldingTestCase() {
|
||||
override fun getProjectDescriptor(): LightProjectDescriptor = LightJavaCodeInsightFixtureTestCase.JAVA_14
|
||||
|
||||
fun testRecord() {
|
||||
val text = """
|
||||
class B {}
|
||||
|
||||
record A(
|
||||
String s,
|
||||
int a
|
||||
) {
|
||||
void f() {}
|
||||
}""".trimIndent()
|
||||
configure(text)
|
||||
|
||||
val regions = myFixture.editor.foldingModel.allFoldRegions
|
||||
assertEquals("""
|
||||
FoldRegion -(20:44), placeholder='(...)'
|
||||
FoldRegion -(45:62), placeholder='{...}'
|
||||
""".trimIndent(), regions.joinToString("\n"))
|
||||
}
|
||||
}
|
||||
+1
@@ -72,6 +72,7 @@ public abstract class LightJavaCodeInsightFixtureTestCase extends UsefulTestCase
|
||||
public static final @NotNull LightProjectDescriptor JAVA_11 = new ProjectDescriptor(LanguageLevel.JDK_11);
|
||||
public static final @NotNull LightProjectDescriptor JAVA_12 = new ProjectDescriptor(LanguageLevel.JDK_12);
|
||||
public static final @NotNull LightProjectDescriptor JAVA_13 = new ProjectDescriptor(LanguageLevel.JDK_13_PREVIEW);
|
||||
public static final @NotNull LightProjectDescriptor JAVA_14 = new ProjectDescriptor(LanguageLevel.JDK_14);
|
||||
public static final @NotNull LightProjectDescriptor JAVA_X = new ProjectDescriptor(LanguageLevel.JDK_X);
|
||||
|
||||
public static final @NotNull LightProjectDescriptor JAVA_LATEST = new ProjectDescriptor(LanguageLevel.HIGHEST) {
|
||||
|
||||
Reference in New Issue
Block a user