Skip to content

Commit

Permalink
refactor(runner): add PsiContextVariableProvider for language support #…
Browse files Browse the repository at this point in the history
…14

Imported PsiContextVariableProvider for language-specific variable resolution in SymbolResolver.
  • Loading branch information
phodal committed Jun 16, 2024
1 parent ed03e25 commit c5c4f93
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,29 @@
package com.phodal.shirelang.run.runner

import com.intellij.lang.Language
import com.intellij.openapi.editor.Editor
import com.intellij.openapi.project.Project
import com.intellij.psi.PsiManager
import com.phodal.shirecore.provider.DefaultPsiContextVariableProvider
import com.phodal.shirecore.provider.PsiContextVariableProvider
import com.phodal.shirelang.compiler.SymbolTable

class SymbolResolver(val myProject: Project, val editor: Editor) {
private val variableProvider: PsiContextVariableProvider
init {
val psiFile = PsiManager.getInstance(myProject).findFile(editor.virtualFile)
variableProvider = if (psiFile?.language != null) {
PsiContextVariableProvider.provide(psiFile.language)
} else {
DefaultPsiContextVariableProvider()
}
}

fun resolve(symbolTable: SymbolTable): Map<String, String> {
// HobbitHole
// symbolTable.getAllVariables().map {
// variableProvider.resolveVariableValue(editor.document, it)
// }
return mapOf()
}

Expand Down

0 comments on commit c5c4f93

Please sign in to comment.