Hi! I am trying to set up a standalone environment...
# compiler
s
Hi! I am trying to set up a standalone environment to play around with building a language server. I am new to the compiler internals, and I know that
KotlinCoreProjectEnvironment#project
can be used to obtain services (
PsiManager
,
PsiFileFactory
...). But I am wondering whether the
KotlinCoreProjectEnvironment
is a one-time use only so that when any files in a root directory change, the whole environment needs to be recreated. I can obtain a
PsiFile
instance through
PsiManager
but I cannot call
PsiManager#reloadFromDisk
when a file change because that throws
Missing extension point: com.intellij.psi.treeChangePreprocessor in container com.intellij.mock.MockProject@4a8355dd
.Am I doing this wrong or are there other ways to do it? It also seems that I can only add a root (as a directory or a jar) through
JavaCoreProjectEnvironment#addSourcesToClassPath
or
JavaCoreProjectEnvironment#addJarToClassPath
but cannot remove them. I tried looking into
intellij-community
and it seems to use a
ProjectExImpl
instance but not sure where it registers all its services or how it manages text changes in a file. Any help would be appreciated!