Standardmäßig ist der Prompt ausgewählt, der zuerst die Quelle prüft. Sie können zu einem direkten Befehl wechseln oder eine lokale Kopie herunterladen.
Quelldateien prüfen
Lesen Sie SKILL.md und alle von SkillsMP angezeigten Begleitdateien, bevor Sie sich für eine Installation entscheiden.
Mit Codex oder Claude installieren Kopieren Sie diesen Prompt, fügen Sie ihn in Codex, Claude oder einen anderen Assistant ein und lassen Sie die Skill-Seite prüfen und installieren.
Ein direkter Befehl überspringt den Prüf-Prompt. Prüfen Sie die Quelle, bevor Sie ihn ausführen.
Add KaResolver resolveSymbol/resolveCall support for a PSI type
user-invocable
true
disable-model-invocation
true
argument-hint
<KtPsiType>
Add KaResolver support for a PSI type
This skill adds resolveSymbol() and optionally resolveCall() support for a given Kt* PSI type
by following the established pattern from existing resolver support commits.
The argument is the PSI type name, e.g. KtDestructuringDeclarationEntry.
Phase 1: Gather information
Find the PSI type source file. Search compiler/psi/ for <KtPsiType>.java or <KtPsiType>.kt.
Read the file to understand the class hierarchy and whether it already implements KtResolvable or KtResolvableCall.
Check KaResolver for existing support. Read analysis/analysis-api/src/org/jetbrains/kotlin/analysis/api/components/KaResolver.kt
and search for the PSI type. If it already has / methods, inform the user and stop.
resolveSymbol()
resolveCall()
Check for existing test data. Search analysis/analysis-api/testData/components/resolver/ for test files
mentioning the PSI type or related scenarios.
Read the Analysis API AGENTS.md at analysis/AGENTS.md for area-specific guidelines.
Phase 2: Ask user questions
Use AskUserQuestion to ask these questions (all in one call):
Question 1: Resolution kind
Header: "Resolution"
Question: "Should <KtPsiType> support symbol-only resolution (KtResolvable) or both symbol and call resolution (KtResolvableCall)?"
KtResolvable — symbol resolution only (resolveSymbol())
KtResolvableCall — both symbol and call resolution (resolveSymbol() + resolveCall())
Question 2: Symbol return type
Header: "Symbol type"
Question: "What should resolveSymbol() return for <KtPsiType>?"
KaConstructorSymbol
KaFunctionSymbol
KaNamedFunctionSymbol
KaCallableSymbol
(Allow "Other" for types like KaDeclarationSymbol, etc.)
Question 3: Call return type (only if KtResolvableCall)
Header: "Call type"
Question: "What should resolveCall() return for <KtPsiType>?"
KaFunctionCall<KaConstructorSymbol>
KaDelegatedConstructorCall
KaAnnotationCall
KaFunctionCall<KaNamedFunctionSymbol>
(Allow "Other" for types like KaSingleCall<*, *>, KaFunctionCall<*>, etc.)
Phase 3: Execute changes
Use the answers from Phase 2 to determine: RESOLUTION_KIND (KtResolvable or KtResolvableCall),
SYMBOL_TYPE (e.g. KaCallableSymbol), and CALL_TYPE (e.g. KaSingleCall<*, *>).
Step 1: PSI type — add interface implementation
File: The PSI source file found in Phase 1 (under compiler/psi/).
If the PSI type does NOT already implement KtResolvable/KtResolvableCall, add it:
For KtResolvable: add implements KtResolvable (Java) or : KtResolvable (Kotlin)
For KtResolvableCall: add implements KtResolvableCall (Java) or : KtResolvableCall (Kotlin)
KtResolvableCall extends KtResolvable, so only one is needed.
Add the necessary import (org.jetbrains.kotlin.resolution.KtResolvable or org.jetbrains.kotlin.resolution.KtResolvableCall).
Insert after the last existing typed resolveSymbol() method (currently KtDestructuringDeclarationEntry.resolveSymbol())
and beforetryResolveCall().
Follow the exact KDoc pattern — copy from a similar existing method and adapt:
/**
* Resolves the <description> by the given [<KtPsiType>].
*
* #### Example
*
* ```kotlin
* <code example with // ^^^^ markers>
* ```
*
* Calling `resolveSymbol()` on a [<KtPsiType>] ... returns the [<SYMBOL_TYPE>] ...
* if resolution succeeds; otherwise, it returns `null` (e.g., when unresolved or ambiguous).
*
* This is a specialized counterpart of [KtResolvable.resolveSymbol] focused specifically on <description>
*
* @see tryResolveSymbols
* @see KtResolvable.resolveSymbol
*/@KaExperimentalApipublicfun<KtPsiType>.resolveSymbol(): <SYMBOL_TYPE>?
2b: Add resolveCall() interface method (only if KtResolvableCall)
Insert after the last existing typed resolveCall() method (currently KtDestructuringDeclarationEntry.resolveCall())
and beforecollectCallCandidates().
/**
* Resolves the given [<KtPsiType>] to a <call description>.
*
* #### Example
*
* ```kotlin
* <code example with // ^^^^ markers>
* ```
*
* Returns the corresponding [<CALL_TYPE short name>] if resolution succeeds; otherwise, it returns `null`
* (e.g., when unresolved or ambiguous).
*
* This is a specialized counterpart of [KtResolvableCall.resolveCall] focused specifically on <description>
*
* @see tryResolveCall
* @see KtResolvableCall.resolveCall
*/@KaExperimentalApipublicfun<KtPsiType>.resolveCall(): <CALL_TYPE>?
2c: Add resolveSymbol() bridge function
Insert after the last existing resolveSymbol bridge (currently KtDestructuringDeclarationEntry.resolveSymbol bridge)
and before the tryResolveCall bridge.
/**
* <Same KDoc as the interface method>
*/// Auto-generated bridge. DO NOT EDIT MANUALLY!@KaExperimentalApi@KaContextParameterApi
context(session: KaSession)
publicfun<KtPsiType>.resolveSymbol(): <SYMBOL_TYPE>? {
return with(session) {
resolveSymbol()
}
}
2d: Add resolveCall() bridge function (only if KtResolvableCall)
Insert after the last existing resolveCall bridge (currently KtDestructuringDeclarationEntry.resolveCall bridge)
and before the collectCallCandidates bridge.
/**
* <Same KDoc as the interface method>
*/// Auto-generated bridge. DO NOT EDIT MANUALLY!@KaExperimentalApi@KaContextParameterApi
context(session: KaSession)
publicfun<KtPsiType>.resolveCall(): <CALL_TYPE>? {
return with(session) {
resolveCall()
}
}
Insert after the last existing resolveSymbolSafe() line (currently KtDestructuringDeclarationEntry.resolveSymbol())
and beforeKtReference.resolveToSymbol().
3b: Add resolveCall() override (only if KtResolvableCall)
Insert after the last existing resolveCallSafe()/resolveSingleCallSafe() line
(currently KtDestructuringDeclarationEntry.resolveCall()) and beforeKtElement.resolveToCall().
Choose the helper based on the call return type:
If CALL_TYPE contains wildcards (*) → use resolveCallSafe():