For context, I’m making a plugin to make development for a thing a bit easier, and when a class implements an interface, how can I detect that and underline the class name (if the file in the resource dir does not contain the class), and to add it into there?
Hi,
I don’t fully understand your use case, but there are some pointers:
- To report a problem, implement a code inspection or an annotator.
- To check if a class implements an interface, use
com.intellij.psi.util.InheritanceUtil#isInheritor(com.intellij.psi.PsiType, java.lang.String)
. - To get a class’ directory, use
com.intellij.psi.PsiElement#getContainingFile
andcom.intellij.psi.PsiFile#getParent
.