idea-plugin / arrow.meta.ide.dsl.editor.hints / HintingSyntax
interface HintingSyntax
Hint’s are generally used with TypeInferenceAlgorithms. HintingSyntax provides means to connect those algorithms to the ide for specified element’s.
| addExpressionTypeProvider | registers an ExpressionTypeProvider for an expressionType A in any given language. This extension can be used to bring TypeInferenceAlgorithms to the ide and is a language independent version of addExpressionTypeProviderForKotlin.open fun <A : PsiElement>
MetaIde
.addExpressionTypeProvider(informationHint: (expression: A) ->
String
, expressionAt: (elementAt: PsiElement) ->
List
<A>, errorHint:
String
= "No expression Found", hasAdvancedInformation:
Boolean
= false, advancedInformation: (expression: A) ->
String
= Noop.string1()): ExtensionPhase
|
| addExpressionTypeProviderForKotlin | registers a ExpressionTypeProvider for KtExpressions. Use this function to add an improved TypeInferenceAlgorithm for Kotlin to the ide. informationHint and expressionAt will be executed as the user types. The following examples is a minimal version of the org.jetbrains.kotlin.idea.codeInsight.KotlinExpressionTypeProvider and targets KtFunctions, who are expressed as expressions.open fun
MetaIde
.addExpressionTypeProviderForKotlin(informationHint: BindingContext.(expression: KtExpression) ->
String
, expressionAt: (elementAt: PsiElement) ->
List
<KtExpression>, errorHint:
String
= "No expression Found", hasAdvancedInformation:
Boolean
= false, advancedInformation: (expression: KtExpression) ->
String
= Noop.string1()): ExtensionPhase
|
| addParameterInfoHandler | registers a ParameterInfoHandler The latter is generally used to render properties and types of parameters for code insight.open fun <Owner : PsiElement, Type>
MetaIde
.addParameterInfoHandler(handler: ParameterInfoHandler<Owner, Type>): ExtensionPhase
registers a ParameterInfoHandlerWithTabActionSupport. One among other goal’s in this extension, is to facilitate a Mapping between Owner -> ActualType, or in other words from List<ActualType>
-> ActualType
. This is evident in actualParameters. Check out addParameterInfoHandlerForKotlin for a minimal example to what this extension may abstract to. The difference between addParameterInfoHandlerForKotlin and this function is that the latter is language independent.open fun <Owner : PsiElement, Type, ActualType : PsiElement>
IdeMetaPlugin
.addParameterInfoHandler(actualParameters: (o: Owner) ->
Array
<ActualType>, argumentListClass:
Class
<Owner>, actualParameterDelimiterType: IElementType, actualParametersRBraceType: IElementType, argumentListAllowedParentClasses:
MutableSet
<
Class
<
Any
>>, argListStopSearchClasses:
MutableSet
<out
Class
<
Any
>>, showParameterInfo: (element: Owner, context: CreateParameterInfoContext) ->
Unit
, updateParameterInfo: (parameterOwner: Owner, context: UpdateParameterInfoContext) ->
Unit
, updateUI: (p: Type, context: ParameterInfoUIContext) ->
Unit
, parametersForLookup: (item: LookupElement?, context: ParameterInfoContext?) ->
Array
<
Any
>?, couldShowInLookup:
Boolean
, findElementForUpdatingParameterInfo: (context: UpdateParameterInfoContext) -> Owner?, findElementForParameterInfo: (context: CreateParameterInfoContext) -> Owner?, syncUpdateOnCaretMove: (context: UpdateParameterInfoContext) ->
Unit
= Noop.effect1, isWhiteSpaceSensitive:
Boolean
= actualParameterDelimiterType == TokenType.WHITE_SPACE): ExtensionPhase
|
| addParameterInfoHandlerForKotlin | registers a KotlinTypeArgumentInfoHandlerBase This extension is used for DeclarationDescriptor’s, the Owner
is KtTypeArgumentList and the ActualType
is KtTypeProjection. The following example provides Hints for ClassDescriptor from org.jetbrains.kotlin.idea.parameterInfo.KotlinClassTypeArgumentInfoHandler:open fun <Type : DeclarationDescriptor, A>
MetaIde
.addParameterInfoHandlerForKotlin(fetchTypeParameters: (descriptor: Type) ->
List
<TypeParameterDescriptor>, findParameterOwners: (argumentList: KtTypeArgumentList) ->
Collection
<Type>?, argumentListAllowedParentClasses:
Set
<
Class
<A>>): ExtensionPhase
registers a KotlinParameterInfoWithCallHandlerBase This is used for FunctionDescriptor’s, the Owner
is ArgumentList and the ActualType
is Argument. Naturally, Type
is a FunctionDescriptor. The following example is for KtLambdaArguments from org.jetbrains.kotlin.idea.parameterInfo.KotlinLambdaParameterInfoHandler:open fun <ArgumentList : KtElement, Argument : KtElement, A>
MetaIde
.addParameterInfoHandlerForKotlin(argumentList:
KClass
<ArgumentList>, argument:
KClass
<Argument>, actualParameters: (o: ArgumentList) ->
Array
<Argument>, actualParametersRBraceType: IElementType, argumentListAllowedParentClasses:
Set
<
Class
<A>>, parameterIndex: (ctx: UpdateParameterInfoContext, argumentList: ArgumentList) ->
Int
= { ctx, list -> list.allChildren.takeWhile { it.startOffset < ctx.offset }.count { it.node.elementType == KtTokens.COMMA } }): ExtensionPhase
|
| classifierNamePolicy | Used to modify a DescriptorRenderer for type Hintingopen fun
HintingSyntax
.classifierNamePolicy(render: (classifier: ClassifierDescriptor, renderer: DescriptorRenderer) ->
String
= { classifier, renderer ->
if (DescriptorUtils.isAnonymousObject(classifier)) "<anonymous object>" else ClassifierNamePolicy.SHORT.renderClassifier(classifier, renderer)
}): ClassifierNamePolicy
|
| parameterInfoHandler | open fun <Owner : PsiElement, Type>
MetaIde
.parameterInfoHandler(showParameterInfo: (element: Owner, context: CreateParameterInfoContext) ->
Unit
, updateParameterInfo: (parameterOwner: Owner, context: UpdateParameterInfoContext) ->
Unit
, updateUI: (p: Type, context: ParameterInfoUIContext) ->
Unit
= Noop.effect2, parameterForLookUp: (item: LookupElement?, context: ParameterInfoContext?) ->
Array
<
Any
>? = Noop.nullable2(), couldShowInLookup:
Boolean
= false, findElementForUpdatingParameterInfo: (context: UpdateParameterInfoContext) -> Owner? = Noop.nullable1(), findElementForParameterInfo: (context: CreateParameterInfoContext) -> Owner? = Noop.nullable1(), syncUpdateOnCaretMove: (context: UpdateParameterInfoContext) ->
Unit
= Noop.effect1, isWhiteSpaceSensitive:
Boolean
= false): ParameterInfoHandler<Owner, Type>
|
Do you like Arrow?
✖