mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-06 11:50:54 +07:00
[platform] IDEA-342326 provide factory method for char tail type
- ensure that TailType class is loaded before CharTailType class if factory method is used GitOrigin-RevId: ccfe8d4ae66c9ff6bd9ab0bef9367c4357db1759
This commit is contained in:
committed by
intellij-monorepo-bot
parent
a10e5febd4
commit
da0308f481
@@ -1,7 +1,6 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.execution.ui;
|
||||
|
||||
import com.intellij.codeInsight.CharTailType;
|
||||
import com.intellij.codeInsight.TailType;
|
||||
import com.intellij.codeInsight.TailTypes;
|
||||
import com.intellij.codeInsight.completion.*;
|
||||
@@ -115,7 +114,7 @@ public final class VmOptionsCompletionContributor extends CompletionContributor
|
||||
}
|
||||
else {
|
||||
Character suffix = option.getVariant().suffix();
|
||||
TailType tailType = suffix == null ? null : new CharTailType(suffix);
|
||||
TailType tailType = suffix == null ? null : TailTypes.charType(suffix);
|
||||
result.addElement(TailTypeDecorator.withTail(builder, tailType));
|
||||
}
|
||||
});
|
||||
|
||||
@@ -112,7 +112,7 @@ class TypeArgumentCompletionProvider {
|
||||
}
|
||||
|
||||
private static TailType getTail(boolean last) {
|
||||
return last ? new CharTailType('>') : CommaTailType.INSTANCE;
|
||||
return last ? TailTypes.charType('>') : CommaTailType.INSTANCE;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
@@ -3,9 +3,15 @@ package com.intellij.codeInsight;
|
||||
|
||||
import com.intellij.codeInsight.completion.InsertionContext;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* Mark as internal until deprecated static fields are not removed from {@link TailType},
|
||||
* use {@link TailTypes#charType(char)} instead to avoid possible deadlock.
|
||||
*/
|
||||
@ApiStatus.Internal
|
||||
public class CharTailType extends TailType {
|
||||
private final char myChar;
|
||||
private final boolean myOverwrite;
|
||||
|
||||
@@ -132,4 +132,12 @@ public final class TailTypes {
|
||||
public static TailType conditionalExpressionColonType() {
|
||||
return COND_EXPR_COLON;
|
||||
}
|
||||
|
||||
public static TailType charType(char aChar) {
|
||||
return new CharTailType(aChar);
|
||||
}
|
||||
|
||||
public static TailType charType(char aChar, boolean overwrite) {
|
||||
return new CharTailType(aChar, overwrite);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
package com.intellij.codeInsight.lookup;
|
||||
|
||||
import com.intellij.codeInsight.CharTailType;
|
||||
import com.intellij.codeInsight.TailType;
|
||||
import com.intellij.codeInsight.TailTypes;
|
||||
import com.intellij.codeInsight.completion.InsertHandler;
|
||||
@@ -167,7 +166,7 @@ public class LookupItem<T> extends MutableLookupElement implements Comparable<Lo
|
||||
|
||||
public static @Nullable TailType getDefaultTailType(final char completionChar) {
|
||||
return switch (completionChar) {
|
||||
case '.' -> new CharTailType('.', false);
|
||||
case '.' -> TailTypes.charType('.', false);
|
||||
case ',' -> CommaTailType.INSTANCE;
|
||||
case ';' -> TailTypes.semicolonType();
|
||||
case '=' -> EqTailType.INSTANCE;
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
// Copyright 2000-2022 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.execution.junit2.properties
|
||||
|
||||
import com.intellij.codeInsight.CharTailType
|
||||
import com.intellij.codeInsight.TailTypes
|
||||
import com.intellij.codeInsight.completion.*
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder
|
||||
import com.intellij.codeInsight.lookup.TailTypeDecorator
|
||||
import com.intellij.icons.AllIcons
|
||||
import com.intellij.lang.properties.psi.codeStyle.PropertiesCodeStyleSettings
|
||||
import com.intellij.lang.properties.psi.impl.PropertyKeyImpl
|
||||
import com.intellij.patterns.PlatformPatterns.psiElement
|
||||
@@ -28,7 +27,7 @@ internal class JUnitPropertiesCompletionContributor : CompletionContributor() {
|
||||
val variants = getJUnitPlatformProperties(file).values
|
||||
|
||||
val delimiterChar = PropertiesCodeStyleSettings.getInstance(parameters.editor.project).delimiter
|
||||
val defaultDelimiterType = CharTailType(delimiterChar)
|
||||
val defaultDelimiterType = TailTypes.charType(delimiterChar)
|
||||
|
||||
result.addAllElements(variants.map {
|
||||
val builder = LookupElementBuilder.create(it.key)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.intellij.lang.properties.providers.slf4j
|
||||
|
||||
import com.intellij.codeInsight.CharTailType
|
||||
import com.intellij.codeInsight.TailTypes
|
||||
import com.intellij.codeInsight.completion.*
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder
|
||||
import com.intellij.codeInsight.lookup.TailTypeDecorator
|
||||
@@ -23,7 +23,7 @@ internal class SimpleLoggerPropertiesCompletionContributor : CompletionContribut
|
||||
object : CompletionProvider<CompletionParameters>() {
|
||||
override fun addCompletions(parameters: CompletionParameters, context: ProcessingContext, result: CompletionResultSet) {
|
||||
val delimiterChar = PropertiesCodeStyleSettings.getInstance(parameters.editor.project).delimiter
|
||||
val defaultDelimiterType = CharTailType(delimiterChar)
|
||||
val defaultDelimiterType = TailTypes.charType(delimiterChar)
|
||||
|
||||
result.addAllElements(SIMPLE_LOGGER_PROPERTIES.map {
|
||||
val builder = LookupElementBuilder.create(it.key)
|
||||
|
||||
Reference in New Issue
Block a user