PSIFile.findElementAt(offset) returns HaxeFile(which extends PsiFileBase) instead of PsiElement instance Follow
Hi,
I am maintaining Haxe plugin and I attempting to implement Refactoring->Pull up members... functionality
I took implementation from
https://github.com/JetBrains/intellij-community/blob/master/java/java-impl/src/com/intellij/refactoring/memberPullUp/JavaPullUpHandler.java#L63
PsiFile.findElementAt(offset)
//returns HaxeFile(which extends PsiFileBase) instead of PsiElement instance
https://github.com/JetBrains/intellij-haxe/blob/master/src/com/intellij/plugins/haxe/lang/psi/HaxeFile.java
Do I need to add some changes to HaxeFile class, for example implement processDeclaration method, like it's done in Dart plugin,
https://github.com/JetBrains/intellij-plugins/blob/master/Dart/src/com/jetbrains/lang/dart/psi/DartFile.java#L35
Thanks, sorry if this is common knowledge
Best regards,
Boyan
Please sign in to leave a comment.
Mine, based on Java
Not sure about PsiField and other things...
So if I got it right, then
for Java, PsiClass, PsiField and PsiMethod are valid objects to work with, for Haxe it would be custom classes... like HaxeClassDeclaration, HaxeVarDeclaration and HaxeFunctionWithAttributesDeclaration If I got it right
PsiClass, PsiField and PsiMethod are historically bad class names, they come from early IntelliJ IDEA ages when it supported Java language only. You probably noticed that these classes are located in technology-specific module 'java-psi-api'. Better names would be JavaClass, JavaField and JavaMethod. In Haxe plugin you work with Haxe-specific PSI classes.
Classes like PsiFile, PsiElement, PsiNamedElement, etc. are in 'core-api' module, so they work for all languages.
Thanks for clearing this out