Skip to content

Commit

Permalink
feat(provider): add PsiQLMethodCallInterpreter interface
Browse files Browse the repository at this point in the history
Add PsiQLMethodCallInterpreter interface for resolving method calls in PSI elements.
  • Loading branch information
phodal committed Jul 11, 2024
1 parent f6389fd commit c9b6606
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.phodal.shirecore.provider.variable

import com.intellij.lang.Language
import com.intellij.lang.LanguageExtension
import com.intellij.psi.PsiElement

/**
* For [com.phodal.shirelang.compiler.hobbit.execute.PsiQueryStatementProcessor]
*/
interface PsiQLMethodCallInterpreter {
/**
* clazz.getName() or clazz.extensions
*/
fun resolveCall(element: PsiElement, methodName: String, arguments: List<String>): Any

Check warning on line 14 in core/src/main/kotlin/com/phodal/shirecore/provider/variable/PsiQLMethodCallInterpreter.kt

View workflow job for this annotation

GitHub Actions / Qodana Community for JVM

Unused symbol

Function "resolveCall" is never used

companion object {
private val languageExtension: LanguageExtension<PsiQLMethodCallInterpreter> =
LanguageExtension("com.phodal.shirePsiQLMethodCallInterpreter")

fun provide(language: Language): PsiQLMethodCallInterpreter? {
return languageExtension.forLanguage(language)
}
}
}
8 changes: 7 additions & 1 deletion core/src/main/resources/com.phodal.shirecore.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,19 @@
implements="com.phodal.shirecore.provider.context.LanguageToolchainProvider"/>
</extensionPoint>

<!-- Toolchain Provider -->
<extensionPoint qualifiedName="com.phodal.shirePsiVariableProvider"
beanClass="com.intellij.lang.LanguageExtensionPoint" dynamic="true">
<with attribute="implementationClass"
implements="com.phodal.shirecore.provider.variable.PsiContextVariableProvider"/>
</extensionPoint>

<!-- PSI Query Expression -->
<extensionPoint qualifiedName="com.phodal.shirePsiQLMethodCallInterpreter"
beanClass="com.intellij.lang.LanguageExtensionPoint" dynamic="true">
<with attribute="implementationClass"
implements="com.phodal.shirecore.provider.variable.PsiQLMethodCallInterpreter"/>
</extensionPoint>

<!-- Code Editor -->
<extensionPoint qualifiedName="com.phodal.shireCodeModifier"
beanClass="com.intellij.lang.LanguageExtensionPoint" dynamic="true">
Expand Down

0 comments on commit c9b6606

Please sign in to comment.