If I do
and have the code
package io.politepixels.gossr.ppft
import com.intellij.lang.Language
import com.intellij.lang.injection.MultiHostInjector
import com.intellij.lang.injection.MultiHostRegistrar
import com.intellij.openapi.diagnostic.Logger
import com.intellij.openapi.util.TextRange
import com.intellij.psi.PsiElement
import x.impl.GoScriptContentElementImpl
private val LOG_INJECTOR = Logger.getInstance(GoLanguageInjector::class.java)
class GoLanguageInjector : MultiHostInjector {
override fun elementsToInjectIn(): List<Class<out PsiElement>> {
return listOf(GoScriptContentElementImpl::class.java)
}
override fun getLanguagesToInject(registrar: MultiHostRegistrar, context: PsiElement) {
if (context !is GoScriptContentElementImpl) {
return
}
val hostFile = context.containingFile
if (hostFile == null) {
return
}
val goLang = Language.findLanguageByID("go")
if (goLang == null) {
LOG_INJECTOR.error("GoLanguageInjector: Go Language service not found! Cannot inject Go.")
return
}
registrar.startInjecting(goLang)
registrar.addPlace(null, null, context, TextRange(0, context.textLength))
registrar.doneInjecting()
}
}
Then in my file the golang code is injected exact as expected, which is great
The issue though is that nothing which is import related to a module or anything which is relative in its own project does not work.
It is almost as if it is unable to see the context of its own golang module.
Am I somehow able to pass through the relavent information to tell it which module it is inside of, give it context.