Suspend function calls highlighting added.

'If' highlighting fixed at settings sample area.

 #KT-27496 Fixed
This commit is contained in:
Vladimir Ilmov
2019-11-06 10:06:47 +03:00
committed by Vladimir Ilmov
parent 46423443e9
commit ab3f9586b3
7 changed files with 46 additions and 3 deletions
@@ -95,6 +95,7 @@ options.kotlin.attribute.descriptor.fun=Functions//Function declaration
options.kotlin.attribute.descriptor.fun.call=Functions//Function call
options.kotlin.attribute.descriptor.dynamic.fun.call=Functions//Dynamic function call
options.kotlin.attribute.descriptor.package.fun.call=Functions//Package-level function call
options.kotlin.attribute.descriptor.suspend.fun.call=Functions//Suspend function call
options.kotlin.attribute.descriptor.extension.fun.call=Functions//Extension function call
options.kotlin.attribute.descriptor.constructor.call=Functions//Constructor call
options.kotlin.attribute.descriptor.variable.as.function.call=Properties and Variables//Variable as function call
@@ -79,12 +79,13 @@ internal class FunctionsHighlightingVisitor(holder: AnnotationHolder, bindingCon
@Suppress("DEPRECATION")
val extensions = Extensions.getExtensions(HighlighterExtension.EP_NAME)
val key = extensions.firstNotNullResult { extension ->
extension.highlightCall(callee, resolvedCall)
} ?: when {
calleeDescriptor.fqNameOrNull() == KOTLIN_SUSPEND_BUILT_IN_FUNCTION_FQ_NAME -> KEYWORD
calleeDescriptor.isDynamic() -> DYNAMIC_FUNCTION_CALL
calleeDescriptor is FunctionDescriptor && calleeDescriptor.isSuspend -> SUSPEND_FUNCTION_CALL
resolvedCall is VariableAsFunctionResolvedCall -> {
val container = calleeDescriptor.containingDeclaration
val containedInFunctionClassOrSubclass = container is ClassDescriptor && container.defaultType.isFunctionTypeOrSubtype
@@ -86,6 +86,7 @@ public class KotlinHighlightingColors {
public static final TextAttributesKey EXTENSION_FUNCTION_CALL = createTextAttributesKey("KOTLIN_EXTENSION_FUNCTION_CALL", DefaultLanguageHighlighterColors.STATIC_METHOD);
public static final TextAttributesKey CONSTRUCTOR_CALL = createTextAttributesKey("KOTLIN_CONSTRUCTOR", DefaultLanguageHighlighterColors.FUNCTION_CALL);
public static final TextAttributesKey DYNAMIC_FUNCTION_CALL = createTextAttributesKey("KOTLIN_DYNAMIC_FUNCTION_CALL");
public static final TextAttributesKey SUSPEND_FUNCTION_CALL = createTextAttributesKey("KOTLIN_SUSPEND_FUNCTION_CALL", KotlinHighlightingColors.FUNCTION_CALL);
public static final TextAttributesKey VARIABLE_AS_FUNCTION_CALL = createTextAttributesKey("KOTLIN_VARIABLE_AS_FUNCTION");
public static final TextAttributesKey VARIABLE_AS_FUNCTION_LIKE_CALL = createTextAttributesKey("KOTLIN_VARIABLE_AS_FUNCTION_LIKE");